Re: more pixel questions
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Jun 05, 1998
- 664 views
>I've poked/mem_copied pixels to #A0000, and it worked perfectly in mode 19. > >in 257 and 261, it worked for the top of the screen only > >what's the address(addresses?) for the rest of the screen? >how do I access screen addresses past #A0000+#FA00? The video memory, is not managed in the same way as the other parts of memory. Which are thanks to Euphoria (causeway dos extender actually) flat. We can acces the memory as if it is a long one dimension sequence. But actually it is not. At least, not for the video memory. First of all, know, that poking in MCGA (Eu-mode 19) actually splits up the bytes over a line of 4. So of you poke {1,2,3} it pokes 1, skips three, pokes 2, skips three, pokes 3. The video card expects this. And will load it up like that. Why is this done ? Internally the videocard always does things 4-bytes by 4-bytes. It's the size of an fast machine integer, speed is quite crucial for a video card. Pete's ModeX- hacks the registers and turns the 4-byte spread off, he can poke {1,2,3} as expected. The use ? More memore available, because now we have lost 3/4 of the screen's memory. (320*200=64000 and we have at *least* for times as much video memory available.) Pete has also made a svga library, but that's not a complete graphics library. What it does, it puts pixel's on the screen itself by banking. Banking is calling an interrupt and telling him we want to acces other parts of the screen. The SVGA-driver than puts the stuff we poke, not in the 1st byte, and then the 5th bytes, and so on. Now it could maybe put it in the 2nd byte, the 6th byte and so on. Because the code is not much and quite clean, you can see the trick there. Like which interrupt and stuff. Just take a look at Irv's Site. He has quite an archive there. I've told you all this stuff, not because you need to know why we need to bank, but I think it comes in hand when you want to speed up your code. I hope all this info helps. >P.S. I know I could just borrow someone else's graphics library, but >what's the fun in that? I love to reinvent the wheel. I know that feeling, sometimes I think, all us programmers, are actually just a bit of control-freaks! Have fun, graphics coding is fun, really, I can tell! Ralf