|  | Routines | 
| Prev: 9579 | Up: Map | Next: 95BB | 
| 
Used by the routine at PlayGame.
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
This routine generates the following bytes in CardDeck:    
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetDeck | 959B | LD HL,$95BB | HL=CardDeck. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959E | LD C,$00 | Initialise C to 00 this will hold the suit value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetSuit_Loop | 95A0 | LD B,$00 | Initialise B to 00 this will hold the card value. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
The suit "value" is held as:  
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetCards_Loop | 95A2 | LD A,C | Fetch the current "suit" value, and store it in A. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95A3 | PUSH BC | Temporarily stash BC on the stack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95A4 | LD B,$04 | Shift A left four positions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ResetSuitShift_Loop | 95A6 | SLA A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95A8 | DJNZ ResetSuitShift_Loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95AA | POP BC | Restore BC from the stack. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
Process and write the current card value to the deck.
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95AB | OR B | Merge the suit bits and the card value together. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95AC | LD (HL),A | Write the card value to the current position in the deck. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95AD | INC HL | Increment the current deck position by one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95AE | INC B | Increment the card value by one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
There are 0D cards for each suit.
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95AF | LD A,B | Keep jumping back to ResetCards_Loop until all card values have been written for this suit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95B0 | CP $0D | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95B2 | JR NZ,ResetCards_Loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95B4 | INC C | Increment the suit value by one. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
There are four suits, are we finished now?
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95B5 | LD A,C | Keep jumping back to ResetSuit_Loop until all suits have been processed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95B6 | CP $04 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95B8 | JR NZ,ResetSuit_Loop | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95BA | RET | Return. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Prev: 9579 | Up: Map | Next: 95BB |