Code: Select all
cli
mov ax, 0
mov ss, ax
mov sp, 0FFFFh
sti
cld
mov ax, 2000h
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
Code: Select all
mov ah, 0Eh
mov al, 'o'
int 10h
Code: Select all
cli
mov ax, 0
mov ss, ax
mov sp, 0FFFFh
sti
cld
mov ax, 2000h
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
Code: Select all
mov ah, 0Eh
mov al, 'o'
int 10h
Code: Select all
main:
call clean_all ; will clear the screen and clean out the GP regs
.string: db 'Successfully booted!', 0
mov si, .string
call print
hlt
; include the functions:
%include "screen.asm"
%include "clean.asm"
Code: Select all
print:
pusha
.loop:
lodsb
cmp al, 0
je .done
mov ah, 0eh
mov bh, 00h
int10h
jmp .loop
.done:
popa
ret
Code: Select all
clean_all:
; clear screen
mov ax, 0600h
mov bh, 07h
mov cx, 0000h
mov dx, 7924h
int 10h
; clean the regs
mov ax, 0
mov bx, 0
mov cx, 0
mov dx, 0
mov si, 0
mov di, 0
ret
Code: Select all
.string: db 'Successfully booted!', 0
Code: Select all
0: e8 1c 00 call 0x1f ; first instruction
3: 53 push %bx ; we come back here after the call and er.... what?
4: 75 63 jne 0x69 ; oops
6: 63 65 73 arpl %sp,0x73(%di)
9: 73 66 jae 0x71
b: 75 6c jne 0x79
d: 6c insb (%dx),%es:(%di)
e: 79 20 jns 0x30
10: 62 6f 6f bound %bp,0x6f(%bx)
13: 74 65 je 0x7a
15: 64 21 00 and %ax,%fs:(%bx,%si)