;=============================================================== ; BOOT SECTOR ; [http://www.karig.net/0008.html] ;=============================================================== [ORG 0x7C00] [BITS 16] main: ; ------ Straighten out segment registers. ; ------ [http://www.karig.net/0002.html] jmp word 0:segzero segzero: mov ax, cs mov ds, ax mov es, ax mov fs, ax mov gs, ax ; ------ Set up stack. cli mov ax, 0x1000 mov ss, ax mov sp, 0xFFFE sti ; ------ Test new print routines. ; ------ [http://www.karig.net/0008.html] testcode: call clear_screen mov cx, 80*25 + 40 xor ax, ax .1: push cx push ax call print_char pop ax pop cx inc al dec cx jnz .1 ; ------ Halt computer. jmp $ ; ROUTINES to print to the screen. ; ------ [http://www.karig.net/0008.html] clear_screen: mov ax, 3 int 0x10 xor bh, bh xor dx, dx mov ah, 2 int 0x10 ret scroll_up: mov bh, 7 xor cx, cx mov dx, (24*0x100) + 79 mov ax, (0x0600 + 23) int 0x10 ret print_char: ;in AL xor bh, bh xor cx, cx inc cx mov ah, 0x0A int 0x10 xor bh, bh mov ah, 3 int 0x10 inc dl cmp dl, 80 jb .1 xor dl, dl inc dh cmp dh, 25 jb .1 dec dh push dx call scroll_up pop dx .1: xor bh, bh mov ah, 2 int 0x10 ret ; ------ (Required to make this a boot sector.) times 510 - ($-$$) db 0 db 0x55, 0xAA