vbr: implement file searching in rootdir
This commit is contained in:
parent
cb3c977286
commit
97fe07a210
2 changed files with 128 additions and 118 deletions
66
lib/print.asm
Normal file
66
lib/print.asm
Normal file
|
@ -0,0 +1,66 @@
|
|||
; important functions in this file: kprintf
|
||||
|
||||
; write a character to kernel output
|
||||
; in: al
|
||||
printc:
|
||||
push ax
|
||||
push bx
|
||||
mov bx, 0x0000
|
||||
mov ah, 0x0e
|
||||
int 0x10
|
||||
pop bx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
; prints a nibble in hex
|
||||
; in: al
|
||||
print4:
|
||||
and al, 0x0F
|
||||
add al, 0x30
|
||||
cmp al, 0x3a
|
||||
jl printc
|
||||
add al, 0x07
|
||||
jmp printc
|
||||
|
||||
; print a byte
|
||||
; in: al
|
||||
print8:
|
||||
push ax ; avoid destroying ah
|
||||
aam 16 ; high nibble moved into ah
|
||||
xchg ah,al ; high nibble first
|
||||
call print4
|
||||
xchg ah,al
|
||||
call print4
|
||||
pop ax
|
||||
ret
|
||||
|
||||
; print a word
|
||||
; in: ax
|
||||
print16:
|
||||
xchg ah,al
|
||||
call print8
|
||||
xchg ah,al
|
||||
call print8
|
||||
ret
|
||||
|
||||
; print a inline following its call opcode
|
||||
; the string ends with a nullbyte
|
||||
; trashes si
|
||||
print_inline:
|
||||
pop si
|
||||
push ax
|
||||
push bx
|
||||
mov bx, 0x0000
|
||||
.loop:
|
||||
lodsb
|
||||
cmp al, 0x00
|
||||
je .end
|
||||
mov ah, 0x0e
|
||||
int 0x10
|
||||
cmp al, 0x0D
|
||||
jmp .loop
|
||||
.end:
|
||||
pop bx
|
||||
pop ax
|
||||
push si
|
||||
ret
|
Loading…
Add table
Add a link
Reference in a new issue