72 lines
1.2 KiB
NASM
72 lines
1.2 KiB
NASM
org 0x7c00
|
|
jmp main
|
|
|
|
%include "hcf.asm"
|
|
|
|
main:
|
|
mov ax, msg_checking
|
|
call puts
|
|
|
|
mov ah, 0 ; reset disk
|
|
mov dl, 0 ; disk A
|
|
int 0x13
|
|
jc .fail
|
|
jmp .success
|
|
.fail:
|
|
mov ax, msg_fail
|
|
call puts
|
|
jmp hcf
|
|
|
|
.success:
|
|
mov ax, msg_success
|
|
call puts
|
|
|
|
mov ah, 0x2 ; read sectors
|
|
mov al, 0x2 ; sector count
|
|
mov ch, 0x0 ; cylind
|
|
mov cl, 0x2 ; sector index
|
|
mov dh, 0x0 ; head
|
|
mov dl, 0x0 ; disk A
|
|
|
|
mov bx, 0
|
|
mov es, bx
|
|
mov bx, stage2
|
|
int 0x13
|
|
jmp stage2
|
|
|
|
puts:
|
|
push bx
|
|
push di
|
|
|
|
mov bx, ax
|
|
|
|
mov ah, 0xE
|
|
mov di, 0
|
|
.loop:
|
|
mov al, [bx + di]
|
|
|
|
cmp al, 0
|
|
je .exit
|
|
int 0x10
|
|
|
|
cmp al, 0xA
|
|
jne .skip
|
|
mov al, 0xD
|
|
int 0x10
|
|
.skip:
|
|
inc di
|
|
jmp .loop
|
|
.exit:
|
|
pop di
|
|
pop bx
|
|
ret
|
|
|
|
msg_checking: db "Checking that Floppy Disk A is mounted... ", 0
|
|
msg_success: db "success!", 0xA, 0
|
|
msg_fail: db "fail!", 0xA, 0
|
|
|
|
times 510 - ($-$$) db 0
|
|
db 0x55, 0xaa
|
|
|
|
%include "stage2.asm"
|