fasm-putchar-virittelyy
This commit is contained in:
parent
deadd739fb
commit
33e5891931
3 changed files with 101 additions and 0 deletions
38
src/font.asm
Normal file
38
src/font.asm
Normal file
|
@ -0,0 +1,38 @@
|
|||
;; Thank you Terminus for letting us use this font under SIL licence
|
||||
kfont:
|
||||
; controlchars
|
||||
times 31 db 0x00000000000000000000000000000000
|
||||
; space
|
||||
db 11000000b
|
||||
db 10000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000001b
|
||||
db 00000001b
|
||||
db 00000001b
|
||||
db 00000001b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000001b
|
||||
db 00000011b
|
||||
; !
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00000000b
|
||||
db 00011000b
|
||||
db 00011000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
||||
db 00000000b
|
|
@ -42,3 +42,60 @@ putpixel:
|
|||
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
; char, x, y
|
||||
putchar:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
; skip non printable
|
||||
mov eax, [ebp+8] ;char
|
||||
cmp eax, 0x20
|
||||
jl .unprintable
|
||||
cmp eax, 0x7e
|
||||
jg .unprintable
|
||||
|
||||
mov ecx, 16
|
||||
mul ecx
|
||||
mov esi, [kfont+eax]
|
||||
|
||||
mov ebx, [ebp+12] ;x
|
||||
mov edx, [ebp+16] ;y
|
||||
|
||||
cld
|
||||
xor eax, eax
|
||||
.loop:
|
||||
lodsb ; load font row to al
|
||||
mov ah, 0
|
||||
.loop2:
|
||||
shl al
|
||||
jnc .blankpix
|
||||
; draw a pixel
|
||||
push 0xff
|
||||
push edx ;x
|
||||
push ecx ;y
|
||||
.blankpix:
|
||||
inc ah
|
||||
cmp ah, 8
|
||||
je .loop
|
||||
|
||||
|
||||
.done:
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
pop ebp
|
||||
ret
|
||||
.unprintable:
|
||||
push .unprintablemsg
|
||||
call serialwrite
|
||||
add esp, 4
|
||||
jmp .done
|
||||
.unprintablemsg: db 10,"Err: Unprintable char not handled!", 0
|
||||
|
||||
include "src/font.asm"
|
||||
|
|
|
@ -133,6 +133,12 @@ rOSkalogodraw:
|
|||
jne .loop
|
||||
.done:
|
||||
|
||||
push byte 0x21
|
||||
push byte 0x21
|
||||
push byte 0x21
|
||||
call putchar
|
||||
add esp, 3*4
|
||||
|
||||
jmp hang
|
||||
|
||||
hang:
|
||||
|
|
Loading…
Reference in a new issue