Code: Select all
%macro Print 2
mov ah, 0xa
mov al, [%1]
mov bl, 0xf
mov bh, 0
mov cx, %2
int 0x10
%endmacro
%macro Printr 2
mov al, %1
mov bl, 0xf
mov bh, 0
mov cl, %2
mov ah, 0xa
int 0x10
%endmacro
[ORG 0x7c00]
[BITS 16]
jmp 0x0000:bootstart
bootstart:
; Set our data segment
xor ax, ax
mov ds, ax
mov es, ax
; Clear interrupts
cli
Print greeting, 1
jmp reset
; 512 bytes per sector
; 18 sectors per track
; 63 tracks
reset:
mov ah, 0
xor dl, dl
int 0x13
jmp readCD
readCDerror:
Print error, 2
readCD:
mov ah, 0x2
mov al, 0x59
mov dh, 0
mov ax, 0x500
mov es, ax
xor bx, bx
xor ch, ch
xor cl, cl
xor dl, dl
int 0x13
jc readCDerror
jmp 0x500:0x0
data:
greeting db 'G'
error db 'E'
load db 'L'
times 510-($-$$) db 0
dw 0x55AA