Routines |
Prev: 9473 | Up: Map | Next: 949B |
|
||||||||||
CalculateSuit | 947B | LD D,A | Copy the card value into D. | |||||||
947C | LD E,$00 | Initialise E to 00. | ||||||||
947E | PUSH IX | Copy the hand pointer into HL from IX (using the stack). | ||||||||
9480 | POP HL | |||||||||
9481 | LD B,$05 | Set a counter in B to check all 05 cards in this hand. | ||||||||
CalculateSuit_Loop | 9483 | LD A,(HL) | Fetch the card value and store it in A. | |||||||
9484 | AND %00001111 | Convert it into a suit-less value (by keeping only bits 0-3). | ||||||||
9486 | CP D | Jump to CalculateSuit_FoundMatch if A is equal to D. | ||||||||
9487 | JR Z,CalculateSuit_FoundMatch | |||||||||
CalculateSuit_Continue | 9489 | INC HL | Move the hand pointer to the next card. | |||||||
948A | DJNZ CalculateSuit_Loop | Decrease the card counter by one and loop back to CalculateSuit_Loop until all cards in the hand have been evaluated. | ||||||||
948C | LD A,E | A=E. | ||||||||
Work out the suit.
|
||||||||||
948D | LD B,$04 | Shift A right four positions. | ||||||||
CalculateSuitShift_Loop | 948F | SRA A | ||||||||
9491 | DJNZ CalculateSuitShift_Loop | |||||||||
9493 | RET | Return. | ||||||||
CalculateSuit_FoundMatch | 9494 | LD A,(HL) | Jump to CalculateSuit_Continue if *HL is lower than E. | |||||||
9495 | CP E | |||||||||
9496 | JR C,CalculateSuit_Continue | |||||||||
9498 | LD E,A | E=A. | ||||||||
9499 | JR CalculateSuit_Continue | Jump to CalculateSuit_Continue. |
Prev: 9473 | Up: Map | Next: 949B |