I wrote a piece of working assembly code and I am now trying to combine it with a c++ program. I have just figured out that dev-c++ can't handle interupts. How else can I get my assembly code into the c++ program.
My original assembly code
Code:
main:
mov ax, 09
mov ds, ax
mov ax, 0a000h ;Set ES to be the graphics segment
mov es, ax
mov ah, 0Fh ;Gets and saves current video mode
int 10h
push ax
mov ax, 0013h ;Turn on mode 13 graphics
int 10h
mov cx, 320 ;Number of pixels per row/Screen width
mov ax, 100 ;Set y coordinate
mul cx
mov cx, 160 ;set x coordinate
add ax, cx
mov bx, ax
mov cx, 9 ;Set Color
mov es:[bx], cx ;Place point
mov ah,0 ;wait for keypress
int 016h
pop ax ;Restore original graphics mode
mov ah, 0
int 10h
mov ax, 4c00h ;Exit program
int 21h
My updated c++ program
Code:
void point()
{
__asm("mov %ax,_09");
__asm("mov %ds, %ax");
__asm("mov %ax, _0a000h");
__asm("mov %es, %ax");
__asm("mov %ah, _0Fh");
__asm("int 10h");
__asm("push %ax");
__asm("mov %ax, _0013h");
__asm("int 10h");
__asm("mov %cx, _320");
__asm("mov %ax, _100");
__asm("mul %cx");
__asm("mov %cx, _160");
__asm("add %ax, %cx");
__asm("mov %bx, %ax");
__asm("mov %cx, _9");
__asm("mov %es:[bx], %cx");
__asm("mov %ah,_0");
__asm("int 016h");
__asm("pop %ax");
__asm("mov %ah, _0");
__asm("int 10h");
__asm("mov %ax, _4c00h");
__asm("int 21h");
}
Any Help would be appreciated,
Steven