PDA

View Full Version : Virtual screen, character based DOS interface



arakvaag
03-25-2002, 05:42 PM
Hi!

I am a Norwegian student working on a assignment in c++ programming. We are told to only use characterbased user interface in our programs. We are using Borland C++ 5.02.

I want to work with a virtual screen (characterbased print). I know this seems a bit much when I'm still only using character based user interface, but I am working on a menu system that is dependent on being able to work with a virtual screen.

What I don't know, but obviously need to know is this:
- What is the memory location I must write to when I want to flip my virtual screen on to the real screen?
- What is the format of the data that lies on these memory adresses?

Any help would be greatly appreciated...

Andre Rakvaag

Quantrizi
03-25-2002, 06:37 PM
The second one is: probably hex, but ain't sure if that is what you mean

arakvaag
03-26-2002, 07:40 AM
I was thinking more about what the actual bytes meant. I assume that the ascii-code for the character is part of the data.

I have tried to found out more about the use of virtual screen. It seems like the start adress for the screen is the same whether it is in graphics mode or in character mode. Is this correct?

Andre Rakvaag

arakvaag
03-27-2002, 06:45 PM
I have now found the solution. In the conio library that si included in Borland c++ there are two functions called gettext and puttext. These copy/put text on the screen, and seems to be fast.

sean
03-29-2002, 06:51 PM
To make things a LOT simpler, you could just gather data based on the circumstances as to what the screen layout should be, than pice together a character by character 2 dimensional array, and then display them all. Also, it will be binary deep down in the memory, and then the higher up you go in the programming languages the more volatile it becomes. In assembler it will be hex almost for sure, than up to C, it would've been converted to decimal, and then in C++ there are some functions that aren't C - derived and were built up straight from assembler. It will also be compiler-specific I would think.

Hillbillie
03-30-2002, 12:00 AM
>What is the memory location I must write to when I want to flip my virtual screen on to the real screen?<

For VGA it's at 0xb8000.

>What is the format of the data that lies on these memory adresses?<

A character on screen in text mode is defined as 2 bytes - the first byte is the ASCII code for the actual character. The second byte is the attribute byte. It looks like this: IBBBFFFF

I - Intensity...basically your blink bit.
B - Background color.
F - Foreground color.

If you want white (actually light gray) text on black, the attribute byte would be 0x07 in hex.

sean
03-30-2002, 07:41 PM
I'm doing a lot with ASM right nw, and I'm learning about graphics and stuff. Would all of what you just said still apply?

Hillbillie
03-30-2002, 07:50 PM
>Would all of what you just said still apply?<

You talkin' to me? :D

Yeah, it applies to any language, as long as you are programming for the VGA.

If you wanna know more about stuff like this, check out FreeVGA (http://sf.znet.com/~vhold/FreeVGA/home.htm).

sean
04-03-2002, 10:14 AM
<accent nationality=New Zeland>Yeah mate, talkin' to ya'! Thanks a heap!</accent>. And I don't even have to fake it.... Know any good sites for ASM graphics? My book was printed in way back in the day - 1960 something..... B.C. So it doesn't cover a whole lot of graphics for ASM.

doubleanti
04-05-2002, 02:41 AM
>- What is the memory location I must write to when I want to flip my virtual screen on to the real screen?
- What is the format of the data that lies on these memory adresses?

you're supposed to write to b80.... oh crap you already said that eh? sheesh! you know it's bad when DOS-Freak isn't the first to have said that... be afraid......... ;)

oh and while i'm at it... it's useful to know the entire mapping of the conventional memory anyhow... i'm not sure if it's in RBIL. but check it out, it's very useful...