我只是接近机器级 x86 编码,所以请原谅我的问题的琐碎性。以下代码旨在成为一个简单的引导加载程序。它将软盘的某些扇区转储到内存中,然后跳转到加载的代码。在加载的代码中,我试图从内存变量中读取,但没有成功,如评论中所述。
    [ORG 0]
            jmp 07C0h:start     ; Goto segment 07C0
    start:
            ; Update the segment registers
            mov ax, cs
            mov ds, ax
            mov es, ax
    reset:                      ; Reset the floppy drive
            mov ax, 0          
            mov dl, 0          
            int 13h            
            jc reset         
    read:
            mov ax, 1000h       ; ES:BX = 1000:0000
            mov es, ax          
            mov bx, 0           
            mov ah, 2           ; Load disk data to ES:BX
            mov al, 5           ; Load 5 sectors
            mov ch, 0           ; Cylinder=0
            mov cl, 2           ; Sector=2
            mov dh, 0           ; Head=0
            mov dl, 0           ; Drive=0
            int 13h             ; Read!
            jc read             ; on error
            jmp 1000h:0000      ; Jump to the program
    times 510-($-$$) db 0
    dw 0AA55h
       ;     ==  Loaded code from second floppy sector  ==
prog:
        mov     ah,     0x0E       ; Prints a char. This one works: the '-'
        mov     al,     '-'        ;   is printed.
        mov     bx,     0
        int     10h
        mov     bx,     0 
a:                                 
        mov     al,     [L1+bx]    ; Should read from L1 and print out chars.
        inc     bx                 ;   But it prints only white spaces. Why?
        int     10h
        cmp     bx,     10
        jz      h
        jmp a
        cli
        hlt
        L1 db "0123456789"        ; my string
我不明白为什么它不起作用。我非常感谢任何帮助。