The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Citric on April 06, 2005, 07:11:07 AM

Title: outputing text to the console.
Post by: Citric on April 06, 2005, 07:11:07 AM
Hi all

How do you write to the console? also what is the lowest Appication level(ring 3) available?

I have used WriteFile with stardardout and printf, but i know there are others, just wondering what other people use

Adam
Title: Re: outputing text to the console.
Post by: liquidsilver on April 06, 2005, 07:18:22 AM
You could use the StdOut from the Masm library. That's what I do as it's very fast. Remember to assemble as a console application if you can't see the console. Often people forget that. I can see when printf would be more useful, but usually I just make a plan.

I can't help with the application level, but I'm interested to know what it is.
Title: Re: outputing text to the console.
Post by: hutch-- on April 06, 2005, 08:06:02 AM
Citric,

I like the "brick" you have as an avatar.
Title: Re: outputing text to the console.
Post by: Citric on April 06, 2005, 08:43:31 AM
Cheers Hutch

I have had her about 6 years now, she has only been that colour for about 6 months.

liquidsilver:
The StdOut from the Masm library uses WriteFile with standard out.

thanks for the reply tho.

Adam
Title: Re: outputing text to the console.
Post by: Vortex on April 06, 2005, 10:15:27 AM
Hi Citric,

Why StdOut and printf ( from C run-time DLLs ) doesn't meet your requirements? What's wrong with them?
Title: Re: outputing text to the console.
Post by: Tedd on April 06, 2005, 10:31:32 AM
You can also use WriteConsole, but this doesn't allow you to redirect the output to a file; so I prefer using WriteFile.

Applications run in ring 3. (If this is what you mean by application level?)
Title: Re: outputing text to the console.
Post by: thomasantony on April 06, 2005, 11:17:36 AM
Hi,
Ring 0 is OS
I forgot what are Ring 1 and Ring 2 as I haven't done OS coding for a while. I think they are for device drivers. Ring 3 is user or applications.

Thomas :U
Title: Re: outputing text to the console.
Post by: Citric on April 07, 2005, 01:13:07 AM
Hi Vortex, Tedd

Nothing is wrong woth StdOut and printf(well cleaning up the stack afterwards sucks), just curious.

thanks Tedd, i will have to have a look at the api for WriteConsole.

Cheers
Adam
Title: Re: outputing text to the console.
Post by: Infro_X on April 07, 2005, 05:50:49 AM
Windows uses 2 CPLs (or rings). CPL of 3 for applications. CPL of 0 for Device Drivers. No other CPLs are used. But, i am unsure of what CPL a user mode driver runs at, I would assume ring 0 as well.
Title: Re: outputing text to the console.
Post by: rags on April 07, 2005, 12:54:53 PM
Citric,
     What kind of automoblie is that  on your avatar?
regards,
    Rags
Title: Re: outputing text to the console.
Post by: Vortex on April 07, 2005, 05:53:52 PM
Hi Citric,

Nice avatar, I liked it  :U
Title: Re: outputing text to the console.
Post by: hutch-- on April 07, 2005, 11:31:12 PM
Rags,

I don't know if you got them in the US in the late 60s, early 70s but they were made as a "Morris" and the model was a "Mini" with the high perforance variation being a "Cooper S". I remember a mate of mine having a Cooper S that he could get about 105 MPH out of (1275CC engine.) ery few cars were competitive to a Mini in tight built up areas where they had both the acceleration and handled brilliantly well, especially for someone who knew how to drive them.

I grew up with Ford V8s which were for open spaces but around the cities or on very tight winding roads a Mini was a giant killer. When you see the old car chase movies, it was mainly fantasy but a well driven Mini Cooper S could actually do it in narrow streets, right angle turns and tight winding roads.

they were called "BRICKS" here in OZ.
Title: Re: outputing text to the console.
Post by: Citric on April 08, 2005, 01:59:35 AM
Thanks Vortex!!

Just a stupid little note, the 'Mini' was made in England right up until September 2000(might have been 2001, cant remember),and still looking very much like my 1963 version. Then BMW came along and made the bini!(I dont like them).

another thing, the 'Mini' weather is was a Morris, An Austin,a Layland or a Rover made in England, Australia or Brazil and probably a number of other countries, is one of the best cars ever made and sooooo much fun to drive, Like a Go CarT.

Looks like WriteFile is my best bet!

Cheers EveryOne!!

ps The colour of my car is a Ford Australia colour called 'Citric Acid'
Title: Re: outputing text to the console.
Post by: rags on April 08, 2005, 12:28:49 PM
Hutch,
  After talking about the mini with an older friend at work, I found out they were available here at least in the '60's,
as an Austin. I think the main reason they stopped the sale of them here was the safety factor of those cars, they couldn't meet the minimum safety standards for automobiles, that were set by our government.
  The BMW Mini is a nice looking car, but here in the States goes for around $20,000 US. A bit much for me.
Rags
Title: Re: outputing text to the console.
Post by: Jimg on April 08, 2005, 02:16:51 PM
The Mini was available in the states thru 1967.  I bought one of the last, a 1967 Austin Cooper 'S' Mark II.   I Drove it for nearly 15 years before it became too much to keep up for me.  Now I'm sorry I ever sold it.
Title: Re: outputing text to the console.
Post by: pbrennick on April 08, 2005, 07:06:48 PM
Hi Rags,
The reason ALL Austins were not 'allowed' to be imprted to the US was because of their refusal to conform to emission control specifications (not a safety issue).  I think their reasoning (that it grossly affected the performance), was correct!  Incidentally, although I have friends who really liked the Mini Cooper, I liked the Austin Healy, best, it was a gocart, IMO!

BTW:  I can see why they call it a Brick in OZ!

Paul
Title: Re: outputing text to the console.
Post by: hutch-- on April 09, 2005, 12:47:43 AM
One of those things I remeber from back in those days was sitting at the Colonial Diner at about 3am which was opposite a large intersection and first this guy goes screaming down the main road, (Anzac Parade) doing a ton up ( > 100 mph). Shortly after a PIG (Oink oink) tried to run the just changed red light in a vain attempt to catch the first guy and the PIG was driving a Brick. Some poor bastard has just crossed the intersection driving an old valiant and the PIG poked the brick straight into the side of the valiant.

Luckily no-one was hurt but it PHUKED the Brick big time and the valiant was not in very good shape either.

There are times when you know there IS justice, that was one of them.  :bdg
Title: Re: outputing text to the console.
Post by: pbrennick on April 09, 2005, 02:21:40 AM
Hutch,
Pride, Integrity, and Guts, I am ashamed!

Paul
Title: Re: outputing text to the console.
Post by: ibraasm on April 17, 2005, 05:11:46 PM
hi there
how can i make the bmp 4 color with using DIB