I'm just approaching to machine-level x86 coding, so please excuse the triviality of my question. The following code is intended to be a simple bootloader. It dumps some sector of floppy disk into memory and then it jumps to loaded code. In the loaded code I was trying to read from a memory variable, without success, as described in comments.
[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
I can't understand why it doesn't work. I very appreciate any help.