Background: I was tasked with writing a data collection program for the Unitech HT630 that runs its own DOS operating system, which can run executable files compiled for 16-bit MS DOS, although with some limitations. I am using the Digital Mars C / C ++ compiler, which seems to work very well.
For some things, I can use the standard C libraries, but for other things, such as drawing on the device’s screen, I need assembly code. The assembly examples provided in the device documentation differ from how I was taught to use the built-in assembler code in C / C ++. For reference, BYTE in the examples below is of type unsigned char .
Example Code Example I:
#include <dos.h> /* Set the state of a pixel */ void LCD_setpixel(BYTE x, BYTE y, BYTE status) { if(status > 1 || x > 63 || y > 127) { /* out of range, return */ return; } /* good data, set the pixel */ union REGS regs; regs.h.ah = 0x41; regs.h.al = status; regs.h.dh = x; regs.h.dl = y; int86(0x10, ®s, ®s); }
As I was always taught to use the built-in assembly:
void LCD_setpixel(BYTE x, BYTE y, BYTE status) { if(status > 1 || x > 63 || y > 127) { return; } asm { mov AH, 41H mov AL, status mov DH, x mov DL, y int 10H } }
Both forms seem to work, I have not yet encountered a problem with any of the approaches. Is one form better than another for DOS programming? Does int86 function int86 something for me that I don’t process myself in my own build code in the second example?
Thanks in advance for any help.
c assembly inline-assembly dos
Heather kordinak
source share