Incomplete demo
This commit is contained in:
parent
488b58b2d6
commit
e4c3f4af3a
17
boot.asm
Normal file
17
boot.asm
Normal file
|
@ -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
|
34
main.asm
34
main.asm
|
@ -1,33 +1,15 @@
|
||||||
[org 0x7c00]
|
; Bootloader
|
||||||
|
%include "boot.asm"
|
||||||
|
|
||||||
main:
|
main:
|
||||||
; Video mode
|
mov bx, HELLO_WORLD
|
||||||
mov ax, 0x13
|
call println
|
||||||
int 0x10
|
|
||||||
|
|
||||||
call mouse_initialize
|
|
||||||
call mouse_enable
|
|
||||||
|
|
||||||
lp:
|
|
||||||
cli
|
|
||||||
mov bx, [mouseX]
|
|
||||||
call print_hex
|
|
||||||
mov bx, [mouseY]
|
|
||||||
sti
|
|
||||||
|
|
||||||
jmp lp
|
|
||||||
|
|
||||||
jmp $ ; Halt
|
jmp $ ; Halt
|
||||||
|
|
||||||
; Make sure includes are done last, otherwise the first include will become main
|
; Libs
|
||||||
%include "print_util.asm"
|
%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
|
; Data
|
||||||
; in memory.
|
HELLO_WORLD:
|
||||||
|
db 'Hello, world! :D', 0
|
||||||
|
|
||||||
times 510-($-$$) db 0
|
|
||||||
dw 0xaa55
|
|
|
@ -119,3 +119,20 @@ print_bin:
|
||||||
|
|
||||||
popa
|
popa
|
||||||
ret
|
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
|
Loading…
Reference in a new issue