mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-02-21 12:29:07 +00:00
Fix addressing issue in font routine and data-overwrite bug; Render no longer crashes!
This commit is contained in:
parent
ab9a2682db
commit
e4d480d2be
@ -36,6 +36,7 @@ VBL_STATE_REG equ $E0C019
|
|||||||
SHADOW_SCREEN equ $012000
|
SHADOW_SCREEN equ $012000
|
||||||
SHR_SCREEN equ $E12000
|
SHR_SCREEN equ $E12000
|
||||||
SHR_SCB equ $E19D00
|
SHR_SCB equ $E19D00
|
||||||
|
SHR_PALETTES equ $E19E00
|
||||||
|
|
||||||
; External references
|
; External references
|
||||||
tiledata ext
|
tiledata ext
|
||||||
@ -84,12 +85,9 @@ tiledata ext
|
|||||||
jsr BlitInit ; Initialize the memory
|
jsr BlitInit ; Initialize the memory
|
||||||
jsr GrafInit ; Initialize the graphics screen
|
jsr GrafInit ; Initialize the graphics screen
|
||||||
|
|
||||||
ldx #9 ; Special debug size
|
ldx #6 ; Gameboy Advance size
|
||||||
jsr SetScreenMode
|
jsr SetScreenMode
|
||||||
|
|
||||||
; ldx #6 ; Gameboy Advance size
|
|
||||||
; jsr SetScreenMode
|
|
||||||
|
|
||||||
; Load a picture and copy it into Bank $E1. Then turn on the screen.
|
; Load a picture and copy it into Bank $E1. Then turn on the screen.
|
||||||
|
|
||||||
jsr AllocOneBank ; Alloc 64KB for Load/Unpack
|
jsr AllocOneBank ; Alloc 64KB for Load/Unpack
|
||||||
@ -360,14 +358,23 @@ BlitInit
|
|||||||
|
|
||||||
|
|
||||||
; Graphic screen initialization
|
; Graphic screen initialization
|
||||||
GrafInit lda #$8888
|
GrafInit
|
||||||
|
jsr ShadowOn
|
||||||
|
jsr GrafOn
|
||||||
|
lda #$8888
|
||||||
jsr ClearToColor
|
jsr ClearToColor
|
||||||
lda #0000
|
lda #0000
|
||||||
jsr SetSCBs
|
jsr SetSCBs
|
||||||
jsr GrafOn
|
ldx #DefaultPalette
|
||||||
jsr ShadowOn
|
lda #0
|
||||||
|
jsr SetPalette
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
DefaultPalette dw $0000,$007F,$0090,$0FF0
|
||||||
|
dw $000F,$0080,$0f70,$0FFF
|
||||||
|
dw $0fa9,$0ff0,$00e0,$04DF
|
||||||
|
dw $0d00,$078f,$0ccc,$0FFF
|
||||||
|
|
||||||
; Return the current border color ($0 - $F) in the accumulator
|
; Return the current border color ($0 - $F) in the accumulator
|
||||||
GetBorderColor lda #0000
|
GetBorderColor lda #0000
|
||||||
sep #$20
|
sep #$20
|
||||||
@ -393,6 +400,26 @@ ClearToColor ldx #$7D00 ;start at top of pixel data
|
|||||||
bne :clearloop ;loop until we've worked our way down to 0
|
bne :clearloop ;loop until we've worked our way down to 0
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
; Set a palette values
|
||||||
|
; A = palette number, X = palette address
|
||||||
|
SetPalette
|
||||||
|
and #$000F ; palette values are 0 - 15 and each palette is 32 bytes
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
txy
|
||||||
|
tax
|
||||||
|
|
||||||
|
]idx equ 0
|
||||||
|
lup 16
|
||||||
|
lda: $0000+]idx,y
|
||||||
|
stal SHR_PALETTES+]idx,x
|
||||||
|
]idx equ ]idx+2
|
||||||
|
--^
|
||||||
|
rts
|
||||||
|
|
||||||
; Initialize the SCB
|
; Initialize the SCB
|
||||||
SetSCBs ldx #$0100 ;set all $100 scbs to A
|
SetSCBs ldx #$0100 ;set all $100 scbs to A
|
||||||
:scbloop dex
|
:scbloop dex
|
||||||
@ -628,6 +655,20 @@ qtRec adrl $0000
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,10 +93,10 @@ DumpBanks
|
|||||||
bne :loop
|
bne :loop
|
||||||
|
|
||||||
pld ; restore the direct page
|
pld ; restore the direct page
|
||||||
tcs ; restore the stack pointer
|
tsc ; restore the stack pointer
|
||||||
clc
|
clc
|
||||||
adc #8
|
adc #8
|
||||||
tsc
|
tcs
|
||||||
rts
|
rts
|
||||||
|
|
||||||
WordBuff str '0000'
|
WordBuff str '0000'
|
||||||
@ -141,5 +141,6 @@ Addr3Buff str '000000' ; str adds leading length byte
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,6 +206,7 @@ ScreenAddr lup 200
|
|||||||
; so that code can pick an offset and copy values without needing to check for a wrap-around. If the
|
; so that code can pick an offset and copy values without needing to check for a wrap-around. If the
|
||||||
; playfield is less than 200 lines tall, then any values after 2 * PLAYFIELD_HEIGHT are undefine.
|
; playfield is less than 200 lines tall, then any values after 2 * PLAYFIELD_HEIGHT are undefine.
|
||||||
RTable ds 400
|
RTable ds 400
|
||||||
|
ds 400
|
||||||
|
|
||||||
; Array of addresses for the banks that hold the blitter.
|
; Array of addresses for the banks that hold the blitter.
|
||||||
BlitBuff ds 4*13
|
BlitBuff ds 4*13
|
||||||
@ -216,3 +217,5 @@ BlitBuff ds 4*13
|
|||||||
BTableHigh ds 208*2*2
|
BTableHigh ds 208*2*2
|
||||||
BTableLow ds 208*2*2
|
BTableLow ds 208*2*2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ FillScreen lda #0
|
|||||||
lsr
|
lsr
|
||||||
tay
|
tay
|
||||||
lda #$FFFF
|
lda #$FFFF
|
||||||
:xloop stal SHR_SCREEN,x
|
:xloop stal $E10000,x ; X is the absolute address
|
||||||
inx
|
inx
|
||||||
inx
|
inx
|
||||||
dey
|
dey
|
||||||
@ -931,5 +931,6 @@ top
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
28
src/font.s
28
src/font.s
@ -16,11 +16,17 @@
|
|||||||
]F_Length ds 2 ;length of string (only one byte currently used)
|
]F_Length ds 2 ;length of string (only one byte currently used)
|
||||||
]F_CharIdx ds 2 ;index of current character
|
]F_CharIdx ds 2 ;index of current character
|
||||||
]F_CurrentPos ds 2 ;current top left char position
|
]F_CurrentPos ds 2 ;current top left char position
|
||||||
]F_StrPtr equ $00 ;pointer to string (including length byte) / DP
|
]F_StrPtr equ $01 ;pointer to string (including length byte) / DP
|
||||||
]F_StrClr equ $02
|
]F_StrClr equ $03
|
||||||
|
|
||||||
DrawString
|
DrawString
|
||||||
sta ]F_StrPtr ;store at dp 0 ($00) for indirect loads
|
pha ; local variable space
|
||||||
|
pha
|
||||||
|
tsc
|
||||||
|
phd
|
||||||
|
tcd
|
||||||
|
|
||||||
|
; sta ]F_StrPtr ; (done in pha init above) store at dp 0 ($00) for indirect loads
|
||||||
stx ]F_CurrentPos
|
stx ]F_CurrentPos
|
||||||
sty ]F_StrClr
|
sty ]F_StrClr
|
||||||
stz ]F_CharIdx
|
stz ]F_CharIdx
|
||||||
@ -31,11 +37,14 @@ DrawString
|
|||||||
NextChar lda ]F_CharIdx
|
NextChar lda ]F_CharIdx
|
||||||
cmp ]F_Length
|
cmp ]F_Length
|
||||||
bne :notDone
|
bne :notDone
|
||||||
|
pld
|
||||||
|
pla
|
||||||
|
pla
|
||||||
rts ;DONE! Return to caller
|
rts ;DONE! Return to caller
|
||||||
|
|
||||||
:notDone inc ]F_CharIdx
|
:notDone inc ]F_CharIdx
|
||||||
ldy ]F_CharIdx
|
ldy ]F_CharIdx
|
||||||
lda ($00),y ;get next char!
|
lda (]F_StrPtr),y ;get next char!
|
||||||
and #$00FF ;mask high byte
|
and #$00FF ;mask high byte
|
||||||
sec
|
sec
|
||||||
sbc #' ' ;our table starts with space ' '
|
sbc #' ' ;our table starts with space ' '
|
||||||
@ -636,6 +645,17 @@ s_Template hex 00000000
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user