In the following lines of code if I uncomment the lines, the program just hangs in bochs, no error message whatsoever....:/
The code is loaded via the bootloader to the address of 0x2000...
If the lines are commented, everything works fine as intended.
I just don't seem to understand why the emulator hangs when I uncomment any of those lines
Please help me, thanks in advance
Code: Select all
org 0x2000
entry:
mov si, msg
call putstr
mov byte [0x298], 0x01
jmp 0x1000
;mov bx, 0x0000 ; LINES FROM HERE
;mov es, bx
;mov bx, 0x2300
;mov byte [0x0297], 4
;mov ax, 0 ; move code segment to ax
;mov ds, ax ; move ax to data segment
;mov es, ax ; move ax to extra segment
;mov ah, 0 ; reset floppy disk function
;mov dl, 80h ; drive number
;int 0x13 ; call BIOS
;jc fail
;mov byte cl, [0x297]
;mov ah, 0x02 ; read floppy sector function
;mov al, 1 ; read 1 sector
;mov ch, 0 ; track number
;;mov cl, 2 ; sector to read
;mov dh, 0 ; head number
;mov dl, 80h ; drive number.
;int 0x13 ; call BIOS - Read the sector
;;jc fail
hlt
putstr:
lodsb ; AL = [DS:SI]
or al, al ; Set zero flag if al=0
jz putstrd ; jump to putstrd if zero flag is set
mov ah, 0x0e ; video function 0Eh (print char)
mov bx, 0x0007 ; color
int 0x10
jmp putstr
putstrd:
retn
msg db 'Sector 3 loaded. Pure awesomenuzz!', 0
size equ $ - entry
%if size > 512
%error "util > 512"
%endif
times (512 - size) db 0