Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [bits 16]
- [org 0x7c00]
- mov bp, 0x8000
- mov sp, bp
- mov bx, rdd
- call print
- call print_nl
- mov bx, 0x9000
- mov dh, 2
- call disk_load
- mov dx, [0x9000]
- mov bx, ok
- call print
- call print_nl
- mov bx, nxt
- call print
- call print_nl
- call print_hex
- call print_nl
- jmp 0x9000
- jmp $
- disk_load:
- pusha
- push dx
- mov ah, 0x02 ;INT 0x13 read mode
- mov al, dh
- mov cl, 0x02 ;Sector
- mov ch, 0x00 ;Cylinder
- mov dh, 0x00 ;Head
- int 0x13
- jc disk_error
- pop dx
- cmp al, dh
- jne sectors_error
- popa
- ret
- disk_error:
- mov bx, diskerror
- call print
- call print_nl
- jmp $
- sectors_error:
- mov bx, sectorerror
- call print
- jmp $
- print:
- pusha
- start:
- mov al, [bx]
- cmp al, 0
- je done
- mov ah, 0x0e
- int 0x10
- add bx, 1
- jmp start
- done:
- popa
- ret
- print_nl:
- pusha
- mov ah, 0x0e
- mov al, 0x0a
- int 0x10
- mov al, 0x0d
- int 0x10
- popa
- ret
- print_hex:
- pusha
- mov cx, 0
- hex_loop:
- cmp cx, 4
- je end
- mov ax, dx
- and ax, 0x000f
- add al, 0x30
- cmp al, 0x39
- jle step2
- add al, 7
- step2:
- mov bx, HEX_OUT + 5
- sub bx, cx
- mov [bx], al
- ror dx, 4
- add cx, 1
- jmp hex_loop
- end:
- mov bx, HEX_OUT
- call print
- popa
- ret
- HEX_OUT db '0x0000',0
- ok db "[OK] Stage 2 sectors loaded",0
- nxt db "[SB] Executing stage 2...",0
- rdd db "[SB] Reading disk...",0
- diskerror db "[ER] Disk error",0
- sectorerror db "[ER] Sector error",0
- times 510-($-$$) db 0
- dw 0xaa55
- mov al, 0Eh
- mov ax, 'A'
- int 10h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement