diff --git a/GSCats.xcodeproj/project.pbxproj b/GSCats.xcodeproj/project.pbxproj index 8908783..4f954b3 100644 --- a/GSCats.xcodeproj/project.pbxproj +++ b/GSCats.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXFileReference section */ 700C39C51F2E5CA800C24F9C /* tables.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = tables.s; sourceTree = ""; }; + 700F21DE1F43E31300D7007D /* input.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = input.s; sourceTree = ""; }; 700FFAFB1F40F3BF00A442DE /* font.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = font.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 = ""; }; @@ -30,6 +31,7 @@ isa = PBXGroup; children = ( 70E9D85F1F2BD95400555C19 /* equates.s */, + 700F21DE1F43E31300D7007D /* input.s */, 70E9D8601F2BD95400555C19 /* graphics.s */, 70E9D8621F2BD95400555C19 /* macros.s */, 7099E3841F41022100182A82 /* gameobject.s */, diff --git a/gamemanager.s b/gamemanager.s index 74b4b87..a996cf5 100644 --- a/gamemanager.s +++ b/gamemanager.s @@ -103,75 +103,6 @@ changeAngle: rts -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; kbdScan -; Processes keyboard input -; -; Trashes A -; - -kbdScan: - EMULATION - -kbdScanLoop: - lda KBD - bpl kbdScanDone - sta KBDSTROBE - - cmp #(8 + $80) - beq kbdScanLeftArrow - cmp #(21 + $80) - beq kbdScanRightArrow - cmp #(' ' + $80) - beq kbdScanSpace - cmp #('a' + $80) - beq kbdScanA - cmp #('z' + $80) - beq kbdScanZ - -kbdScanDone: - NATIVE - rts - -kbdScanRightArrow: - NATIVE - lda mapScrollPos - cmp #VISIBLETERRAINWIDTH-VISIBLETERRAINWINDOW - beq kbdScanDone - inc - inc - sta mapScrollRequested - rts - -kbdScanLeftArrow: - NATIVE - lda mapScrollPos - beq kbdScanDone - dec - dec - sta mapScrollRequested - rts - -kbdScanSpace: - NATIVE - lda #1 - sta quitRequested - rts - -kbdScanA: - NATIVE - lda #1 - sta angleDeltaRequested - rts - -kbdScanZ: - NATIVE - lda #-1 - sta angleDeltaRequested - rts - - - basePalette: .word $0000,$0080,$0000,$000F,$0FFF,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0FFF quitRequested: @@ -182,6 +113,8 @@ angleDeltaRequested: .word $0000 terrainDirty: .word 1 +activePlayer: + .word 0 ; Position of map viewing window. Can be visualized in two ways: ; a) Word-distance from right edge of terrain data (which is in memory right-to-left) to left edge of visible screen diff --git a/gscats.2mg b/gscats.2mg index 7128a34..69fce4f 100644 Binary files a/gscats.2mg and b/gscats.2mg differ diff --git a/gscats.s b/gscats.s index 58af01b..54a1ad2 100644 --- a/gscats.s +++ b/gscats.s @@ -36,6 +36,8 @@ quitGame: .include "utility.s" .include "tables.s" .include "gamemanager.s" +.include "input.s" + endMainBank2: diff --git a/input.s b/input.s new file mode 100644 index 0000000..520599b --- /dev/null +++ b/input.s @@ -0,0 +1,74 @@ +; +; input +; Code related to handling input +; +; Created by Quinn Dunki on 8/15/17 +; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; kbdScan +; Processes keyboard input +; +; Trashes A +; + +kbdScan: + BITS8 + lda KBD + bpl kbdScanDone + sta KBDSTROBE + + cmp #(8 + $80) + beq kbdScanLeftArrow + cmp #(21 + $80) + beq kbdScanRightArrow + cmp #(' ' + $80) + beq kbdScanSpace + cmp #('a' + $80) + beq kbdScanA + cmp #('z' + $80) + beq kbdScanZ + +kbdScanDone: + BITS16 + rts + +kbdScanRightArrow: + BITS16 + lda mapScrollPos + cmp #VISIBLETERRAINWIDTH-VISIBLETERRAINWINDOW + beq kbdScanDone + inc + inc + sta mapScrollRequested + rts + +kbdScanLeftArrow: + BITS16 + + lda mapScrollPos + beq kbdScanDone + dec + dec + sta mapScrollRequested + rts + +kbdScanSpace: + BITS16 + + lda #1 + sta quitRequested + rts + +kbdScanA: + BITS16 + lda #1 + sta angleDeltaRequested + rts + +kbdScanZ: + BITS16 + lda #-1 + sta angleDeltaRequested + rts +