mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-12-28 03:29:22 +00:00
Continue shaping the structuer of the helper functions
This commit is contained in:
parent
bd097704ac
commit
e00b47a88d
@ -52,12 +52,14 @@ MemInit PushLong #0 ; space for result
|
||||
stx ZeroPage
|
||||
sta ZeroPage+2
|
||||
|
||||
; Allocate the 13 banks of memory we need
|
||||
; Allocate the 13 banks of memory we need and store in double-length array
|
||||
]step equ 0
|
||||
lup 13
|
||||
jsr AllocOneBank2
|
||||
sta BlitBuff+]step+2
|
||||
sta BlitBuffMid+]step+2
|
||||
stz BlitBuff+]step
|
||||
stz BlitBuffMid+]step
|
||||
]step equ ]step+4
|
||||
--^
|
||||
|
||||
@ -67,8 +69,13 @@ Buff00 ds 4
|
||||
Buff01 ds 4
|
||||
ZeroPage ds 4
|
||||
|
||||
;
|
||||
; Array of addressed for the banks that hold the blitter. This is actually a double-length
|
||||
; array, which is a pattern that is used a lot in GTE. Whenever we have a situation where
|
||||
; we need to wrap around an array, we can to this be doubling the array length and using an
|
||||
; unrolled loop that starts in the middle instead of doing some kind of "mod N" or loop
|
||||
; splitting.
|
||||
BlitBuff ds 4*13
|
||||
BlitBuffMid ds 4*13
|
||||
|
||||
; Bank allocator (for one full, fixed bank of memory. Can be immediately deferenced)
|
||||
|
||||
@ -127,6 +134,13 @@ ShutDown rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
166
test/App.Main.s
166
test/App.Main.s
@ -20,6 +20,7 @@
|
||||
use Misc.Macs.s
|
||||
put ..\macros\App.Macs.s
|
||||
put ..\macros\EDS.GSOS.MACS.s
|
||||
put .\blitter\DirectPage.s
|
||||
|
||||
mx %00
|
||||
|
||||
@ -106,50 +107,77 @@ EvtLoop
|
||||
brl DoFrame
|
||||
:4 bra EvtLoop
|
||||
|
||||
; Set the screen address (right-edge) in all of the scan lines
|
||||
SetRightEdge
|
||||
sep #$20 ; push all the bank addresses on the stack
|
||||
ldx #0
|
||||
:loop1 lda BlitBuff+2,x
|
||||
pha
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
inx
|
||||
cpx #4*13
|
||||
bcc :loop1
|
||||
|
||||
lup 13
|
||||
lda #{$2000+159+15*160} ; Set the stack address to the right edge of the screen
|
||||
ldy #0
|
||||
ldx #16*2
|
||||
jsr SetScreenAddrs
|
||||
--^
|
||||
|
||||
phk
|
||||
plb
|
||||
rts
|
||||
|
||||
|
||||
|
||||
; Set up the code field and render it
|
||||
DoFrame
|
||||
|
||||
; Render some tiles
|
||||
:bank equ 0
|
||||
:column equ 2
|
||||
:tile equ 4
|
||||
|
||||
lda BlitBuff+1 ; set the data bank to the code field
|
||||
stz :bank
|
||||
stz :tile
|
||||
:bankloop
|
||||
ldx :bank
|
||||
ldal BlitBuff+1,x ; set the data bank to the code field
|
||||
pha
|
||||
plb
|
||||
plb
|
||||
|
||||
ldx #0
|
||||
stz :column
|
||||
|
||||
:tileloop
|
||||
ldx :column
|
||||
ldal Col2CodeOffset,x
|
||||
tay
|
||||
iny
|
||||
lda #1 ; draw tile #1
|
||||
lda :tile
|
||||
jsr CopyTile
|
||||
|
||||
ldx #4
|
||||
ldal Col2CodeOffset,x
|
||||
tay
|
||||
iny
|
||||
lda #2 ; draw tile #1
|
||||
jsr CopyTile
|
||||
lda :tile
|
||||
inc
|
||||
and #$000F
|
||||
sta :tile
|
||||
|
||||
ldx #8
|
||||
ldal Col2CodeOffset,x
|
||||
tay
|
||||
iny
|
||||
lda #3 ; draw tile #1
|
||||
jsr CopyTile
|
||||
lda :column
|
||||
clc
|
||||
adc #4
|
||||
sta :column
|
||||
cmp #4*40
|
||||
bcc :tileloop
|
||||
|
||||
ldx #12
|
||||
ldal Col2CodeOffset,x
|
||||
tay
|
||||
iny
|
||||
lda #4 ; draw tile #1
|
||||
jsr CopyTile
|
||||
|
||||
ldx #16
|
||||
ldal Col2CodeOffset,x
|
||||
tay
|
||||
iny
|
||||
lda #5 ; draw tile #1
|
||||
jsr CopyTile
|
||||
lda :bank
|
||||
clc
|
||||
adc #4
|
||||
sta :bank
|
||||
cmp #4*13
|
||||
bcc :bankloop
|
||||
|
||||
phk
|
||||
plb
|
||||
@ -166,10 +194,6 @@ DoFrame
|
||||
pha ; push twice because we will use it later
|
||||
rep #$20
|
||||
|
||||
tsc ; save the stack pointer
|
||||
inc ; adjust for the plb below
|
||||
sta stk_save+1 ; save a cycle by storing while bank is set
|
||||
|
||||
ldx #80*2 ; This is the word to exit from
|
||||
ldy Col2CodeOffset,x ; Get the offset
|
||||
|
||||
@ -201,7 +225,7 @@ DoFrame
|
||||
jsr SetConst
|
||||
rep #$30
|
||||
|
||||
ldy #$F000
|
||||
ldy #$7000 ; Set the return after line 200 (Bank 13, line 8)
|
||||
jsr SetReturn
|
||||
|
||||
sei ; disable interrupts
|
||||
@ -210,6 +234,9 @@ DoFrame
|
||||
ora #$0010 ; Read Bank 0 / Write Bank 1
|
||||
stal STATE_REG
|
||||
|
||||
tsc ; save the stack pointer
|
||||
stal stk_save+1
|
||||
|
||||
blt_entry jml $000006 ; Jump into the blitter code $XX/YY06
|
||||
|
||||
blt_return ldal STATE_REG ; Read Bank 0 / Write Bank 0
|
||||
@ -608,76 +635,3 @@ qtRec adrl $0000
|
||||
put blitter/Tables.s
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
20
test/blitter/DirectPage.s
Normal file
20
test/blitter/DirectPage.s
Normal file
@ -0,0 +1,20 @@
|
||||
; Direct page locations used by the engine
|
||||
ScreenHeight equ 0 ; Height of the playfield in scan lines
|
||||
ScreenWidth equ 2 ; Width of the playfield in bytes
|
||||
ScreenY0 equ 4 ; First vertical line on the physical screen of the playfield
|
||||
ScreenY1 equ 6 ; End of playfield on the physical screen. If the height is 20 and Y0 is
|
||||
ScreenX0 equ 8 ; 100, then ScreenY1 = 120.
|
||||
ScreenX1 equ 10
|
||||
|
||||
StartY equ 12 ; Which code buffer line displays first on screen. Range = 0 to 207
|
||||
|
||||
tmp0 equ 240 ; 16 bytes of temporary space to be used as scratch
|
||||
tmp1 equ 242
|
||||
tmp2 equ 244
|
||||
tmp3 equ 246
|
||||
tmp4 equ 248
|
||||
tmp5 equ 250
|
||||
tmp6 equ 252
|
||||
tmp7 equ 254
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user