Routines |
Prev: 38106 | Up: Map | Next: 38150 |
Used by the routine at CheckTwoPairs.
|
||||
Table_CardDuplicates holds counts of duplicate values of cards, this routine specifically looks for two pair matches.
|
||||
Handler_TwoPairs | 38120 | LD HL,38208 | HL=Table_CardDuplicates. | |
38123 | LD B,13 | Set a counter in B of the number of possible values of cards there are in one suit. | ||
CheckTwoPairs_Loop | 38125 | LD A,(HL) | Jump to FoundOnePair if *HL is equal to 2. | |
38126 | CP 2 | |||
38128 | JR Z,FoundOnePair | |||
38130 | INC HL | Increment HL by one. | ||
38131 | DJNZ CheckTwoPairs_Loop | Decrease counter by one and loop back to CheckTwoPairs_Loop until counter is zero. | ||
TwoPairs_Return | 38133 | INC B | Increment B by one. | |
38134 | RET | Return. | ||
One pair exists, let's look for a second pair.
|
||||
FoundOnePair | 38135 | DEC B | Decrease B by one, as we don't need to count the value we're already on. | |
38136 | LD (38166),HL | Write HL to *PointerDuplicateCount. | ||
Don't bother with the second loop if this match was the last card value.
|
||||
38139 | JR Z,TwoPairs_Return | Jump to TwoPairs_Return if there are no further duplicate counts to check. | ||
This entry point is used by the routine at Handler_Pair.
|
||||
CheckSecondPair_Loop | 38141 | INC HL | Increment HL by one. | |
38142 | LD A,(HL) | Return if *HL is equal to 2. | ||
38143 | CP 2 | |||
38145 | RET Z | |||
38146 | DJNZ CheckSecondPair_Loop | Decrease counter by one and loop back to CheckSecondPair_Loop until counter is zero. | ||
38148 | JR TwoPairs_Return | Jump to TwoPairs_Return. |
Prev: 38106 | Up: Map | Next: 38150 |