mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-08-15 15:27:22 +00:00
Additional tweaks to get old sprite demo working
This commit is contained in:
@@ -10,6 +10,26 @@
|
|||||||
; There are two subroutines that need to be implemented -- one to update the overlay content and a
|
; There are two subroutines that need to be implemented -- one to update the overlay content and a
|
||||||
; second to actually render to the screen
|
; second to actually render to the screen
|
||||||
|
|
||||||
|
STATE_REG equ $E0C068
|
||||||
|
|
||||||
|
_R0W0 mac ; Read Bank 0 / Write Bank 0
|
||||||
|
ldal STATE_REG
|
||||||
|
and #$FFCF
|
||||||
|
stal STATE_REG
|
||||||
|
<<<
|
||||||
|
|
||||||
|
_R0W1 mac ; Read Bank 0 / Write Bank 1
|
||||||
|
ldal STATE_REG
|
||||||
|
ora #$0010
|
||||||
|
stal STATE_REG
|
||||||
|
<<<
|
||||||
|
|
||||||
|
_R1W1 mac ; Read Bank 0 / Write Bank 1
|
||||||
|
ldal STATE_REG
|
||||||
|
ora #$0030
|
||||||
|
stal STATE_REG
|
||||||
|
<<<
|
||||||
|
|
||||||
; Initialize the overlay be drawing in static content that will not change over time
|
; Initialize the overlay be drawing in static content that will not change over time
|
||||||
|
|
||||||
CHAR_TILE_BASE equ 193 ; set this to the real tile id that starts an ASCII run starting at '0' through 'Z'
|
CHAR_TILE_BASE equ 193 ; set this to the real tile id that starts an ASCII run starting at '0' through 'Z'
|
||||||
@@ -32,35 +52,57 @@ l_mask equ ovrly_mask
|
|||||||
|
|
||||||
MASK_OFFSET equ {ovrly_mask-ovrly_buff}
|
MASK_OFFSET equ {ovrly_mask-ovrly_buff}
|
||||||
|
|
||||||
|
TileDataPtr equ $FC
|
||||||
|
TileMaskPtr equ $F8
|
||||||
|
|
||||||
InitOverlay
|
InitOverlay
|
||||||
|
|
||||||
|
pha
|
||||||
|
pha
|
||||||
|
_GTEGetTileDataAddr
|
||||||
|
pla
|
||||||
|
sta TileDataPtr
|
||||||
|
clc
|
||||||
|
adc #32
|
||||||
|
sta TileMaskPtr
|
||||||
|
pla
|
||||||
|
sta TileDataPtr+2
|
||||||
|
sta TileMaskPtr+2
|
||||||
|
|
||||||
lda #'F'
|
lda #'F'
|
||||||
ldy #l_line+{CHAR_WIDTH*0}
|
ldx #l_line+{CHAR_WIDTH*0}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #'P'
|
lda #'P'
|
||||||
ldy #l_line+{CHAR_WIDTH*1}
|
ldx #l_line+{CHAR_WIDTH*1}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #'S'
|
lda #'S'
|
||||||
ldy #l_line+{CHAR_WIDTH*2}
|
ldx #l_line+{CHAR_WIDTH*2}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #':'
|
lda #':'
|
||||||
ldy #l_line+{CHAR_WIDTH*3}
|
ldx #l_line+{CHAR_WIDTH*3}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
lda #'T'
|
lda #'T'
|
||||||
ldy #r_line+{CHAR_WIDTH*0}
|
ldx #r_line+{CHAR_WIDTH*0}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #'I'
|
lda #'I'
|
||||||
ldy #r_line+{CHAR_WIDTH*1}
|
ldx #r_line+{CHAR_WIDTH*1}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #'C'
|
lda #'C'
|
||||||
ldy #r_line+{CHAR_WIDTH*2}
|
ldx #r_line+{CHAR_WIDTH*2}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #'K'
|
lda #'K'
|
||||||
ldy #r_line+{CHAR_WIDTH*3}
|
ldx #r_line+{CHAR_WIDTH*3}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
lda #':'
|
lda #':'
|
||||||
ldy #r_line+{CHAR_WIDTH*4}
|
ldx #r_line+{CHAR_WIDTH*4}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
|
pea $0000
|
||||||
|
pea $0008
|
||||||
|
pea #^StatusBar
|
||||||
|
pea #StatusBar
|
||||||
|
_GTESetOverlay
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Update the dynamic content of the overlay
|
; Update the dynamic content of the overlay
|
||||||
@@ -79,7 +121,7 @@ UdtOverlay
|
|||||||
lda frameCount ; render the FPS value
|
lda frameCount ; render the FPS value
|
||||||
xba
|
xba
|
||||||
jsr _num2ascii
|
jsr _num2ascii
|
||||||
ldy #l_line+{CHAR_WIDTH*4}
|
ldx #l_line+{CHAR_WIDTH*4}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
lda frameCount
|
lda frameCount
|
||||||
@@ -88,44 +130,52 @@ UdtOverlay
|
|||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
jsr _num2ascii
|
jsr _num2ascii
|
||||||
ldy #l_line+{CHAR_WIDTH*5}
|
ldx #l_line+{CHAR_WIDTH*5}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
lda frameCount
|
lda frameCount
|
||||||
jsr _num2ascii
|
jsr _num2ascii
|
||||||
ldy #l_line+{CHAR_WIDTH*6}
|
ldx #l_line+{CHAR_WIDTH*6}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
ldal OneSecondCounter ; reder the number of remaining seconds
|
pha
|
||||||
|
_GTEGetSeconds
|
||||||
|
pla
|
||||||
|
sta oneSecondCounter ; render the number of remaining seconds
|
||||||
xba
|
xba
|
||||||
jsr _num2ascii
|
jsr _num2ascii
|
||||||
ldy #r_line+{CHAR_WIDTH*5}
|
ldx #r_line+{CHAR_WIDTH*5}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
ldal OneSecondCounter
|
lda oneSecondCounter
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
jsr _num2ascii
|
jsr _num2ascii
|
||||||
ldy #r_line+{CHAR_WIDTH*6}
|
ldx #r_line+{CHAR_WIDTH*6}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
ldal OneSecondCounter
|
lda oneSecondCounter
|
||||||
jsr _num2ascii
|
jsr _num2ascii
|
||||||
ldy #r_line+{CHAR_WIDTH*7}
|
ldx #r_line+{CHAR_WIDTH*7}
|
||||||
jsr _DrawChar
|
jsr _DrawChar
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
oneSecondCounter ds 2
|
||||||
|
|
||||||
; Draw the overlay
|
; Draw the overlay
|
||||||
; A = address of the left edge of the screen
|
; A = address of the left edge of the screen
|
||||||
Overlay ENT
|
StatusBar phb ; Called via JSL
|
||||||
phb ; Called via JSL
|
phd ; save the direct page register
|
||||||
|
|
||||||
phk
|
phk
|
||||||
plb
|
plb
|
||||||
|
|
||||||
phd ; save the direct page register
|
ldx MyDirectPage ; Preserve the accumulator
|
||||||
|
phx
|
||||||
|
pld
|
||||||
|
|
||||||
sta l_addr ; save this value (will go into D-reg later)
|
sta l_addr ; save this value (will go into D-reg later)
|
||||||
clc
|
clc
|
||||||
@@ -144,12 +194,12 @@ Overlay ENT
|
|||||||
sec
|
sec
|
||||||
sbc m_addr ; calculate the number of words between the two ends
|
sbc m_addr ; calculate the number of words between the two ends
|
||||||
and #$FFFE
|
and #$FFFE
|
||||||
pha
|
|
||||||
lda #m_end
|
eor #$FFFF
|
||||||
sec
|
inc
|
||||||
sbc 1,s
|
clc
|
||||||
|
adc #m_end
|
||||||
sta m_patch+1
|
sta m_patch+1
|
||||||
pla
|
|
||||||
|
|
||||||
sei
|
sei
|
||||||
_R1W1
|
_R1W1
|
||||||
@@ -192,7 +242,7 @@ l_ovrly_rtn
|
|||||||
_R0W0
|
_R0W0
|
||||||
cli
|
cli
|
||||||
|
|
||||||
:exit
|
o_exit
|
||||||
pld ; restore the direct page and bank and return
|
pld ; restore the direct page and bank and return
|
||||||
plb
|
plb
|
||||||
rtl
|
rtl
|
||||||
@@ -201,7 +251,6 @@ l_addr ds 2
|
|||||||
m_addr ds 2
|
m_addr ds 2
|
||||||
r_addr ds 2
|
r_addr ds 2
|
||||||
|
|
||||||
|
|
||||||
r_ovrly
|
r_ovrly
|
||||||
]idx equ 0
|
]idx equ 0
|
||||||
lup R_CHAR_COUNT
|
lup R_CHAR_COUNT
|
||||||
@@ -247,10 +296,7 @@ m_end
|
|||||||
;
|
;
|
||||||
; A = Tile ID
|
; A = Tile ID
|
||||||
; Y = overlay address location
|
; Y = overlay address location
|
||||||
tiledata EXT
|
|
||||||
|
|
||||||
_DCOut rts
|
_DCOut rts
|
||||||
|
|
||||||
_DrawChar
|
_DrawChar
|
||||||
cmp #'0'
|
cmp #'0'
|
||||||
bcc _DCOut
|
bcc _DCOut
|
||||||
@@ -261,19 +307,122 @@ _DrawChar
|
|||||||
sbc #'0'
|
sbc #'0'
|
||||||
clc
|
clc
|
||||||
adc #CHAR_TILE_BASE
|
adc #CHAR_TILE_BASE
|
||||||
jsl GetTileAddr
|
jsr _GetTileAddr
|
||||||
tax
|
tay
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {0*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {0*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {0*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {0*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {1*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {1*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {1*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {1*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {2*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {2*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {2*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {2*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {3*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {3*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {3*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {3*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {4*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {4*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {4*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {4*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {5*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {5*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {5*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {5*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {6*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {6*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {6*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {6*OVRLY_SPAN}+2,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {7*OVRLY_SPAN}+MASK_OFFSET,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {7*OVRLY_SPAN},x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
lda [TileMaskPtr],y
|
||||||
|
sta: {7*OVRLY_SPAN}+MASK_OFFSET+2,x
|
||||||
|
lda [TileDataPtr],y
|
||||||
|
sta: {7*OVRLY_SPAN}+2,x
|
||||||
|
|
||||||
]idx equ 0
|
rts
|
||||||
lup 8
|
|
||||||
ldal tiledata+32+{]idx*4},x
|
_GetTileAddr
|
||||||
sta: {]idx*OVRLY_SPAN}+MASK_OFFSET,y
|
asl ; Multiply by 2
|
||||||
ldal tiledata+{]idx*4},x
|
bit #2*TILE_HFLIP_BIT ; Check if the horizontal flip bit is set
|
||||||
sta: {]idx*OVRLY_SPAN},y
|
beq :no_flip
|
||||||
ldal tiledata+32+{]idx*4}+2,x
|
inc ; Set the LSB
|
||||||
sta: {]idx*OVRLY_SPAN}+MASK_OFFSET+2,y
|
:no_flip asl ; x4
|
||||||
ldal tiledata+{]idx*4}+2,x
|
asl ; x8
|
||||||
sta: {]idx*OVRLY_SPAN}+2,y
|
asl ; x16
|
||||||
]idx equ ]idx+1
|
asl ; x32
|
||||||
--^
|
asl ; x64
|
||||||
|
asl ; x128
|
||||||
rts
|
rts
|
@@ -38,6 +38,9 @@ ScreenHeight equ 14
|
|||||||
plb
|
plb
|
||||||
|
|
||||||
sta MyUserId ; GS/OS passes the memory manager user ID for the application into the program
|
sta MyUserId ; GS/OS passes the memory manager user ID for the application into the program
|
||||||
|
tdc
|
||||||
|
sta MyDirectPage ; Keep a copy for the overlay callback
|
||||||
|
|
||||||
_MTStartUp ; GTE requires the miscellaneous toolset to be running
|
_MTStartUp ; GTE requires the miscellaneous toolset to be running
|
||||||
|
|
||||||
jsr GTEStartUp ; Load and install the GTE User Tool
|
jsr GTEStartUp ; Load and install the GTE User Tool
|
||||||
@@ -68,17 +71,16 @@ ScreenHeight equ 14
|
|||||||
|
|
||||||
; Set up our level data
|
; Set up our level data
|
||||||
jsr BG0SetUp
|
jsr BG0SetUp
|
||||||
|
|
||||||
jsr TileAnimInit
|
jsr TileAnimInit
|
||||||
jsr SetLimits
|
jsr SetLimits
|
||||||
|
|
||||||
; jsr InitOverlay ; Initialize the status bar
|
jsr InitOverlay ; Initialize the status bar
|
||||||
stz frameCount
|
stz frameCount
|
||||||
pha
|
pha
|
||||||
_GTEGetSeconds
|
_GTEGetSeconds
|
||||||
pla
|
pla
|
||||||
sta oldOneSecondCounter
|
sta oldOneSecondCounter
|
||||||
; jsr UdtOverlay
|
jsr UdtOverlay
|
||||||
|
|
||||||
; Allocate a buffer for loading files
|
; Allocate a buffer for loading files
|
||||||
jsl AllocBank ; Alloc 64KB for Load/Unpack
|
jsl AllocBank ; Alloc 64KB for Load/Unpack
|
||||||
@@ -349,7 +351,7 @@ EvtLoop
|
|||||||
cmp oldOneSecondCounter
|
cmp oldOneSecondCounter
|
||||||
beq :noudt
|
beq :noudt
|
||||||
sta oldOneSecondCounter
|
sta oldOneSecondCounter
|
||||||
; jsr UdtOverlay
|
jsr UdtOverlay
|
||||||
stz frameCount
|
stz frameCount
|
||||||
:noudt
|
:noudt
|
||||||
brl EvtLoop
|
brl EvtLoop
|
||||||
@@ -400,6 +402,7 @@ MaxBG0Y ds 2
|
|||||||
oldOneSecondCounter ds 2
|
oldOneSecondCounter ds 2
|
||||||
frameCount ds 2
|
frameCount ds 2
|
||||||
MyUserId ds 2
|
MyUserId ds 2
|
||||||
|
MyDirectPage ds 2
|
||||||
|
|
||||||
PLAYER_X_MIN equ 0
|
PLAYER_X_MIN equ 0
|
||||||
PLAYER_X_MAX equ 160-4
|
PLAYER_X_MAX equ 160-4
|
||||||
@@ -783,6 +786,6 @@ _GetVBLTicks
|
|||||||
plx
|
plx
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; PUT ../shell/Overlay.s
|
PUT ../shell/Overlay.s
|
||||||
PUT gen/App.TileMapBG0.s
|
PUT gen/App.TileMapBG0.s
|
||||||
PUT gen/App.TileSetAnim.s
|
PUT gen/App.TileSetAnim.s
|
||||||
|
@@ -71,9 +71,6 @@ TileStore EXT
|
|||||||
spritedata EXT
|
spritedata EXT
|
||||||
spritemask EXT
|
spritemask EXT
|
||||||
|
|
||||||
; If there are overlays, they are provided as an external
|
|
||||||
Overlay EXT
|
|
||||||
|
|
||||||
; Core engine functionality. The idea is that that source file can be PUT into
|
; Core engine functionality. The idea is that that source file can be PUT into
|
||||||
; a main source file and all of the functionality will be available.
|
; a main source file and all of the functionality will be available.
|
||||||
;
|
;
|
||||||
|
@@ -254,6 +254,7 @@ VBuffArray EXT
|
|||||||
_stamp_step EXT
|
_stamp_step EXT
|
||||||
VBuffVertTableSelect EXT
|
VBuffVertTableSelect EXT
|
||||||
VBuffHorzTableSelect EXT
|
VBuffHorzTableSelect EXT
|
||||||
|
Overlays EXT
|
||||||
|
|
||||||
; Tool error codes
|
; Tool error codes
|
||||||
NO_TIMERS_AVAILABLE equ 10
|
NO_TIMERS_AVAILABLE equ 10
|
||||||
|
57
src/Render.s
57
src/Render.s
@@ -42,37 +42,47 @@ _Render
|
|||||||
jsr _ApplyBG0XPos ; Patch the code field instructions with exit BRA opcode
|
jsr _ApplyBG0XPos ; Patch the code field instructions with exit BRA opcode
|
||||||
jsr _ApplyBG1XPos ; Update the direct page value based on the horizontal position
|
jsr _ApplyBG1XPos ; Update the direct page value based on the horizontal position
|
||||||
|
|
||||||
; The code fields are locked in now and ready to be rendered
|
; The code fields are locked in now and ready to be rendered. See if there is an overlay or any
|
||||||
|
; other reason to render with shadowing off. Otherwise, just do things quickly.
|
||||||
|
|
||||||
; jsr _ShadowOff
|
lda Overlays
|
||||||
|
beq :no_ovrly
|
||||||
|
|
||||||
|
jsr _ShadowOff
|
||||||
|
|
||||||
; Shadowing is turned off. Render all of the scan lines that need a second pass. One
|
; Shadowing is turned off. Render all of the scan lines that need a second pass. One
|
||||||
; optimization that can be done here is that the lines can be rendered in any order
|
; optimization that can be done here is that the lines can be rendered in any order
|
||||||
; since it is not shown on-screen yet.
|
; since it is not shown on-screen yet.
|
||||||
|
|
||||||
; ldx #0 ; Blit the full virtual buffer to the screen
|
ldx Overlays+2 ; Blit the full virtual buffer to the screen
|
||||||
; ldy #8
|
ldy Overlays+4
|
||||||
; jsr _BltRange
|
jsr _BltRange
|
||||||
|
|
||||||
; Turn shadowing back on
|
; Turn shadowing back on
|
||||||
|
|
||||||
; jsr _ShadowOn
|
jsr _ShadowOn
|
||||||
|
|
||||||
; Now render all of the remaining lines in top-to-bottom (or bottom-to-top) order
|
; Now render all of the remaining lines in top-to-bottom (or bottom-to-top) order
|
||||||
|
|
||||||
; lda ScreenY0 ; pass the address of the first line of the overlay
|
ldx #0
|
||||||
; clc
|
ldy Overlays+2
|
||||||
; adc #0
|
beq :skip
|
||||||
; asl
|
jsr _BltRange
|
||||||
; tax
|
:skip
|
||||||
; lda ScreenAddr,x
|
jsr _DoOverlay
|
||||||
; clc
|
|
||||||
; adc ScreenX0
|
|
||||||
; jsl Overlay
|
|
||||||
|
|
||||||
|
ldx Overlays+4
|
||||||
|
cpx ScreenHeight
|
||||||
|
beq :done
|
||||||
|
ldy ScreenHeight
|
||||||
|
jsr _BltRange
|
||||||
|
bra :done
|
||||||
|
|
||||||
|
:no_ovrly
|
||||||
ldx #0 ; Blit the full virtual buffer to the screen
|
ldx #0 ; Blit the full virtual buffer to the screen
|
||||||
ldy ScreenHeight
|
ldy ScreenHeight
|
||||||
jsr _BltRange
|
jsr _BltRange
|
||||||
|
:done
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
ldy ScreenHeight
|
ldy ScreenHeight
|
||||||
@@ -102,6 +112,23 @@ _Render
|
|||||||
:no_removal
|
:no_removal
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
_DoOverlay
|
||||||
|
lda Overlays+6
|
||||||
|
stal :disp+1
|
||||||
|
lda Overlays+7
|
||||||
|
stal :disp+2
|
||||||
|
|
||||||
|
lda ScreenY0 ; pass the address of the first line of the overlay
|
||||||
|
clc
|
||||||
|
adc Overlays+2
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
lda ScreenAddr,x
|
||||||
|
clc
|
||||||
|
adc ScreenX0
|
||||||
|
:disp jsl $000000
|
||||||
|
rts
|
||||||
|
|
||||||
; The _ApplyTilesFast is the same as _ApplyTiles, but we use the _RenderTileFast subroutine
|
; The _ApplyTilesFast is the same as _ApplyTiles, but we use the _RenderTileFast subroutine
|
||||||
_ApplyTilesFast
|
_ApplyTilesFast
|
||||||
ldx DirtyTileCount
|
ldx DirtyTileCount
|
||||||
|
49
src/Tool.s
49
src/Tool.s
@@ -83,6 +83,11 @@ _CallTable
|
|||||||
adrl _TSAddTimer-1
|
adrl _TSAddTimer-1
|
||||||
adrl _TSRemoveTimer-1
|
adrl _TSRemoveTimer-1
|
||||||
adrl _TSStartScript-1
|
adrl _TSStartScript-1
|
||||||
|
|
||||||
|
adrl _TSSetOverlay-1
|
||||||
|
adrl _TSClearOverlay-1
|
||||||
|
|
||||||
|
adrl _TSGetTileDataAddr-1
|
||||||
_CTEnd
|
_CTEnd
|
||||||
_GTEAddSprite MAC
|
_GTEAddSprite MAC
|
||||||
UserTool $1000+GTEToolNum
|
UserTool $1000+GTEToolNum
|
||||||
@@ -472,7 +477,6 @@ _TSGetScreenInfo
|
|||||||
sta :x,s
|
sta :x,s
|
||||||
lda ScreenY0
|
lda ScreenY0
|
||||||
sta :y,s
|
sta :y,s
|
||||||
sta :width,s
|
|
||||||
lda ScreenWidth
|
lda ScreenWidth
|
||||||
sta :width,s
|
sta :width,s
|
||||||
lda ScreenHeight
|
lda ScreenHeight
|
||||||
@@ -615,6 +619,49 @@ _TSStartScript
|
|||||||
jsr _StartScript
|
jsr _StartScript
|
||||||
|
|
||||||
_TSExit #0;#6
|
_TSExit #0;#6
|
||||||
|
; SetOverlay(top, bottom, proc)
|
||||||
|
_TSSetOverlay
|
||||||
|
:proc equ FirstParam+0
|
||||||
|
:bottom equ FirstParam+4
|
||||||
|
:top equ FirstParam+6
|
||||||
|
|
||||||
|
_TSEntry
|
||||||
|
|
||||||
|
lda #1
|
||||||
|
sta Overlays
|
||||||
|
lda :top,s
|
||||||
|
sta Overlays+2
|
||||||
|
lda :bottom,s
|
||||||
|
sta Overlays+4
|
||||||
|
lda :proc,s
|
||||||
|
sta Overlays+6
|
||||||
|
lda :proc+2,s
|
||||||
|
sta Overlays+8
|
||||||
|
|
||||||
|
_TSExit #0;#8
|
||||||
|
|
||||||
|
; ClearOverlay()
|
||||||
|
_TSClearOverlay
|
||||||
|
|
||||||
|
_TSEntry
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta Overlays
|
||||||
|
|
||||||
|
_TSExit #0;#0
|
||||||
|
|
||||||
|
; GetTileDataAddr()
|
||||||
|
_TSGetTileDataAddr
|
||||||
|
:output equ FirstParam+0
|
||||||
|
|
||||||
|
_TSEntry
|
||||||
|
|
||||||
|
lda #tiledata
|
||||||
|
sta :output,s
|
||||||
|
lda #^tiledata
|
||||||
|
sta :output+2,s
|
||||||
|
|
||||||
|
_TSExit #0;#0
|
||||||
|
|
||||||
; Insert the GTE code
|
; Insert the GTE code
|
||||||
|
|
||||||
|
@@ -388,6 +388,9 @@ OldOneSecVec ENT
|
|||||||
ds 4
|
ds 4
|
||||||
Timers ENT
|
Timers ENT
|
||||||
ds TIMER_REC_SIZE*MAX_TIMERS
|
ds TIMER_REC_SIZE*MAX_TIMERS
|
||||||
|
Overlays ENT
|
||||||
|
dw 0 ; count
|
||||||
|
ds 8 ; only support one or now (start_line, end_line, function call)
|
||||||
|
|
||||||
; From the IIgs ref
|
; From the IIgs ref
|
||||||
DefaultPalette ENT
|
DefaultPalette ENT
|
||||||
|
Reference in New Issue
Block a user