![]() |
Routines |
| Prev: 6713 | Up: Map | Next: 680F |
|
Used by the routine at Initialise_Next_Phase.
Fills Slot_Table with random points, drifts them, then draws the letter while sliding *Position_X.
|
||||
|
Return if there are no slots.
|
||||
| Initialise_Slot_Table | 6720 | LD A,($EF90) | Return if *Slot_Table_Count is zero. | |
| 6723 | AND A | |||
| 6724 | RET Z | |||
| 6725 | EXX | Switch to the shadow registers, and stash HL' on the stack. | ||
| 6726 | PUSH HL | |||
| 6727 | LD IX,$5B00 | Point IX at Slot_Table. | ||
| 672B | LD B,A | Copy the slot count to B. | ||
|
Write random coordinates into each slot.
|
||||
| Initialise_Slot_Table_Write | 672C | LD A,$3F | Call Random_Number and clamp the maximum value to 3F. | |
| 672E | CALL Random_Number | |||
| 6731 | ADD A,A | Multiply the result by four. | ||
| 6732 | ADD A,A | |||
| 6733 | LD (IX+$01),A | Write the X coordinate to the slot. | ||
| 6736 | LD A,$3F | Call Random_Number and clamp the maximum value to 3F. | ||
| 6738 | CALL Random_Number | |||
| 673B | ADD A,A | Double the result. | ||
| 673C | LD (IX+$03),A | Write the Y coordinate to the slot. | ||
| 673F | LD A,$0D | Call Random_Number and clamp the maximum value to 0D. | ||
| 6741 | CALL Random_Number | |||
| 6744 | SRL A | Halve the result. | ||
| 6746 | INC A | Increment the result by one. | ||
| 6747 | LD (IX+$08),A | Write the attribute to the slot. | ||
| 674A | PUSH BC | Stash the slot counter on the stack. | ||
| 674B | LD H,(IX+$03) | Fetch the pixel coordinate from the slot. | ||
| 674E | LD L,(IX+$01) | |||
| 6751 | CALL Plot_Pixel | Call Plot_Pixel. | ||
| 6754 | POP BC | Restore the slot counter from the stack. | ||
| 6755 | LD DE,$0009 | Advance the slot pointer by 09. | ||
| 6758 | ADD IX,DE | |||
| 675A | DJNZ Initialise_Slot_Table_Write | Decrease the slot counter by one and loop back to Initialise_Slot_Table_Write until it is zero. | ||
|
Wait one frame.
|
||||
| 675C | LD A,$01 | Write 01 to *Frame_Flag. | ||
| 675E | LD ($EED5),A | |||
| 6761 | HALT | Halt. | ||
|
Drift the points for 1E frames.
|
||||
| 6762 | LD C,$0B | Set the X step to 0B in C. | ||
| 6764 | LD D,$1E | Set the frame counter to 1E in D. | ||
| Initialise_Slot_Table_Drift | 6766 | PUSH DE | Stash the counters on the stack. | |
| 6767 | CALL Drift_Slot_Table | Call Drift_Slot_Table. | ||
| 676A | LD A,$01 | Write 01 to *Frame_Flag. | ||
| 676C | LD ($EED5),A | |||
| 676F | HALT | Halt twice. | ||
| 6770 | HALT | |||
| 6771 | POP DE | Restore the counters from the stack. | ||
| 6772 | DEC D | Decrease the frame counter by one and jump to Initialise_Slot_Table_Drift until it is zero. | ||
| 6773 | JR NZ,Initialise_Slot_Table_Drift | |||
|
Place the letter.
|
||||
| 6775 | LD HL,$0034 | Write 34 to *Saved_Position_Y and *Position_Y. | ||
| 6778 | LD ($EE26),HL | |||
| 677B | LD ($EE22),HL | |||
| 677E | LD HL,$0103 | Write 0103 to *Saved_Position_X and *Position_X. | ||
| 6781 | LD ($EE24),HL | |||
| 6784 | LD ($EE20),HL | |||
| 6787 | LD D,$0E | Set the frame counter to 0E in D. | ||
| 6789 | LD A,($EF90) | Copy *Slot_Table_Count to B. | ||
| 678C | LD B,A | |||
|
Drift the points and slide the letter.
|
||||
| Initialise_Slot_Table_Slide | 678D | PUSH DE | Stash the counters on the stack. | |
| 678E | CALL Drift_Slot_Table | Call Drift_Slot_Table. | ||
| 6791 | PUSH BC | Stash the slot counter on the stack. | ||
| 6792 | CALL Place_Letter | Call Place_Letter. | ||
| 6795 | POP BC | Restore the slot counter from the stack. | ||
| 6796 | LD DE,$FFF5 | Decrease *Saved_Position_X and *Position_X by 0B. | ||
| 6799 | LD HL,($EE24) | |||
| 679C | ADD HL,DE | |||
| 679D | LD ($EE24),HL | |||
| 67A0 | LD ($EE20),HL | |||
| 67A3 | LD HL,($EE26) | Copy *Saved_Position_Y to *Position_Y. | ||
| 67A6 | LD ($EE22),HL | |||
| 67A9 | LD A,$01 | Write 01 to *Frame_Flag. | ||
| 67AB | LD ($EED5),A | |||
| 67AE | HALT | Halt. | ||
| 67AF | POP DE | Restore the counters from the stack. | ||
| 67B0 | DEC D | Decrease the frame counter by one and jump to Initialise_Slot_Table_Slide until it is zero. | ||
| 67B1 | JR NZ,Initialise_Slot_Table_Slide | |||
|
Convert each slot into a 16-bit step.
|
||||
| 67B3 | LD IX,$5B00 | Point IX at Slot_Table. | ||
| 67B7 | LD A,($EF90) | Copy *Slot_Table_Count to B. | ||
| 67BA | LD B,A | |||
| 67BB | LD DE,$0009 | Set the slot stride to 09 in DE. | ||
| Initialise_Slot_Table_Convert | 67BE | LD A,(IX+$01) | Subtract 80 from the X coordinate. | |
| 67C1 | SUB $80 | |||
| 67C3 | LD (IX+$01),A | |||
| 67C6 | LD H,A | Copy the result to HL as a high byte. | ||
| 67C7 | LD L,$00 | |||
| 67C9 | SRA H | Divide HL by eight. | ||
| 67CB | RR L | |||
| 67CD | SRA H | |||
| 67CF | RR L | |||
| 67D1 | SRA H | |||
| 67D3 | RR L | |||
| 67D5 | LD (IX+$04),L | Write the X step to the slot. | ||
| 67D8 | LD (IX+$05),H | |||
| 67DB | LD A,(IX+$03) | Subtract 40 from the Y coordinate. | ||
| 67DE | SUB $40 | |||
| 67E0 | LD (IX+$03),A | |||
| 67E3 | LD H,A | Copy the result to HL as a high byte. | ||
| 67E4 | LD L,$00 | |||
| 67E6 | SRA H | Divide HL by eight. | ||
| 67E8 | RR L | |||
| 67EA | SRA H | |||
| 67EC | RR L | |||
| 67EE | SRA H | |||
| 67F0 | RR L | |||
| 67F2 | LD (IX+$06),L | Write the Y step to the slot. | ||
| 67F5 | LD (IX+$07),H | |||
| 67F8 | ADD IX,DE | Advance the slot pointer by the slot stride. | ||
| 67FA | DJNZ Initialise_Slot_Table_Convert | Decrease the slot counter by one and loop back to Initialise_Slot_Table_Convert until it is zero. | ||
|
Restart unless the system bytes match.
|
||||
| 67FC | LD HL,$5C3D | Point HL at 5C3D. | ||
| 67FF | LD A,(HL) | Restart if *5C3D is not B0. | ||
| 6800 | CP $B0 | |||
| 6802 | JP NZ,$0000 | |||
| 6805 | INC HL | Restart if *5C3E is not 5C. | ||
| 6806 | LD A,(HL) | |||
| 6807 | CP $5C | |||
| 6809 | JP NZ,$0000 | |||
| 680C | POP HL | Restore HL' from the stack. | ||
| 680D | EXX | Switch back. | ||
| 680E | RET | Return. | ||
| Prev: 6713 | Up: Map | Next: 680F |