|  | Routines | 
| Prev: 38331 | Up: Map | Next: 38412 | 
| 
Used by the routine at CountDuplicates.
 
 
 | ||||||||||||
| CountSuits | 38383 | PUSH IX | Load the hand pointer into DE (using the stack). | |||||||||
| 38385 | POP DE | |||||||||||
| 
Only having all four suits present is meaningful.
 | ||||||||||||
| 38386 | LD B,4 | Set a counter in B for the number of cards left to check. | ||||||||||
| 38388 | LD A,(DE) | Fetch the primary card for comparison. | ||||||||||
| 38389 | AND %11110000 | Store the suit value in H. | ||||||||||
| 38391 | LD H,A | |||||||||||
| 
Loop through the remaining 4 cards.
 | ||||||||||||
| CountSuits_Loop | 38392 | INC DE | Move the pointer to the next card. | |||||||||
| 38393 | LD A,(DE) | Fetch the card. | ||||||||||
| 38394 | AND %11110000 | Store the suit value in A. | ||||||||||
| 38396 | CP H | Jump to NotAFlush if the suits of the two cards differ. | ||||||||||
| 38397 | JR NZ,NotAFlush | |||||||||||
| 38399 | DJNZ CountSuits_Loop | Decrease the suit counter by one and loop back to CountSuits_Loop until counter is zero. | ||||||||||
| 
All four suits are present in the hand! We have a flush.
 | ||||||||||||
| 38401 | LD A,1 | A=1. | ||||||||||
| WriteFlushFlag | 38403 | LD (38221),A | Write A to *FlushFlag. | |||||||||
| 38406 | JP CalculateHand | Jump to CalculateHand. | ||||||||||
| 
This hand doesn't contain a flush.
 | ||||||||||||
| NotAFlush | 38409 | XOR A | A=0. | |||||||||
| 38410 | JR WriteFlushFlag | Jump to WriteFlushFlag. | ||||||||||
| Prev: 38331 | Up: Map | Next: 38412 |