Prev: 9073 Up: Map Next: 90BB
9093: Mark Cards: Select Card
Used by the routine at MarkCards.
Count the number of cards marked already, there is a maximum limit of 03 markable cards.
MarkCards_SelectCard 9093 LD HL,$9055 HL=MarkedCards.
9096 LD B,$05 Set a counter of 05 for the total number of cards in a hand.
9098 LD C,$00 Use C to count the number of already marked cards.
CountMarkedCards_Loop 909A LD A,(HL) A=*HL.
909B OR A Jump to CountMarkedCards_Next if this card isn't marked.
909C JR Z,CountMarkedCards_Next
This card is marked, so increment the "already marked" counter.
909E INC C Increment C by one.
CountMarkedCards_Next 909F INC HL Move the marked card pointer to the next card.
90A0 DJNZ CountMarkedCards_Loop Decrease the card count by one and loop back to CountMarkedCards_Loop until all card slots have been checked.
Find the marked card data.
90A2 LD A,($9054) A=*SelectedMarkedCard.
90A5 INC A Increment A by one for the loop below.
90A6 LD HL,$9054 HL=SelectedMarkedCard.
FindMarkedCard_Loop 90A9 INC HL Increment HL by one.
90AA DEC A Decrease A by one.
90AB JR NZ,FindMarkedCard_Loop Jump to FindMarkedCard_Loop until A is zero.
Have less than 03 cards been marked already?
90AD LD A,C Jump to ToggleMarkedCard if there are less than 03 marked cards.
90AE CP $03
90B0 JR C,ToggleMarkedCard
The maximum limit of 03 marked cards has already been reached, so don't allow this card to be marked.
90B2 XOR A A=00.
90B3 JR WriteMarkedCardData Jump to WriteMarkedCardData.
Switch the state of the card, if it was selected - make it now unselected, and if it was unselected - make it selected.
ToggleMarkedCard 90B5 LD A,(HL) A=*HL.
90B6 XOR %00111111 Flip bits 0-5.
WriteMarkedCardData 90B8 LD (HL),A Write A to *HL.
90B9 JR Alias_FindSelectedCardAttribute Jump to Alias_FindSelectedCardAttribute.
Prev: 9073 Up: Map Next: 90BB