Routines |
Prev: 36979 | Up: Map | Next: 37051 |
Used by the routine at MarkCards.
|
||||
Count the number of cards marked already, there is a maximum limit of 3 markable cards.
|
||||
MarkCards_SelectCard | 37011 | LD HL,36949 | HL=MarkedCards. | |
37014 | LD B,5 | Set a counter of 5 for the total number of cards in a hand. | ||
37016 | LD C,0 | Use C to count the number of already marked cards. | ||
CountMarkedCards_Loop | 37018 | LD A,(HL) | A=*HL. | |
37019 | OR A | Jump to CountMarkedCards_Next if this card isn't marked. | ||
37020 | JR Z,CountMarkedCards_Next | |||
This card is marked, so increment the "already marked" counter.
|
||||
37022 | INC C | Increment C by one. | ||
CountMarkedCards_Next | 37023 | INC HL | Move the marked card pointer to the next card. | |
37024 | 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.
|
||||
37026 | LD A,(36948) | A=*SelectedMarkedCard. | ||
37029 | INC A | Increment A by one for the loop below. | ||
37030 | LD HL,36948 | HL=SelectedMarkedCard. | ||
FindMarkedCard_Loop | 37033 | INC HL | Increment HL by one. | |
37034 | DEC A | Decrease A by one. | ||
37035 | JR NZ,FindMarkedCard_Loop | Jump to FindMarkedCard_Loop until A is zero. | ||
Have less than 3 cards been marked already?
|
||||
37037 | LD A,C | Jump to ToggleMarkedCard if there are less than 3 marked cards. | ||
37038 | CP 3 | |||
37040 | JR C,ToggleMarkedCard | |||
The maximum limit of 3 marked cards has already been reached, so don't allow this card to be marked.
|
||||
37042 | XOR A | A=0. | ||
37043 | 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 | 37045 | LD A,(HL) | A=*HL. | |
37046 | XOR %00111111 | Flip bits 0-5. | ||
WriteMarkedCardData | 37048 | LD (HL),A | Write A to *HL. | |
37049 | JR Alias_FindSelectedCardAttribute | Jump to Alias_FindSelectedCardAttribute. |
Prev: 36979 | Up: Map | Next: 37051 |