Working an external assembly function that will be called from C as AsmPixel(int x, int y, int value) will put a value into the y*320+x location of unsigned char far *double_buffer this is the assembly code that I have so far that crashes when ran.
dw 2 dup(?)
x dw ?
y dw ?
value dw ?
_AsmPixel proc near
mov dx, 320 ; Put 320 in DX
mul dx ; multiply AX (Y) by DX (320)
add ax, bx ; add BX (X) to AX -> 320*y+x
add di, ax ; add to pointer offset ***
;ES:DI now points at &double_buffer[320*y+x]
mov es:[di], cl ; Store the byte
When a simple c program is ran with this function it crashes. Could someone help me with what is wrong.