On 1/13/2023 8:33 AM, Knedlik wrote:
void clearScreen(char color) {
     int i;
     for (i = 0xa000; i < 0xfa00; i++) {
         char* byte = i;
         *byte = color;
     }
}

What the hell are you trying to do here? Seriously, it doesn't help just to blindly follow some tutorial without trying to understand what you are doing.

First of all, your addresses are all wrong, you are simply writing where you shouldn't. If you want to program in DOS and directly access hardware (in this case RAM) like this, you need to understand how the segment:offset concept of the 8086 CPU works.

While 0xA000 is the start of the graphics *segment*, the normalized *address* would be 0xA0000 (0xA000:0x0000 in segment offset notation), the end of the video RAM for MCGA mode would be segment 0xBFFF, with the last byte of that video RAM segment being at normalized address 0xBFFFF (0xB000:0xFFFF).

As you actually never set any segment in your code, assuming that you are using the default small memory model, you are just blasting 0xFF bytes at random addresses in your current data segment...


Ralf

_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to