Variables initialization on strart

This commit is contained in:
Pecusx
2022-08-09 13:30:21 +02:00
parent 234fbc5a4a
commit 664dc1568d
6 changed files with 85 additions and 28 deletions
+22 -6
View File
@@ -2,6 +2,22 @@
.IF *>0 ;this is a trick that prevents compiling this file alone
; initial values for some variables
initialvaluesStart
I_OptionsTable .by 0,1,2,2,0,1,3,2
I_RoundsInTheGame .by 10 ;how many rounds in the current game
I_seppukuVal .by 75
I_mountainDeltaH .by 3
I_mountainDeltaL .by $ff
;----------------------------------------------------
; 4x4 text buffer
I_ResultLineBuffer
dta d" ", $ff
I_LineHeader1
dta d"# ROUND: "
I_RoundNrDisplay
dta d" #", $ff
initialvaluesCount = *-initialvaluesstart ; MAX 128 bytes !
;===================================================================================
;==========================CONSTANT TABLES, do not erase!===========================
;===================================================================================
@@ -678,7 +694,7 @@ nineplus dta d"9"+1
space dta d" "
;------credits
CreditsStart
dta d" "*
dta d" "*
dta d"You were playin",d"g"*
dta d"Scorc",d"h"*
dta d"Warsaw, Miam",d"i"*
@@ -690,7 +706,7 @@ CreditsStart
dta d"Tomasz 'Pecus' Peck",d"o"*
dta d"Pawel 'pirx' Kalinowsk",d"i"*
dta d" "*
dta d"SFX and Music",d"c"*
dta d"SFX and Musi",d"c"*
dta d"Michal 'Miker' Szpilowsk",d"i"*
dta d" "*
dta d"Additional musi",d"c"*
@@ -704,12 +720,12 @@ CreditsStart
dta d"Krzysztof 'Kaz' Ziembi",d"k"*
dta d" "*
dta d"Ideas and Q",d"A"*
dta d"Bocianu, Probabilitydragon, KrzysRog",d","*
dta d"Beeblebrox, EnderDude, lopezpb, Dracon",d","*
dta d"Bocianu, Probabilitydragon, EnderDude",d","*
dta d"Beeblebrox, KrzysRog, lopezpb, Dracon",d","*
dta d"brad-colbert, archon800",d","*
dta d"Shaggy the Ataria",d"n"*
dta d" "*
dta d" "*
dta d"Stay tuned for the FujiNet version",d"!"*
dta d" "*
dta d" "*
CreditsEnd
.endif
+3 -3
View File
@@ -945,7 +945,7 @@ NoFallingSound
and #01
beq DoNotClearParachute
; here we clear the parachute
ldx TankNr
; ldx TankNr
jsr DrawTankParachute
DoNotClearParachute
mva #0 Erase
@@ -1087,7 +1087,7 @@ EndOfFCycle
cmp #3 ; parachute and falling
bne DoNotDrawParachute
; here we draw parachute
ldx TankNr
; ldx TankNr
jsr DrawTankParachute
jsr WaitOneFrame ; only if tank with parachute
RapidFalling
@@ -1115,7 +1115,7 @@ ForceFallLeft
jne TankFallsX
EndOfFall
mva #1 Erase
ldx TankNr
; ldx TankNr
; if tank was falling down having parachute,
; we must deduct one parachute
lda Parachute
+40 -6
View File
@@ -112,7 +112,7 @@
icl 'lib/macro.hea'
;splash screen and musix
;icl 'artwork/HIMARS14.asm'
icl 'artwork/HIMARS14.asm'
;Game loading address
ORG $3000
WeaponFont
@@ -126,8 +126,25 @@ WeaponFont
;--------------------------------------------------
; Game Code
;--------------------------------------------------
START
FirstSTART
mva #0 dmactls ; dark screen
jsr WaitOneFrame
; one time zero variables in RAM (non zero page)
lda #0
ldy #OneTimeZeroVariablesCount-1
@ sta OneTimeZeroVariables
dey
bpl @-
; initialize variables in RAM (non zero page)
ldy #initialvaluesCount-1
@ lda initialvaluesStart,y
sta variablesToInitialize,y
dey
bpl @-
START
; Startup sequence
jsr Initialize
@@ -138,10 +155,14 @@ START
jsr Options ;startup screen
mva #0 dmactls ; dark screen
jsr WaitOneFrame
lda escFlag
bne START
jsr EnterPlayerNames
mva #0 dmactls ; dark screen
jsr WaitOneFrame
lda escFlag
bne START
@@ -152,7 +173,8 @@ MainGameLoop
jsr CallPurchaseForEveryTank
; issue #72 (glitches when switches)
mva #0 dmactls
mva #0 dmactls ; dark screen
jsr WaitOneFrame
jsr GetRandomWind
@@ -268,6 +290,8 @@ eskipzeroing
lda GameIsOver
beq NoGameOverYet
mva #0 dmactls ; dark screen
jsr WaitOneFrame
jsr GameOverScreen
jmp START
NoGameOverYet
@@ -1059,9 +1083,9 @@ CreditsScroll
sta COLPF2
inc CreditsVScrol
lda CreditsVScrol
cmp #16 ;not to fast
cmp #32 ;not to fast
beq nextlinedisplay
lsr ;not to fast
:2 lsr ;not to fast
sta VSCROL
jmp EndOfDLI_GO
nextlinedisplay
@@ -1446,6 +1470,16 @@ getkeyend
rts
.endp
;--------------------------------------------------
.proc IsKeyPressed ; A=0 - yes , A>0 - no
;--------------------------------------------------
lda SKSTAT
and #%00000100
beq @+
lda #1
@ and TRIG0S
rts
.endp
;--------------------------------------------------
.proc DemoModeOrKey
;--------------------------------------------------
;check demo mode
@@ -1534,4 +1568,4 @@ TheEnd
run START
run FirstSTART
BIN
View File
Binary file not shown.
+5 -2
View File
@@ -16,6 +16,8 @@
; - money each player has on the beginning of the game (moneyL i moneyH)
; - and I am sure maxwind, gravity, no_of_rounds in a game, speed of shell flight
jsr clearscreen ;let the screen be clean
mwa #OptionsDL dlptrs
; lda dmactls
; and #$fc
@@ -2001,9 +2003,10 @@ FastTank
; ldx TankNr
dex
bpl AllTanksFloatingDown
lda kbcode
and #%00000100
jsr IsKeyPressed
bne MainTanksFloatingLoop ; neverending loop
mva #0 dmactls ; dark screen
jsr WaitOneFrame
jsr GameOverResultsClear
rts
RandomizeTankPos
+15 -11
View File
@@ -8,25 +8,29 @@
; compilation to e.g. cartridge
; zero page variables are declared in program.s65 module
;=====================================================
TanksNames ; DO NOT ZERO - ticket #24
OneTimeZeroVariables
OneTimeZeroVariablesCount = variablesToInitialize-OneTimeZeroVariables ; MAX 128 bytes !
noMusic .by 0 ; 0 - play music, $ff - do not play music
noSfx .by 0 ; 0 - play SFX, $ff - do not play SFX
;----------------------------------------------------
; Color table for Game Over Screen (created in a gameover routine)
.by $00 ; labels line color
GameOverColoursTable .BYTE $80,$40,$c4,$20,$c0,$e4
;----------------------------------------------------
TanksNames ; DO NOT ZERO ON RESTART GAME - ticket #24
:6 dta d" "
;----------------------------------------------------
;Options DO NOT ZERO - ticket #27
skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30)
.DS [MaxPlayers]
;----------------------------------------------------
variablesToInitialize
;Options DO NOT ZERO ON RESTART GAME - ticket #27
OptionsTable .by 0,1,2,2,0,1,3,2
RoundsInTheGame .by 10 ;how many rounds in the current game
seppukuVal .by 75
mountainDeltaH .by 3
mountainDeltaL .by $ff
;----------------------------------------------------
; Color table for Game Over Screen
.by $00 ; labels line color
GameOverColoursTable .BYTE $80,$40,$c4,$20,$c0,$e4
;----------------------------------------------------
skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30)
.DS [MaxPlayers]
;----------------------------------------------------
noMusic .by 0 ; 0 - play music, $ff - do not play music
noSfx .by 0 ; 0 - play SFX, $ff - do not play SFX
; 4x4 text buffer
ResultLineBuffer
dta d" ", $ff