0
我在做一個系統編程任務,但是面臨一個小問題。程序集從一個扇區加載程序並返回
我已經設法寫入我的引導扇區,並能夠調用另一個扇區,我用int 13讀過。所有指令都執行並且代碼返回到引導扇區。
,但我無法訪問我在第二扇區聲明的變量在第二個部門
這裏使用的是代碼
[bits 16]
[org 0x7c00]
mov ah,2
mov al,1 ;Number of sectors to read
mov ch,0 ;Cylinder number (10 bit value; upper 2 bits in CL)
mov cl,2 ;Starting sector number
mov dh,0 ;Head number
mov dl,0 ;Drive number
mov bx,cs
mov es,bx
mov bx,here
int 13h
jc error
call here
error:
mov ah,0eh
mov al,'E'
mov bl,7
mov bh,0
int 10h
jmp $
exit:
mov ah,0eh
mov al,'F'
mov bl,7
mov bh,0
int 10h
jmp $
here:
jmp $
times 510 - ($-$$) db 0
dw 0xaa55
Sector2.asm
[bits 16]
mov bx,cs
mov ds,bx
jmp start
msg db "Welcome to my OSD",0
start:
mov si,0
mov si,msg
mov ah,0eh
mov al,':'
int 10h
mov ah,0eh
mov al,[si] ;; HERE IS THE PROBLEM IT PRINTS GARBAGE
int 10h
inc si
mov ah,0eh
mov al,[si] ;; HERE IS THE PROBLEM IT PRINTS GARBAGE
int 10h
inc si
mov ah,0eh
mov al,[si] ;; HERE IS THE PROBLEM IT PRINTS GARBAGE
int 10h
ret
times 510-($-$$) db 0
dw 0x0055