site banner

Friday Fun Thread for September 16, 2022

Be advised; this thread is not for serious in depth discussion of weighty topics, this thread is not for anything Culture War related. This thread is for Fun. You got jokes? Share 'em. You got silly questions? Ask 'em.

6
Jump in the discussion.

No email address required.

So I'm continuing my journey through assembly programming and 8088/DOS programming specifically.

I wrote a pretty simple ascii object dodging game. I did it first using all standard DOS or BIOS interrupt calls for all the drawing. Then I did it again just directly accessing the memory for the screen, and writing my own interrupt handlers for system ticks and keyboard interrupts. It's been a fun proof of concept.

Next up, I'm going to try to dive into the vagaries of EGA, and replace all the ascii stuff with actual graphics. And probably tune the difficulty more as well. I haven't delved much into the nuts and bolts of how you write to the screen with EGA. I saw that supposedly there is a vertical retrace interrupt, which for the most part you should never use because not all EGA cards, and especially most VGA cards, actually implemented it. Apparently it's even a discrete pin on the ISA slot that you can check whether it was even wired or not? Also the specific hardware IRQ for it got reused a bunch later, so you can't even be certain the IRQ you are services is the vertical retrace? So there is a register you can poll instead, if the vertical retrace interval is important to you.

Aside from that, apparently EGA works by having 4 different bit planes overlapping the same memory space. By default the bit planes correspond to red, green, blue and intensity. I'm under the impression very few games bothered to change these defaults. Each bit is one pixel. So to write anything other than white to the screen, you need to set the plane masks and the bit masks to registers for the EGA card. I haven't delved into the nuts and bolts of implementation yet. They crow about how it allows you to more efficiently write to the screen with few calls, and that seems possible in theory. But for any image of any color complexity, I wonder if the overhead of constantly changed masks registers eats severely into that. We shall see.

Maybe at the end of this I'll start uploading all my shitty ASM to github or something for people to gawk at. But it's mostly practice for a retro style RPG I'm always planning on making using OSRIC, since it's open source and basically AD&D, my favorite rpg system of all time. And I'm not creative enough to come up with an RPG system from scratch, much as I want to create my own CRPG. At least not out the gate. Training wheels first.

... when I first filled screen screen with BIOS 10h paint pixel calls, I found it was very slow... I wondered why??? I had written it in assembly!...

don't you want to use VGA mode 13h, much simpler?

I may, but my target platform is a NuXT, which is basically a slightly suped up IBM XT SBC. Because of the Trident 9000I VGA chip they chose, it's technically capable of VGA. But from everything I've seen, the CPU really can't push the pixels for it. So I want to stick to EGA at least for now.

They crow about how it allows you to more efficiently write to the screen with few calls, and that seems possible in theory.

Planar (bit pane) video modes are actually about fast reads. Not for the CPU, but the hardware on a video card can read the data from multiple vram chips in parallel when outputting to a monitor. 320 x 200 x 4bits x 60Hz was a lot of bandwidth for 80s memory chips.

I kinda get your point, but it's orthogonal on how these bits are presented to CPU. You can use multiple chips without any of this color planes thing. Also, EGA also had 640x350x 4bits mode which would require >64 kb address space if not this trick. CGA which had less memory did not use color planes.