mirror of
https://github.com/StewBC/penetrator-apple2.git
synced 2024-06-01 08:41:31 +00:00
Audio, save scores, allow quit
More audio, better tuned. Allow Quit. Save high scores.
This commit is contained in:
parent
1307c2ae66
commit
d9c2957b60
|
@ -8,6 +8,7 @@
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.segment "CODE"
|
.segment "CODE"
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
.proc serviceAudio
|
.proc serviceAudio
|
||||||
|
|
||||||
lda audioMask ; get the active channels
|
lda audioMask ; get the active channels
|
||||||
|
@ -50,7 +51,7 @@ explosion:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
bombDrop:
|
bombDrop:
|
||||||
ldy #$50
|
ldy #$30
|
||||||
ldx #$10
|
ldx #$10
|
||||||
jmp playNote
|
jmp playNote
|
||||||
|
|
||||||
|
@ -77,8 +78,8 @@ engine:
|
||||||
jmp playNote
|
jmp playNote
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
ldy #$80
|
ldy #$40
|
||||||
ldx #$10
|
ldx #$08
|
||||||
jmp playNote
|
jmp playNote
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@ -91,7 +92,7 @@ ui:
|
||||||
sty delay
|
sty delay
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
lda speaker_toggle
|
lda SPEAKER
|
||||||
ldy delay
|
ldy delay
|
||||||
:
|
:
|
||||||
nop
|
nop
|
||||||
|
|
|
@ -7,19 +7,28 @@
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; System locations
|
; System locations
|
||||||
.include "apple2.inc"
|
PATHNAME = $0280
|
||||||
|
|
||||||
ram_layer0 = $2000 ; HGR Pages
|
ram_layer0 = $2000 ; HGR Pages
|
||||||
ram_layer1 = $4000
|
ram_layer1 = $4000
|
||||||
|
|
||||||
speaker_toggle = $C030
|
MLI = $BF00 ; ProDOS API
|
||||||
|
SPEAKER = $C030 ; Access to toggle the speaker
|
||||||
|
PADDL0 = $C064 ; Read to get POT
|
||||||
|
PTRIG = $C070 ; Reset PADDLE values
|
||||||
|
|
||||||
PADDL0 = $C064
|
;-----------------------------------------------------------------------------
|
||||||
PTRIG = $C070
|
; MLI call type bytes
|
||||||
|
QUIT_CALL = $65
|
||||||
|
OPEN_CALL = $C8
|
||||||
|
READ_CALL = $CA
|
||||||
|
WRITE_CALL = $CB
|
||||||
|
CLOSE_CALL = $CC
|
||||||
|
CREATE_CALL = $C0
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; self-modifying address marker
|
; self-modifying address marker
|
||||||
PLACEHOLDER = $FFFF
|
PLACEHOLDER = $FFFF
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; modes
|
; modes
|
||||||
|
@ -44,7 +53,7 @@ KEY_BOMB = %10000000
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; game constants
|
; game constants
|
||||||
XINSET = 4 ; By how many BYTE cols the display is offset into X
|
XINSET = 4 ; By how many BYTE cols the display is offset into X
|
||||||
XSIZE = (80 - (4 * XINSET)) ; columns on screen (1 BYTE col = 2 game cols)
|
XSIZE = (80 - (4 * XINSET)) ; columns on screen (1 BYTE col = 2 game cols)
|
||||||
YSIZE = 192 ; lines on screen
|
YSIZE = 192 ; lines on screen
|
||||||
|
|
||||||
WORLD_START = $08 ; top line where world is drawn
|
WORLD_START = $08 ; top line where world is drawn
|
||||||
|
|
|
@ -49,6 +49,11 @@ loop:
|
||||||
bcc notnum
|
bcc notnum
|
||||||
sbc #'1' ; stages are 0 based
|
sbc #'1' ; stages are 0 based
|
||||||
sta stage
|
sta stage
|
||||||
|
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
|
|
||||||
lda #0 ; reset where the buffers will start
|
lda #0 ; reset where the buffers will start
|
||||||
sta bufferInsert
|
sta bufferInsert
|
||||||
jsr drawClearScreen
|
jsr drawClearScreen
|
||||||
|
@ -58,6 +63,11 @@ loop:
|
||||||
notnum:
|
notnum:
|
||||||
cmp #$1b ; ESC key
|
cmp #$1b ; ESC key
|
||||||
bne notQuit
|
bne notQuit
|
||||||
|
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
|
|
||||||
lda #1
|
lda #1
|
||||||
sta pause ; abuse pause to signal quit
|
sta pause ; abuse pause to signal quit
|
||||||
rts
|
rts
|
||||||
|
@ -69,6 +79,10 @@ notQuit:
|
||||||
bne notHelp
|
bne notHelp
|
||||||
|
|
||||||
help:
|
help:
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
|
|
||||||
jmp uiShowEditHelp
|
jmp uiShowEditHelp
|
||||||
|
|
||||||
notHelp:
|
notHelp:
|
||||||
|
@ -78,6 +92,10 @@ notHelp:
|
||||||
bne notSave
|
bne notSave
|
||||||
|
|
||||||
save:
|
save:
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
|
|
||||||
lda #0 ; a 0 is save
|
lda #0 ; a 0 is save
|
||||||
jsr uiFileLoadSave
|
jsr uiFileLoadSave
|
||||||
jmp editLoop
|
jmp editLoop
|
||||||
|
@ -89,6 +107,10 @@ notSave:
|
||||||
bne done
|
bne done
|
||||||
|
|
||||||
load:
|
load:
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
|
|
||||||
lda #1 ; a 1 is load
|
lda #1 ; a 1 is load
|
||||||
jsr uiFileLoadSave
|
jsr uiFileLoadSave
|
||||||
jmp editLoop
|
jmp editLoop
|
||||||
|
@ -235,8 +257,8 @@ missile:
|
||||||
sta zCollision
|
sta zCollision
|
||||||
sta stopScrolling
|
sta stopScrolling
|
||||||
sta bufferInsert
|
sta bufferInsert
|
||||||
|
sta dangerTickIdx
|
||||||
sta pause
|
sta pause
|
||||||
sta terrainOrigin
|
|
||||||
|
|
||||||
tax ; start at 0 for the buffers
|
tax ; start at 0 for the buffers
|
||||||
:
|
:
|
||||||
|
@ -257,6 +279,10 @@ missile:
|
||||||
|
|
||||||
lda #$ff
|
lda #$ff
|
||||||
sta lastInput ; set no keys down - all 1's
|
sta lastInput ; set no keys down - all 1's
|
||||||
|
sta nextStage
|
||||||
|
|
||||||
|
lda #DANGER_TICKS
|
||||||
|
sta dangerTickCount
|
||||||
|
|
||||||
lda #(XSIZE/2) ; middle of the screen in X
|
lda #(XSIZE/2) ; middle of the screen in X
|
||||||
sta playerShipX ; is where the cursor is
|
sta playerShipX ; is where the cursor is
|
||||||
|
|
|
@ -5,71 +5,180 @@
|
||||||
; Stefan Wessels, 2019
|
; Stefan Wessels, 2019
|
||||||
; This is free and unencumbered software released into the public domain.
|
; This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
|
||||||
PATHNAME = $0280
|
|
||||||
MLI = $BF00
|
|
||||||
|
|
||||||
QUIT_CALL = $65
|
|
||||||
OPEN_CALL = $C8
|
|
||||||
READ_CALL = $CA
|
|
||||||
WRITE_CALL = $CB
|
|
||||||
CLOSE_CALL = $CC
|
|
||||||
CREATE_CALL = $C0
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.segment "DATA"
|
.segment "DATA"
|
||||||
|
|
||||||
createParam:
|
createParam:
|
||||||
.byte $07 ;PARAM_COUNT
|
.byte $07 ; param_count
|
||||||
.addr PATHNAME ;PATHNAME
|
createName:
|
||||||
.byte $C3 ;ACCESS
|
.addr PATHNAME ; pathname
|
||||||
.byte $06 ;FILE_TYPE (6 is binay)
|
.byte $C3 ; access
|
||||||
.word $0000 ;AUX_TYPE
|
.byte $06 ; file_type (6 is binay)
|
||||||
.byte $01 ;STORAGE_TYPE
|
.word $0000 ; aux_type
|
||||||
.word $0000 ;CREATE_DATE
|
.byte $01 ; storage_type
|
||||||
.word $0000 ;CREATE_TIME
|
.word $0000 ; create_date
|
||||||
|
.word $0000 ; create_time
|
||||||
|
|
||||||
openParam:
|
openParam:
|
||||||
.byte $03 ;PARAM_COUNT
|
.byte $03 ; param_count
|
||||||
.addr PATHNAME ;PATHNAME
|
openName:
|
||||||
.addr $2000-$400 ;IO_BUFFER
|
.addr PATHNAME ; pathname
|
||||||
|
.addr $2000-$400 ; io_buffer
|
||||||
openRef:
|
openRef:
|
||||||
.byte $00 ;REF_NUM
|
.byte $00 ; ref_num
|
||||||
|
|
||||||
readParam:
|
readParam:
|
||||||
.byte $04 ;PARAM_COUNT
|
.byte $04 ; param_count
|
||||||
readRef:
|
readRef:
|
||||||
.byte $00 ;REF_NUM
|
.byte $00 ; ref_num
|
||||||
.addr worldDataStart ;DATA_BUFFER
|
readAddress:
|
||||||
.word $FFFF ;REQUEST_COUNT
|
.addr worldDataStart ; data_buffer
|
||||||
.word $0000 ;TRANS_COUNT
|
readLength:
|
||||||
|
.word $FFFF ; request_count
|
||||||
|
.word $0000 ; trans_count
|
||||||
|
|
||||||
writeParam:
|
writeParam:
|
||||||
.byte $04 ;PARAM_COUNT
|
.byte $04 ; param_count
|
||||||
writeRef:
|
writeRef:
|
||||||
.byte $00 ;REF_NUM
|
.byte $00 ; ref_num
|
||||||
.addr worldDataStart ;DATA_BUFFER
|
writeAddress:
|
||||||
.word worldDataEnd-worldDataStart ;REQUEST_COUNT
|
.addr worldDataStart ; data_buffer
|
||||||
.word $0000 ;TRANS_COUNT
|
writeLength:
|
||||||
|
.word worldDataEnd-worldDataStart ; request_count
|
||||||
|
.word $0000 ; trans_count
|
||||||
|
|
||||||
closeParam:
|
closeParam:
|
||||||
.byte $01 ;PARAM_COUNT
|
.byte $01 ; param_count
|
||||||
closeRef:
|
closeRef:
|
||||||
.byte $00 ;REF_NUM
|
.byte $00 ; ref_num
|
||||||
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.segment "CODE"
|
.segment "CODE"
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.proc fileSave
|
.proc saveWorld
|
||||||
|
|
||||||
jsr MLI ; create the file
|
lda #<worldDataStart ; set the location
|
||||||
.byte CREATE_CALL
|
sta writeAddress
|
||||||
.word createParam
|
lda #>worldDataStart
|
||||||
bcc :+
|
sta writeAddress + 1
|
||||||
jmp error
|
|
||||||
|
lda #<(worldDataEnd-worldDataStart) ; set the size
|
||||||
|
sta writeLength
|
||||||
|
lda #>(worldDataEnd-worldDataStart)
|
||||||
|
sta writeLength + 1
|
||||||
|
|
||||||
|
jmp saveFile ; save
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
.proc loadWorld
|
||||||
|
|
||||||
|
lda #<worldDataStart ; set the location
|
||||||
|
sta readAddress
|
||||||
|
lda #>worldDataStart
|
||||||
|
sta readAddress + 1
|
||||||
|
|
||||||
|
lda #<(worldDataEnd-worldDataStart) ; set the length (size)
|
||||||
|
sta readLength
|
||||||
|
lda #>(worldDataEnd-worldDataStart)
|
||||||
|
sta readLength + 1
|
||||||
|
|
||||||
|
jmp loadFile ; load
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
.proc saveHighScores
|
||||||
|
|
||||||
|
jsr setHighScoreFileNames ; set the name
|
||||||
|
|
||||||
|
lda #<scoresTable ; set the location
|
||||||
|
sta writeAddress
|
||||||
|
lda #>scoresTable
|
||||||
|
sta writeAddress + 1
|
||||||
|
|
||||||
|
lda #<(scoresTableEnd-scoresTable) ; set the size
|
||||||
|
sta writeLength
|
||||||
|
lda #>(scoresTableEnd-scoresTable)
|
||||||
|
sta writeLength + 1
|
||||||
|
|
||||||
|
jmp saveFile ; save
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
.proc loadHighScores
|
||||||
|
|
||||||
|
jsr setHighScoreFileNames ; set the name
|
||||||
|
|
||||||
|
lda #<scoresTable ; set the location
|
||||||
|
sta readAddress
|
||||||
|
lda #>scoresTable
|
||||||
|
sta readAddress + 1
|
||||||
|
|
||||||
|
lda #<(scoresTableEnd-scoresTable) ; set the size
|
||||||
|
sta readLength
|
||||||
|
lda #>(scoresTableEnd-scoresTable)
|
||||||
|
sta readLength + 1
|
||||||
|
|
||||||
|
jmp loadFile ; load
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
.proc setHighScoreFileNames
|
||||||
|
|
||||||
|
ldx pathPos ; append to the end of the path
|
||||||
|
ldy #0 ; from the 1st char pf the name
|
||||||
|
:
|
||||||
|
lda hihgScoreFileName, y ; copy name to path
|
||||||
|
sta PATHNAME, x
|
||||||
|
beq :+
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
bne :-
|
||||||
|
|
||||||
:
|
:
|
||||||
jsr MLI
|
stx PATHNAME
|
||||||
|
dec PATHNAME ; don't count the trailing null
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
.proc setWorldFileName
|
||||||
|
|
||||||
|
zaEntryL = zWorldPtr ; internal - ptr to a string being entered (abusing world ptr)
|
||||||
|
|
||||||
|
tya ; add the file length to the path length
|
||||||
|
clc
|
||||||
|
adc pathPos
|
||||||
|
tax
|
||||||
|
stx PATHNAME
|
||||||
|
dec PATHNAME ; don't count the trailing null
|
||||||
|
|
||||||
|
:
|
||||||
|
lda (zaEntryL), y ; copy the file name to the end of the path
|
||||||
|
sta PATHNAME, x
|
||||||
|
dex
|
||||||
|
dey
|
||||||
|
bpl :-
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
.proc saveFile
|
||||||
|
|
||||||
|
jsr MLI ; create the file, ignoring errors
|
||||||
|
.byte CREATE_CALL
|
||||||
|
.word createParam
|
||||||
|
|
||||||
|
jsr MLI ; open the (now hopefully existing) file
|
||||||
.byte OPEN_CALL
|
.byte OPEN_CALL
|
||||||
.word openParam
|
.word openParam
|
||||||
bcc :+
|
bcc :+
|
||||||
|
@ -96,7 +205,7 @@ error:
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.proc fileLoad
|
.proc loadFile
|
||||||
|
|
||||||
jsr MLI
|
jsr MLI
|
||||||
.byte OPEN_CALL
|
.byte OPEN_CALL
|
||||||
|
|
|
@ -41,16 +41,6 @@ preamble: ; bring terrain on-screen with n
|
||||||
wait #$40 ; give the user a moment to get ready
|
wait #$40 ; give the user a moment to get ready
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
lda runAudio ; alternate between game and audio
|
|
||||||
eor #1
|
|
||||||
sta runAudio
|
|
||||||
beq :+ ; run the game when runAudio eq 0
|
|
||||||
jsr serviceAudio ; run the audio
|
|
||||||
jmp loop ; go back and flip to the game
|
|
||||||
:
|
|
||||||
lda playerDead ; check if the input should run
|
|
||||||
bne skip ; and skip if not
|
|
||||||
|
|
||||||
jsr inputGame ; read joystick and move player, check for pause key
|
jsr inputGame ; read joystick and move player, check for pause key
|
||||||
cmp #$9b ; check for ESC
|
cmp #$9b ; check for ESC
|
||||||
bne skip ; if not, check for pause
|
bne skip ; if not, check for pause
|
||||||
|
@ -90,12 +80,13 @@ delay:
|
||||||
|
|
||||||
lda victory ; when set, either a nuke or back home
|
lda victory ; when set, either a nuke or back home
|
||||||
bne win
|
bne win
|
||||||
|
jsr serviceAudio ; run the audio
|
||||||
lda playerDead
|
lda playerDead
|
||||||
beq loop ; playerDead = 0 means alive so keep going
|
beq loop ; playerDead = 0 means alive so keep going
|
||||||
|
|
||||||
died:
|
died:
|
||||||
dec playerDead ; the counter holds the explosion state
|
dec playerDead ; the counter holds the explosion state
|
||||||
bne loop ; don't get user input
|
bne skip ; don't get user input
|
||||||
jsr gameNextPlayer ; switch players if a 2p game
|
jsr gameNextPlayer ; switch players if a 2p game
|
||||||
jmp outerloop
|
jmp outerloop
|
||||||
|
|
||||||
|
@ -153,7 +144,6 @@ win:
|
||||||
sta dangerTickIdx
|
sta dangerTickIdx
|
||||||
sta moveHorz
|
sta moveHorz
|
||||||
sta moveVert
|
sta moveVert
|
||||||
sta runAudio
|
|
||||||
sta flipFlop
|
sta flipFlop
|
||||||
sta pause
|
sta pause
|
||||||
sta fireCoolDown
|
sta fireCoolDown
|
||||||
|
|
|
@ -288,8 +288,11 @@ joyDone:
|
||||||
sta rawEor ; and save this state as the key state
|
sta rawEor ; and save this state as the key state
|
||||||
|
|
||||||
Button_B:
|
Button_B:
|
||||||
bit Bit7Mask ; Button_B
|
bit Bit7Mask ; Button_B
|
||||||
beq Button_A
|
beq Button_A
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
lda brushType
|
lda brushType
|
||||||
bne radar
|
bne radar
|
||||||
ora #KEY_RIGHT ; when pressed, move right as well
|
ora #KEY_RIGHT ; when pressed, move right as well
|
||||||
|
@ -305,6 +308,9 @@ radar:
|
||||||
Button_A:
|
Button_A:
|
||||||
bit Bit8Mask ; Button_A
|
bit Bit8Mask ; Button_A
|
||||||
beq up
|
beq up
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
lda brushType
|
lda brushType
|
||||||
bne missile
|
bne missile
|
||||||
ora #KEY_RIGHT
|
ora #KEY_RIGHT
|
||||||
|
@ -356,6 +362,9 @@ Button_Start:
|
||||||
and lastInput ; and debounce
|
and lastInput ; and debounce
|
||||||
bit Bit5Mask ; test if Start button down
|
bit Bit5Mask ; test if Start button down
|
||||||
beq joyDone
|
beq joyDone
|
||||||
|
lda #AUDIO_UI_TICK ; make a sound
|
||||||
|
sta audioFrame
|
||||||
|
jsr serviceAudio
|
||||||
lda brushType ; if down, toggle the brush type between terrain and enemies
|
lda brushType ; if down, toggle the brush type between terrain and enemies
|
||||||
eor #1
|
eor #1
|
||||||
sta brushType
|
sta brushType
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
jmp main ; This ends up at $080d (sys 2061's target)
|
jmp main ; This ends up at $080d (sys 2061's target)
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
|
.include "apple2.inc" ; Apple II locations from cc65
|
||||||
.include "defs.inc" ; constants
|
.include "defs.inc" ; constants
|
||||||
.include "macros.inc" ; vpoke, vpeek, print* & wait.
|
.include "macros.inc" ; vpoke, vpeek, print* & wait.
|
||||||
.include "zpvars.inc" ; Zero Page usage (variables)
|
.include "zpvars.inc" ; Zero Page usage (variables)
|
||||||
|
@ -39,12 +40,15 @@ jmp main ; This ends up at $080d (sys 206
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.segment "CODE"
|
.segment "CODE"
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
.proc main
|
.proc main
|
||||||
|
|
||||||
jsr mainGameSetup
|
jsr mainGameSetup
|
||||||
:
|
:
|
||||||
jsr inputCheckForInput ; wait for user interaction
|
jsr inputCheckForInput ; wait for user interaction
|
||||||
beq :-
|
beq :-
|
||||||
|
jsr drawClearScreen
|
||||||
jsr drawPresent
|
jsr drawPresent
|
||||||
:
|
:
|
||||||
jsr uiTitleScreen
|
jsr uiTitleScreen
|
||||||
|
@ -56,6 +60,27 @@ jmp main ; This ends up at $080d (sys 206
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.proc mainGameSetup
|
.proc mainGameSetup
|
||||||
|
|
||||||
|
lda #$0
|
||||||
|
sta backLayer ; set back layer to 0
|
||||||
|
sta audioFrame ; set all audio channels to off (0)
|
||||||
|
sta numPlayers ; Init initially to 0 (not set for training)
|
||||||
|
|
||||||
|
lda PATHNAME ; length of file path
|
||||||
|
tax ; put in index
|
||||||
|
:
|
||||||
|
lda PATHNAME, x ; get character
|
||||||
|
cmp #'/' ; look backwards for directory seperator
|
||||||
|
beq :+
|
||||||
|
dex
|
||||||
|
bne :-
|
||||||
|
|
||||||
|
:
|
||||||
|
inx ; 1 or 1 past / is where the file name starts
|
||||||
|
stx pathPos ; save that location
|
||||||
|
|
||||||
|
jsr loadHighScores ; load high scores from disc
|
||||||
|
bcc cont ; on success, skip the init
|
||||||
|
|
||||||
ldx #((textHSEnd-textHS) - 1) ; empty the high score names to spaces
|
ldx #((textHSEnd-textHS) - 1) ; empty the high score names to spaces
|
||||||
store:
|
store:
|
||||||
lda textHS, x
|
lda textHS, x
|
||||||
|
@ -66,19 +91,16 @@ store:
|
||||||
dex
|
dex
|
||||||
bpl store
|
bpl store
|
||||||
|
|
||||||
ldx #((highScoresEnd-highScores) - 1) ; set high score table scores to 0
|
|
||||||
lda #$0
|
lda #$0
|
||||||
sta backLayer ; set back layer to 0
|
ldx #((highScoresEnd-highScores) - 1) ; set high score table scores to 0
|
||||||
sta audioFrame ; set all audio channels to off (0)
|
|
||||||
sta numPlayers ; Init initially to 0 (not set for training)
|
|
||||||
:
|
:
|
||||||
sta highScores, x
|
sta highScores, x
|
||||||
dex
|
dex
|
||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
ldx #(AUDIO_EXPLOSION | AUDIO_BOMB_DROP | AUDIO_FIRE | AUDIO_UI_TICK)
|
cont:
|
||||||
|
lda #(AUDIO_EXPLOSION | AUDIO_BOMB_DROP | AUDIO_FIRE | AUDIO_UI_TICK)
|
||||||
stx audioMask ; set the mask to all channels on ($ff)
|
sta audioMask ; set the mask for default ON channels
|
||||||
|
|
||||||
ldx #((BitMasksEnd - BitMasks) - 1)
|
ldx #((BitMasksEnd - BitMasks) - 1)
|
||||||
:
|
:
|
||||||
|
|
|
@ -38,6 +38,7 @@ textTrain: .asciiz "\"T\" FOR TRAINING CONTROL CENTER"
|
||||||
textEdit: .asciiz "\"E\" FOR THE LANDSCAPE EDITOR"
|
textEdit: .asciiz "\"E\" FOR THE LANDSCAPE EDITOR"
|
||||||
textLoad: .asciiz "\"L\" TO LOAD ANOTHER LANDSCAPE"
|
textLoad: .asciiz "\"L\" TO LOAD ANOTHER LANDSCAPE"
|
||||||
textSirens: .asciiz "\"S\" SET AUDIO: "
|
textSirens: .asciiz "\"S\" SET AUDIO: "
|
||||||
|
textQuit: .asciiz "\"Q\" QUIT"
|
||||||
|
|
||||||
; main menu audio options
|
; main menu audio options
|
||||||
textAudio1: .asciiz "ENGINE, SFX"
|
textAudio1: .asciiz "ENGINE, SFX"
|
||||||
|
@ -102,28 +103,7 @@ textFileSuccess: .asciiz "SUCCESS."
|
||||||
textFileThe: .asciiz "The"
|
textFileThe: .asciiz "The"
|
||||||
textFileFailed: .asciiz "Failed. Error Code"
|
textFileFailed: .asciiz "Failed. Error Code"
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
hihgScoreFileName:.asciiz "PENSCORES"
|
||||||
.segment "DATA"
|
|
||||||
|
|
||||||
textHS:
|
|
||||||
textHighScore1: .asciiz "123456"
|
|
||||||
textHighScore2: .asciiz "123456"
|
|
||||||
textHighScore3: .asciiz "123456"
|
|
||||||
textHighScore4: .asciiz "123456"
|
|
||||||
textHighScore5: .asciiz "123456"
|
|
||||||
textHSEnd:
|
|
||||||
|
|
||||||
textStage: .asciiz "1"
|
|
||||||
textPlayerNum: .asciiz "1"
|
|
||||||
textNumber: .asciiz "1234567" ; score display 10x score - extra digit needed
|
|
||||||
textDangerBar: .asciiz "123"
|
|
||||||
textEnd:
|
|
||||||
|
|
||||||
textFileName: .asciiz "PENEWORLD01" ; default file name
|
|
||||||
textFilePad: .asciiz "" ; This makes the null terminator on textFileName viable and a 12 char filename
|
|
||||||
textFileNameEnd:
|
|
||||||
szHex: .asciiz " "
|
|
||||||
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.segment "CODE"
|
.segment "CODE"
|
||||||
|
|
|
@ -199,6 +199,9 @@ show: ; a high-score was set, so show
|
||||||
width = tempBlock + 14
|
width = tempBlock + 14
|
||||||
height = tempBlock + 15
|
height = tempBlock + 15
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta audioExplFrame ; use this as a delay counter for logo sound
|
||||||
|
|
||||||
lda #((dataLogoLinesEnd - dataLogoLines) / 4)
|
lda #((dataLogoLinesEnd - dataLogoLines) / 4)
|
||||||
sta remain
|
sta remain
|
||||||
|
|
||||||
|
@ -215,6 +218,8 @@ show: ; a high-score was set, so show
|
||||||
loop:
|
loop:
|
||||||
dec remain ; iterate over all lines
|
dec remain ; iterate over all lines
|
||||||
bpl :+
|
bpl :+
|
||||||
|
lda #0
|
||||||
|
sta audioExplFrame
|
||||||
rts
|
rts
|
||||||
:
|
:
|
||||||
ldx index
|
ldx index
|
||||||
|
@ -285,6 +290,18 @@ plot:
|
||||||
|
|
||||||
lda skip ; if key/button pressed - fast draw logo
|
lda skip ; if key/button pressed - fast draw logo
|
||||||
bne :+
|
bne :+
|
||||||
|
lda audioMask
|
||||||
|
beq nosnd
|
||||||
|
snd:
|
||||||
|
ldy audioExplFrame
|
||||||
|
ldx #4
|
||||||
|
jsr playNote ; play the note
|
||||||
|
dec audioExplFrame ; alter the note
|
||||||
|
dec audioExplFrame
|
||||||
|
bmi nosnd ; variable decay so that the duration
|
||||||
|
dec audioExplFrame ; is a close match to when the logo ends
|
||||||
|
dec audioExplFrame
|
||||||
|
nosnd:
|
||||||
jsr inputCheckForInput ; check for user interaction
|
jsr inputCheckForInput ; check for user interaction
|
||||||
sta skip
|
sta skip
|
||||||
bne :+
|
bne :+
|
||||||
|
@ -357,6 +374,7 @@ redraw:
|
||||||
print textEdit , #(02), #(8*13)
|
print textEdit , #(02), #(8*13)
|
||||||
print textLoad , #(01), #(8*14)
|
print textLoad , #(01), #(8*14)
|
||||||
print textSirens , #(05), #(8*15)
|
print textSirens , #(05), #(8*15)
|
||||||
|
print textQuit , #(12), #(8*16)
|
||||||
|
|
||||||
lda audioMask
|
lda audioMask
|
||||||
beq none
|
beq none
|
||||||
|
@ -416,7 +434,10 @@ load:
|
||||||
jsr uiFileLoadSave ; call the code to do file name and load
|
jsr uiFileLoadSave ; call the code to do file name and load
|
||||||
jmp uiMainMenu
|
jmp uiMainMenu
|
||||||
|
|
||||||
sirens:
|
sirens: ; For Apple II this is the "set sound type"
|
||||||
|
cpx #5
|
||||||
|
bne quit
|
||||||
|
|
||||||
lda audioMask
|
lda audioMask
|
||||||
beq audioSetAll
|
beq audioSetAll
|
||||||
bit Bit8432Mask
|
bit Bit8432Mask
|
||||||
|
@ -431,10 +452,23 @@ audioSetAll:
|
||||||
lda #%01111111
|
lda #%01111111
|
||||||
:
|
:
|
||||||
sta audioMask
|
sta audioMask
|
||||||
jmp redraw ; siren code instead of this
|
jmp redraw
|
||||||
|
|
||||||
|
quit:
|
||||||
|
inc PWREDUP ; Make sure this isn't a power vector
|
||||||
|
|
||||||
options: .byte "12TELS"
|
jsr MLI ; call the prodos mli ($bf00) - never returns here
|
||||||
|
.byte QUIT_CALL ; call type = quit
|
||||||
|
.addr quitParam ; pointer to parameter table
|
||||||
|
|
||||||
|
quitParam:
|
||||||
|
.byte 4 ; number of parameters is 4
|
||||||
|
.byte 0 ; quit type
|
||||||
|
.word 0000 ; reserved
|
||||||
|
.byte 0 ; reserved
|
||||||
|
.word 0000 ; reserved
|
||||||
|
|
||||||
|
options: .byte "12TELSQ"
|
||||||
optionsEnd:
|
optionsEnd:
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
@ -778,7 +812,8 @@ copyScore:
|
||||||
dey
|
dey
|
||||||
bpl :-
|
bpl :-
|
||||||
|
|
||||||
jmp uiGetHighScoreName ; now get the new name
|
jsr uiGetHighScoreName ; now get the new name
|
||||||
|
jmp saveHighScores
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
@ -981,13 +1016,7 @@ enter:
|
||||||
lda #0 ; and null terminate the string
|
lda #0 ; and null terminate the string
|
||||||
sta (zaEntryL), y
|
sta (zaEntryL), y
|
||||||
|
|
||||||
setPathName:
|
jsr setWorldFileName
|
||||||
sty PATHNAME
|
|
||||||
:
|
|
||||||
lda (zaEntryL), y
|
|
||||||
sta PATHNAME+1,y
|
|
||||||
dey
|
|
||||||
bpl :-
|
|
||||||
|
|
||||||
lda #1 ; enter has been pressed - it's all over
|
lda #1 ; enter has been pressed - it's all over
|
||||||
sta allOver ; time to attempt a disc action, but just redraw once more
|
sta allOver ; time to attempt a disc action, but just redraw once more
|
||||||
|
@ -996,13 +1025,13 @@ setPathName:
|
||||||
disc:
|
disc:
|
||||||
lda forLoad ; load or save
|
lda forLoad ; load or save
|
||||||
beq save
|
beq save
|
||||||
|
|
||||||
jsr fileLoad ; load the file by the name
|
jsr loadWorld ; load the file by the name
|
||||||
bcs fail ; if carry set then there's an error
|
bcs fail ; if carry set then there's an error
|
||||||
jmp success ; no error - all good
|
jmp success ; no error - all good
|
||||||
|
|
||||||
save:
|
save:
|
||||||
jsr fileSave ; save the file
|
jsr saveWorld ; save the file
|
||||||
bcs fail ; if carry set then there's an error
|
bcs fail ; if carry set then there's an error
|
||||||
|
|
||||||
success:
|
success:
|
||||||
|
|
|
@ -20,6 +20,9 @@ rsEnd:
|
||||||
|
|
||||||
playerStats: .res ((rsEnd-rsStart) * 2) ; 2 copies of stats, for p1 and p2 is 2p game
|
playerStats: .res ((rsEnd-rsStart) * 2) ; 2 copies of stats, for p1 and p2 is 2p game
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
; High scores table saved to disc
|
||||||
|
scoresTable:
|
||||||
highScores:
|
highScores:
|
||||||
highScore1: .res 3
|
highScore1: .res 3
|
||||||
highScore2: .res 3
|
highScore2: .res 3
|
||||||
|
@ -28,6 +31,29 @@ highScore4: .res 3
|
||||||
highScore5: .res 3
|
highScore5: .res 3
|
||||||
highScoresEnd:
|
highScoresEnd:
|
||||||
|
|
||||||
|
textHS:
|
||||||
|
textHighScore1: .asciiz "123456"
|
||||||
|
textHighScore2: .asciiz "123456"
|
||||||
|
textHighScore3: .asciiz "123456"
|
||||||
|
textHighScore4: .asciiz "123456"
|
||||||
|
textHighScore5: .asciiz "123456"
|
||||||
|
textHSEnd:
|
||||||
|
scoresTableEnd:
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
|
; user facing text area
|
||||||
|
textStage: .asciiz "1"
|
||||||
|
textPlayerNum: .asciiz "1"
|
||||||
|
textNumber: .asciiz "1234567" ; score display 10x score - extra digit needed
|
||||||
|
textDangerBar: .asciiz "123"
|
||||||
|
textEnd:
|
||||||
|
|
||||||
|
textFileName: .asciiz "PENEWORLD01" ; default file name
|
||||||
|
textFilePad: .asciiz "" ; This makes the null terminator on textFileName viable and a 12 char filename
|
||||||
|
textFileNameEnd:
|
||||||
|
szHex: .asciiz " "
|
||||||
|
|
||||||
|
;-----------------------------------------------------------------------------
|
||||||
; per "run" buffers
|
; per "run" buffers
|
||||||
bombX: .res NUM_BOMBS ; 2 bombs allowed, their x values
|
bombX: .res NUM_BOMBS ; 2 bombs allowed, their x values
|
||||||
bombY: .res NUM_BOMBS ; Y values for 2 bombs (0=available)
|
bombY: .res NUM_BOMBS ; Y values for 2 bombs (0=available)
|
||||||
|
|
|
@ -57,7 +57,6 @@ dangerTickCount: .res 1 ; how often a dot is added to th
|
||||||
dangerTickIdx: .res 1 ; the index into the text that holds the danger line of dots
|
dangerTickIdx: .res 1 ; the index into the text that holds the danger line of dots
|
||||||
moveHorz: .res 1 ; keeps track of horizontal movement - only moves every 2nd frame
|
moveHorz: .res 1 ; keeps track of horizontal movement - only moves every 2nd frame
|
||||||
moveVert: .res 1 ; keeps track of vertical movement - moves 4 rows but over 2 frames
|
moveVert: .res 1 ; keeps track of vertical movement - moves 4 rows but over 2 frames
|
||||||
runAudio: .res 1 ; flip-flop for service audio or run a game frame
|
|
||||||
|
|
||||||
; helper variables
|
; helper variables
|
||||||
updateHUD: .res 1 ; 0 - don't draw, 1+ - clean and redraw
|
updateHUD: .res 1 ; 0 - don't draw, 1+ - clean and redraw
|
||||||
|
@ -67,7 +66,9 @@ enemyHit: .res 1 ; the flags of the enemy destroy
|
||||||
enemyHitType: .res 1 ; 0 = nuke, 1 = missile, 2 = monster, 3 = radar, $ff - nothing
|
enemyHitType: .res 1 ; 0 = nuke, 1 = missile, 2 = monster, 3 = radar, $ff - nothing
|
||||||
lastInput: .res 1 ; holds the value of the prev joystick frame
|
lastInput: .res 1 ; holds the value of the prev joystick frame
|
||||||
pause: .res 1 ; <> 0 when the game is paused
|
pause: .res 1 ; <> 0 when the game is paused
|
||||||
fireCoolDown: .res 1
|
fireCoolDown: .res 1 ; decay to zero before fire allowed
|
||||||
|
pathPos: .res 1 ; index to start of file name in path
|
||||||
|
|
||||||
|
|
||||||
; audio variables
|
; audio variables
|
||||||
audioMask: .res 1 ; which audio "channels" are active (and with audioFrame)
|
audioMask: .res 1 ; which audio "channels" are active (and with audioFrame)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user