From: sam AT greenaum DOT demonARSE!ARSE!ARSE!.co.uk (Sam.) Newsgroups: comp.os.msdos.djgpp Subject: Re: beginner mode13 question Date: Sun, 20 Dec 1998 09:35:05 GMT Organization: Rossum's Universal Robots Message-ID: <369dc4bb.16232852@158.152.254.70> References: NNTP-Posting-Host: greenaum.demon.co.uk X-NNTP-Posting-Host: greenaum.demon.co.uk:194.222.71.189 X-Trace: news.demon.co.uk 914146556 nnrp-06:27685 NO-IDENT greenaum.demon.co.uk:194.222.71.189 X-Complaints-To: abuse AT demon DOT net X-Newsreader: Forte Agent 1.5/32.452 X-No-Archive: yes MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 62 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I haven't even dared try to understand memory in DJGPP. It's something you don't really need to know, but basically you can't count on the memory addresses you give your pointers being in any way related to the actual addresses in the machine. Fortunately this doesn't matter, you can just use the memory you get allocated. For my mode 13 stuff, I have an array char screenbuf[64000] which is my buffer I just use this to plot into, as you'd expect, then when I want to, copy the whole thing to the screen with movedata, which can interface DJGPP memory to real-mode memory. void update_screen() { movedata(_my_ds(), (int)screenbuf, _dos_ds, 0xa0000, (size_t)64000); } Also wait_vbl() waits for the vertical blank interval, which is a good time to blit the screen without getting flickering void wait_vbl() { while(inportb(PORT_VTRACE) & 0x08); while(!(inportb(PORT_VTRACE) & 0x08)); } I just go wait_vbl(); update_screen(); It's also handy because it provides a central point in the flow of the program for everything to sync to. The scheme probably isn't the absolute fastest, but it's easy to get to grips with, and it keeps everything protected. Also, if you need a set of character set bitmaps you can copy the ROM BIOS character set into an array and use that. char rom_char_buf[2048] I load the character set at the beginning of the program with dosmemget void setup_char_table() { dosmemget(0xFFA6E, 2048, rom_char_buf); } The bitmaps for each character is stored as 8 bytes per character, 1 byte per row, work out your own way of using it. There are a few more functions for copying between real and protected memory, look in the info files. ------------------------------------------------------------------------ The person who said he was a crap presenter knows nothing because compared to the outwardly camp stuart miles, speech impediment Katy Hill and nothing upstairs Konnie Huq, he was a true professional. Heh heh heh.