diff --git a/boot.asm b/boot.asm new file mode 100644 index 0000000..beb1127 --- /dev/null +++ b/boot.asm @@ -0,0 +1,17 @@ +[org 0x7c00] + +boot: + mov bx, HELLO_WORLD2 + call println + +jmp $ ; Halt + +; Boot sector libs + + +; Boot sector data + + +; Boot sector padding and magic number +times 510-($-$$) db 0 +dw 0xaa55 diff --git a/main.asm b/main.asm index 6ccdf92..188af92 100644 --- a/main.asm +++ b/main.asm @@ -1,33 +1,15 @@ -[org 0x7c00] +; Bootloader +%include "boot.asm" main: - ; Video mode - mov ax, 0x13 - int 0x10 + mov bx, HELLO_WORLD + call println - call mouse_initialize - call mouse_enable - -lp: - cli - mov bx, [mouseX] - call print_hex - mov bx, [mouseY] - sti - - jmp lp - jmp $ ; Halt - -; Make sure includes are done last, otherwise the first include will become main + +; Libs %include "print_util.asm" -;%include "input_util.asm" -;%include "num_util.asm" -%include "mouse_util.asm" - -; Make sure data is *inside* the boot sector, or it will not be copied to the right place -; in memory. - - -times 510-($-$$) db 0 -dw 0xaa55 + +; Data +HELLO_WORLD: + db 'Hello, world! :D', 0 \ No newline at end of file diff --git a/main.bin b/main.bin index 41d3388..7ca3f4e 100644 Binary files a/main.bin and b/main.bin differ diff --git a/print_util.asm b/print_util.asm index 5ca91f8..2f002db 100644 --- a/print_util.asm +++ b/print_util.asm @@ -118,4 +118,21 @@ print_bin: .end: popa - ret \ No newline at end of file + ret + + +%macro print_ch 1 + push ax + mov al, [%1] + mov ah, 0x0e + int 0x10 + pop ax +%endmacro + +%macro cls 0 + mov ax, 0x0600 ; AH=06 Scroll screen, AL=0 Clear screen + mov bh, 0x0F ; black bg, white fg + mov cx, 0x0000 ; x1=y1=0 + mov dx, 0x5019 ; 89x25 + int 0x10 ; Graphics services +%endmacro \ No newline at end of file