![]() |
Routines |
| Prev: 38265 | Up: Map | Next: 38331 |
|
Used by the routine at PlayGame.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This routine generates the following bytes in CardDeck:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetDeck | 38299 | LD HL,38331 | HL=CardDeck. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38302 | LD C,0 | Initialise C to 0 this will hold the suit value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetSuit_Loop | 38304 | LD B,0 | Initialise B to 0 this will hold the card value. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The suit "value" is held as:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetCards_Loop | 38306 | LD A,C | Fetch the current "suit" value, and store it in A. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38307 | PUSH BC | Temporarily stash BC on the stack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38308 | LD B,4 | Shift A left four positions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetSuitShift_Loop | 38310 | SLA A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38312 | DJNZ ResetSuitShift_Loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38314 | POP BC | Restore BC from the stack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Process and write the current card value to the deck.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38315 | OR B | Merge the suit bits and the card value together. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38316 | LD (HL),A | Write the card value to the current position in the deck. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38317 | INC HL | Increment the current deck position by one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38318 | INC B | Increment the card value by one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There are 13 cards for each suit.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38319 | LD A,B | Keep jumping back to ResetCards_Loop until all card values have been written for this suit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38320 | CP 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38322 | JR NZ,ResetCards_Loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38324 | INC C | Increment the suit value by one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There are four suits, are we finished now?
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38325 | LD A,C | Keep jumping back to ResetSuit_Loop until all suits have been processed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38326 | CP 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38328 | JR NZ,ResetSuit_Loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38330 | RET | Return. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Prev: 38265 | Up: Map | Next: 38331 |