LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 895|回复: 0

linux C 如何调用汇编的变量?

[复制链接]
发表于 2007-3-15 05:11:09 | 显示全部楼层 |阅读模式
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'
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表