Listing 4

      asm("    push   es");        /*  save es */
      asm("    mov    ax, 034h");  /*  use Phar Lap LDT to access real */
      asm("    mov    es, ax");
      dx = 0x3CE;                  /*  EGA graphics address register */
      ebx= 655360 + ((y*colx+x) >> 3); /*  memory position of pixel */
  asm(ebx, "    mov    cl, byte ptr es:[ebx]"); /*  load EGA registers */
      ax = color << 8;
asm(dx, ax, "   out    dx, ax");    /*  set color */
      ax = 0x0 F01;
asm(dx, ax, "   out    dx, ax");    /*  enable */
      ax = 0x0003; /* 0x00 = replace, 0x10 OR, 0x18 XOR, 0x08 AND */
asm(dx, ax, "   out    dx, ax");    /*  pixel write mode */
      ax = ((0x80 >> (x % 8)) << 8 ) + 8;
asm(dx, ax, "   out    dx, ax");    /*  bit mask (8 pixels/byte) */
  asm(ebx, "    mov    byte ptr es:[ebx],  255"); /*  write EGA registers */
      asm("    pop    es");        /*  restore es */