-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(bee,super80) Update copy font to cope with different sizes
-pragma-define:CLIB_FONT_HEIGHT=xx assets must have that many rows per character
- Loading branch information
Showing
1 changed file
with
42 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,54 @@ | ||
|
||
SECTION code_clib | ||
SECTION code_clib | ||
|
||
PUBLIC copy_font_8x8 | ||
PUBLIC copy_font_8x8 | ||
|
||
EXTERN CRT_FONT | ||
EXTERN CRT_FONT | ||
EXTERN __CLIB_FONT_HEIGHT | ||
|
||
|
||
; Copy font in PCG area | ||
; Entry: c = number of characters | ||
; de = address to copy from | ||
; hl = address for PCG | ||
; | ||
; | ||
; PCG takes 16 bytes, for an 8x8 we want to pad 1 at top, 7 at bottom | ||
copy_font_8x8: | ||
copy_1: | ||
ld (hl),0 | ||
inc hl | ||
ld b,8 | ||
push bc | ||
call filltop | ||
ld b,__CLIB_FONT_HEIGHT | ||
copy_2: | ||
ld a,(de) | ||
ld (hl),a | ||
inc de | ||
inc hl | ||
djnz copy_2 | ||
ld b,7 | ||
copy_3: | ||
ld (hl),0 | ||
inc hl | ||
djnz copy_3 | ||
dec c | ||
jr nz,copy_1 | ||
ret | ||
ld a,(de) | ||
ld (hl),a | ||
inc c | ||
inc de | ||
inc hl | ||
djnz copy_2 | ||
call fillbottom | ||
pop bc | ||
dec c | ||
jr nz,copy_1 | ||
ret | ||
|
||
filltop: | ||
ld c,0 | ||
ld a,__CLIB_FONT_HEIGHT | ||
cp 8 | ||
ret nz | ||
ld a,1 | ||
jr fill_loop | ||
|
||
fillbottom: | ||
ld a,16 | ||
sub c | ||
ret c | ||
fill_loop: | ||
and a | ||
ret z | ||
ld (hl),0 | ||
inc hl | ||
inc c | ||
dec a | ||
jr fill_loop |