diff --git a/Block.xcf b/Block.xcf new file mode 100644 index 0000000..ef5fef6 Binary files /dev/null and b/Block.xcf differ diff --git a/Block1.xcf b/Block1.xcf new file mode 100644 index 0000000..b5e0578 Binary files /dev/null and b/Block1.xcf differ diff --git a/Cat.xcf b/Cat.xcf new file mode 100644 index 0000000..6606c46 Binary files /dev/null and b/Cat.xcf differ diff --git a/GSCats.xcodeproj/project.pbxproj b/GSCats.xcodeproj/project.pbxproj index 7ce875b..8f80b92 100644 --- a/GSCats.xcodeproj/project.pbxproj +++ b/GSCats.xcodeproj/project.pbxproj @@ -12,6 +12,9 @@ 700F21DF1F4A364600D7007D /* projectile.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = projectile.s; sourceTree = ""; }; 700F21E01F4A3A5500D7007D /* GenerateTrigTables.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateTrigTables.py; sourceTree = ""; }; 700FFAFB1F40F3BF00A442DE /* font.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = font.s; sourceTree = ""; }; + 70218F1D1F8009B5005A32C6 /* cat.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cat.s; sourceTree = ""; }; + 70218F1E1F80127C005A32C6 /* block.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = block.s; sourceTree = ""; }; + 70218F1F1F801BC4005A32C6 /* block1.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = block1.s; sourceTree = ""; }; 7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = ""; }; 706DF1641F2D39F700AA6680 /* loader.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loader.s; sourceTree = ""; }; 706DF1651F2D4A8100AA6680 /* terrain.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = terrain.s; sourceTree = ""; }; @@ -51,6 +54,9 @@ 700F21DF1F4A364600D7007D /* projectile.s */, 70A80FB01F43D7F200BD34C9 /* gamemanager.s */, 70E9D8611F2BD95400555C19 /* gscats.s */, + 70218F1D1F8009B5005A32C6 /* cat.s */, + 70218F1E1F80127C005A32C6 /* block.s */, + 70218F1F1F801BC4005A32C6 /* block1.s */, 70E9D8631F2BD95400555C19 /* Makefile */, 7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */, 7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */, diff --git a/Makefile b/Makefile index 4e2e63f..04301f0 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,8 @@ AC=AppleCommander.jar ADDR=800 PGM=gscats +MRSPRITE=../MrSprite/mrsprite CODE +PALETTE=00ff00 000000 ffff00 886611 cc9933 eebb44 dd6666 ff99aa 00ff00 ffff00 ffff00 ffff00 ffff00 ffff00 ffff00 ffff00 ffffff all: $(PGM) @@ -32,4 +34,7 @@ clean: rm -f $(PGM).o rm ~/Library/Application\ Support/Sweet16/Disk\ Images/* - +sprites: + $(MRSPRITE) cat.gif $(PALETTE) + $(MRSPRITE) block.gif $(PALETTE) + $(MRSPRITE) block1.gif $(PALETTE) diff --git a/block.gif b/block.gif new file mode 100644 index 0000000..5188694 Binary files /dev/null and b/block.gif differ diff --git a/block.s b/block.s new file mode 100644 index 0000000..bb6ac98 --- /dev/null +++ b/block.s @@ -0,0 +1,124 @@ +Spr_001: + FASTGRAPHICS ; 16x16, 214 bytes, 433 cycles + clc + tya ; Y = Sprite Target Screen Address (upper left corner) + tcs ; New Stack address + ldx #$FFFF ; Pattern #1 : 112 +;-- + tsc + adc #$0007 + tcs + phx + phx + phx + phx + tsc ; Line 1 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 2 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 3 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 4 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 5 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 6 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 7 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 8 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 9 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 10 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 11 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 12 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 13 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 14 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 15 + adc #$00A8 + tcs + phx + phx + phx + phx +;-- +SLOWGRAPHICS + rts + +;------------------------------ diff --git a/block1.gif b/block1.gif new file mode 100644 index 0000000..f7b683c Binary files /dev/null and b/block1.gif differ diff --git a/block1.s b/block1.s new file mode 100644 index 0000000..771c952 --- /dev/null +++ b/block1.s @@ -0,0 +1,124 @@ +Spr_002: + FASTGRAPHICS ; 16x16, 214 bytes, 433 cycles + clc + tya ; Y = Sprite Target Screen Address (upper left corner) + tcs ; New Stack address + ldx #$6666 ; Pattern #1 : 112 +;-- + tsc + adc #$0007 + tcs + phx + phx + phx + phx + tsc ; Line 1 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 2 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 3 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 4 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 5 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 6 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 7 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 8 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 9 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 10 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 11 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 12 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 13 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 14 + adc #$00A8 + tcs + phx + phx + phx + phx + tsc ; Line 15 + adc #$00A8 + tcs + phx + phx + phx + phx +;-- +SLOWGRAPHICS + rts + +;------------------------------ diff --git a/cat.gif b/cat.gif new file mode 100644 index 0000000..a269e38 Binary files /dev/null and b/cat.gif differ diff --git a/cat.s b/cat.s new file mode 100644 index 0000000..2ab4108 --- /dev/null +++ b/cat.s @@ -0,0 +1,219 @@ +Spr_000: + FASTGRAPHICS ; 16x16, 484 bytes, 710 cycles + clc + tya ; Y = Sprite Target Screen Address (upper left corner) + tcs ; New Stack address + ldx #$4444 ; Pattern #1 : 4 + ldy #$0444 ; Pattern #2 : 2 + lda #$4004 ; Pattern #3 : 2 + tcd +;-- + lda #$2633 ; Line 0 + sta $A5,S + lda $A3,S + and #$F000 + ora #$0226 + sta $A3,S + sep #$20 + .a8 + lda $03,S + and #$F0 + ora #$03 + sta $03,S + lda $06,S + and #$F0 + ora #$03 + sta $06,S + lda $A7,S + and #$0F + ora #$20 + sta $A7,S + rep #$30 + .a16 + tsc ; Line 2 + adc #$0140 + tcs + sep #$20 + .a8 + lda #$FF + sta $00,S + sta $A0,S + lda $07,S + and #$0F + ora #$20 + sta $07,S + lda $A7,S + and #$0F + ora #$20 + sta $A7,S + rep #$30 + .a16 + tsc + adc #$0006 + tcs + pea $3533 + pea $2425 + tsc ; Line 3 + adc #$00A4 + tcs + sep #$20 + .a8 + lda #$23 + sta $9A,S + lda $A1,S + and #$0F + ora #$30 + sta $A1,S + rep #$30 + .a16 + pea $3434 + pea $4423 + tsc ; Line 4 + adc #$00A4 + tcs + lda $9C,S + and #$00F0 + ora #$2303 + sta $9C,S + sep #$20 + .a8 + lda #$24 + sta $9A,S + rep #$30 + .a16 + phx + pea $4434 + tsc ; Line 5 + adc #$00A5 + tcs + sep #$20 + .a8 + lda #$24 + sta $99,S + lda $A0,S + and #$0F + ora #$30 + sta $A0,S + rep #$30 + .a16 + pea $2340 + phy + tsc ; Line 6 + adc #$00A3 + tcs + phd + pea $4433 + tsc ; Line 7 + adc #$00A5 + tcs + sep #$20 + .a8 + lda $99,S + and #$F0 + ora #$03 + sta $99,S + rep #$30 + .a16 + pea $236F + pea $F64F + pea $2233 + pea $3324 + tsc ; Line 8 + adc #$00A7 + tcs + lda $9F,S + and #$0F00 + ora #$3022 + sta $9F,S + sep #$20 + .a8 + lda $9A,S + and #$F0 + ora #$03 + sta $9A,S + rep #$30 + .a16 + pea $F2FF + pea $2333 + pea $3444 + tsc ; Line 9 + adc #$00A4 + tcs + txa + sta $9E,S + lda $9C,S + and #$00F0 + ora #$4403 + sta $9C,S + lda $A0,S + and #$0F00 + ora #$F03F + sta $A0,S + pea $FF43 + phx + tsc ; Line 11 + adc #$0140 + tcs + lda #$4434 + sta $02,S + lda #$2322 + sta $A2,S + lda $00,S + and #$00F0 + ora #$4403 + sta $00,S + lda $04,S + and #$0F00 + ora #$F043 + sta $04,S + lda $A0,S + and #$00F0 + ora #$4303 + sta $A0,S + lda $A4,S + and #$0F00 + ora #$3044 + sta $A4,S + tsc ; Line 13 + adc #$0140 + tcs + lda $00,S + and #$00F0 + ora #$3204 + sta $00,S + lda $03,S + and #$00F0 + ora #$4203 + sta $03,S + lda $A0,S + and #$00F0 + ora #$3203 + sta $A0,S + lda $A3,S + and #$00F0 + ora #$3203 + sta $A3,S + sep #$20 + .a8 + lda $05,S + and #$0F + ora #$30 + sta $05,S + rep #$30 + .a16 + tsc ; Line 15 + adc #$0140 + tcs + lda $00,S + and #$00F0 + ora #$F30F + sta $00,S + lda $03,S + and #$00F0 + ora #$F30F + sta $03,S +;-- +SLOWGRAPHICS + rts + +;------------------------------ diff --git a/cat.src b/cat.src new file mode 100644 index 0000000..20ace59 --- /dev/null +++ b/cat.src @@ -0,0 +1,219 @@ +Spr_000: + FASTGRAPHICS ; 16x16, 484 bytes, 710 cycles + clc + tya ; Y = Sprite Target Screen Address (upper left corner) + tcs ; New Stack address + ldx #$3333 ; Pattern #1 : 4 + ldy #$0333 ; Pattern #2 : 2 + lda #$3003 ; Pattern #3 : 2 + tcd +;-- + lda #$1522 ; Line 0 + sta $A5,S + lda $A3,S + and #$F000 + ora #$0115 + sta $A3,S + sep #$20 + .a8 + lda $03,S + and #$F0 + ora #$02 + sta $03,S + lda $06,S + and #$F0 + ora #$02 + sta $06,S + lda $A7,S + and #$0F + ora #$10 + sta $A7,S + rep #$30 + .a16 + tsc ; Line 2 + adc #$0140 + tcs + sep #$20 + .a8 + lda #$77 + sta $00,S + sta $A0,S + lda $07,S + and #$0F + ora #$10 + sta $07,S + lda $A7,S + and #$0F + ora #$10 + sta $A7,S + rep #$30 + .a16 + tsc + adc #$0006 + tcs + pea $2422 + pea $1314 + tsc ; Line 3 + adc #$00A4 + tcs + sep #$20 + .a8 + lda #$12 + sta $9A,S + lda $A1,S + and #$0F + ora #$20 + sta $A1,S + rep #$30 + .a16 + pea $2323 + pea $3312 + tsc ; Line 4 + adc #$00A4 + tcs + lda $9C,S + and #$00F0 + ora #$1202 + sta $9C,S + sep #$20 + .a8 + lda #$13 + sta $9A,S + rep #$30 + .a16 + phx + pea $3323 + tsc ; Line 5 + adc #$00A5 + tcs + sep #$20 + .a8 + lda #$13 + sta $99,S + lda $A0,S + and #$0F + ora #$20 + sta $A0,S + rep #$30 + .a16 + pea $1230 + phy + tsc ; Line 6 + adc #$00A3 + tcs + phd + pea $3322 + tsc ; Line 7 + adc #$00A5 + tcs + sep #$20 + .a8 + lda $99,S + and #$F0 + ora #$02 + sta $99,S + rep #$30 + .a16 + pea $1257 + pea $7537 + pea $1122 + pea $2213 + tsc ; Line 8 + adc #$00A7 + tcs + lda $9F,S + and #$0F00 + ora #$2011 + sta $9F,S + sep #$20 + .a8 + lda $9A,S + and #$F0 + ora #$02 + sta $9A,S + rep #$30 + .a16 + pea $7177 + pea $1222 + pea $2333 + tsc ; Line 9 + adc #$00A4 + tcs + txa + sta $9E,S + lda $9C,S + and #$00F0 + ora #$3302 + sta $9C,S + lda $A0,S + and #$0F00 + ora #$7027 + sta $A0,S + pea $7732 + phx + tsc ; Line 11 + adc #$0140 + tcs + lda #$3323 + sta $02,S + lda #$1211 + sta $A2,S + lda $00,S + and #$00F0 + ora #$3302 + sta $00,S + lda $04,S + and #$0F00 + ora #$7032 + sta $04,S + lda $A0,S + and #$00F0 + ora #$3202 + sta $A0,S + lda $A4,S + and #$0F00 + ora #$2033 + sta $A4,S + tsc ; Line 13 + adc #$0140 + tcs + lda $00,S + and #$00F0 + ora #$2103 + sta $00,S + lda $03,S + and #$00F0 + ora #$3102 + sta $03,S + lda $A0,S + and #$00F0 + ora #$2102 + sta $A0,S + lda $A3,S + and #$00F0 + ora #$2102 + sta $A3,S + sep #$20 + .a8 + lda $05,S + and #$0F + ora #$20 + sta $05,S + rep #$30 + .a16 + tsc ; Line 15 + adc #$0140 + tcs + lda $00,S + and #$00F0 + ora #$7207 + sta $00,S + lda $03,S + and #$00F0 + ora #$7207 + sta $03,S +;-- +SLOWGRAPHICS + rts + +;------------------------------ diff --git a/gamemanager.s b/gamemanager.s index 8cc75ed..bc89d4f 100644 --- a/gamemanager.s +++ b/gamemanager.s @@ -17,7 +17,7 @@ beginGameplay: jsr setPalette ; Erase the screen - ldx #$2222 + ldx #$0000 jsr colorFill ; Generate, compile, and clip terrain @@ -37,7 +37,6 @@ beginGameplay: ldy #0 jsr renderPlayerHeader - gameplayLoop: jsr syncVBL @@ -52,12 +51,16 @@ gameplayLoop: jsr renderPlayers gameplayLoopKbd: - lda projectileActive - bpl gameplayLoopProjectiles ; Skip input during shots +; lda projectileActive +; bpl gameplayLoopProjectiles ; Skip input during shots ; Check for keys down jsr kbdScan + ; Check for pause + lda paused + bne gameplayLoopEndFrame + ; Scroll map if needed lda mapScrollRequested bmi gameplayLoopAngle @@ -208,7 +211,10 @@ fire: basePalette: - .word $0000,$0080,$0000,$000F,$0FFF,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0FFF + .word $0000,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0FFF + + + quitRequested: .word $0000 mapScrollRequested: @@ -231,6 +237,8 @@ gameOver: .word -1 ; Player index of winner projectileActive: .word -1 +paused: + .word 0 ; Position of map viewing window. Can be visualized in two ways: diff --git a/gameobject.s b/gameobject.s index e5514ba..e317171 100644 --- a/gameobject.s +++ b/gameobject.s @@ -59,7 +59,7 @@ placeGameObjectOnTerrain: ; ptr = Pointer to gameobject data ; Trashes SCRATCHL ; -.macro RENDER_GAMEOBJECT ptr +.macro RENDER_GAMEOBJECT ptr,compiledSprite .scope SAVE_AXY @@ -356,6 +356,8 @@ renderGameobjectBackground: iny lda VRAMBANK+160*14+6,x sta ptr+GO_BACKGROUND,y + iny + iny lda VRAMBANK+160*15,x sta ptr+GO_BACKGROUND,y @@ -371,12 +373,10 @@ renderGameobjectBackground: iny lda VRAMBANK+160*15+6,x sta ptr+GO_BACKGROUND,y - iny - iny ; Draw sprite ply - jsr Spr_000 + jsr compiledSprite renderGameobjectDone: RESTORE_AXY @@ -564,6 +564,8 @@ unrenderGameobjectBackground: iny lda ptr+GO_BACKGROUND,y sta VRAMBANK+160*7+6,x + iny + iny lda ptr+GO_BACKGROUND,y sta VRAMBANK+160*8,x diff --git a/graphics.s b/graphics.s index 788d717..1858b13 100644 --- a/graphics.s +++ b/graphics.s @@ -206,6 +206,7 @@ waitVBLToStart: BITS16 rts +.if 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; TEST OF MR. SPRITE ; @@ -413,7 +414,7 @@ SLOWGRAPHICS rts ;------------------------------ - +.endif ; caches @@ -423,3 +424,7 @@ stackRegister: .byte 0 stackPtr: .word 0 + +.include "cat.s" +.include "block.s" +.include "block1.s" diff --git a/gscats.2mg b/gscats.2mg index 1923a81..a22476f 100644 Binary files a/gscats.2mg and b/gscats.2mg differ diff --git a/input.s b/input.s index 61e8e47..7ec13e4 100644 --- a/input.s +++ b/input.s @@ -36,6 +36,8 @@ kbdScan: beq kbdScanSpace cmp #(27 + $80) beq kbdScanESC + cmp #(127 + $80) + beq kbdScanDEL kbdScanDone: BITS16 @@ -104,6 +106,13 @@ kbdScanESC: sta breakpoint rts +kbdScanDEL: + BITS16 + lda paused + eor #1 + sta paused + rts + breakpoint: .word 0 diff --git a/player.s b/player.s index e40e2a5..915568a 100644 --- a/player.s +++ b/player.s @@ -200,8 +200,8 @@ playerIntersectRect: ; ; renderPlayers: - RENDER_GAMEOBJECT playerData - RENDER_GAMEOBJECT playerData+PD_SIZE + RENDER_GAMEOBJECT playerData,Spr_000 + RENDER_GAMEOBJECT playerData+PD_SIZE,Spr_000 rts diff --git a/projectile.s b/projectile.s index 54181f7..0857fcd 100644 --- a/projectile.s +++ b/projectile.s @@ -326,7 +326,7 @@ renderProjectiles: jmp renderProjectilesDone renderProjectilesDoIt: - RENDER_GAMEOBJECT projectileData + RENDER_GAMEOBJECT projectileData,Spr_001 renderProjectilesDone: pla