Skip to content

Commit

Permalink
Added checkkeys() for input processing #52
Browse files Browse the repository at this point in the history
  • Loading branch information
picosonic committed Apr 7, 2023
1 parent 674f739 commit d9ef088
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
55 changes: 55 additions & 0 deletions beeb/dizzy3.asm
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,61 @@ INCLUDE "gfx.asm"
JMP titlescreen
}

; Set input key states
.checkkeys
{
; Set defaults to "nothing" pressed
LDA #&00

STA left
STA right
STA jump
STA fire

; Do nothing if killed
LDA killed:BNE done

; Cache the current input state
LDX keys

; Prevent fire (pickup/inventory) being pressed when not "looking forward idle"
LDA sequence:BNE firenotpressed

; Prevent fire (pickup/inventory) being pressed when already picking up
LDA usepickup:BNE firenotpressed

; Check for FIRE button
TXA:AND #PAD_FIRE:BEQ firenotpressed

.firepressed
INC fire
RTS

; Check for LEFT button
.firenotpressed
TXA:AND #PAD_LEFT:BEQ leftnotpressed

.leftpressed
INC left

; Check for RIGHT button
.leftnotpressed
TXA:AND #PAD_RIGHT:BEQ rightnotpressed

.rightpressed
INC right

; Check for JUMP button
.rightnotpressed
TXA:AND #PAD_JUMP:BEQ done

.jumppressed
INC jump

.done
RTS
}

.updatedizzy
{
; Should be called from vsync, so wait for one
Expand Down
Binary file modified beeb/progress.odt
Binary file not shown.
6 changes: 6 additions & 0 deletions beeb/vars.asm
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ GUARD ENVELOPE_DEFS
.startroom EQUB 0 ; Starting room id
.objcollide EQUB 0 ; Allow proximity collision detection to work

; Bit flags for Dizzy movement
.fire EQUB 0
.left EQUB 0
.right EQUB 0
.jump EQUB 0

; Collision box
.cx EQUB 0
.cy EQUB 0
Expand Down

0 comments on commit d9ef088

Please sign in to comment.