Hi its been a while sence I was last here but I've resently come across a problem when trying to call a asm function from my c code, basically The prototype for it is
word being an unsigned short, and byte being an unsigned char
extern void PlotPixel( word x, word y, byte c);
All my c code does so far is change the vid mode by calling
extern void ChangeVidMode(void);
which works
and proceeds to attempt to plot 640 x 480 worth of pixels
using PlotPixel(x,y,3);
then it loops, the problem has to be my asm code i tried to work though it based on the code the c compiler gave me and I ended up with this...
_PlotPixel:
enter 0, 0
mov ecx, dword[bp+8]
mov edx, dword[bp+12]
mov ah, 0Ch
mov al, 0x3
mov bh, 0h
int 10h
leave
ret
ps, I know im ignoreing the third arg thats cause its gonna be the color, but I can't even get the position to work right so I have been working with that pre-set
Needless to say I need some help here, im totally lost as to why I am only getting a 10 to 20 pixel horizontal line about 4 pixels down on the screen.
any help would be most appreciated, ive spent a few hours trying to get this to work and so far I have had no luck.
Calling ASM with C
-
- Posts: 14
- Joined: Sat Jun 24, 2006 8:09 pm
Forget it
It seems that either I was doing everything fine, or its a strange question but in any case I dont need the answer anymore, I switched my development tools to turbo c + tasm so I am just going to use all c + inline asm for my project, I was using nasm and linking with my c objs