Skip to content

Commit

Permalink
Change fire to return to start game and move across levels
Browse files Browse the repository at this point in the history
  • Loading branch information
intoinside committed Dec 3, 2021
1 parent a661dc0 commit ceb7fbf
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 6 deletions.
4 changes: 1 addition & 3 deletions _intro.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ Intro: {
CheckFire:
jsr WaitRoutine
jsr TimedRoutine
jsr GetJoystickMove

lda FirePressed
jsr Keyboard.IsReturnPressed
beq CheckFire

NoMovement:
Expand Down
32 changes: 32 additions & 0 deletions _keyboard.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
////////////////////////////////////////////////////////////////////////////////
//
// Project : ForestSaver - https://github.com/intoinside/ForestSaver
// Target : Commodore 64
// Author : Raffaele Intorcia - raffaele.intorcia@gmail.com
//
// Routine for keyboard managing
//
////////////////////////////////////////////////////////////////////////////////

#importonce

Keyboard: {
Init: {
lda #1
sta KEYB.BUFFER_LEN // disable keyboard buffer
lda #127
sta KEYB.REPEAT_SWITCH // disable key repeat
}

IsReturnPressed: {
lda KEYB.CURRENT_PRESSED
and #$01
sta ReturnPressed

rts
}

ReturnPressed: .byte $00
}

#import "_label.asm"
6 changes: 6 additions & 0 deletions _label.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ CIA: {
.label PORT_A = $dd00
}

KEYB: {
.label CURRENT_PRESSED = $00cb
.label BUFFER_LEN = $0289
.label REPEAT_SWITCH = $028a
}

SPRITES: {
.label EXTRACOLOR1 = $d025
.label EXTRACOLOR2 = $d026
Expand Down
4 changes: 2 additions & 2 deletions _level1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ Level1: {

CloseLevelAndGotoNext:
SetSpriteToBackground()
lda FirePressed
jsr Keyboard.IsReturnPressed
bne LevelDone
jmp EndLoop

CloseLevelAndGame:
SetSpriteToBackground()
lda FirePressed
lda Keyboard.ReturnPressed
bne LevelDone

EndLoop:
Expand Down
2 changes: 1 addition & 1 deletion _level2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Level2: {

CloseLevelAndGame:
SetSpriteToBackground()
lda FirePressed
jsr Keyboard.IsReturnPressed
bne LevelDone

EndLoop:
Expand Down
3 changes: 3 additions & 0 deletions main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ MainGameSettings: {
lda #$ff
sta VIC.SPRITE_MULTICOLOR

jsr Keyboard.Init

rts
}

#import "_intro.asm"
#import "_level1.asm"
#import "_level2.asm"
#import "_keyboard.asm"
#import "_label.asm"
Binary file modified maps/game-maps.ctm
Binary file not shown.

0 comments on commit ceb7fbf

Please sign in to comment.