diff --git a/scorch.xex b/scorch.xex index 198e5be..0601fa5 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/textproc.asm b/textproc.asm index ab2bb02..e6c1696 100644 --- a/textproc.asm +++ b/textproc.asm @@ -245,6 +245,10 @@ AfterManualPurchase lda TankStatusColoursTable,x sta colpf2s + ; ldy PositionOnTheList + ; lda IndexesOfWeaponsL1,y + + ; we are clearing list of the weapons mva #$ff LastWeapon mva #$00 WhichList @@ -291,8 +295,8 @@ AfterPurchase ; in 'Xbyte' address of the first char in filled screen line CreateList - stx temp ; number of weapon will be necessary later - ; checking if the weapon of the given number is present + stx temp ; index of a weapon will be necessary later + ; checking if the weapon of the given index is present lda WeaponUnits,x jeq NoWeapon @@ -310,7 +314,7 @@ CreateList cmp WeaponPriceL,x @ jcc TooLittleCash - bcs notInventory + bcs notInventory ; jmp itIsInventory lda TanksWeaponsTableL,y @@ -321,12 +325,6 @@ itIsInventory lda (temp2),y jeq noWeapon - txa ; lda weapon index - cmp activeWeapon,y - sne:sta PositionOnTheList - - - notInventory ; we have enough cash and the weapon can be ; added to the list @@ -409,11 +407,11 @@ notInventory cpx LastWeapon bne NotTheSameAsLastTime lda WhichList - bne ominx06 + bne @+ lda HowManyOnTheList1 sta PositionOnTheList jmp NotTheSameAsLastTime -ominx06 +@ lda HowManyOnTheList2 sta PositionOnTheList NotTheSameAsLastTime @@ -422,12 +420,12 @@ NotTheSameAsLastTime cpx #$30 bcs SecondList ldy HowManyOnTheList1 - sta NubersOfWeaponsL1,y + sta IndexesOfWeaponsL1,y inc HowManyOnTheList1 bne NextLineOfTheList SecondList ldy HowManyOnTheList2 - sta NubersOfWeaponsL2,y + sta IndexesOfWeaponsL2,y inc HowManyOnTheList2 ; If everything is copied then next line NextLineOfTheList @@ -551,18 +549,32 @@ DoNotIncHigher2 ; (it was very ugly - I checked it :) +; calculate positionOnTheList + ldx tankNr + lda activeWeapon,x + ldy #0 +@ + cmp IndexesOfWeaponsL1,y + beq weaponfound + iny + cpy #40 ; maxOffensiveWeapons + bne @- + ; not found apparently? + ; TODO: check border case (the last weapon) + ldy #0 +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 ldx escFlag - beq @+ - jsr WaitForKeyRelease - rts -@ + seq:jmp WaitForKeyRelease ; like jsr ... : rts cmp #$2c ; Tab jeq ListChange cmp #$0c ; Return @@ -603,8 +615,7 @@ EndUpX PurchaseKeyDown lda WhichList beq GoDown1 - inc PositionOnTheList - lda PositionOnTheList + inc:lda PositionOnTheList cmp HowManyOnTheList2 bne EndGoDownX ldy HowManyOnTheList2 @@ -612,8 +623,7 @@ PurchaseKeyDown sty PositionOnTheList jmp ChoosingItemForPurchase GoDown1 - inc PositionOnTheList - lda PositionOnTheList + inc:lda PositionOnTheList cmp HowManyOnTheList1 bne MakeOffsetDown ldy HowManyOnTheList1 @@ -665,15 +675,15 @@ isPriceZero = tempXRoller ; here we purchase the offensive weapon ldy PositionOnTheList - lda NubersOfWeaponsL1,y + lda IndexesOfWeaponsL1,y jmp PurchaseAll PurchaseDeffensive ldy PositionOnTheList - lda NubersOfWeaponsL2,y + lda IndexesOfWeaponsL2,y PurchaseAll - ; after getting weapon number the routine is common for all + ; after getting weapon index the routine is common for all ldx tanknr - tay ; weapon number is in Y + tay ; weapon index is in Y beq @+ ; baby missile skips all sec lda moneyL,x ; substracting from posessed money diff --git a/variables.asm b/variables.asm index 7397073..756257a 100644 --- a/variables.asm +++ b/variables.asm @@ -245,14 +245,12 @@ temptankNr .DS 1 ;---------------------------------------------------- ;Variables from textproc.s65 - ; tables with numbers of weapons on the right lists - ; to be honest - I do not know at the moment what the above - ; comment was supposed to mean... + ; tables with indexes of weapons on the right lists ; OK (2022) so, L1 is list of offensive weapons, L2 - defensive -NubersOfWeaponsL1 - .ds 8*5 ; :(8*5) .by $ff -NubersOfWeaponsL2 - .ds 8*2 ; :(8*2) .by $ff +IndexesOfWeaponsL1 + .ds 8*5 ; max 40 offensive weapons. this is wrong, should be 48, still only 32 defined. +IndexesOfWeaponsL2 + .ds 8*2 ; max 16 defensive weapons. ;---------------------------------------------------- ; variables storing amount of weapons on the first and second