我有一个简单的程序,必须读取PCI configuration space(仅适用于第一个 PCI 设备)。但它不起作用。雅思:
18: warning: value doesnt fit in 8 bit fild
19: warning: value doesnt fit in 8 bit fild
这是代码:
   [use    32]
    [org    0x7c00]
start:
    mov     ah, 0x3
    int     0x10        ;clear screen
;forming the PCI address
    push    ax
    or      ah, 10000000b
    xor     al, al
    or      al, 00000001b
    shl     eax, 16
    pop     ax
    xor     al, al
    xor     ah, ah
    push    eax
    out     0xcf8, eax
    in      eax, 0xcfc
    mov     edi, field
    stosd   
    mov     si, di
    call    print_str
    ret
field:      
print_str:
;print a string in si
    mov     ax, 0xb800
    mov     es, ax
    xor     di, di
    mov     cx, 128
    rep     movsw
    ret
    times   510 - ($ - $$) db 0
    dw      0xaa55
谢谢。
PS 我使用 Bochs 进行仿真,使用 YASM 作为汇编程序