Thread: Virtual screen, character based DOS interface

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    3

    Question Virtual screen, character based DOS interface

    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

  2. #2
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    The second one is: probably hex, but ain't sure if that is what you mean

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    3
    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

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    3
    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.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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.

  6. #6
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    >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.

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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?

  8. #8
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    >Would all of what you just said still apply?<

    [accent="brooklyn"]You talkin' to me?[/accent]

    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.

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    <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.

  10. #10
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    >- 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...
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 06:19 PM
  2. Calling DOS based programs
    By UnclePunker in forum C++ Programming
    Replies: 3
    Last Post: 08-07-2003, 09:37 AM
  3. Reading a character from the screen
    By neandrake in forum C++ Programming
    Replies: 4
    Last Post: 03-03-2002, 05:00 PM
  4. DOS character animation
    By cpp4ever in forum C++ Programming
    Replies: 1
    Last Post: 11-13-2001, 08:22 PM
  5. Shut off DOS screen automatically to Windows
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 11-08-2001, 07:14 PM