mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-24 12:29:29 +00:00
hgr_font: clean things up a bit
This commit is contained in:
parent
8c8f764388
commit
68ae91fe7e
|
@ -37,7 +37,7 @@ bios_test:
|
||||||
ldy #>test1
|
ldy #>test1
|
||||||
|
|
||||||
ldx #1
|
ldx #1
|
||||||
stx VTAB
|
stx CV
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ bios_test:
|
||||||
ldy #>test2
|
ldy #>test2
|
||||||
|
|
||||||
ldx #3
|
ldx #3
|
||||||
stx VTAB
|
stx CV
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ bios_test:
|
||||||
ldy #>test3
|
ldy #>test3
|
||||||
|
|
||||||
ldx #5
|
ldx #5
|
||||||
stx VTAB
|
stx CV
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ bios_test:
|
||||||
ldy #>test4
|
ldy #>test4
|
||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
stx VTAB
|
stx CV
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
jsr DrawCondensedString
|
jsr DrawCondensedString
|
||||||
|
@ -80,7 +80,7 @@ bios_test:
|
||||||
ldy #>test5
|
ldy #>test5
|
||||||
|
|
||||||
ldx #9
|
ldx #9
|
||||||
stx VTAB
|
stx CV
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
jsr DrawCondensedString
|
jsr DrawCondensedString
|
||||||
|
@ -103,8 +103,8 @@ test4:
|
||||||
test5:
|
test5:
|
||||||
.byte 17,"@/\/\/\/\______ |"
|
.byte 17,"@/\/\/\/\______ |"
|
||||||
|
|
||||||
.include "font_condensed.s"
|
.include "font_4am_condensed.s"
|
||||||
.include "font_condensed_data.s"
|
.include "font_4am_condensed_data.s"
|
||||||
|
|
||||||
.include "zx02_optim.s"
|
.include "zx02_optim.s"
|
||||||
|
|
||||||
|
|
218
graphics/hgr/hgr_font_4am/font_4am_condensed.s
Normal file
218
graphics/hgr/hgr_font_4am/font_4am_condensed.s
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
;license:MIT
|
||||||
|
;(c) 2023 by 4am
|
||||||
|
;
|
||||||
|
; drawing routines for Million Perfect Tiles Condensed
|
||||||
|
;
|
||||||
|
; Public functions:
|
||||||
|
; - DrawCondensedString
|
||||||
|
;
|
||||||
|
|
||||||
|
; VMW: commented, reformatted, minor changes, ca65 assembly
|
||||||
|
|
||||||
|
string_ptr = $FC ; word (used by DrawLargeString)
|
||||||
|
tmpx = $FE ; byte (used by DrawLargeCharacter, FindValidMove)
|
||||||
|
tmpy = $FF ; byte (used by DrawLargeCharacter, FindValidMove)
|
||||||
|
|
||||||
|
; Y location of the 16 supported lines
|
||||||
|
CondensedHGRTops:
|
||||||
|
.byte 7,18,29,40,51,62,73,84,95,106,117,128,139,150,161,172
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; DrawCondensedString
|
||||||
|
;
|
||||||
|
; in: A/Y points to length-prefixed string (Pascal style)
|
||||||
|
; X contains column number (0x00..0x27)
|
||||||
|
; $25 (CV) contains logical line number (0x00..0x0F)
|
||||||
|
; pointer is hidden
|
||||||
|
; out: clobbers all registers & flags
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
DrawCondensedString:
|
||||||
|
|
||||||
|
; store the string location
|
||||||
|
|
||||||
|
sta string_ptr
|
||||||
|
sty string_ptr+1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
stx CH ; save the X column offset
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
lda (string_ptr), Y ; get string length
|
||||||
|
tax ; store it in X
|
||||||
|
|
||||||
|
; 16 bit increment of string_ptr
|
||||||
|
|
||||||
|
inc string_ptr ; increment past the length
|
||||||
|
bne dcs_noflo
|
||||||
|
inc string_ptr+1
|
||||||
|
dcs_noflo:
|
||||||
|
|
||||||
|
; Load updated string pointer back into Y/A
|
||||||
|
lda string_ptr
|
||||||
|
ldy string_ptr+1
|
||||||
|
|
||||||
|
; /!\ execution falls through here to DrawCondensedBuffer
|
||||||
|
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
; DrawCondensedBuffer
|
||||||
|
;
|
||||||
|
; in: A/Y contains address of character buffer (characters 0x19+ only)
|
||||||
|
; X contains buffer length (0x01..0x28)
|
||||||
|
; $24 (CH) contains starting column (0x00..0x27)
|
||||||
|
; $25 (CV) contains logical line number (0x00..0x0F)
|
||||||
|
; all characters are drawn on the same line
|
||||||
|
; CH is incremented for each character
|
||||||
|
; CV is NOT incremented
|
||||||
|
; out: clobbers all registers & flags
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
DrawCondensedBuffer:
|
||||||
|
|
||||||
|
sta dcb_loop_smc+1 ; save string address
|
||||||
|
sty dcb_loop_smc+2 ; to smc location
|
||||||
|
|
||||||
|
dex ; ?
|
||||||
|
|
||||||
|
ldy CV ; lookup y-coord location
|
||||||
|
lda CondensedHGRTops, Y ; using lookup table
|
||||||
|
tay ;
|
||||||
|
|
||||||
|
; row0
|
||||||
|
|
||||||
|
lda hposn_low, Y ; get low memory offset
|
||||||
|
clc
|
||||||
|
adc CH ; add in x-coord
|
||||||
|
sta dcb_row0+4
|
||||||
|
lda hposn_high, Y ; get high memory offset
|
||||||
|
sta dcb_row0+5 ; save it out
|
||||||
|
iny ; go to next row
|
||||||
|
|
||||||
|
; row1
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row1+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row1+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row2
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row2+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row2+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row3
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row3+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row3+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row4
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row4+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row4+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row5
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row5+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row5+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row6
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row6+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row6+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row7
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row7+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row7+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row8
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row8+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row8+5
|
||||||
|
iny
|
||||||
|
|
||||||
|
; row9
|
||||||
|
|
||||||
|
lda hposn_low, Y
|
||||||
|
adc CH
|
||||||
|
sta dcb_row9+4
|
||||||
|
lda hposn_high, Y
|
||||||
|
sta dcb_row9+5
|
||||||
|
|
||||||
|
dcb_loop:
|
||||||
|
dcb_loop_smc:
|
||||||
|
ldy $FDFD, X ; load next char into Y
|
||||||
|
; note we are going backward
|
||||||
|
|
||||||
|
; unrolled loop to write out each line
|
||||||
|
|
||||||
|
dcb_row0:
|
||||||
|
lda CondensedRow0-$19, Y ; get 1-byte font row
|
||||||
|
sta $FDFD, X ; write out to graphics mem
|
||||||
|
dcb_row1:
|
||||||
|
lda CondensedRow1-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row2:
|
||||||
|
lda CondensedRow2-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row3:
|
||||||
|
lda CondensedRow3-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row4:
|
||||||
|
lda CondensedRow4-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row5:
|
||||||
|
lda CondensedRow5-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row6:
|
||||||
|
lda CondensedRow6-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row7:
|
||||||
|
lda CondensedRow7-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row8:
|
||||||
|
lda CondensedRow8-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
dcb_row9:
|
||||||
|
lda CondensedRow9-$19, Y
|
||||||
|
sta $FDFD, X
|
||||||
|
|
||||||
|
|
||||||
|
; increment to next char
|
||||||
|
inc CH ; not-needed for the routine
|
||||||
|
; I guess auto-points to next string
|
||||||
|
|
||||||
|
; decrement number of characters
|
||||||
|
dex ; we're traversing backward
|
||||||
|
bpl dcb_loop
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
|
@ -1,156 +0,0 @@
|
||||||
;license:MIT
|
|
||||||
;(c) 2023 by 4am
|
|
||||||
;
|
|
||||||
; drawing routines for Million Perfect Tiles Condensed
|
|
||||||
;
|
|
||||||
; Public functions:
|
|
||||||
; - DrawCondensedString
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
string_ptr = $FC ; word (used by DrawLargeString)
|
|
||||||
tmpx = $FE ; byte (used by DrawLargeCharacter, FindValidMove)
|
|
||||||
tmpy = $FF ; byte (used by DrawLargeCharacter, FindValidMove)
|
|
||||||
|
|
||||||
|
|
||||||
CondensedHGRTops:
|
|
||||||
.byte 7,18,29,40,51,62,73,84,95,106,117,128,139,150,161,172
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; DrawCondensedString
|
|
||||||
;
|
|
||||||
; in: A/Y points to length-prefixed string (Pascal style)
|
|
||||||
; X contains column number (0x00..0x27)
|
|
||||||
; $25 (VTAB) contains logical line number (0x00..0x0F)
|
|
||||||
; pointer is hidden
|
|
||||||
; out: clobbers all registers & flags
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
DrawCondensedString:
|
|
||||||
; +ST16 string_ptr ; macro
|
|
||||||
sta string_ptr
|
|
||||||
sty string_ptr+1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stx HTAB
|
|
||||||
ldy #0
|
|
||||||
lda (string_ptr), y
|
|
||||||
tax
|
|
||||||
inc string_ptr
|
|
||||||
bne dcs1
|
|
||||||
inc string_ptr+1
|
|
||||||
dcs1:
|
|
||||||
; +LD16 string_ptr
|
|
||||||
lda string_ptr
|
|
||||||
ldy string_ptr+1
|
|
||||||
|
|
||||||
; /!\ execution falls through here to DrawCondensedBuffer
|
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
; DrawCondensedBuffer
|
|
||||||
;
|
|
||||||
; in: A/Y contains address of character buffer (characters 0x19+ only)
|
|
||||||
; X contains buffer length (0x01..0x28)
|
|
||||||
; $24 (HTAB) contains starting column (0x00..0x27)
|
|
||||||
; $25 (VTAB) contains logical line number (0x00..0x0F)
|
|
||||||
; all characters are drawn on the same line
|
|
||||||
; HTAB is incremented for each character
|
|
||||||
; VTAB is NOT incremented
|
|
||||||
; out: clobbers all registers & flags
|
|
||||||
;------------------------------------------------------------------------------
|
|
||||||
;DrawCondensedBuffer
|
|
||||||
; +ST16 @loop+1
|
|
||||||
|
|
||||||
sta @loop+1
|
|
||||||
sty @loop+2
|
|
||||||
|
|
||||||
dex
|
|
||||||
ldy VTAB
|
|
||||||
lda CondensedHGRTops, y
|
|
||||||
tay
|
|
||||||
lda hposn_low, y
|
|
||||||
clc
|
|
||||||
adc HTAB
|
|
||||||
sta @row0+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row0+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row1+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row1+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row2+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row2+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row3+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row3+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row4+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row4+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row5+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row5+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row6+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row6+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row7+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row7+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row8+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row8+2
|
|
||||||
iny
|
|
||||||
lda hposn_low, y
|
|
||||||
adc HTAB
|
|
||||||
sta @row9+1
|
|
||||||
lda hposn_high, y
|
|
||||||
sta @row9+2
|
|
||||||
@loop: ldy $FDFD, x
|
|
||||||
lda CondensedRow0-$19, y
|
|
||||||
@row0: sta $FDFD, x
|
|
||||||
lda CondensedRow1-$19, y
|
|
||||||
@row1: sta $FDFD, x
|
|
||||||
lda CondensedRow2-$19, y
|
|
||||||
@row2: sta $FDFD, x
|
|
||||||
lda CondensedRow3-$19, y
|
|
||||||
@row3: sta $FDFD, x
|
|
||||||
lda CondensedRow4-$19, y
|
|
||||||
@row4: sta $FDFD, x
|
|
||||||
lda CondensedRow5-$19, y
|
|
||||||
@row5: sta $FDFD, x
|
|
||||||
lda CondensedRow6-$19, y
|
|
||||||
@row6: sta $FDFD, x
|
|
||||||
lda CondensedRow7-$19, y
|
|
||||||
@row7: sta $FDFD, x
|
|
||||||
lda CondensedRow8-$19, y
|
|
||||||
@row8: sta $FDFD, x
|
|
||||||
lda CondensedRow9-$19, y
|
|
||||||
@row9: sta $FDFD, x
|
|
||||||
inc HTAB
|
|
||||||
dex
|
|
||||||
bpl @loop
|
|
||||||
rts
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ font_test:
|
||||||
ldy #>test1
|
ldy #>test1
|
||||||
|
|
||||||
ldx #1
|
ldx #1
|
||||||
stx VTAB
|
stx CV
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ font_test:
|
||||||
ldy #>test2
|
ldy #>test2
|
||||||
|
|
||||||
ldx #3
|
ldx #3
|
||||||
stx VTAB
|
stx CV
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ font_test:
|
||||||
ldy #>test3
|
ldy #>test3
|
||||||
|
|
||||||
ldx #5
|
ldx #5
|
||||||
stx VTAB
|
stx CV
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ font_test:
|
||||||
ldy #>test4
|
ldy #>test4
|
||||||
|
|
||||||
ldx #7
|
ldx #7
|
||||||
stx VTAB
|
stx CV
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
jsr DrawCondensedString
|
jsr DrawCondensedString
|
||||||
|
@ -76,7 +76,7 @@ font_test:
|
||||||
ldy #>test5
|
ldy #>test5
|
||||||
|
|
||||||
ldx #9
|
ldx #9
|
||||||
stx VTAB
|
stx CV
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
jsr DrawCondensedString
|
jsr DrawCondensedString
|
||||||
|
@ -99,8 +99,8 @@ test4:
|
||||||
test5:
|
test5:
|
||||||
.byte 17,"@/\/\/\/\______ |"
|
.byte 17,"@/\/\/\/\______ |"
|
||||||
|
|
||||||
.include "font_condensed.s"
|
.include "font_4am_condensed.s"
|
||||||
.include "font_condensed_data.s"
|
.include "font_4am_condensed_data.s"
|
||||||
|
|
||||||
|
|
||||||
hposn_low = $1713 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
|
hposn_low = $1713 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user