mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-01-25 01:33:06 +00:00
Basic Mr. Sprite integration
- Larger gameobject sprites - Fixed some bugs in collision detection
This commit is contained in:
parent
5d04f335e0
commit
9aadc36361
@ -8,6 +8,7 @@ KBD = $e0c000
|
||||
KBDSTROBE = $e0c010
|
||||
COUT = $fded
|
||||
VRAM = $e12000
|
||||
VRAMBANK = $e10000
|
||||
|
||||
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)
|
||||
PARAM0 = $06
|
||||
@ -21,3 +22,4 @@ SCRATCH1 = $1a
|
||||
SCRATCHL = $19 ; 16-bit version of scratch
|
||||
SCRATCHL2 = $67 ; Second 16-bit scratch
|
||||
PARAM24 = $67 ; 24-bit param (This is almost certainly messing up AppleSoft, but meh)
|
||||
STACKPTR = $70 ; Cache for stack pointer in fast graphics
|
||||
|
@ -26,11 +26,11 @@ beginGameplay:
|
||||
jsr clipTerrain
|
||||
|
||||
; Create players
|
||||
lda #191
|
||||
lda #40
|
||||
ldy #0
|
||||
jsr playerCreate
|
||||
|
||||
lda #40
|
||||
lda #196
|
||||
ldy #1
|
||||
jsr playerCreate
|
||||
|
||||
|
512
gameobject.s
512
gameobject.s
@ -5,14 +5,17 @@
|
||||
; Created by Quinn Dunki on 8/13/17
|
||||
;
|
||||
|
||||
GAMEOBJECTWIDTH = 8
|
||||
GAMEOBJECTHEIGHT = 8
|
||||
GAMEOBJECTWIDTH = 16
|
||||
GAMEOBJECTHEIGHT = 16
|
||||
|
||||
; Base class sample:
|
||||
;gameobjectData:
|
||||
; .word 40 ; X pos in pixels (from right terrain edge)
|
||||
; .word 38 ; Y pos in pixels (from bottom terrain edge)
|
||||
; .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||
; .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background 64 bytes
|
||||
; .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
; .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
; .word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
GO_POSX = 0 ; Byte offsets into gameobject data structure
|
||||
GO_POSY = 2
|
||||
@ -65,6 +68,7 @@ placeGameObjectOnTerrain:
|
||||
|
||||
; X
|
||||
lda ptr+GO_POSX,y
|
||||
|
||||
lsr
|
||||
cmp leftScreenEdge
|
||||
bmi renderGameobjectSkip ; Gameobject is off left edge of screen
|
||||
@ -79,6 +83,7 @@ placeGameObjectOnTerrain:
|
||||
sec
|
||||
lda #200
|
||||
sbc ptr+GO_POSY,y
|
||||
|
||||
bmi renderGameobjectSkip ; Gameobject is off top edge of screen
|
||||
cmp #200 - GAMEOBJECTHEIGHT
|
||||
bpl renderGameobjectSkip ; Gameobject is off bottom edge of screen
|
||||
@ -88,7 +93,9 @@ placeGameObjectOnTerrain:
|
||||
lda vramYOffset,x
|
||||
clc
|
||||
adc SCRATCHL
|
||||
tax ; X now contains the VRAM offset of the upper left corner
|
||||
adc #$2000
|
||||
tax ; X now contains the bank address of the upper left corner
|
||||
|
||||
phx
|
||||
bra renderGameobjectBackground
|
||||
|
||||
@ -97,88 +104,279 @@ renderGameobjectSkip:
|
||||
|
||||
renderGameobjectBackground:
|
||||
; Save background
|
||||
lda VRAM,x
|
||||
lda VRAMBANK,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+2,x
|
||||
lda VRAMBANK+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160,x
|
||||
lda VRAMBANK+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160+2,x
|
||||
lda VRAMBANK+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*2,x
|
||||
|
||||
lda VRAMBANK+160,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*2+2,x
|
||||
lda VRAMBANK+160+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*3,x
|
||||
lda VRAMBANK+160+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*3+2,x
|
||||
lda VRAMBANK+160+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*4,x
|
||||
|
||||
lda VRAMBANK+160*2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*4+2,x
|
||||
lda VRAMBANK+160*2+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*5,x
|
||||
lda VRAMBANK+160*2+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*5+2,x
|
||||
lda VRAMBANK+160*2+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*6,x
|
||||
|
||||
lda VRAMBANK+160*3,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*6+2,x
|
||||
lda VRAMBANK+160*3+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*7,x
|
||||
lda VRAMBANK+160*3+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAM+160*7+2,x
|
||||
lda VRAMBANK+160*3+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
plx
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*4+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*4+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*4+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*5,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*5+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*5+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*5+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*6+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*6+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*6+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*7,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*7+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*7+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*7+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*8,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*8+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*8+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*8+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*9,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*9+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*9+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*9+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*10,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*10+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*10+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*10+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*11,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*11+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*11+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*11+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*12,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*12+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*12+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*12+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*13,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*13+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*13+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*13+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
lda VRAMBANK+160*14,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*14+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*14+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*14+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
|
||||
lda VRAMBANK+160*15,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*15+2,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*15+4,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
lda VRAMBANK+160*15+6,x
|
||||
sta ptr+GO_BACKGROUND,y
|
||||
iny
|
||||
iny
|
||||
|
||||
; Draw sprite
|
||||
lda #$FFFF
|
||||
sta VRAM,x
|
||||
sta VRAM+2,x
|
||||
sta VRAM+160,x
|
||||
sta VRAM+160+2,x
|
||||
sta VRAM+160*2,x
|
||||
sta VRAM+160*2+2,x
|
||||
sta VRAM+160*3,x
|
||||
sta VRAM+160*3+2,x
|
||||
sta VRAM+160*4,x
|
||||
sta VRAM+160*4+2,x
|
||||
sta VRAM+160*5,x
|
||||
sta VRAM+160*5+2,x
|
||||
sta VRAM+160*6,x
|
||||
sta VRAM+160*6+2,x
|
||||
sta VRAM+160*7,x
|
||||
sta VRAM+160*7+2,x
|
||||
ply
|
||||
jsr Spr_000
|
||||
|
||||
renderGameobjectDone:
|
||||
RESTORE_AXY
|
||||
@ -224,6 +422,7 @@ renderGameobjectDone:
|
||||
lda vramYOffset,x
|
||||
clc
|
||||
adc SCRATCHL
|
||||
adc #$2000
|
||||
tax ; X now contains the VRAM offset of the upper left corner
|
||||
|
||||
bra unrenderGameobjectBackground
|
||||
@ -233,67 +432,272 @@ unrenderGameobjectSkip:
|
||||
|
||||
unrenderGameobjectBackground:
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM,x
|
||||
sta VRAMBANK,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+2,x
|
||||
sta VRAMBANK+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160,x
|
||||
sta VRAMBANK+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160+2,x
|
||||
sta VRAMBANK+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*2,x
|
||||
sta VRAMBANK+160+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*2+2,x
|
||||
sta VRAMBANK+160+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*3,x
|
||||
sta VRAMBANK+160+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*3+2,x
|
||||
sta VRAMBANK+160*2+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*4,x
|
||||
sta VRAMBANK+160*2+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*4+2,x
|
||||
sta VRAMBANK+160*2+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*3,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*5,x
|
||||
sta VRAMBANK+160*3+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*5+2,x
|
||||
sta VRAMBANK+160*3+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*6,x
|
||||
sta VRAMBANK+160*3+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*6+2,x
|
||||
sta VRAMBANK+160*4+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*7,x
|
||||
sta VRAMBANK+160*4+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAM+160*7+2,x
|
||||
sta VRAMBANK+160*4+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*5,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*5+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*5+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*5+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*6,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*6+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*6+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*6+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*7,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*7+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*7+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*7+6,x
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*8,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*8+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*8+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*8+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*9,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*9+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*9+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*9+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*10,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*10+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*10+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*10+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*11,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*11+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*11+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*11+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*12,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*12+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*12+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*12+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*13,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*13+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*13+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*13+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*14,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*14+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*14+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*14+6,x
|
||||
iny
|
||||
iny
|
||||
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*15,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*15+2,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*15+4,x
|
||||
iny
|
||||
iny
|
||||
lda ptr+GO_BACKGROUND,y
|
||||
sta VRAMBANK+160*15+6,x
|
||||
|
||||
unrenderGameobjectDone:
|
||||
RESTORE_AXY
|
||||
|
219
graphics.s
219
graphics.s
@ -17,7 +17,7 @@ colorFill:
|
||||
colorFillLoop:
|
||||
; 80 PHXs, for 1 line
|
||||
; We could do the entire screen with PHXs, but this is a
|
||||
; balance between speed and super-verbose code
|
||||
; balance between speed and code size
|
||||
.byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
|
||||
.byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
|
||||
.byte $da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da,$da
|
||||
@ -206,13 +206,220 @@ waitVBLToStart:
|
||||
BITS16
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; TEST OF MR. SPRITE
|
||||
;
|
||||
Spr_000:
|
||||
FASTGRAPHICS ; 16x16, 464 bytes, 722 cycles
|
||||
clc
|
||||
tya ; Y = Sprite Target Screen Address (upper left corner)
|
||||
tcs ; New Stack address
|
||||
ldx #$1111 ; Pattern #1 : 14
|
||||
ldy #$4444 ; Pattern #2 : 12
|
||||
lda #$3333 ; Pattern #3 : 6
|
||||
tcd
|
||||
;--
|
||||
sep #$20
|
||||
.a8
|
||||
lda $A0,S
|
||||
and #$0F
|
||||
ora #$10
|
||||
sta $A0,S
|
||||
lda $A7,S
|
||||
and #$F0
|
||||
ora #$01
|
||||
sta $A7,S
|
||||
rep #$30
|
||||
.a16
|
||||
tsc
|
||||
adc #$0007
|
||||
tcs
|
||||
phx
|
||||
phx
|
||||
phx
|
||||
phx
|
||||
tsc ; Line 2
|
||||
adc #$0141
|
||||
tcs
|
||||
lda $00,S
|
||||
and #$000F
|
||||
ora #$3310
|
||||
sta $00,S
|
||||
lda $06,S
|
||||
and #$F000
|
||||
ora #$0133
|
||||
sta $06,S
|
||||
lda $A0,S
|
||||
and #$0F0F
|
||||
ora #$3010
|
||||
sta $A0,S
|
||||
lda $A6,S
|
||||
and #$F0F0
|
||||
ora #$0103
|
||||
sta $A6,S
|
||||
tsc
|
||||
adc #$0005
|
||||
tcs
|
||||
phd
|
||||
phd
|
||||
tsc ; Line 4
|
||||
adc #$013F
|
||||
tcs
|
||||
lda $00,S
|
||||
and #$000F
|
||||
ora #$3410
|
||||
sta $00,S
|
||||
lda $06,S
|
||||
and #$F000
|
||||
ora #$0143
|
||||
sta $06,S
|
||||
lda $A0,S
|
||||
and #$000F
|
||||
ora #$3410
|
||||
sta $A0,S
|
||||
lda $A6,S
|
||||
and #$F000
|
||||
ora #$0143
|
||||
sta $A6,S
|
||||
tsc
|
||||
adc #$0005
|
||||
tcs
|
||||
phy
|
||||
phy
|
||||
tsc ; Line 5
|
||||
adc #$00A4
|
||||
tcs
|
||||
lda $9B,S
|
||||
and #$0F0F
|
||||
ora #$3010
|
||||
sta $9B,S
|
||||
lda $A1,S
|
||||
and #$F0F0
|
||||
ora #$0103
|
||||
sta $A1,S
|
||||
phy
|
||||
phy
|
||||
tsc ; Line 7
|
||||
adc #$013F
|
||||
tcs
|
||||
lda $00,S
|
||||
and #$000F
|
||||
ora #$3310
|
||||
sta $00,S
|
||||
lda $06,S
|
||||
and #$F000
|
||||
ora #$0133
|
||||
sta $06,S
|
||||
lda $A0,S
|
||||
and #$000F
|
||||
ora #$2210
|
||||
sta $A0,S
|
||||
lda $A6,S
|
||||
and #$F000
|
||||
ora #$0122
|
||||
sta $A6,S
|
||||
tsc
|
||||
adc #$0005
|
||||
tcs
|
||||
phd
|
||||
phd
|
||||
tsc ; Line 8
|
||||
adc #$00A4
|
||||
tcs
|
||||
lda $9B,S
|
||||
and #$0F0F
|
||||
ora #$2010
|
||||
sta $9B,S
|
||||
lda $A1,S
|
||||
and #$F0F0
|
||||
ora #$0102
|
||||
sta $A1,S
|
||||
pea $2222
|
||||
pea $2222
|
||||
tsc ; Line 10
|
||||
adc #$013F
|
||||
tcs
|
||||
lda $00,S
|
||||
and #$000F
|
||||
ora #$2410
|
||||
sta $00,S
|
||||
lda $06,S
|
||||
and #$F000
|
||||
ora #$0142
|
||||
sta $06,S
|
||||
lda $A0,S
|
||||
and #$000F
|
||||
ora #$2410
|
||||
sta $A0,S
|
||||
lda $A6,S
|
||||
and #$F000
|
||||
ora #$0142
|
||||
sta $A6,S
|
||||
tsc
|
||||
adc #$0005
|
||||
tcs
|
||||
phy
|
||||
phy
|
||||
tsc ; Line 11
|
||||
adc #$00A4
|
||||
tcs
|
||||
lda $9B,S
|
||||
and #$0F0F
|
||||
ora #$2010
|
||||
sta $9B,S
|
||||
lda $A1,S
|
||||
and #$F0F0
|
||||
ora #$0102
|
||||
sta $A1,S
|
||||
phy
|
||||
phy
|
||||
tsc ; Line 13
|
||||
adc #$013F
|
||||
tcs
|
||||
lda $00,S
|
||||
and #$000F
|
||||
ora #$2210
|
||||
sta $00,S
|
||||
lda $06,S
|
||||
and #$F000
|
||||
ora #$0122
|
||||
sta $06,S
|
||||
sep #$20
|
||||
.a8
|
||||
lda $A0,S
|
||||
and #$0F
|
||||
ora #$10
|
||||
sta $A0,S
|
||||
lda $A7,S
|
||||
and #$F0
|
||||
ora #$01
|
||||
sta $A7,S
|
||||
rep #$30
|
||||
.a16
|
||||
tsc
|
||||
adc #$0005
|
||||
tcs
|
||||
pea $2222
|
||||
pea $2222
|
||||
tsc ; Line 15
|
||||
adc #$0146
|
||||
tcs
|
||||
phx
|
||||
phx
|
||||
phx
|
||||
phx
|
||||
;--
|
||||
SLOWGRAPHICS
|
||||
rts
|
||||
|
||||
;------------------------------
|
||||
|
||||
|
||||
|
||||
; caches
|
||||
shadowRegister:
|
||||
.byte 0
|
||||
.byte 0
|
||||
stackRegister:
|
||||
.byte 0
|
||||
.byte 0
|
||||
stackPtr:
|
||||
.word 0
|
||||
|
||||
.word 0
|
||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
53
macros.s
53
macros.s
@ -69,44 +69,45 @@
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro FASTGRAPHICS
|
||||
sei
|
||||
sep #%00100000 ; 16-bit A only, to preserve X/Y
|
||||
.macro FASTGRAPHICS ;51 cycles, 12 bytes
|
||||
sei ;2
|
||||
phd ;4
|
||||
sep #%00100000 ; 3 16-bit A only, to preserve X/Y
|
||||
.a8
|
||||
|
||||
lda SHADOW
|
||||
sta shadowRegister
|
||||
lda #0
|
||||
sta SHADOW
|
||||
lda SHADOW ;5
|
||||
sta shadowRegister ;4
|
||||
lda #0 ;2
|
||||
sta SHADOW ;5
|
||||
|
||||
lda STACKCTL
|
||||
sta stackRegister
|
||||
ora #$30
|
||||
sta STACKCTL
|
||||
lda STACKCTL ;5
|
||||
sta stackRegister ;4
|
||||
ora #$30 ;2
|
||||
sta STACKCTL ;5
|
||||
|
||||
rep #%00100000
|
||||
rep #%00100000 ;3
|
||||
.a16
|
||||
tsc
|
||||
sta stackPtr
|
||||
tsc ;2
|
||||
sta stackPtr ;5
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SLOWGRAPHICS
|
||||
sep #%00100000 ; 16-bit A only, to preserve X/Y
|
||||
.macro SLOWGRAPHICS ;38 cycles, 12 bytes
|
||||
sep #%00100000 ; 3 16-bit A only, to preserve X/Y
|
||||
.a8
|
||||
|
||||
lda shadowRegister
|
||||
sta SHADOW
|
||||
lda shadowRegister ;4
|
||||
sta SHADOW ;5
|
||||
|
||||
lda stackRegister
|
||||
sta STACKCTL
|
||||
lda stackRegister ;4
|
||||
sta STACKCTL ;5
|
||||
|
||||
rep #%00100000
|
||||
rep #%00100000 ;3
|
||||
.a16
|
||||
lda stackPtr
|
||||
tcs
|
||||
|
||||
cli
|
||||
lda stackPtr ;5
|
||||
tcs ;2
|
||||
pld ;5
|
||||
cli ;2
|
||||
.endmacro
|
||||
|
||||
|
||||
@ -131,6 +132,8 @@
|
||||
pha
|
||||
lda breakpoint
|
||||
beq nobrk
|
||||
lda #1
|
||||
sta $e1c029
|
||||
pla
|
||||
brk
|
||||
nobrk:
|
||||
|
34
player.s
34
player.s
@ -11,29 +11,41 @@ playerData:
|
||||
.word 0 ; X pos in pixels (from left terrain edge)
|
||||
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
.word 90 ; Angle in degrees from +X
|
||||
.word 1 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"SPROCKET " ; Name
|
||||
.word 0,0,0,0,0,0 ;Padding
|
||||
|
||||
.repeat 108
|
||||
.byte 0 ; Padding to 256-byte boundary
|
||||
.endrepeat
|
||||
|
||||
; gameobject data
|
||||
.word 0 ; X pos in pixels (from left terrain edge)
|
||||
.word 0 ; Y pos in pixels (from bottom terrain edge)
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
.word 45 ; Angle in degrees from +X
|
||||
.word 135 ; Angle in degrees from +X
|
||||
.word 1 ; Power
|
||||
.word 100 ; Anger
|
||||
.byte 8,"TINKER " ; Name
|
||||
.word 0,0,0,0,0,0 ;Padding
|
||||
|
||||
PD_ANGLE = 36
|
||||
PD_POWER = 38
|
||||
PD_ANGER = 40
|
||||
PD_NAME = 42
|
||||
PD_SIZE = 64
|
||||
.repeat 108
|
||||
.byte 0 ; Padding to 256-byte boundary
|
||||
.endrepeat
|
||||
|
||||
PD_ANGLE = 132
|
||||
PD_POWER = 134
|
||||
PD_ANGER = 136
|
||||
PD_NAME = 138
|
||||
PD_SIZE = 256
|
||||
|
||||
.macro PLAYERPTR_Y
|
||||
tya ; Pointer to player structure from index
|
||||
@ -43,6 +55,8 @@ PD_SIZE = 64
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
.endmacro
|
||||
|
||||
@ -164,6 +178,7 @@ playerFire:
|
||||
; A => non zero if rectangle is intersecting player
|
||||
;
|
||||
playerIntersectRect:
|
||||
phy
|
||||
PLAYERPTR_Y
|
||||
|
||||
lda playerData+GO_POSX,y
|
||||
@ -174,8 +189,9 @@ playerIntersectRect:
|
||||
sta rectParams2+4
|
||||
lda #GAMEOBJECTHEIGHT
|
||||
sta rectParams2+6
|
||||
jsr intersectRectRect
|
||||
|
||||
jsr intersectRectRect
|
||||
ply
|
||||
rts
|
||||
|
||||
|
||||
|
38
projectile.s
38
projectile.s
@ -11,6 +11,9 @@ projectileData:
|
||||
.word -1 ; Pos X in pixels (from left terrain edge)
|
||||
.word 0 ; Pos Y in pixels (from bottom terrain edge)
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Saved background
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
.word 0 ; Pos X (12.4 fixed point)
|
||||
.word 0 ; Pos Y (12.4 fixed point)
|
||||
@ -19,12 +22,16 @@ projectileData:
|
||||
.word 0 ; Type
|
||||
.word 1 ; New?
|
||||
|
||||
JD_PRECISEX = 36 ; Byte offsets into projectile data structure
|
||||
JD_PRECISEY = 38
|
||||
JD_VX = 40
|
||||
JD_VY = 42
|
||||
JD_TYPE = 44
|
||||
JD_NEW = 46
|
||||
.repeat 112
|
||||
.byte 0 ; Padding to 256-byte boundary
|
||||
.endrepeat
|
||||
|
||||
JD_PRECISEX = 132 ; Byte offsets into projectile data structure
|
||||
JD_PRECISEY = 134
|
||||
JD_VX = 136
|
||||
JD_VY = 138
|
||||
JD_TYPE = 140
|
||||
JD_NEW = 142
|
||||
|
||||
GRAVITY = $ffff ; 8.8 fixed point
|
||||
|
||||
@ -43,6 +50,10 @@ PT_RADIUS = 2
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
.endmacro
|
||||
|
||||
@ -234,16 +245,17 @@ updateProjectileCollisions:
|
||||
sta rectParams+6
|
||||
|
||||
updateProjectileCollisionsPlayerLoop:
|
||||
iny
|
||||
cpy #NUMPLAYERS
|
||||
beq updateProjectileCollisionsPlayerDone
|
||||
cpy currentPlayer
|
||||
beq updateProjectileCollisionsPlayerLoop
|
||||
beq updateProjectileCollisionsPlayerNext
|
||||
|
||||
jsr playerIntersectRect
|
||||
cmp #0
|
||||
bne updateProjectileCollisionsPlayerHit
|
||||
|
||||
updateProjectileCollisionsPlayerDone:
|
||||
updateProjectileCollisionsPlayerNext:
|
||||
iny
|
||||
cpy #NUMPLAYERS
|
||||
bne updateProjectileCollisionsPlayerLoop
|
||||
|
||||
; Check for terrain collisions
|
||||
lda projectileData+GO_POSX
|
||||
@ -280,6 +292,7 @@ updateProjectileCollisionsTerrainHit:
|
||||
; Trashes A and Y
|
||||
;
|
||||
endProjectile:
|
||||
UNRENDER_GAMEOBJECT projectileData
|
||||
ldy #0
|
||||
jsr deleteProjectile
|
||||
lda #1
|
||||
@ -347,9 +360,10 @@ unrenderProjectilesDone:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; processPlayerImpact
|
||||
;
|
||||
; Y = Byte offset of player that was hit
|
||||
; Y = Index of player that was hit
|
||||
;
|
||||
processPlayerImpact:
|
||||
PLAYERPTR_Y
|
||||
tyx
|
||||
|
||||
ldy #0 ; Assume projectile 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user