hi! if you are using a protected mode model, it may be impossible to call int 10 directly and you may have to use dpmi for that.
all compilers for DOS offer ways to call BIOS and other interrupts directly from C, which is a lot more foolproof than using ASM here. the next problem is whether you should use RET here, that may be something C does for you and it may be something more complex than just calling RET, e.g. also preparing and clearing up the stack before and after the ASM part. you can try without the RET. C compilers have various opinions about whether and which registers you are allowed to change, but int ax=0x0013 probably is safe, changing only AX, as far as I remember. Note that you write mov al,0x13, which means you do NOT specify what AH should be. this is a BAD idea. AH could be any arbitrary value at that moment, so you could be triggering any VGA BIOS int 10 thing instead of the one you intended. Finally, your clear screen confuses the graphics RAM segment 0xa000 with absolute address 0xa0000 and relative offsets of 0 to 0xfa00 within that. It will depend A LOT on which compiler and memory model you use what the PROPER way to do this will be for you. I can only tell that the style you use right know is NOT okay and will just overwrite data and crash. Regards, Eric
I can’t for the love of god figure out why this is throwing the divide by zero interrupt. void setMCGA() { _asm { mov al, 0x13 int 0x10 ret } } void setText() { _asm { mov al, 0x03 int 0x10 ret } } void clearScreen(char color) { int i; for (i = 0xa000; i < 0xfa00; i++) { char* byte = i; *byte = color; } } int main(int argc, char** argv) { setMCGA(); clearScreen(255); getchar(); setText(); return 0; }
_______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel