Routines |
Prev: 94DA | Up: Map | Next: 9506 |
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 | 94E8 | LD HL,$9540 | HL=Table_CardDuplicates. | |
94EB | LD B,$0D | Set a counter in B of the number of possible values of cards there are in one suit. | ||
CheckTwoPairs_Loop | 94ED | LD A,(HL) | Jump to FoundOnePair if *HL is equal to 02. | |
94EE | CP $02 | |||
94F0 | JR Z,FoundOnePair | |||
94F2 | INC HL | Increment HL by one. | ||
94F3 | DJNZ CheckTwoPairs_Loop | Decrease counter by one and loop back to CheckTwoPairs_Loop until counter is zero. | ||
TwoPairs_Return | 94F5 | INC B | Increment B by one. | |
94F6 | RET | Return. | ||
One pair exists, let's look for a second pair.
|
||||
FoundOnePair | 94F7 | DEC B | Decrease B by one, as we don't need to count the value we're already on. | |
94F8 | LD ($9516),HL | Write HL to *PointerDuplicateCount. | ||
Don't bother with the second loop if this match was the last card value.
|
||||
94FB | 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 | 94FD | INC HL | Increment HL by one. | |
94FE | LD A,(HL) | Return if *HL is equal to 02. | ||
94FF | CP $02 | |||
9501 | RET Z | |||
9502 | DJNZ CheckSecondPair_Loop | Decrease counter by one and loop back to CheckSecondPair_Loop until counter is zero. | ||
9504 | JR TwoPairs_Return | Jump to TwoPairs_Return. |
Prev: 94DA | Up: Map | Next: 9506 |