hgr_font: separate out the hgr table code

This commit is contained in:
Vince Weaver 2023-08-23 20:02:57 -04:00
parent 9ac439ae28
commit 8c8f764388
4 changed files with 64 additions and 96 deletions

View File

@ -111,41 +111,9 @@ test5:
graphics_data:
.incbin "graphics/a2_energy.hgr.zx02"
hposn_low = $1713 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
hposn_high = $1800 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
.include "hgr_table.s"
; .hgrlo, .hgr1hi will each be filled with $C0 bytes
; based on routine by John Brooks
; posted on comp.sys.apple2 on 2018-07-11
; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ
; clobbers A,X
; preserves Y
build_tables:
ldx #0
btmi:
txa
and #$F8
bpl btpl1
ora #5
btpl1:
asl
bpl btpl2
ora #5
btpl2:
asl
asl
sta HGRLO, X
txa
and #7
rol
asl HGRLO, X
rol
ora #$20
sta HGRHI, X
inx
cpx #$C0
bne btmi
rts

View File

@ -13,11 +13,6 @@ tmpx = $FE ; byte (used by DrawLargeCharacter, FindVal
tmpy = $FF ; byte (used by DrawLargeCharacter, FindValidMove)
HGRLO = $1713 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
read_buffer = $17D3 ; 0x2D bytes (used by nth, free before and after)
HGRHI = $1800 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
CondensedHGRTops:
.byte 7,18,29,40,51,62,73,84,95,106,117,128,139,150,161,172
@ -73,65 +68,65 @@ dcs1:
ldy VTAB
lda CondensedHGRTops, y
tay
lda HGRLO, y
lda hposn_low, y
clc
adc HTAB
sta @row0+1
lda HGRHI, y
lda hposn_high, y
sta @row0+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row1+1
lda HGRHI, y
lda hposn_high, y
sta @row1+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row2+1
lda HGRHI, y
lda hposn_high, y
sta @row2+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row3+1
lda HGRHI, y
lda hposn_high, y
sta @row3+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row4+1
lda HGRHI, y
lda hposn_high, y
sta @row4+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row5+1
lda HGRHI, y
lda hposn_high, y
sta @row5+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row6+1
lda HGRHI, y
lda hposn_high, y
sta @row6+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row7+1
lda HGRHI, y
lda hposn_high, y
sta @row7+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row8+1
lda HGRHI, y
lda hposn_high, y
sta @row8+2
iny
lda HGRLO, y
lda hposn_low, y
adc HTAB
sta @row9+1
lda HGRHI, y
lda hposn_high, y
sta @row9+2
@loop: ldy $FDFD, x
lda CondensedRow0-$19, y

View File

@ -103,39 +103,7 @@ test5:
.include "font_condensed_data.s"
; .hgrlo, .hgr1hi will each be filled with $C0 bytes
; based on routine by John Brooks
; posted on comp.sys.apple2 on 2018-07-11
; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ
; clobbers A,X
; preserves Y
build_tables:
ldx #0
btmi:
txa
and #$F8
bpl btpl1
ora #5
btpl1:
asl
bpl btpl2
ora #5
btpl2:
asl
asl
sta HGRLO, X
txa
and #7
rol
asl HGRLO, X
rol
ora #$20
sta HGRHI, X
inx
cpx #$C0
bne btmi
rts
hposn_low = $1713 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
hposn_high = $1800 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
.include "hgr_table.s"

View File

@ -0,0 +1,37 @@
; hposn_low, hposn_high will each be filled with $C0 bytes
; based on routine by John Brooks
; posted on comp.sys.apple2 on 2018-07-11
; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ
; clobbers A,X
; preserves Y
; vmw note: version I was using based on applesoft HPOSN was ~64 bytes
; this one is 37 bytes
build_tables:
ldx #0
btmi:
txa
and #$F8
bpl btpl1
ora #5
btpl1:
asl
bpl btpl2
ora #5
btpl2:
asl
asl
sta hposn_low, X
txa
and #7
rol
asl hposn_low, X
rol
ora #$20
sta hposn_high, X
inx
cpx #$C0
bne btmi
rts