> 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

Reply via email to