Improved VBL, fixed Ctrl-OA-Reset crash
This commit is contained in:
parent
62fc459fba
commit
d4077a7edc
|
@ -64,6 +64,7 @@ beginGameplay:
|
||||||
jsl renderTerrainSpans
|
jsl renderTerrainSpans
|
||||||
|
|
||||||
gameplayLoop:
|
gameplayLoop:
|
||||||
|
jsr kbdScan
|
||||||
jsr syncVBL
|
jsr syncVBL
|
||||||
BORDER_COLOR #$0
|
BORDER_COLOR #$0
|
||||||
|
|
||||||
|
@ -75,9 +76,6 @@ gameplayLoop:
|
||||||
lda projectileActive
|
lda projectileActive
|
||||||
bpl gameplayLoopShotTracking ; Skip input during shots
|
bpl gameplayLoopShotTracking ; Skip input during shots
|
||||||
|
|
||||||
; Check for keys down
|
|
||||||
jsr kbdScan
|
|
||||||
|
|
||||||
; Check for pause
|
; Check for pause
|
||||||
; lda paused
|
; lda paused
|
||||||
; bne gameplayLoopEndFrame
|
; bne gameplayLoopEndFrame
|
||||||
|
@ -150,9 +148,14 @@ gameplayLoopProjectilesSkip:
|
||||||
|
|
||||||
gameplayLoopVictoryCondition:
|
gameplayLoopVictoryCondition:
|
||||||
lda gameOver
|
lda gameOver
|
||||||
bmi gameplayLoopEndFrame
|
bmi gameplayEndTurnCondition
|
||||||
jsr endGame
|
jsr endGame
|
||||||
|
|
||||||
|
gameplayEndTurnCondition:
|
||||||
|
lda turnRequested
|
||||||
|
beq gameplayLoopEndFrame
|
||||||
|
jsr endTurn
|
||||||
|
|
||||||
gameplayLoopEndFrame:
|
gameplayLoopEndFrame:
|
||||||
lda quitRequested
|
lda quitRequested
|
||||||
beq gameplayLoopContinue
|
beq gameplayLoopContinue
|
||||||
|
@ -358,8 +361,6 @@ projectilesDirty:
|
||||||
.word 1
|
.word 1
|
||||||
inventoryDirty:
|
inventoryDirty:
|
||||||
.word 1
|
.word 1
|
||||||
activePlayer:
|
|
||||||
.word 0
|
|
||||||
currentPlayer:
|
currentPlayer:
|
||||||
.word 0
|
.word 0
|
||||||
gameOver:
|
gameOver:
|
||||||
|
|
|
@ -268,18 +268,21 @@ waitVBL:
|
||||||
bpl waitVBL
|
bpl waitVBL
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
; The Apple version, taken from GS Tech Note 039
|
; The Apple version, taken from GS Tech Note 039
|
||||||
;
|
;
|
||||||
syncVBL:
|
syncVBL:
|
||||||
|
;sei
|
||||||
BITS8
|
BITS8
|
||||||
syncVBL0:
|
syncVBL0:
|
||||||
lda $E0C02F
|
ldaA $C02f
|
||||||
asl ; VA is now in the Carry flag
|
asl ; VA is now in the Carry flag
|
||||||
lda $E0C02E
|
ldaA $C02e
|
||||||
rol ; Roll Carry into bit 0
|
rol ; Roll Carry into bit 0
|
||||||
cmp #200 ; A now contains line number
|
cmp #200 ; A now contains line number
|
||||||
bne syncVBL0
|
blt syncVBL0
|
||||||
BITS16
|
BITS16
|
||||||
|
;cli
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; The old style //e version
|
; The old style //e version
|
||||||
|
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
33
loader.s
33
loader.s
|
@ -72,9 +72,25 @@ main:
|
||||||
ldy #$800 ; Must match terrain_e1 .org
|
ldy #$800 ; Must match terrain_e1 .org
|
||||||
jsr copyBytes
|
jsr copyBytes
|
||||||
|
|
||||||
|
; Copy vram table into bank E1
|
||||||
|
phb
|
||||||
|
lda #vramRowInvertedSpanLookupEnd-vramRowInvertedSpanLookup-1
|
||||||
|
ldx #vramRowInvertedSpanLookupEnd-1
|
||||||
|
ldy #$16C0 + vramRowInvertedSpanLookupEnd-vramRowInvertedSpanLookup-1 ; Must match terrain_e1 vramRowInvertedSpanLookup
|
||||||
|
mvp $e1,$00 ; Note that ca65 reverses src,dest. Grrr.
|
||||||
|
plb
|
||||||
|
|
||||||
EMULATION
|
EMULATION
|
||||||
|
|
||||||
|
jmp loadData
|
||||||
|
|
||||||
|
; Mystery jump table at 1680 - 16BB
|
||||||
|
|
||||||
|
ioError:
|
||||||
|
brk
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
loadData:
|
||||||
|
|
||||||
; Open the sprite bank file
|
; Open the sprite bank file
|
||||||
jsr PRODOS
|
jsr PRODOS
|
||||||
|
@ -114,8 +130,21 @@ returnToProDOS:
|
||||||
EMULATION
|
EMULATION
|
||||||
rts
|
rts
|
||||||
|
|
||||||
ioError:
|
|
||||||
brk
|
; This table lives here in the loader because we need to copy
|
||||||
|
; it to a specific free hole in bank E1
|
||||||
|
vramRowInvertedSpanLookup:
|
||||||
|
.word $9d00,$9c60,$9bc0,$9b20,$9a80,$99e0,$9940,$98a0,$9800,$9760,$96c0,$9620,$9580,$94e0,$9440,$93a0,$9300,$9260,$91c0,$9120
|
||||||
|
.word $9080,$8fe0,$8f40,$8ea0,$8e00,$8d60,$8cc0,$8c20,$8b80,$8ae0,$8a40,$89a0,$8900,$8860,$87c0,$8720,$8680,$85e0,$8540,$84a0
|
||||||
|
.word $8400,$8360,$82c0,$8220,$8180,$80e0,$8040,$7fa0,$7f00,$7e60,$7dc0,$7d20,$7c80,$7be0,$7b40,$7aa0,$7a00,$7960,$78c0,$7820
|
||||||
|
.word $7780,$76e0,$7640,$75a0,$7500,$7460,$73c0,$7320,$7280,$71e0,$7140,$70a0,$7000,$6f60,$6ec0,$6e20,$6d80,$6ce0,$6c40,$6ba0
|
||||||
|
.word $6b00,$6a60,$69c0,$6920,$6880,$67e0,$6740,$66a0,$6600,$6560,$64c0,$6420,$6380,$62e0,$6240,$61a0,$6100,$6060,$5fc0,$5f20
|
||||||
|
.word $5e80,$5de0,$5d40,$5ca0,$5c00,$5b60,$5ac0,$5a20,$5980,$58e0,$5840,$57a0,$5700,$5660,$55c0,$5520,$5480,$53e0,$5340,$52a0
|
||||||
|
.word $5200,$5160,$50c0,$5020,$4f80,$4ee0,$4e40,$4da0,$4d00,$4c60,$4bc0,$4b20,$4a80,$49e0,$4940,$48a0,$4800,$4760,$46c0,$4620
|
||||||
|
.word $4580,$44e0,$4440,$43a0,$4300,$4260,$41c0,$4120,$4080,$3fe0,$3f40,$3ea0,$3e00,$3d60,$3cc0,$3c20,$3b80,$3ae0,$3a40,$39a0
|
||||||
|
.word $3900,$3860,$37c0,$3720,$3680,$35e0,$3540,$34a0,$3400,$3360,$32c0,$3220,$3180,$30e0,$3040,$2fa0,$2f00,$2e60,$2dc0,$2d20
|
||||||
|
.word $2c80,$2be0,$2b40,$2aa0,$2a00,$2960,$28c0,$2820,$2780,$26e0,$2640,$25a0,$2500,$2460,$23c0,$2320,$2280,$21e0,$2140,$20a0
|
||||||
|
vramRowInvertedSpanLookupEnd:
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
6
macros.s
6
macros.s
|
@ -169,6 +169,12 @@
|
||||||
.dbyt (((Arg & $FF00) | $AA00) & $EE00) | (((Arg & $00FF) | $00AA) & $00EE)
|
.dbyt (((Arg & $FF00) | $AA00) & $EE00) | (((Arg & $00FF) | $00AA) & $00EE)
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
.macro ldaA Arg ; Forces 24-bit absolute addressing to bank $00
|
||||||
|
.byte $af
|
||||||
|
.word Arg
|
||||||
|
.byte $00
|
||||||
|
.endmacro
|
||||||
|
|
||||||
.macro BREAK
|
.macro BREAK
|
||||||
pha
|
pha
|
||||||
lda breakpoint
|
lda breakpoint
|
||||||
|
|
14
terrain_e1.s
14
terrain_e1.s
|
@ -278,19 +278,7 @@ terrainSpanData:
|
||||||
.endrepeat
|
.endrepeat
|
||||||
|
|
||||||
|
|
||||||
vramRowInvertedSpanLookup:
|
vramRowInvertedSpanLookup = $16C0 ; This table is copied to here by the loader
|
||||||
.word $9d00,$9c60,$9bc0,$9b20,$9a80,$99e0,$9940,$98a0,$9800,$9760,$96c0,$9620,$9580,$94e0,$9440,$93a0,$9300,$9260,$91c0,$9120
|
|
||||||
.word $9080,$8fe0,$8f40,$8ea0,$8e00,$8d60,$8cc0,$8c20,$8b80,$8ae0,$8a40,$89a0,$8900,$8860,$87c0,$8720,$8680,$85e0,$8540,$84a0
|
|
||||||
.word $8400,$8360,$82c0,$8220,$8180,$80e0,$8040,$7fa0,$7f00,$7e60,$7dc0,$7d20,$7c80,$7be0,$7b40,$7aa0,$7a00,$7960,$78c0,$7820
|
|
||||||
.word $7780,$76e0,$7640,$75a0,$7500,$7460,$73c0,$7320,$7280,$71e0,$7140,$70a0,$7000,$6f60,$6ec0,$6e20,$6d80,$6ce0,$6c40,$6ba0
|
|
||||||
.word $6b00,$6a60,$69c0,$6920,$6880,$67e0,$6740,$66a0,$6600,$6560,$64c0,$6420,$6380,$62e0,$6240,$61a0,$6100,$6060,$5fc0,$5f20
|
|
||||||
.word $5e80,$5de0,$5d40,$5ca0,$5c00,$5b60,$5ac0,$5a20,$5980,$58e0,$5840,$57a0,$5700,$5660,$55c0,$5520,$5480,$53e0,$5340,$52a0
|
|
||||||
.word $5200,$5160,$50c0,$5020,$4f80,$4ee0,$4e40,$4da0,$4d00,$4c60,$4bc0,$4b20,$4a80,$49e0,$4940,$48a0,$4800,$4760,$46c0,$4620
|
|
||||||
.word $4580,$44e0,$4440,$43a0,$4300,$4260,$41c0,$4120,$4080,$3fe0,$3f40,$3ea0,$3e00,$3d60,$3cc0,$3c20,$3b80,$3ae0,$3a40,$39a0
|
|
||||||
.word $3900,$3860,$37c0,$3720,$3680,$35e0,$3540,$34a0,$3400,$3360,$32c0,$3220,$3180,$30e0,$3040,$2fa0,$2f00,$2e60,$2dc0,$2d20
|
|
||||||
.word $2c80,$2be0,$2b40,$2aa0,$2a00,$2960,$28c0,$2820,$2780,$26e0,$2640,$25a0,$2500,$2460,$23c0,$2320,$2280,$21e0,$2140,$20a0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.export renderTerrainSpans
|
.export renderTerrainSpans
|
||||||
|
|
27
utility.s
27
utility.s
|
@ -152,3 +152,30 @@ mult88:
|
||||||
|
|
||||||
jsr mult16 ; Result is 8.8
|
jsr mult16 ; Result is 8.8
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; delayShort
|
||||||
|
; Sleeps for a teeny bit
|
||||||
|
;
|
||||||
|
delayShort:
|
||||||
|
SAVE_AXY
|
||||||
|
|
||||||
|
ldy #$01 ; Loop a bit
|
||||||
|
delayShortOuter:
|
||||||
|
ldx #$ff
|
||||||
|
delayShortInner:
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
dex
|
||||||
|
bne delayShortInner
|
||||||
|
dey
|
||||||
|
bne delayShortOuter
|
||||||
|
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
Loading…
Reference in New Issue