|
linux C 如何调用汇编的变量?
我在汇编程序中定义了graphics_set_palette(index, red, green, blue)如下:
ENTRY(graphics_set_palette)
push %ebp
push %eax
push %ebx
push %ecx
push %edx
movw $0x3c8, %bx /* address write mode register */
/* wait vertical retrace */
movw $0x3da, %dx
l1b: inb %dx, %al /* wait vertical active display */
test $8, %al
jnz l1b
。。。。。。。。。。。。。。
。。。。。。。。。。。。。
。。。。。。。。。。。。。
。。。。。。。。。。。。。。
call EXT_C(prot_to_real)
.code16
movb %bl, %bh
movw $0x1000, %ax
int $0x10
DATA32 call EXT_C(real_to_prot)
.code32
pop %edx
pop %ecx
pop %ebx
pop %eax
pop %ebp
ret
在C中调用cursorX,cursorY如下
extern void graphics_set_palette(int idx, int red, int green, int blue);
sample_code
{
graphics_set_palette(0, (background >> 16), (background >> 8) & 63,
background & 63);
graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63,
foreground & 63);
graphics_set_palette(0x11, (sborder >> 16), (sborder >> 8) & 63,
sborder & 63);
return 1;
}
编译报错如下:
./graphics.c:402: undefined reference to `graphics_set_palette'
./graphics.c:404: undefined reference to `graphics_set_palette' |
|