source clean-up

This commit is contained in:
2023-05-20 09:48:28 -04:00
parent 401d94eec9
commit 4fa861af3d
23 changed files with 805 additions and 12540 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
;-----------------------------------------------
; start of "variables" (RAM)
;-----------------------------------------------
OptionsHere
OptionsHere
; 0123456789012345678901234567890123456789
dta d"Players : 2 3 4 5 6 "
dta d"Cash : none 2K 8K 12K 20K "
+55 -60
View File
@@ -8,54 +8,54 @@
;-----------------------------------------------
OptionsScreen
dta d"Welcome to Scorch v. "
build ; 4 bytes from scorch.asm (fancy method) :)
build ; 4 bytes from scorch.asm (fancy method) :)
dta d" (un)2000-2023"
.IF TARGET = 800
dta d" Please select option with "
dta $fe,$dc,$dd,$ff ; cursors in inverse
dta d" and "
dta d"Tab"*
dta d" "
dta d" Press "
dta d"Return"*
dta d" to proceed "
dta d" Please select option with "
dta $fe,$dc,$dd,$ff ; cursors in inverse
dta d" and "
dta d"Tab"*
dta d" "
dta d" Press "
dta d"Return"*
dta d" to proceed "
.ELIF TARGET = 5200
dta d" Please select option with joystick one "
dta d" and press FIRE to proceed "
dta d" Please select option with joystick one "
dta d" and press FIRE to proceed "
.ENDIF
; 0123456789012345678901234567890123456789
;-----------------------------------------------
NameScreen
.IF TARGET = 800
dta d" Enter names of players "
dta d" Enter names of players "
.ELIF TARGET = 5200
dta d"Hold "
dta d "FIRE"*
dta d " to enter player names "
dta d"Hold "
dta d "FIRE"*
dta d " to enter player names "
.ENDIF
NameScreen3
dta d" Human/Atari (difficulty level) "
NameScreen5
.IF TARGET = 800
dta d"TAB"*
dta d" - Port nr "
dta $fe,$dc,$dd,$ff ; cursors in inverse
dta d" - Difficulty"
dta d" "
dta d"INV"*
dta d" - Shape "
dta d"Return"*
dta d" - Proceed "
dta d"TAB"*
dta d" - Port nr "
dta $fe,$dc,$dd,$ff ; cursors in inverse
dta d" - Difficulty"
dta d" "
dta d"INV"*
dta d" - Shape "
dta d"Return"*
dta d" - Proceed "
.ELIF TARGET = 5200
dta d" "
dta d"(5)"*
dta d" - Port/Shape "
dta d"Joy"*
dta d" - Diffic. "
dta d" "
dta d"FIRE"*
dta d" - Proceed "
dta d" "
dta d"(5)"*
dta d" - Port/Shape "
dta d"Joy"*
dta d" - Diffic. "
dta d" "
dta d"FIRE"*
dta d" - Proceed "
.ENDIF
;-----------------------------------------------
MoreUp
@@ -73,51 +73,46 @@ MoreDown
WeaponsDescription
; 0123456789012345678901234567890123456789
.IF TARGET = 800
dta d"Tab"*
dta d ": Defensive/Offensive weapon "
dta d"Tab"*
dta d ": Defensive/Offensive weapon "
.ELIF TARGET = 5200
dta d"Left"*
dta d ": Defensive/Offensive weapon"
dta d"Left"*
dta d ": Defensive/Offensive weapon"
.ENDIF
PurchaseDescription
; 0123456789012345678901234567890123456789
.IF TARGET = 800
dta d"Space"*
dta d": Purchase "
dta d"Return"*
dta d": Finish "
dta d"Space"*
dta d": Purchase "
dta d"Return"*
dta d": Finish "
.ELIF TARGET = 5200
dta d"Right"*
dta d": Purchase "
dta d"FIRE"*
dta d": Finish "
dta d"Right"*
dta d": Purchase "
dta d"FIRE"*
dta d": Finish "
.ENDIF
ActivateDescription
; 0123456789012345678901234567890123456789
.IF TARGET = 800
dta d"Space"*
dta d": Activate "
dta d"Return"*
dta d": Finish "
dta d"Space"*
dta d": Activate "
dta d"Return"*
dta d": Finish "
.ELIF TARGET = 5200
dta d"Right"*
dta d": Activate "
dta d"FIRE"*
dta d": Finish "
dta d"Right"*
dta d": Activate "
dta d"FIRE"*
dta d": Finish "
.ENDIF
EmptyLine
dta d" "
;---------------------------------------------------
OptionsTitle
.IF TARGET = 800
dta d" scorch "*
dta d" scorch "*
.ELIF TARGET = 5200
dta d" scorch supersystem "*
; dta d" scorch "*
; dta d"5"
; dta d"k"*
; dta d"2"
; dta d" "*
dta d" scorch supersystem "*
.ENDIF
DifficultyTitle
dta d" difficulty "*
@@ -135,7 +130,7 @@ GameOverTitle2
dl ; MAIN game display list
.byte $70
.byte $42
.byte $42
.word statusBuffer
.byte $02, $02
.byte $10+$80 ; 2 blank lines + DLI
+14 -14
View File
@@ -113,7 +113,7 @@ EndOfUnPlot
; game. If you are going to speed up the game, start with
; plot - it is used by every single effect starting from explosions
; through line drawing and small text output!!!
;
;
; Optimized by 0xF (Fox) THXXXX!!!
; -----------------------------------------
@@ -122,7 +122,7 @@ EndOfUnPlot
bcs unPlot.EndOfUnPlot ;nearest RTS
CheckX02
cpw xdraw #screenwidth
bcs EndOfPlot
bcs EndOfPlot
MakePlot
; let's calculate coordinates from xdraw and ydraw
@@ -190,7 +190,7 @@ ClearPlot
rts
.endp
;--------------------------------------------------
.proc drawmountains
.proc drawmountains
;--------------------------------------------------
mwa #0 xdraw
mwa #mountaintable modify
@@ -204,7 +204,7 @@ drawmountainsloop
sta ydraw
sty ydraw+1
.IF FASTER_GRAF_PROCS = 1
; there was Drawline proc
; there was Drawline proc
lda #screenheight
sec
sbc ydraw
@@ -223,7 +223,7 @@ drawmountainsloop
bne @-
; end of Drawline proc
.ELSE
; there was Drawline proc
; there was Drawline proc
drawline
jsr plot.MakePlot
inc ydraw
@@ -331,12 +331,12 @@ EmptyChar
ldx #0
CharLoopi
lda (xbyte),y
ora mask1,x
ora mask1,x
and char1,x
sta (xbyte),y
iny
lda (xbyte),y
ora mask2,x
ora mask2,x
and char2,x
sta (xbyte),y
dey
@@ -398,7 +398,7 @@ EndPutChar
cpw dy #(screenheight-1)
jcs TypeChar.EndPutChar ;nearest RTS
cpw dy #(4)
jcc TypeChar.EndPutChar ;nearest RTS
jcc TypeChar.EndPutChar ;nearest RTS
cpw dx #(screenwidth-4)
jcs TypeChar.EndPutChar ;nearest RTS
; checks ommited.
@@ -414,7 +414,7 @@ Upper4bits
sta fontind
lda #$00
sta fontind+1
adw fontind #font4x4
; and 4 bytes to the table
@@ -480,7 +480,7 @@ MaskOK01
ldx #0
CharLoopi4x4
lda (xbyte),y
ora mask1,x
ora mask1,x
bit plot4x4color
bpl PutInColor0_1 ; only mask - no char
and char1,x
@@ -488,7 +488,7 @@ PutInColor0_1
sta (xbyte),y
iny
lda (xbyte),y
ora mask2,x
ora mask2,x
bit plot4x4color
bpl PutInColor0_2 ; only mask - no char
and char2,x
@@ -555,7 +555,7 @@ EndPut4x4
inw temp
cpw temp #display+screenheight*screenBytes+1
bne @-
rts
rts
.endp
;--------------------------------------------------
@@ -577,14 +577,14 @@ EndPut4x4
.endp
;--------------------------------------------------
.proc SetMainScreen
; mva #0 dmactls
; mva #0 dmactls
SetDLI DLIinterruptGraph ; jsr SetDLI for graphics (game) screen
mwa #dl dlptrs ; issue #72 (glitches when switches)
lda #%00111110
; and #$fc
; ora #$02 ; 2=normal, 3 = wide screen width
sta dmactls
mva WallsType COLBAKS ; set color of background
mva WallsType COLBAKS ; set color of background
jsr WaitOneFrame
rts
.endp
+21 -21
View File
@@ -98,13 +98,13 @@ EndOfDLI_Text
pla
DLIinterruptNone
rti
.endp
;--------------------------------------------------
.proc VBLinterrupt
mva #0 dliCounter
mva #$02 DliColorBack
lda PAL
and #%00001110
beq itsPAL
@@ -118,7 +118,7 @@ DLIinterruptNone
itsPAL
; pressTimer is trigger tick counter. always 50 ticks / s
bit:smi:inc pressTimer ; timer halted if >127. max time measured 2.5 s
SkippedIfNTSC
bit RMT_blocked
@@ -138,7 +138,7 @@ SkippedIfNTSC
lab2
jsr RASTERMUSICTRACKER+3 ;1 play
; ------- RMT -------
SkipRMTVBL
SkipRMTVBL
bit ScrollFlag
bpl EndOfCreditsVBI
CreditsVBI
@@ -170,7 +170,15 @@ nextlinedisplay
; bne EndOfCreditsVBI
mwa #Credits DLCreditsAddr
EndOfCreditsVBI
.IF TARGET = 5200
.IF TARGET = 800
; support for joysticks :)
ldx JoystickNumber
lda STICK0,x
sta STICK0
lda STRIG0,x
sta STRIG0
jmp XITVBV
.ELIF TARGET = 5200
lda SkStatSimulator
bmi @+
inc SkStatSimulator
@@ -181,7 +189,7 @@ EndOfCreditsVBI
center = 114 ;Read analog stick and make it look like a digital stick
threshold = 60
lda JoystickNumber
asl
tax
@@ -190,28 +198,28 @@ EndOfCreditsVBI
rol stick0 ;Feed carry into digital stick value
cmp #center-threshold ;Compare with left threshold
rol stick0 ;Feed carry into digital stick value
lda paddl1,x ;Read POT1 value (vertical position)
cmp #center+threshold ;Compare with down threshold
rol stick0 ;Feed carry into digital stick value
cmp #center-threshold ;Compare with down threshold
rol stick0 ;Feed carry into digital stick value
lda stick0 ;0 indicates a press so the right/down values need to be inverted
eor #2+8
and #$0f
sta stick0
ldx JoystickNumber
; check shift key (5200 second fire button)
lda SKSTAT
:3 lsr ; third bit
and trig0,x ; and first button
and trig0,x ; and first button
;lda trig0,x
sta strig0 ;Move hardware to shadow
mva chbas chbase
lda skstat ;Reset consol key shadow is no key is pressed anymore
and #4
beq @+
@@ -225,14 +233,6 @@ EndOfCreditsVBI
tax
pla
rti
.ELSE
; support for joysticks :)
ldx JoystickNumber
lda STICK0,x
sta STICK0
lda STRIG0,x
sta STRIG0
jmp XITVBV
.ENDIF
.endp
.IF TARGET = 5200
@@ -245,7 +245,7 @@ exit pla
tax
pla
rti
.endp
.endp
.ENDIF
;--------------------------------------------------
+69 -69
View File
@@ -32,7 +32,7 @@
jsr ColorsOfSprites
mva #$ca COLOR1
mva #$00 COLBAKS ; set color of background
SetDLI DLIinterruptOptions ; jsr SetDLI for Options text screen
; -------- setup bottom (tanks) line
@@ -70,7 +70,7 @@ OptionsMainLoop
jsr getkey
bit escFlag
spl:rts
cmp #@kbcode._down ; $f ;cursor down
bne OptionsNoDown
inc:lda OptionsY
@@ -113,7 +113,7 @@ OptionsNoRight
cmp #@kbcode._ret ; $c ;Return key
bne OptionsNoReturn
rts ; options selected
OptionsNoReturn
cmp #@kbcode._tab ; Tab key
bne OptionsNoTab
@@ -141,7 +141,7 @@ NoGradientLoop
lda GradientAddrL,y
sta GradientColors
lda GradientAddrH,y
sta GradientColors+1
sta GradientColors+1
rts
.endp
@@ -174,7 +174,7 @@ OptionsLoop
cpy #optionWidth ; width of the option highlight
bne OptionsLoop
ldy #0
; next X position of the
; next X position of the
adw temp #optionWidth ; width of the option highlight
inc:lda XPos
cmp #5 ; number of options in a row
@@ -191,12 +191,12 @@ OptionsLoop
_inverter
beq invertme
; clean inversion otherwise
lda (temp),y
lda (temp),y
and #$7f ; clear the top bit
sta (temp),y
bpl @+ ; JMP
invertme
lda (temp),y
lda (temp),y
ora #$80 ; set the top bit
sta (temp),y
@
@@ -227,7 +227,7 @@ ManualPurchase
spl:rts
jsr DefensivesActivate ; activate weapons
bit escFlag
spl:rts
spl:rts
AfterManualPurchase
inc:lda TankNr
cmp NumberOfPlayers
@@ -238,8 +238,8 @@ AfterManualPurchase
.proc DefensivesActivate
;--------------------------------------------------
; This proc call Inventory and set Defensives activation first
mwa #ListOfDefensiveWeapons WeaponsListDL ;switch to the list of offensive weapons
mwa #ListOfDefensiveWeapons WeaponsListDL ;switch to the list of offensive weapons
mva #$ff IsInventory
mva #%10000000 WhichList
; offensive weapon - 0, defensive - %10000000
@@ -265,7 +265,7 @@ AfterManualPurchase
jsr CopyFromPurchaseAndGameOver
mwa #ListOfWeapons WeaponsListDL ;switch to the list of offensive weapons
; we are clearing list of the weapons
mva #$00 WhichList
; offensive weapon - 0, deffensive - %10000000
@@ -283,7 +283,7 @@ GoToActivation
bpl @+
lda #song_inventory
@ jsr RmtSongSelect
ldx tankNr
lda TankStatusColoursTable,x
sta COLOR2
@@ -331,15 +331,15 @@ AfterPurchase
ldx #$00 ; index of the checked weapon
stx HowManyOnTheListOff ; amounts of weapons (shells, bullets) in both lists
stx HowManyOnTheListDef
jsr CreateList
bit isInventory ;
bit isInventory ;
bpl ChoosingItemForPurchase
lda whichList
bne PositionDefensive
; calculate positionOnTheList from the activeWeapon (offensives)
ldx tankNr
lda activeWeapon,x
@@ -356,7 +356,7 @@ AfterPurchase
beq ?weaponFound ; jmp
PositionDefensive
jsr calcPosDefensive
?weaponFound
; weapon index in Y
@@ -368,7 +368,7 @@ PositionDefensive
;--------------------------------------------------
ChoosingItemForPurchase
;--------------------------------------------------
jsr PutLitteChar ; Places pointer at the right position
jsr getkey
bit escFlag
@@ -497,11 +497,11 @@ CreateList
lda WeaponUnits,x
jeq NoWeapon
ldy tanknr
ldy tanknr
bit isInventory
jmi itIsInventory
; put "Purchase" on the screen
mwa #PurchaseDescription PurActDescAddr
; and Title
@@ -516,7 +516,7 @@ CreateList
cmp WeaponPriceL,x
@
jcc TooLittleCash
; we have enough cash and the weapon can be
; added to the list
@@ -585,7 +585,7 @@ notInventory
jsr HowManyBullets
sta decimal
adw xbyte #1 displayposition
adw xbyte #1 displayposition
jsr displaybyte
ldx temp ;weapon index
@@ -665,7 +665,7 @@ NoWeapon
mwa #ListOfDefensiveWeapons xbyte
NoDefense
cpx #last_defensive +1
jne CreateList
; offset may be only too big
@@ -686,14 +686,14 @@ WeHaveOffset
lda HowManyOnTheListOff
sta xbyte ; multiplier (temporarily here, it will be erased anyway)
lda #$00 ;
lda #$00 ;
sta xbyte+1 ; higher byte of the Result
ldx #$05 ; 2^5
@ asl xbyte
rol xbyte+1
dex
bne @-
; add to the address of the list
adw xbyte #ListOfWeapons
ldy #0
@@ -711,7 +711,7 @@ ListCleared1
; of the first erased char.
lda HowManyOnTheListDef
sta xbyte ; multiplier (temporarily here, it will be erased anyway)
lda #$00 ;
lda #$00 ;
sta xbyte+1 ; higher byte of the Result
ldx #$05 ; 2^5
@ asl xbyte
@@ -766,36 +766,36 @@ PurchaseAll
lda moneyH,x
sbc WeaponPriceH,y
sta moneyH,x
positiveMoney
positiveMoney
; now we have to get address of
; the table of the weapon of the tank
; and add appropriate number of shells
sty LastWeapon ; store last purchased weapon
; because we must put screen pointer next to it
; but if we purchasing "Buy me!" then we must draw the winning weapon.
cpy #ind_Buy_me
cpy #ind_Buy_me
bne NoSuprise
Suprise ; get a random weapon
lda random
cmp #51 ; defensive weapons are less likely because they are more expensive - probability 255:51 (5:1)
bcc GetRandomDefensive
GetRandomOffensive
randomize ind_Missile last_offensive
randomize ind_Missile last_offensive
;cmp #ind_Buy_me ; buy me do not buy buy me :)
;beq GetRandomOffensive
tay
bne NoSuprise ; Y always <> 0
GetRandomDefensive
randomize ind_Battery last_defensive
randomize ind_Battery last_defensive
tay
; lda WeaponUnits,y ; check if weapon exist
; beq GetRandomDefensive
NoSuprise
lda TanksWeaponsTableL,x
sta weaponPointer
@@ -824,13 +824,13 @@ inventorySelect
ldx tankNr
sta activeWeapon,x
jmp WaitForKeyRelease ; rts
invSelectDef
ldy PositionOnTheList
lda IndexesOfWeaponsL2,y
tay
ldx tankNr
cmp #ind_Battery
cmp #ind_Battery
bne NotBattery
; if activate battery, we do it differently
mva #sfx_battery sfx_effect
@@ -840,38 +840,38 @@ invSelectDef
ply
jmp DecreaseDefensive ; bypass activation
NotBattery
cmp #ind_Auto_Defense
cmp #ind_Auto_Defense
bne NoAutoDefense
; Auto Defense - do it like battery
mva #sfx_auto_defense sfx_effect
mva #$A1 AutoDefenseFlag,x ; this is "A" in inverse - for status line :)
jmp DecreaseDefensive ; bypass activation
NoAutoDefense
cmp #ind_Lazy_Boy
cmp #ind_Lazy_Boy
bne NoLazyBoy
; Lazy Boy - do it like battery
mva #%01000000 LazyFlag
jmp DecreaseDefensive ; bypass activation
NoLazyBoy
cmp #ind_Lazy_Darwin
cmp #ind_Lazy_Darwin
bne NoLazyDarwin
; Lazy Darwin - do it like battery
mva #%11000000 LazyFlag
jmp DecreaseDefensive ; bypass activation
NoLazyDarwin
cmp #ind_Spy_Hard
cmp #ind_Spy_Hard
bne NotSpy
mva #$ff SpyHardFlag
jmp DecreaseDefensive ; bypass activation
jmp DecreaseDefensive ; bypass activation
NotSpy
cmp #ind_Long_Barrel
cmp #ind_Long_Barrel
bne NotBarrel
; if activate long barrel, we do it differently too
mva #sfx_long_barrel sfx_effect
mva #LongBarrel BarrelLength,x
bne DecreaseDefensive ; bypass activation
bne DecreaseDefensive ; bypass activation
NotBarrel
cmp #ind_White_Flag
cmp #ind_White_Flag
bne NotWhiteFlag
cmp ActiveDefenceWeapon,x
bne NoDeactivateWhiteFlag
@@ -897,7 +897,7 @@ DecreaseDefensive
sec
sbc #1
sta (weaponPointer),y
DefActivationEnd
jmp WaitForKeyRelease ; rts
.endp
@@ -1084,7 +1084,7 @@ NoArrowDown
lda TankNr
:3 asl
tax
ldy #0
@ lda TanksNames,x
sta NameAdr,y
@@ -1114,12 +1114,12 @@ CheckKeys
lda TankShape,x
tay
lda digits+1,y
sta NameScreen2+15 ; display tank shape number
sta NameScreen2+15 ; display tank shape number
jsr CursorDisplay
jsr getkey
bit escFlag
spl:rts
.IF TARGET = 800 ; only the A800 has a keyboard
; is the char to be recorded?
ldx #keycodesEnd-keycodes ;table was 38 chars long
@@ -1256,7 +1256,7 @@ NotRobot
; check if all chars are empty (" ")
ldy #7
lda #0
@ ora NameAdr,y
@ ora NameAdr,y
and #$7F ; remove inverse (Cursor)
dey
bpl @-
@@ -1333,7 +1333,7 @@ CharacterFound
beq checkjoy
bit pressTimer ; trick (no A change)
bpl @-
checkjoy
checkjoy
lda STICK0
and #$0f
cmp #$0f
@@ -1543,7 +1543,7 @@ displayloop1
sta dmactls
lda #%00100100 ; playfield before P/M
sta GPRIOR
jsr SetPMWidth
jsr SetPMWidth
jsr ColorsOfSprites
mva #0 COLOR1
sta COLBAKS ; set color of background
@@ -1628,7 +1628,7 @@ ThisIsAI
NotAItank
tya
ldy #38
sta (temp),y
sta (temp),y
; put earned money on the screen
lda EarnedMoneyL,x
sta decimal
@@ -1669,10 +1669,10 @@ MakeAllTanksVisible
jsr RandomizeTankPos
dex
bpl @-
MainTanksFloatingLoop
MainTanksFloatingLoop
; main tanks floating loop
ldx #(MaxPlayers-1) ;maxNumberOfPlayers-1
AllTanksFloatingDown
AllTanksFloatingDown
stx TankNr
lda Ytankstable,x
cmp #(72-7) ; tank under screen - no erase
@@ -1842,7 +1842,7 @@ ThisIsAI
;-------------------------------------------------
ldx TankNr
;=========================
;displaying symbol of the weapon
;=========================
@@ -1872,7 +1872,7 @@ ThisIsAI
aslw temp
dey
bpl @-
adw temp #NamesOfWeapons
ldy #15
@
@@ -1900,7 +1900,7 @@ ThisIsAI
sta statusBuffer+80+22
sta statusBuffer+80+39
mwa #emptyLine temp
jmp ClearingOnly
jmp ClearingOnly
ActiveDefence
sta temp ;get back number of the weapon
mva #0 temp+1
@@ -1910,7 +1910,7 @@ ActiveDefence
aslw temp
dey
bpl @-
adw temp #NamesOfWeapons
ClearingOnly
ldy #15
@@ -1950,7 +1950,7 @@ ClearingOnly
jsr displaybyte
lda #$09 ; )
sta statusBuffer+40+13
NoDefenceWeapon
NoDefenceWeapon
NoShieldEnergy
;=========================
@@ -1981,7 +1981,7 @@ DisplayWindValue
sta decimal
mwa #statusBuffer+80+18 displayposition
jsr displaybyte
;=========================
;display round number
;=========================
@@ -2027,7 +2027,7 @@ AngleToLeft
sty statusBuffer+40+25 ; (space) character
lda #$7e ;(del) char
sta statusBuffer+40+22
bne AngleDisplay
bne AngleDisplay
VerticallyUp
; now we have value 90
sta decimal
@@ -2037,7 +2037,7 @@ VerticallyUp
AngleDisplay
mwa #statusBuffer+40+23 displayposition
jsr displaybyte
ldx TankNr
ldx TankNr
rts
.endp
;-------------------------------------------------
@@ -2047,7 +2047,7 @@ AngleDisplay
dey
lda gameOverSpritesTop,y
sta temp
; clean the whole sprite
lda #0
tax
@@ -2055,11 +2055,11 @@ AngleDisplay
sta PMGraph+$500,x
dex
bne @-
lda #$01
sta sizep0 ; P0-P1 widths
sta sizep0+1
; set background
lda #$ff
ldx #100+7 ; top of the sprites
@@ -2071,10 +2071,10 @@ AngleDisplay
GOSbeg = 112
mva #GOSbeg hposp0
mva #GOSbeg+12 hposp0+1
mva #15 PCOLR0
sta PCOLR1
rts
.endp