I have the following code in which I am trying to call an assembly function in C, which is trying to print "e" on the VGA Display (of QEmu):
void main()
{
extern void put_in_mem();
char c = 'e';
put_in_mem(c, 0xA0);
}
The function put_in_mem is defined below:
.global _put_in_mem
_put_in_mem:
push bp
mov bp, sp
mov cx, [bp + 4]
mov ax, [bp + 6]
mov ax, 0xb800
mov ds, ax
mov [bx], cx
add bx, 0x1
mov cx, 0x7
mov [bx], cx
pop bp
ret
When I compile the above assembly code using nasm I am getting the following error:
put_in_mem.asm:1: error: attempt to define a local label before any non-local labels
put_in_mem.asm:1: error: parser: instruction expected
Why is this error coming?