weapons optimization

This commit is contained in:
2022-08-28 01:01:36 -04:00
parent 851e8dd5af
commit 068e5af36b
6 changed files with 339 additions and 335 deletions
+79 -79
View File
@@ -263,21 +263,21 @@ WeaponPriceH ; weapons prices (tables with prices of weapons)
.by >price_Buy_me_________ .by >price_Buy_me_________
.by >price_Plasma_Blast___ .by >price_Plasma_Blast___
.by >price_Laser__________ .by >price_Laser__________
.by >price______________33 ; .by >price______________33
.by >price______________34 ; .by >price______________34
.by >price______________35 ; .by >price______________35
.by >price______________36 ; .by >price______________36
.by >price______________37 ; .by >price______________37
.by >price______________38 ; .by >price______________38
.by >price______________39 ; .by >price______________39
.by >price______________40 ; .by >price______________40
.by >price______________41 ; .by >price______________41
.by >price______________42 ; .by >price______________42
.by >price______________43 ; .by >price______________43
.by >price______________44 ; .by >price______________44
.by >price______________45 ; .by >price______________45
.by >price______________46 ; .by >price______________46
.by >price______________47 ; .by >price______________47
.by >price_White_Flag_____ .by >price_White_Flag_____
.by >price_Battery________ .by >price_Battery________
.by >price_Bal_Guidance___ .by >price_Bal_Guidance___
@@ -329,21 +329,21 @@ WeaponPriceL
.by <price_Buy_me_________ .by <price_Buy_me_________
.by <price_Plasma_Blast___ .by <price_Plasma_Blast___
.by <price_Laser__________ .by <price_Laser__________
.by <price______________33 ; .by <price______________33
.by <price______________34 ; .by <price______________34
.by <price______________35 ; .by <price______________35
.by <price______________36 ; .by <price______________36
.by <price______________37 ; .by <price______________37
.by <price______________38 ; .by <price______________38
.by <price______________39 ; .by <price______________39
.by <price______________40 ; .by <price______________40
.by <price______________41 ; .by <price______________41
.by <price______________42 ; .by <price______________42
.by <price______________43 ; .by <price______________43
.by <price______________44 ; .by <price______________44
.by <price______________45 ; .by <price______________45
.by <price______________46 ; .by <price______________46
.by <price______________47 ; .by <price______________47
.by <price_White_Flag_____ .by <price_White_Flag_____
.by <price_Battery________ .by <price_Battery________
.by <price_Bal_Guidance___ .by <price_Bal_Guidance___
@@ -401,21 +401,21 @@ WeaponUnits
.by 1 ;Buy_me_________ .by 1 ;Buy_me_________
.by 0 ;Plasma_Blast___ .by 0 ;Plasma_Blast___
.by 5 ;Laser__________ .by 5 ;Laser__________
.by 0 ;_____________33 ; .by 0 ;_____________33
.by 0 ;_____________34 ; .by 0 ;_____________34
.by 0 ;_____________35 ; .by 0 ;_____________35
.by 0 ;_____________36 ; .by 0 ;_____________36
.by 0 ;_____________37 ; .by 0 ;_____________37
.by 0 ;_____________38 ; .by 0 ;_____________38
.by 0 ;_____________39 ; .by 0 ;_____________39
.by 0 ;_____________40 ; .by 0 ;_____________40
.by 0 ;_____________41 ; .by 0 ;_____________41
.by 0 ;_____________42 ; .by 0 ;_____________42
.by 0 ;_____________43 ; .by 0 ;_____________43
.by 0 ;_____________44 ; .by 0 ;_____________44
.by 0 ;_____________45 ; .by 0 ;_____________45
.by 0 ;_____________46 ; .by 0 ;_____________46
.by 0 ;_____________47 ; .by 0 ;_____________47
.by 1 ;White_Flag___48 .by 1 ;White_Flag___48
.by 3 ;Battery________ .by 3 ;Battery________
.by 0 ;Bal_Guidance___ .by 0 ;Bal_Guidance___
@@ -488,8 +488,8 @@ WeaponSymbols
.by $48,$49,$4a,$4b,$4c,$4d,$4e,$4f .by $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
.by $50,$51,$52,$53,$54,$55,$56,$57 .by $50,$51,$52,$53,$54,$55,$56,$57
.by $58,$59,$5a,$5b,$60,$7b,$1f,$7d .by $58,$59,$5a,$5b,$60,$7b,$1f,$7d
.by $20,$00,$00,$00,$00,$00,$00,$00 .by $20 ;,$00,$00,$00,$00,$00,$00,$00
.by $00,$00,$00,$00,$00,$00,$00,$00 ;.by $00,$00,$00,$00,$00,$00,$00,$00
.by $5f,$1c,$03,$06,$06,$0a,$1b,$1b ; defensives .by $5f,$1c,$03,$06,$06,$0a,$1b,$1b ; defensives
.by $1e,$3b,$3d,$3c,$3e,$3f,$1d,$7d .by $1e,$3b,$3d,$3c,$3e,$3f,$1d,$7d
@@ -528,38 +528,38 @@ NamesOfWeapons ;the comment is an index in the tables
dta d"Buy me! " ; 30 dta d"Buy me! " ; 30
dta d"Plasma Blast " ; 31 dta d"Plasma Blast " ; 31
dta d"Laser " ; 32 dta d"Laser " ; 32
dta d"----------------" ; 33 ; dta d"----------------" ; 33
dta d"----------------" ; 34 ; dta d"----------------" ; 34
dta d"----------------" ; 35 ; dta d"----------------" ; 35
dta d"----------------" ; 36 ; dta d"----------------" ; 36
dta d"----------------" ; 37 ; dta d"----------------" ; 37
dta d"----------------" ; 38 ; dta d"----------------" ; 38
dta d"----------------" ; 39 ; dta d"----------------" ; 39
dta d"----------------" ; 40 ; dta d"----------------" ; 40
dta d"----------------" ; 41 ; dta d"----------------" ; 41
dta d"----------------" ; 42 ; dta d"----------------" ; 42
dta d"----------------" ; 43 ; dta d"----------------" ; 43
dta d"----------------" ; 44 ; dta d"----------------" ; 44
dta d"----------------" ; 45 ; dta d"----------------" ; 45
dta d"----------------" ; 46 ; dta d"----------------" ; 46
dta d" " ; 47 ; special (no weapon) name to simplify display ; dta d" " ; 47 ; special (no weapon) name to simplify display
dta d"White Flag " ; 48 ($30) dta d"White Flag " ; 33
dta d"Battery " ; 49 dta d"Battery " ; 34
dta d"Bal Guidance " ; 50 dta d"Bal Guidance " ; 35
dta d"Horz Guidance " ; 51 dta d"Horz Guidance " ; 36
dta d"Hovercraft " ; 52 dta d"Hovercraft " ; 37
dta d"Lazy Boy " ; 53 dta d"Lazy Boy " ; 38
dta d"Parachute " ; 54 - no energy dta d"Parachute " ; 39 - no energy
dta d"Strong Parachute" ; 55 - with energy (earlier Battery) dta d"Strong Parachute" ; 40 - with energy (earlier Battery)
dta d"Mag Deflector " ; 56 - with shield and energy dta d"Mag Deflector " ; 41 - with shield and energy
dta d"Shield " ; 57 - shield for one shot - no energy dta d"Shield " ; 42 - shield for one shot - no energy
dta d"Heavy Shield " ; 58 - shield with energy dta d"Heavy Shield " ; 43 - shield with energy
dta d"Force Shield " ; 59 - shield with energy and parachute dta d"Force Shield " ; 44 - shield with energy and parachute
dta d"Super Mag " ; 60 dta d"Super Mag " ; 45
dta d"Bouncy Castle " ; 61 - with shield and energy dta d"Bouncy Castle " ; 46 - with shield and energy
dta d"Long Schlong " ; 62 dta d"Long Schlong " ; 47
dta d"Nuclear Winter " ; 63 dta d"Nuclear Winter " ; 48
DefensiveEnergy = * - 48 DefensiveEnergy = * - 48
.by 00 ; White Flag .by 00 ; White Flag
.by 00 ; Heat Guidance .by 00 ; Heat Guidance
@@ -577,7 +577,7 @@ DefensiveEnergy = * - 48
.by 99 ; Bouncy Castle .by 99 ; Bouncy Castle
.by 00 ; Long Barrel .by 00 ; Long Barrel
.by 00 ; Nuclear Winter .by 00 ; Nuclear Winter
weaponsOfDeath weaponsOfDeath ; weapons used in tank death animations
dta 1,2,3,7,17,18,19,20,21,22,23,24,25,26,27 dta 1,2,3,7,17,18,19,20,21,22,23,24,25,26,27
weaponsOfDeathEnd weaponsOfDeathEnd
joyToKeyTable joyToKeyTable
+67 -64
View File
@@ -13,7 +13,7 @@ PMGraph = $0800 ; real PM start = $0b00
linetableL = $0b00 - (screenHeight+1)*2 linetableL = $0b00 - (screenHeight+1)*2
linetableH = $0b00 - (screenHeight+1) linetableH = $0b00 - (screenHeight+1)
display = $1010 ;screen takes $2K due to clearing routine display = $1010 ;screen takes $1f68 because it has screenHeight+1 lines because of out of screen tracer(?)
margin = 40 ;mountain drawing Y variable margin margin = 40 ;mountain drawing Y variable margin
MaxPlayers = 6 MaxPlayers = 6
@@ -35,7 +35,6 @@ char_clear_flame_____ = $1c
char_digger__________ = $04 char_digger__________ = $04
char_sandhog_________ = $0c char_sandhog_________ = $0c
char_sandhog_offset = char_sandhog_________ - char_digger__________ char_sandhog_offset = char_sandhog_________ - char_digger__________
char_tank1___________ = $20 char_tank1___________ = $20
char_tank2___________ = $24 char_tank2___________ = $24
char_tank3___________ = $28 char_tank3___________ = $28
@@ -74,39 +73,40 @@ price_Dirt_Charge____ = 343 ;_29
price_Buy_me_________ = 170 ;430 ;_30 price_Buy_me_________ = 170 ;430 ;_30
price_Plasma_Blast___ = $ffff ;274 ;_31 price_Plasma_Blast___ = $ffff ;274 ;_31
price_Laser__________ = 277 ;_32 price_Laser__________ = 277 ;_32
price______________33 = 0 ;price______________33 = 0
price______________34 = 0 ;price______________34 = 0
price______________35 = 0 ;price______________35 = 0
price______________36 = 0 ;price______________36 = 0
price______________37 = 0 ;price______________37 = 0
price______________38 = 0 ;price______________38 = 0
price______________39 = 0 ;price______________39 = 0
price______________40 = 0 ;price______________40 = 0
price______________41 = 0 ;price______________41 = 0
price______________42 = 0 ;price______________42 = 0
price______________43 = 0 ;price______________43 = 0
price______________44 = 0 ;price______________44 = 0
price______________45 = 0 ;price______________45 = 0
price______________46 = 0 ;price______________46 = 0
price______________47 = 0 ;price______________47 = 0
price_White_Flag_____ = $0 ;_48_($30) price_White_Flag_____ = $0 ;_33
price_Battery________ = 300 ;_49 price_Battery________ = 300 ;_34
price_Bal_Guidance___ = $ffff ;_50 price_Bal_Guidance___ = $ffff ;_35
price_Horz_Guidance__ = $ffff ;_51 price_Horz_Guidance__ = $ffff ;_36
price_Floating_Tank__ = 352 ;_52 price_Floating_Tank__ = 352 ;_37
price_Lazy_Boy_______ = $ffff ;_53 price_Lazy_Boy_______ = $ffff ;_38
price_Parachute______ = 234 ;_54 price_Parachute______ = 234 ;_39
price_StrongParachute = 1000 ;_55 price_StrongParachute = 1000 ;_40
price_Mag_Deflector__ = 745 ;_56 price_Mag_Deflector__ = 745 ;_41
price_Shield_________ = 224 ;_57 price_Shield_________ = 224 ;_42
price_Heavy_Shield___ = 628 ;_58 price_Heavy_Shield___ = 628 ;_43
price_Force_Shield___ = 1100 ;_59 price_Force_Shield___ = 1100 ;_44
price_Super_Mag______ = $ffff ;_60 price_Super_Mag______ = $ffff ;_45
price_Bouncy_Castle__ = 512 ;_61 price_Bouncy_Castle__ = 512 ;_46
price_Long_Barrel____ = 2100 ;_62 price_Long_Barrel____ = 2100 ;_47
price_Nuclear_Winter_ = 1000 ;_63 price_Nuclear_Winter_ = 1000 ;_48
;Weapon indexes (numbers) ;Weapon indexes (numbers)
ind_Baby_Missile___ = 0 ind_Baby_Missile___ = 0
first_offensive____ = ind_Baby_Missile___
ind_Missile________ = 1 ind_Missile________ = 1
ind_Baby_Nuke______ = 2 ind_Baby_Nuke______ = 2
ind_Nuke___________ = 3 ind_Nuke___________ = 3
@@ -139,37 +139,40 @@ ind_Dirt_Charge____ = 29
ind_Buy_me_________ = 30 ind_Buy_me_________ = 30
ind_Plasma_Blast___ = 31 ind_Plasma_Blast___ = 31
ind_Laser__________ = 32 ind_Laser__________ = 32
ind______________33 = 0 last_offensive_____ = ind_Laser__________
ind______________34 = 0 ;ind______________33 = 0
ind______________35 = 0 ;ind______________34 = 0
ind______________36 = 0 ;ind______________35 = 0
ind______________37 = 0 ;ind______________36 = 0
ind______________38 = 0 ;ind______________37 = 0
ind______________39 = 0 ;ind______________38 = 0
ind______________40 = 0 ;ind______________39 = 0
ind______________41 = 0 ;ind______________40 = 0
ind______________42 = 0 ;ind______________41 = 0
ind______________43 = 0 ;ind______________42 = 0
ind______________44 = 0 ;ind______________43 = 0
ind______________45 = 0 ;ind______________44 = 0
ind______________46 = 0 ;ind______________45 = 0
ind______________47 = 0 ;ind______________46 = 0
ind_White_Flag_____ = 48 ;ind______________47 = 0
ind_Battery________ = 49 ind_White_Flag_____ = 33
ind_Bal_Guidance___ = 50 first_defensive____ = ind_White_Flag_____
ind_Horz_Guidance__ = 51 ind_Battery________ = 34
ind_Floating_Tank__ = 52 ind_Bal_Guidance___ = 35
ind_Lazy_Boy_______ = 53 ind_Horz_Guidance__ = 36
ind_Parachute______ = 54 ind_Floating_Tank__ = 37
ind_StrongParachute = 55 ind_Lazy_Boy_______ = 38
ind_Mag_Deflector__ = 56 ind_Parachute______ = 39
ind_Shield_________ = 57 ind_StrongParachute = 40
ind_Heavy_Shield___ = 58 ind_Mag_Deflector__ = 41
ind_Force_Shield___ = 59 ind_Shield_________ = 42
ind_Super_Mag______ = 60 ind_Heavy_Shield___ = 43
ind_Bouncy_Castle__ = 61 ind_Force_Shield___ = 44
ind_Long_Barrel____ = 62 ind_Super_Mag______ = 45
ind_Nuclear_Winter_ = 63 ind_Bouncy_Castle__ = 46
ind_Long_Barrel____ = 47
ind_Nuclear_Winter_ = 48
last_defensive_____ = ind_Nuclear_Winter_
;-------------------------------- ;--------------------------------
; names of RMT instruments (sfx) ; names of RMT instruments (sfx)
;-------------------------------- ;--------------------------------
+7 -10
View File
@@ -154,7 +154,7 @@
icl 'lib/macro.hea' icl 'lib/macro.hea'
;splash screen and musix ;splash screen and musix
icl 'artwork/Scorch50.asm' ;icl 'artwork/Scorch50.asm'
;Game loading address ;Game loading address
@@ -1694,9 +1694,6 @@ noingame
;---------------------------------------------- ;----------------------------------------------
icl 'artwork/talk.asm' icl 'artwork/talk.asm'
;---------------------------------------------- ;----------------------------------------------
font4x4
ins 'artwork/font4x4s.bmp',+62
;----------------------------------------------
TankFont TankFont
ins 'artwork/tanksv3.fnt',+0,352 ; 44 characters only ins 'artwork/tanksv3.fnt',+0,352 ; 44 characters only
;---------------------------------------------- ;----------------------------------------------
@@ -1715,12 +1712,12 @@ MODUL equ $b000 ;address of RMT module
ins "artwork/sfx/scorch_str4.rmt" ;include music RMT module ins "artwork/sfx/scorch_str4.rmt" ;include music RMT module
opt h+ opt h+
; ;
; ;----------------------------------------------
TheEnd org $bf80
.ECHO 'TheEnd: ',TheEnd font4x4
;.if TheEnd > PMGraph + $300 ins 'artwork/font4x4s.bmp',+62
; .error "memory conflict"
;.endif
BIN
View File
Binary file not shown.
+182 -178
View File
@@ -272,8 +272,8 @@ AfterManualPurchase
mwa #ListOfDefensiveWeapons WeaponsListDL ;switch to the list of offensive weapons mwa #ListOfDefensiveWeapons WeaponsListDL ;switch to the list of offensive weapons
mva #$ff IsInventory mva #$ff IsInventory
mva #$01 WhichList mva #%10000000 WhichList
; offensive weapon - 0, deffensive - 1 ; offensive weapon - 0, defensive - %10000000
jmp Purchase.GoToActivation jmp Purchase.GoToActivation
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
@@ -288,15 +288,14 @@ AfterManualPurchase
; we are clearing list of the weapons ; we are clearing list of the weapons
mva #$00 WhichList mva #$00 WhichList
; offensive weapon - 0, deffensive - 1 ; offensive weapon - 0, deffensive - %10000000
GoToActivation GoToActivation
mva #$ff LastWeapon mva #$ff LastWeapon
; mva #0 dmactl
VDLI DLIinterruptText ; jsr SetDLI for text (purchase) screen VDLI DLIinterruptText ; jsr SetDLI for text (purchase) screen
jsr PMoutofScreen jsr PMoutofScreen
mwa #PurchaseDL dlptrs mwa #PurchaseDL dlptrs
lda #@dmactl(narrow|dma) ; narro screen width, DL on, P/M off lda #@dmactl(narrow|dma) ; narrow screen width, DL on, P/M off
sta dmactls sta dmactls
lda #song_supermarket lda #song_supermarket
@@ -345,7 +344,153 @@ AfterPurchase
ldx #$00 ; index of the checked weapon ldx #$00 ; index of the checked weapon
stx HowManyOnTheListOff ; amounts of weapons (shells, bullets) in both lists stx HowManyOnTheListOff ; amounts of weapons (shells, bullets) in both lists
stx HowManyOnTheListDef stx HowManyOnTheListDef
jsr CreateList
bit isInventory ;
bpl ChoosingItemForPurchase
lda whichList
bne PositionDefensive
; calculate positionOnTheList from the activeWeapon (offensives)
ldx tankNr
lda activeWeapon,x
ldy #0
@
cmp IndexesOfWeaponsL1,y
beq ?weaponfound
iny
cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapons
bne @-
; not found apparently?
; TODO: check border case (the last weapon)
ldy #0
beq ?weaponFound ; jmp
PositionDefensive
jsr calcPosDefensive
?weaponFound
; weapon index in Y
sty positionOnTheList
; Here we have all we need
; So choose the weapon for purchase ......
;--------------------------------------------------
ChoosingItemForPurchase
;--------------------------------------------------
jsr PutLitteChar ; Places pointer at the right position
jsr getkey
bit escFlag
spl:jmp WaitForKeyRelease ; like jsr ... : rts
cmp #$2c ; Tab
jeq ListChange
cmp #$06 ; cursor left
jeq ListChange
cmp #$0c ; Return
sne:rts
cmp #$e
beq PurchaseKeyUp
cmp #$f
beq PurchaseKeyDown
cmp #$21 ; Space
jeq PurchaseWeaponNow
cmp #$07 ; cursor right
jeq PurchaseWeaponNow
bne ChoosingItemForPurchase
PurchaseKeyUp
lda WhichList
bpl GoUpOffensive
dec PositionOnTheList
bpl EndUpX
ldy #0 ;HowManyOnTheListDef
;dey
sty PositionOnTheList
jmp ChoosingItemForPurchase
GoUpOffensive
dec PositionOnTheList
bpl MakeOffsetUp
ldy #0 ;HowManyOnTheListOff
;dey
sty PositionOnTheList
MakeOffsetUp
; If offset is larger than pointer position,
; it must be equal then.
lda PositionOnTheList
cmp OffsetDL1
bcs EndUpX ; do not modify the offset
sta OffsetDL1
EndUpX
jmp ChoosingItemForPurchase
PurchaseKeyDown
lda WhichList
bpl GoDownOffensive
inc:lda PositionOnTheList
cmp HowManyOnTheListDef
bne EndGoDownX
ldy HowManyOnTheListDef
dey
sty PositionOnTheList
jmp ChoosingItemForPurchase
GoDownOffensive
inc:lda PositionOnTheList
cmp HowManyOnTheListOff
bne MakeOffsetDown
ldy HowManyOnTheListOff
dey
sty PositionOnTheList
MakeOffsetDown
lda OffsetDL1
clc
adc #15
;if offset+16 is lower than the position then it must =16
cmp PositionOnTheList
bcs EndGoDownX
sec
lda PositionOnTheList
sbc #15
sta OffsetDL1
EndGoDownX
jmp ChoosingItemForPurchase
; swapping the displayed list and setting pointer to position 0
ListChange
mva #0 OffsetDL1
lda WhichList
eor #%10000000 ; flip WhichList
sta WhichList
bne DeffensiveSelected
mwa #ListOfWeapons WeaponsListDL
lda isInventory
beq @+
; inventory
jsr calcPosOffensive
jmp ChoosingItemForPurchase
@
mva #0 PositionOnTheList
jmp ChoosingItemForPurchase
DeffensiveSelected
mwa #ListOfDefensiveWeapons WeaponsListDL
lda isInventory
beq @+
jsr calcPosDefensive
jmp ChoosingItemForPurchase
@
mva #0 positionOnTheList
jmp ChoosingItemForPurchase
.endp
;
;--------------------------------------------------
.proc CreateList
;--------------------------------------------------
; Creating full list of the available weapons for displaying ; Creating full list of the available weapons for displaying
; in X there is an index of the weapon to be checked, ; in X there is an index of the weapon to be checked,
; in 'Xbyte' address of the first char in filled screen line ; in 'Xbyte' address of the first char in filled screen line
@@ -362,9 +507,9 @@ CreateList
jmi itIsInventory jmi itIsInventory
; put "Purchase" on the screen ; put "Purchase" on the screen
mwa #PurchaseDescription PurActDescAddr mwa #PurchaseDescription PurActDescAddr
; and Title ; and Title
mwa #PurchaseTitle DLPurTitleAddr mwa #PurchaseTitle DLPurTitleAddr
; checking if we can afford buying this weapon ; checking if we can afford buying this weapon
ldx temp ldx temp
@@ -408,7 +553,7 @@ CreateList
lda WeaponPriceH,x lda WeaponPriceH,x
sta decimal+1 sta decimal+1
jsr displaydec5 jsr displaydec5
ldy #25 ; overwrite first digit (allways space - no digit :) ) ldy #25 ; overwrite first digit (allways space - no digit :) )
lda #04 ; "$" lda #04 ; "$"
sta (xbyte),y sta (xbyte),y
@@ -416,9 +561,9 @@ CreateList
itIsInventory itIsInventory
; put "Activate" on the screen ; put "Activate" on the screen
mwa #ActivateDescription PurActDescAddr mwa #ActivateDescription PurActDescAddr
; and Title ; and Title
mwa #InventoryTitle DLPurTitleAddr mwa #InventoryTitle DLPurTitleAddr
ldx temp ldx temp
lda TanksWeaponsTableL,y lda TanksWeaponsTableL,y
@@ -487,8 +632,8 @@ notInventory
@ @
cpx LastWeapon cpx LastWeapon
bne NotTheSameAsLastTime bne NotTheSameAsLastTime
lda WhichList bit WhichList
bne @+ bmi @+
lda HowManyOnTheListOff lda HowManyOnTheListOff
sta PositionOnTheList sta PositionOnTheList
jmp NotTheSameAsLastTime jmp NotTheSameAsLastTime
@@ -498,7 +643,7 @@ notInventory
NotTheSameAsLastTime NotTheSameAsLastTime
; increase appropriate counter ; increase appropriate counter
txa txa
cpx #$30 cpx #last_offensive_____+1
bcs DefenceList bcs DefenceList
ldy HowManyOnTheListOff ldy HowManyOnTheListOff
sta IndexesOfWeaponsL1,y sta IndexesOfWeaponsL1,y
@@ -516,14 +661,15 @@ NoWeapon
; next weapon. If no more weapons then finish! ; next weapon. If no more weapons then finish!
inx inx
cpx #$30 cpx #last_offensive_____+1
bne NoDefense bne NoDefense
; if we got to the defense weapons, ; if we got to the defense weapons,
; we switch address to the second table. ; we switch address to the second table.
mwa #ListOfDefensiveWeapons xbyte mwa #ListOfDefensiveWeapons xbyte
NoDefense NoDefense
cpx #$40 cpx #last_defensive_____+1
jne CreateList jne CreateList
; offset may be only too big ; offset may be only too big
@@ -541,7 +687,6 @@ WeHaveOffset
; Multiply number on list 1 by 32 and set address ; Multiply number on list 1 by 32 and set address
; of the first erased char. ; of the first erased char.
; (multiplying taken from book of Ruszczyc 'Assembler 6502'
lda HowManyOnTheListOff lda HowManyOnTheListOff
sta xbyte ; multiplier (temporarily here, it will be erased anyway) sta xbyte ; multiplier (temporarily here, it will be erased anyway)
@@ -577,7 +722,7 @@ DoNotIncHigher1
; And the same we do with the second list ; And the same we do with the second list
; Multiply number on list 1 by 40 and set address ; Multiply number on list 1 by 32 and set address
; of the first erased char. ; of the first erased char.
lda HowManyOnTheListDef lda HowManyOnTheListDef
sta xbyte ; multiplier (temporarily here, it will be erased anyway) sta xbyte ; multiplier (temporarily here, it will be erased anyway)
@@ -614,157 +759,19 @@ DoNotIncHigher2
; here we have pretty cool lists and there is no brute force ; here we have pretty cool lists and there is no brute force
; screen clearing at each list refresh ; screen clearing at each list refresh
; (it was very ugly - I checked it :) ; (it was very ugly - I checked it :)
rts
bit isInventory ;
bpl ChoosingItemForPurchase
lda whichList
bne PositionDefensive
; calculate positionOnTheList from the activeWeapon (offensives)
ldx tankNr
lda activeWeapon,x
ldy #0
@
cmp IndexesOfWeaponsL1,y
beq ?weaponfound
iny
cpy #48 ; maxOffensiveWeapons
bne @-
; not found apparently?
; TODO: check border case (the last weapon)
ldy #0
beq ?weaponFound ; jmp
PositionDefensive
jsr calcPosDefensive
?weaponFound
; weapon index in Y
sty positionOnTheList
; Here we have all we need
; So choose the weapon for purchase ......
;--------------------------------------------------
ChoosingItemForPurchase
;--------------------------------------------------
jsr PutLitteChar ; Places pointer at the right position
jsr getkey
bit escFlag
spl:jmp WaitForKeyRelease ; like jsr ... : rts
cmp #$2c ; Tab
jeq ListChange
cmp #$06 ; cursor left
jeq ListChange
cmp #$0c ; Return
sne:rts
cmp #$e
beq PurchaseKeyUp
cmp #$f
beq PurchaseKeyDown
cmp #$21 ; Space
jeq PurchaseWeaponNow
cmp #$07 ; cursor right
jeq PurchaseWeaponNow
bne ChoosingItemForPurchase
PurchaseKeyUp
lda WhichList
beq GoUpOffensive
dec PositionOnTheList
bpl EndUpX
ldy #0 ;HowManyOnTheListDef
;dey
sty PositionOnTheList
jmp ChoosingItemForPurchase
GoUpOffensive
dec PositionOnTheList
bpl MakeOffsetUp
ldy #0 ;HowManyOnTheListOff
;dey
sty PositionOnTheList
MakeOffsetUp
; If offset is larger than pointer position,
; it must be equal then.
lda PositionOnTheList
cmp OffsetDL1
bcs EndUpX ; do not modify the offset
sta OffsetDL1
EndUpX
jmp ChoosingItemForPurchase
PurchaseKeyDown
lda WhichList
beq GoDownOffensive
inc:lda PositionOnTheList
cmp HowManyOnTheListDef
bne EndGoDownX
ldy HowManyOnTheListDef
dey
sty PositionOnTheList
jmp ChoosingItemForPurchase
GoDownOffensive
inc:lda PositionOnTheList
cmp HowManyOnTheListOff
bne MakeOffsetDown
ldy HowManyOnTheListOff
dey
sty PositionOnTheList
MakeOffsetDown
lda OffsetDL1
clc
adc #15
;if offset+16 is lower than the position then it must =16
cmp PositionOnTheList
bcs EndGoDownX
sec
lda PositionOnTheList
sbc #15
sta OffsetDL1
EndGoDownX
jmp ChoosingItemForPurchase
; swapping the displayed list and setting pointer to position 0
ListChange
mva #0 OffsetDL1
lda WhichList
eor #$01
sta WhichList
bne DeffensiveSelected
mwa #ListOfWeapons WeaponsListDL
lda isInventory
beq @+
; inventory
jsr calcPosOffensive
jmp ChoosingItemForPurchase
@
mva #0 PositionOnTheList
jmp ChoosingItemForPurchase
DeffensiveSelected
mwa #ListOfDefensiveWeapons WeaponsListDL
lda isInventory
beq @+
jsr calcPosDefensive
jmp ChoosingItemForPurchase
@
mva #0 positionOnTheList
jmp ChoosingItemForPurchase
.endp .endp
; weapon purchase routne increases number of possessed bullets
; decreases cash and jumps to screen refresh
;-------------------------------------------------- ;--------------------------------------------------
.proc PurchaseWeaponNow .proc PurchaseWeaponNow
; weapon purchase routne increases number of possessed bullets
; decreases cash and jumps to screen refresh
;-------------------------------------------------- ;--------------------------------------------------
bit isInventory bit isInventory
bmi inventorySelect bmi inventorySelect
lda WhichList bit WhichList
bne PurchaseDeffensive bmi PurchaseDeffensive
; here we purchase the offensive weapon ; here we purchase the offensive weapon
ldy PositionOnTheList ldy PositionOnTheList
@@ -836,8 +843,8 @@ LessThan100
jmp Purchase.AfterPurchase jmp Purchase.AfterPurchase
inventorySelect inventorySelect
lda whichList bit whichList
bne invSelectDef bmi invSelectDef
ldy PositionOnTheList ldy PositionOnTheList
lda IndexesOfWeaponsL1,y lda IndexesOfWeaponsL1,y
@@ -909,7 +916,7 @@ DefActivationEnd
cmp IndexesOfWeaponsL2,y cmp IndexesOfWeaponsL2,y
beq ?weaponfound beq ?weaponfound
iny iny
cpy #8*2 ; maxDefensiveWeapon cpy #(last_defensive_____ - first_defensive____) ; maxDefensiveWeapon
bne @- bne @-
; not found apparently? ; not found apparently?
; TODO: check border case (the last weapon) ; TODO: check border case (the last weapon)
@@ -932,7 +939,7 @@ DefActivationEnd
cmp IndexesOfWeaponsL1,y cmp IndexesOfWeaponsL1,y
beq ?weaponfound beq ?weaponfound
iny iny
cpy #8*5 ; maxOffensiveWeapon cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapon
bne @- bne @-
; not found apparently? ; not found apparently?
; TODO: check border case (the last weapon) ; TODO: check border case (the last weapon)
@@ -948,25 +955,25 @@ DefActivationEnd
.proc PutLitteChar .proc PutLitteChar
; first let's clear both lists from little chars ; first let's clear both lists from little chars
mwa #ListOfWeapons xbyte mwa #ListOfWeapons xbyte
ldx #52 ; there are 52 lines total ldx #last_defensive_____ ; there are 52 lines total
ldy #$00 ldy #$00
EraseLoop EraseLoop
tya ; lda #$00 tya ; lda #$00
sta (xbyte),y sta (xbyte),y
adw xbyte #32 adw xbyte #32 ; narrow screen
dex dex
bpl EraseLoop bpl EraseLoop
; now let's check which list is active now ; now let's check which list is active now
lda WhichList bit WhichList
beq CharToList1 bpl CharToList1
; we are on the second list (deffensive) ; we are on the second list (deffensive)
; so there is no problem with scrolling ; so there is no problem with scrolling
mwa #ListOfDefensiveWeapons xbyte mwa #ListOfDefensiveWeapons xbyte
ldx PositionOnTheList ldx PositionOnTheList
beq SelectList2 ; if there is 0 we add nothing beq SelectList2 ; if there is 0 we add nothing
AddLoop2 AddLoop2
adw xbyte #32 adw xbyte #32 ; narrow screen
dex dex
bne AddLoop2 bne AddLoop2
SelectList2 SelectList2
@@ -988,7 +995,7 @@ CharToList1
ldx PositionOnTheList ldx PositionOnTheList
beq SelectList1 ; if there is 0 we add nothing beq SelectList1 ; if there is 0 we add nothing
AddLoop1 AddLoop1
adw xbyte #32 adw xbyte #32 ; narrow screen
dex dex
bne AddLoop1 bne AddLoop1
SelectList1 SelectList1
@@ -999,7 +1006,7 @@ SelectList1
ldx OffsetDL1 ldx OffsetDL1
beq SetWindowList1 ; if zero then add nothing beq SetWindowList1 ; if zero then add nothing
LoopWindow1 LoopWindow1
adw xbyte #32 adw xbyte #32 ; narrow screen
dex dex
bne LoopWindow1 bne LoopWindow1
SetWindowList1 SetWindowList1
@@ -1021,7 +1028,7 @@ NoArrowUp
ldx #<EmptyLine ldx #<EmptyLine
ldy #>EmptyLine ldy #>EmptyLine
sec sec
sbc #17 sbc #17 ; ????
bmi NoArrowDown bmi NoArrowDown
cmp OffsetDL1 cmp OffsetDL1
bcc NoArrowDown bcc NoArrowDown
@@ -1036,9 +1043,6 @@ NoArrowDown
.proc EnterPlayerNames .proc EnterPlayerNames
;entering names of players ;entering names of players
mwa #NameDL dlptrs mwa #NameDL dlptrs
; lda dmactls
; and #$fc
; ora #$01 ; narrow screen (32 chars)
lda #%00110001 ; narrow screen width, DL on, P/M off lda #%00110001 ; narrow screen width, DL on, P/M off
sta dmactls sta dmactls
VDLI DLIinterruptText ; jsr SetDLI for text (names) screen VDLI DLIinterruptText ; jsr SetDLI for text (names) screen
+4 -4
View File
@@ -152,7 +152,7 @@ LowResDistances ; coarse tank positions divided by 4 (to be in just one byte)
;---------------------------------------------------- ;----------------------------------------------------
TargetTankNr ; Target tank index (for AI routines) TargetTankNr ; Target tank index (for AI routines)
.DS 1 .DS 1
SecondTryFlag ; For precize aiming AI SecondTryFlag ; For precise AI aiming
.DS 1 .DS 1
;---------------------------------------------------- ;----------------------------------------------------
;Erase .DS 1 ; if 1 only mask of the character is printed ;Erase .DS 1 ; if 1 only mask of the character is printed
@@ -273,9 +273,9 @@ temptankNr .DS 1
; tables with indexes of weapons on the right lists ; tables with indexes of weapons on the right lists
; OK (2022) so, L1 is list of offensive weapons, L2 - defensive ; OK (2022) so, L1 is list of offensive weapons, L2 - defensive
IndexesOfWeaponsL1 IndexesOfWeaponsL1
.ds 8*5 ; max 40 offensive weapons. this is wrong, should be 48, still only 32 defined. .ds (last_offensive_____ - first_offensive____)
IndexesOfWeaponsL2 IndexesOfWeaponsL2
.ds 8*2 ; max 16 defensive weapons. .ds (last_defensive_____ - first_defensive____)
;---------------------------------------------------- ;----------------------------------------------------
; variables storing amount of weapons on the first and second ; variables storing amount of weapons on the first and second
@@ -294,7 +294,7 @@ LastWeapon
; and the cursor must be placed elsewhere ; and the cursor must be placed elsewhere
.DS 1 .DS 1
WhichList ; list currently on the screen WhichList ; list currently on the screen
; (0-offensive, 1-defensive) ; (0-offensive, %10000000 - defensive (check with bit:bmi for defensives)
.DS 1 .DS 1
;OffsetDL1 .DS 1 ; offset of the list screen (how many lines).... ;OffsetDL1 .DS 1 ; offset of the list screen (how many lines)....