2017-08-16 02:20:47 +00:00
|
|
|
;
|
|
|
|
; input
|
|
|
|
; Code related to handling input
|
|
|
|
;
|
|
|
|
; Created by Quinn Dunki on 8/15/17
|
|
|
|
;
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; kbdScanTitle
|
|
|
|
; Processes keyboard input for title screen
|
|
|
|
;
|
|
|
|
; Trashes A
|
|
|
|
;
|
|
|
|
|
|
|
|
kbdScanTitle:
|
|
|
|
BITS8
|
|
|
|
lda KBD
|
|
|
|
bpl kbdScanTitleDone
|
|
|
|
sta KBDSTROBE
|
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
cmp #(11 + $80)
|
|
|
|
beq kbdScanUpArrowTitle
|
|
|
|
cmp #(10 + $80)
|
|
|
|
beq kbdScanDownArrowTitle
|
|
|
|
cmp #(13 + $80)
|
|
|
|
beq kbdScanEnterTitle
|
|
|
|
cmp #(32 + $80)
|
|
|
|
beq kbdScanSpaceTitle
|
2023-07-30 22:46:59 +00:00
|
|
|
jmp kbdScanDebugPiggyback
|
2023-07-23 21:59:55 +00:00
|
|
|
|
|
|
|
kbdScanTitleDone:
|
|
|
|
BITS16
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; Title Screen Key Handlers
|
|
|
|
;
|
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
kbdScanUpArrowTitle:
|
|
|
|
BITS16
|
|
|
|
lda #-1
|
|
|
|
sta menuActionRequested
|
|
|
|
rts
|
|
|
|
|
|
|
|
kbdScanDownArrowTitle:
|
2023-07-23 21:59:55 +00:00
|
|
|
BITS16
|
|
|
|
lda #1
|
|
|
|
sta menuActionRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 03:29:11 +00:00
|
|
|
kbdScanEnterTitle:
|
|
|
|
BITS16
|
|
|
|
lda #2
|
|
|
|
sta menuActionRequested
|
|
|
|
rts
|
|
|
|
|
|
|
|
kbdScanSpaceTitle:
|
|
|
|
BITS16
|
|
|
|
lda #2
|
|
|
|
sta menuActionRequested
|
|
|
|
rts
|
2023-07-23 21:59:55 +00:00
|
|
|
|
|
|
|
|
2023-07-30 22:46:59 +00:00
|
|
|
;;;;;;;
|
|
|
|
|
|
|
|
kbdScanApostrophe:
|
|
|
|
BITS16
|
|
|
|
lda #2
|
|
|
|
sta playerMoveRequested
|
|
|
|
rts
|
|
|
|
|
|
|
|
kbdScanSemiColon:
|
|
|
|
BITS16
|
|
|
|
lda #-2
|
|
|
|
sta playerMoveRequested
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-16 02:20:47 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2023-06-24 22:25:08 +00:00
|
|
|
; kbdScanGameplay/Debug
|
2023-07-23 21:59:55 +00:00
|
|
|
; Processes keyboard input for gameplay
|
2017-08-16 02:20:47 +00:00
|
|
|
;
|
|
|
|
; Trashes A
|
|
|
|
;
|
|
|
|
|
2023-06-24 22:25:08 +00:00
|
|
|
kbdScanGameplay:
|
2017-08-16 02:20:47 +00:00
|
|
|
BITS8
|
|
|
|
lda KBD
|
|
|
|
bpl kbdScanDone
|
|
|
|
sta KBDSTROBE
|
|
|
|
|
|
|
|
cmp #(8 + $80)
|
|
|
|
beq kbdScanLeftArrow
|
|
|
|
cmp #(21 + $80)
|
|
|
|
beq kbdScanRightArrow
|
2023-07-25 21:33:23 +00:00
|
|
|
cmp #(11 + $80)
|
|
|
|
beq kbdScanUpArrow
|
|
|
|
cmp #(10 + $80)
|
|
|
|
beq kbdScanDownArrow
|
|
|
|
cmp #(27 + $80)
|
|
|
|
beq kbdScanESC
|
|
|
|
cmp #(',' + $80)
|
|
|
|
beq kbdScanComma
|
|
|
|
cmp #('.' + $80)
|
|
|
|
beq kbdScanPeriod
|
2017-08-21 00:51:12 +00:00
|
|
|
cmp #(' ' + $80)
|
|
|
|
beq kbdScanSpace
|
2024-01-22 00:27:12 +00:00
|
|
|
; cmp #(';' + $80) ; For debugging cat movement
|
|
|
|
; beq kbdScanSemiColon ;
|
|
|
|
; cmp #(39 + $80) ;
|
|
|
|
; beq kbdScanApostrophe ;
|
2023-06-24 22:25:08 +00:00
|
|
|
cmp #(9 + $80)
|
2023-06-26 01:43:07 +00:00
|
|
|
bne kbdScanDebugPiggyback
|
2023-06-24 22:25:08 +00:00
|
|
|
jmp kbdScanTab
|
|
|
|
|
|
|
|
kbdScanDone:
|
|
|
|
BITS16
|
|
|
|
rts
|
|
|
|
|
|
|
|
kbdScanDebug:
|
|
|
|
BITS8
|
|
|
|
lda KBD
|
|
|
|
bpl kbdScanDone
|
|
|
|
sta KBDSTROBE
|
2023-06-26 01:43:07 +00:00
|
|
|
|
|
|
|
kbdScanDebugPiggyback:
|
2023-07-25 21:33:23 +00:00
|
|
|
cmp #('`' + $80)
|
|
|
|
beq kbdScanBackQuote
|
2017-09-30 20:01:36 +00:00
|
|
|
cmp #(127 + $80)
|
|
|
|
beq kbdScanDEL
|
2019-02-22 23:52:07 +00:00
|
|
|
cmp #('=' + $80)
|
|
|
|
beq kbdScanEquals
|
2023-06-24 22:25:08 +00:00
|
|
|
bra kbdScanDone
|
|
|
|
|
2023-07-23 21:59:55 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; Gameplay Key Handlers
|
|
|
|
;
|
2017-08-16 02:20:47 +00:00
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanPeriod:
|
2017-08-16 02:20:47 +00:00
|
|
|
BITS16
|
|
|
|
lda mapScrollPos
|
|
|
|
cmp #VISIBLETERRAINWIDTH-VISIBLETERRAINWINDOW
|
|
|
|
beq kbdScanDone
|
2021-07-24 20:55:16 +00:00
|
|
|
inc
|
|
|
|
inc
|
|
|
|
inc
|
2017-08-16 02:20:47 +00:00
|
|
|
inc
|
|
|
|
sta mapScrollRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanComma:
|
2017-08-16 02:20:47 +00:00
|
|
|
BITS16
|
|
|
|
|
|
|
|
lda mapScrollPos
|
|
|
|
beq kbdScanDone
|
|
|
|
dec
|
2021-07-24 20:55:16 +00:00
|
|
|
dec
|
|
|
|
dec
|
|
|
|
dec
|
2017-08-16 02:20:47 +00:00
|
|
|
sta mapScrollRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanLeftArrow:
|
2017-08-16 02:20:47 +00:00
|
|
|
BITS16
|
2023-06-22 03:07:30 +00:00
|
|
|
lda #2
|
2017-08-16 02:20:47 +00:00
|
|
|
sta angleDeltaRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanRightArrow:
|
2017-08-16 02:20:47 +00:00
|
|
|
BITS16
|
2023-06-22 03:07:30 +00:00
|
|
|
lda #-2
|
2017-08-16 02:20:47 +00:00
|
|
|
sta angleDeltaRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanUpArrow:
|
2017-09-05 19:55:27 +00:00
|
|
|
BITS16
|
|
|
|
lda #1
|
|
|
|
sta powerDeltaRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanDownArrow:
|
2017-09-05 19:55:27 +00:00
|
|
|
BITS16
|
|
|
|
lda #-1
|
|
|
|
sta powerDeltaRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-30 22:46:59 +00:00
|
|
|
kbdScanESC:
|
|
|
|
BITS16
|
|
|
|
lda #1
|
|
|
|
sta quitRequested
|
|
|
|
rts
|
|
|
|
|
2017-08-21 00:51:12 +00:00
|
|
|
kbdScanSpace:
|
|
|
|
BITS16
|
|
|
|
lda #1
|
|
|
|
sta fireRequested
|
|
|
|
rts
|
|
|
|
|
2023-07-25 21:33:23 +00:00
|
|
|
kbdScanBackQuote:
|
2017-08-31 19:55:02 +00:00
|
|
|
BITS16
|
|
|
|
lda #1
|
|
|
|
sta breakpoint
|
|
|
|
rts
|
|
|
|
|
2017-09-30 20:01:36 +00:00
|
|
|
kbdScanDEL:
|
|
|
|
BITS16
|
|
|
|
lda paused
|
|
|
|
eor #1
|
|
|
|
sta paused
|
|
|
|
rts
|
|
|
|
|
2019-02-22 23:52:07 +00:00
|
|
|
kbdScanEquals:
|
|
|
|
BITS16
|
|
|
|
lda #1
|
|
|
|
sta singleStep
|
|
|
|
stz paused
|
|
|
|
rts
|
|
|
|
|
2018-06-11 00:05:20 +00:00
|
|
|
kbdScanTab:
|
|
|
|
BITS16
|
|
|
|
ldy currentPlayer
|
|
|
|
PLAYERPTR_Y
|
|
|
|
lda playerData+PD_CURRWEAPON,y
|
|
|
|
inc
|
|
|
|
cmp #INVENTORY_ITEMS
|
|
|
|
bne kbdScanTab_store
|
|
|
|
lda #0
|
|
|
|
|
|
|
|
kbdScanTab_store:
|
|
|
|
sta playerData+PD_CURRWEAPON,y
|
|
|
|
inc inventoryDirty
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2017-08-31 19:55:02 +00:00
|
|
|
breakpoint:
|
|
|
|
.word 0
|
|
|
|
|
2023-08-06 22:55:42 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; kbdWaitForAnyKey
|
|
|
|
;
|
|
|
|
; Waits for any keypress
|
|
|
|
;
|
|
|
|
; Trashes A
|
|
|
|
;
|
|
|
|
kbdWaitForAnyKey:
|
|
|
|
BITS8
|
|
|
|
|
|
|
|
kbdWaitForAnyKeyLoop:
|
|
|
|
lda KBD
|
|
|
|
bpl kbdWaitForAnyKeyLoop
|
|
|
|
sta KBDSTROBE
|
|
|
|
BITS16
|
|
|
|
rts
|