This commit is contained in:
Baptiste Wicht 2013-10-10 17:21:34 +02:00
parent 3f756ecd03
commit b296a2b13c
3 changed files with 76 additions and 98 deletions

View File

@ -1,11 +1,14 @@
[BITS 16]
jmp rm_start
%include "src/utils/intel_16.asm"
; Start in real mode
rm_start:
; 1. Set stable environment
; Set stack space (4K) and stack segment
mov ax, 0x7C0
add ax, 288
mov ss, ax
@ -89,50 +92,6 @@ error_end:
jmp $
; Functions
new_line_16:
mov ah, 0Eh
mov al, 0Ah
int 10h
mov al, 0Dh
int 10h
ret
print_line_16:
mov ah, 0Eh
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
call new_line_16
ret
key_wait:
mov al, 0xD2
out 64h, al
mov al, 0x80
out 60h, al
keyup:
in al, 0x60
and al, 10000000b
jnz keyup
Keydown:
in al, 0x60
ret
; Datas
header_0 db '******************************', 0
@ -149,5 +108,6 @@ key_wait:
bootdev db 0
; Make a real bootsector
times 510-($-$$) db 0
dw 0xAA55

View File

@ -1,6 +1,8 @@
[BITS 16]
jmp _start
[BITS 16]
%include "src/utils/intel_16.asm"
_start:
; Set stack space
@ -27,35 +29,6 @@ _start:
jmp $
; Functions
new_line_16:
mov ah, 0Eh
mov al, 0Ah
int 10h
mov al, 0Dh
int 10h
ret
print_line_16:
mov ah, 0Eh
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
call new_line_16
ret
; Datas
kernel_header_0 db '******************************', 0

45
src/utils/intel_16.asm Normal file
View File

@ -0,0 +1,45 @@
[BITS 16]
; Functions
new_line_16:
mov ah, 0Eh
mov al, 0Ah
int 10h
mov al, 0Dh
int 10h
ret
print_line_16:
mov ah, 0Eh
.repeat:
lodsb
cmp al, 0
je .done
int 10h
jmp .repeat
.done:
call new_line_16
ret
key_wait:
mov al, 0xD2
out 64h, al
mov al, 0x80
out 60h, al
keyup:
in al, 0x60
and al, 10000000b
jnz keyup
Keydown:
in al, 0x60
ret