Compare commits

...

1 commit

Author SHA1 Message Date
33e5891931
fasm-putchar-virittelyy 2023-09-19 19:48:30 +03:00
3 changed files with 101 additions and 0 deletions

38
src/font.asm Normal file
View 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

View file

@ -42,3 +42,60 @@ putpixel:
pop ebp pop ebp
ret 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"

View file

@ -133,6 +133,12 @@ rOSkalogodraw:
jne .loop jne .loop
.done: .done:
push byte 0x21
push byte 0x21
push byte 0x21
call putchar
add esp, 3*4
jmp hang jmp hang
hang: hang: