|  | Routines | 
| Prev: 37459 | Up: Map | Next: 37602 | 
| 
Used by the routine at RevealDartboard.
 
 | ||||||||
| 
Handles the pixel manipulation for one line of the reveal effect, including both straight copying of already-revealed areas and masked reveal of transition areas.
 | ||||||||
| ProcessRevealLine | 37543 | PUSH DE | Stash the reveal co-ordinate on the stack. | |||||
| 
First handle the already-revealed portion.
 | ||||||||
| 37544 | DEC E | Decrease E by one for the check below. | ||||||
| 
Is the X coordinate within the screen boundaries?
 | ||||||||
| 37545 | LD A,E | Jump to ProcessRevealLine_Skip if (0 <= E < 32). | ||||||
| 37546 | CP 32 | |||||||
| 37548 | JR NC,ProcessRevealLine_Skip | |||||||
| 37550 | AND A | |||||||
| 37551 | JP M,ProcessRevealLine_Skip | |||||||
| 37554 | CALL CopyRevealLine | Call CopyRevealLine. | ||||||
| ProcessRevealLine_Skip | 37557 | POP DE | Restore the reveal co-ordinate from the stack. | |||||
| 37558 | LD A,E | Return if X is past the right-hand edge of the screen. | ||||||
| 37559 | CP 32 | |||||||
| 37561 | RET NC | |||||||
| 37562 | PUSH DE | Stash the reveal co-ordinate on the stack. | ||||||
| 
On return from CalculateDartBoardAddress HL will contain the dart board graphic destination (i.e. DartBoard onwards).
 | ||||||||
| 37563 | CALL CalculateDartBoardAddress | Call CalculateDartBoardAddress. | ||||||
| 
Set up the source and destination addresses.
 | ||||||||
| 37566 | LD D,H | Copy the dart board graphic location from HL into DE. | ||||||
| 37567 | LD E,L | |||||||
| 37568 | LD A,H | H-=32. | ||||||
| 37569 | SUB 32 | |||||||
| 37571 | LD H,A | |||||||
| 
Process 8 pixel rows with the reveal mask.
 | ||||||||
| 37572 | LD B,8 | Set a counter in B for the number of pixels rows to process. | ||||||
| 
Mask value; altered to either- 1 at RevealDartboard_ModifyMaskForLower, or 255 at RevealDartboard_ModifyMaskForUpper.
 | ||||||||
| Reveal_MaskValue | 37574 | LD C,255 | Set the initial mask value. | |||||
| RevealDartboard_MaskLoop | 37576 | LD A,(DE) | Get the dartboard graphic byte. | |||||
| 37577 | OR C | Apply the reveal mask. | ||||||
| 37578 | LD (HL),A | Write the result to the screen. | ||||||
| 37579 | INC H | Move to the next screen line. | ||||||
| 37580 | INC D | Move to the next dartboard graphic line. | ||||||
| 
Shift command. Altered to either;
 SLL Cat RevealDartboard_ModifyToShiftLeft.SRL Cat RevealDartboard_ModifyToShiftRight. | ||||||||
| Reveal_ShiftCommand | 37581 | SRL C | Shift the mask value. | |||||
| 37583 | DJNZ RevealDartboard_MaskLoop | Decrease the pixel row counter by one and loop back to RevealDartboard_MaskLoop until all 8 lines have been processed. | ||||||
| 
Work out which attribute byte to apply.
 | ||||||||
| 37585 | POP HL | Restore the original reveal co-ordinate from the stack. | ||||||
| 37586 | LD A,L | Is the co-ordinate in the menu or dartboard area? | ||||||
| 37587 | CP 8 | |||||||
| 
Default with the dartboard attribute value.
 | ||||||||
| 37589 | LD A,112 | A=INK: BLACK, PAPER: YELLOW (BRIGHT) . | ||||||
| 37591 | JR NC,RevealDartboard_SetAttribute | Jump to RevealDartboard_SetAttribute if the X co-ordinate is greater than or equal to 8. | ||||||
| 
The X co-ordinate was less than 8 so use the menu attribute value.
 | ||||||||
| 37593 | LD A,0 | A=INK: BLACK, PAPER: BLACK . | ||||||
| 
Stash the attribute byte temporarily as CalculateAttributeBuffer needs the A register.
 | ||||||||
| RevealDartboard_SetAttribute | 37595 | EX AF,AF' | Temporarily switch the attribute byte with the shadow AF register. | |||||
| 
CalculateAttributeBuffer converts given co-ordinates into an attribute buffer location (into HL).
 | ||||||||
| 37596 | CALL CalculateAttributeBuffer | Call CalculateAttributeBuffer. | ||||||
| 37599 | EX AF,AF' | Restore the attribute byte back from the shadow AF register. | ||||||
| 37600 | LD (HL),A | Write the colour attribute byte to the attribute buffer. | ||||||
| 37601 | RET | Return. | ||||||
| Prev: 37459 | Up: Map | Next: 37602 |