mirror of
https://github.com/a2-4am/4cade.git
synced 2025-02-17 07:31:19 +00:00
move font drawing routines to LC RAM 2
This commit is contained in:
parent
27ec2ebd4e
commit
912d4d892a
@ -80,7 +80,7 @@ RestoreStackNextTime
|
||||
!source "src/textrank.a"
|
||||
!source "src/parse.common.a"
|
||||
!source "src/parse.prefs.a"
|
||||
!source "src/ui.font.a"
|
||||
!source "src/glue.font.a"
|
||||
; add new files above here so ui.common stays last
|
||||
!source "src/ui.common.a"
|
||||
MachineStatus
|
||||
@ -104,9 +104,12 @@ gGamesListStore
|
||||
LastMover
|
||||
!pseudopc $D600 {
|
||||
!source "src/ui.font.data.a"
|
||||
!source "src/ui.font.a"
|
||||
!source "src/prodos.impl.a"
|
||||
!if * > $DEFF {
|
||||
!error "code is too large: ends at ", *
|
||||
; } else {
|
||||
; !warn "LCRAM2 ends at ", *
|
||||
}
|
||||
}
|
||||
EvenLasterMover
|
||||
|
@ -16,8 +16,8 @@
|
||||
; D000..D3FF - ProRWTS data
|
||||
; D400..D5FF - ProRWTS code
|
||||
; D600..D9FF - HGR font data
|
||||
; DA00..DD5C - ProRWTS glue code
|
||||
; DD5D..DFEF - unused
|
||||
; DA00..DEE6 - ProRWTS glue code
|
||||
; DEE7..DFEF - unused
|
||||
; DFF0..DFFF - backup of stack (during gameplay and self-running demos)
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
|
38
src/glue.font.a
Normal file
38
src/glue.font.a
Normal file
@ -0,0 +1,38 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; hi-res font drawing routines
|
||||
;
|
||||
; Glue functions that handle bank switching and calling the real font drawing routines
|
||||
; that live in LC RAM 2 now.
|
||||
;
|
||||
; Public functions
|
||||
; - DrawPage
|
||||
; - Draw40Chars
|
||||
; - DrawString
|
||||
; - DrawBuffer
|
||||
;
|
||||
|
||||
DrawPage
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
jsr DrawPageInternal
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
Draw40Chars
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
jsr Draw40CharsInternal
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
DrawString
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
jsr DrawStringInternal
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
DrawBuffer
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
jsr DrawBufferInternal
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
@ -3,14 +3,18 @@
|
||||
;
|
||||
; hi-res font drawing routines
|
||||
;
|
||||
; /!\ These live in LC RAM 2 and rely on the font data which is also in LC RAM 2. /!\
|
||||
; Code in LC RAM 1 (which is most program code) should call the functions in glue.font
|
||||
; which handle bank switching for you.
|
||||
;
|
||||
; Public functions
|
||||
; - DrawPage
|
||||
; - Draw40Chars
|
||||
; - DrawString
|
||||
; - DrawBuffer
|
||||
; - DrawPageInternal
|
||||
; - Draw40CharsInternal
|
||||
; - DrawStringInternal
|
||||
; - DrawBufferInternal
|
||||
;
|
||||
|
||||
DrawPage
|
||||
DrawPageInternal
|
||||
; A/Y contains address of character buffer
|
||||
; carry bit clear -> draw on page 1
|
||||
; carry bit set -> draw on page 2
|
||||
@ -51,7 +55,7 @@ DrawPage
|
||||
+LDAY PTR
|
||||
plp
|
||||
php
|
||||
jsr DrawBuffer
|
||||
jsr DrawBufferInternal
|
||||
@skip inc SAVE ; skip carriage return
|
||||
lda SAVE ; advance PTR to start of next line
|
||||
clc
|
||||
@ -65,7 +69,7 @@ DrawPage
|
||||
plp
|
||||
rts
|
||||
|
||||
Draw40Chars
|
||||
Draw40CharsInternal
|
||||
; A/Y contains address of character buffer
|
||||
; carry bit clear -> draw on page 1
|
||||
; carry bit set -> draw on page 2
|
||||
@ -76,13 +80,13 @@ Draw40Chars
|
||||
; clobbers A/X/Y
|
||||
jsr +
|
||||
ldx #40
|
||||
jsr DrawBuffer
|
||||
jsr DrawBufferInternal
|
||||
inc VTAB
|
||||
+ ldx #0
|
||||
stx HTAB
|
||||
rts
|
||||
|
||||
DrawString
|
||||
DrawStringInternal
|
||||
; A/Y contains address of length-prefixed string
|
||||
; carry bit clear -> draw on page 1
|
||||
; carry bit set -> draw on page 2
|
||||
@ -102,7 +106,7 @@ DrawString
|
||||
+LDAY PTR
|
||||
; note: execution falls through here
|
||||
|
||||
DrawBuffer
|
||||
DrawBufferInternal
|
||||
; A/Y contains address of character buffer
|
||||
; X contains buffer length (1..40)
|
||||
; carry bit clear -> draw on page 1
|
||||
@ -174,7 +178,6 @@ DrawBuffer
|
||||
sta @row5+1
|
||||
sta @row6+1
|
||||
sta @row7+1
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
@loop
|
||||
@src ldy $FDFD,x
|
||||
lda FontDataRow0,y
|
||||
@ -196,5 +199,4 @@ DrawBuffer
|
||||
inc HTAB
|
||||
dex
|
||||
bpl @loop
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
Loading…
x
Reference in New Issue
Block a user