OpenWatcom uses `<dos.h>`, `union REGS` type, and `int86()` when using a DOS Real Mode Memory Model.
See: Page 405 - https://web.archive.org/web/20220507185907/http://ftp.openwatcom.org/manuals/current/clib.pdf https://web.archive.org/web/20201112024837/http://www3.telus.net/alexander_russell/course/chapter_1.htm https://github.com/balintkissdev/awesome-dos https://web.archive.org/web/20201111162212/http://www.ctyme.com/rbrown.htm On Fri, Jan 13, 2023 at 9:06 AM tom ehlert <t...@drivesnapshot.de> wrote: > > > > Okay, this is just weird. > > I can’t for the love of god figure out why this is throwing the divide by > > zero interrupt. > > a) learn to use a debugger. single step this stuff. you will likely see > that 'ret' is not a good idea in inline assembly in general. > > also > > WDIS graphic.obj > graphic.txt > > shows you why some instructions in inline assembly are usually > forbidden. > > > b) don't use assembly for this. > > #include <dos.h> > > int setMCGA() { > _REGS r; > > r.h.ah = 0x13; > _int86(0x10, &r, &r); > > if (r.flags & _CARRY) > { > printf("setting MCGA failed because %x\n", r.h.al); > return 1; > } > return 0; > } > > does the same, works with every compiler around and avoids this > trouble. > > > last not least, > > INT 10 - VIDEO - SET VIDEO MODE > AH = 00h > AL = desired video mode (see #00010) > > > > > > > > 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 > > > > > > Mit freundlichen Grüßen / with kind regards > Tom Ehlert > +49-15151898538 > > > > _______________________________________________ > Freedos-devel mailing list > Freedos-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freedos-devel _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel