![]() |
Routines |
| Prev: 26387 | Up: Map | Next: 26639 |
|
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 | 26400 | LD A,(61328) | Return if *Slot_Table_Count is zero. | |
| 26403 | AND A | |||
| 26404 | RET Z | |||
| 26405 | EXX | Switch to the shadow registers, and stash HL' on the stack. | ||
| 26406 | PUSH HL | |||
| 26407 | LD IX,23296 | Point IX at Slot_Table. | ||
| 26411 | LD B,A | Copy the slot count to B. | ||
|
Write random coordinates into each slot.
|
||||
| Initialise_Slot_Table_Write | 26412 | LD A,63 | Call Random_Number and clamp the maximum value to 63. | |
| 26414 | CALL Random_Number | |||
| 26417 | ADD A,A | Multiply the result by four. | ||
| 26418 | ADD A,A | |||
| 26419 | LD (IX+1),A | Write the X coordinate to the slot. | ||
| 26422 | LD A,63 | Call Random_Number and clamp the maximum value to 63. | ||
| 26424 | CALL Random_Number | |||
| 26427 | ADD A,A | Double the result. | ||
| 26428 | LD (IX+3),A | Write the Y coordinate to the slot. | ||
| 26431 | LD A,13 | Call Random_Number and clamp the maximum value to 13. | ||
| 26433 | CALL Random_Number | |||
| 26436 | SRL A | Halve the result. | ||
| 26438 | INC A | Increment the result by one. | ||
| 26439 | LD (IX+8),A | Write the attribute to the slot. | ||
| 26442 | PUSH BC | Stash the slot counter on the stack. | ||
| 26443 | LD H,(IX+3) | Fetch the pixel coordinate from the slot. | ||
| 26446 | LD L,(IX+1) | |||
| 26449 | CALL Plot_Pixel | Call Plot_Pixel. | ||
| 26452 | POP BC | Restore the slot counter from the stack. | ||
| 26453 | LD DE,9 | Advance the slot pointer by 9. | ||
| 26456 | ADD IX,DE | |||
| 26458 | 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.
|
||||
| 26460 | LD A,1 | Write 1 to *Frame_Flag. | ||
| 26462 | LD (61141),A | |||
| 26465 | HALT | Halt. | ||
|
Drift the points for 30 frames.
|
||||
| 26466 | LD C,11 | Set the X step to 11 in C. | ||
| 26468 | LD D,30 | Set the frame counter to 30 in D. | ||
| Initialise_Slot_Table_Drift | 26470 | PUSH DE | Stash the counters on the stack. | |
| 26471 | CALL Drift_Slot_Table | Call Drift_Slot_Table. | ||
| 26474 | LD A,1 | Write 1 to *Frame_Flag. | ||
| 26476 | LD (61141),A | |||
| 26479 | HALT | Halt twice. | ||
| 26480 | HALT | |||
| 26481 | POP DE | Restore the counters from the stack. | ||
| 26482 | DEC D | Decrease the frame counter by one and jump to Initialise_Slot_Table_Drift until it is zero. | ||
| 26483 | JR NZ,Initialise_Slot_Table_Drift | |||
|
Place the letter.
|
||||
| 26485 | LD HL,52 | Write 52 to *Saved_Position_Y and *Position_Y. | ||
| 26488 | LD (60966),HL | |||
| 26491 | LD (60962),HL | |||
| 26494 | LD HL,259 | Write 259 to *Saved_Position_X and *Position_X. | ||
| 26497 | LD (60964),HL | |||
| 26500 | LD (60960),HL | |||
| 26503 | LD D,14 | Set the frame counter to 14 in D. | ||
| 26505 | LD A,(61328) | Copy *Slot_Table_Count to B. | ||
| 26508 | LD B,A | |||
|
Drift the points and slide the letter.
|
||||
| Initialise_Slot_Table_Slide | 26509 | PUSH DE | Stash the counters on the stack. | |
| 26510 | CALL Drift_Slot_Table | Call Drift_Slot_Table. | ||
| 26513 | PUSH BC | Stash the slot counter on the stack. | ||
| 26514 | CALL Place_Letter | Call Place_Letter. | ||
| 26517 | POP BC | Restore the slot counter from the stack. | ||
| 26518 | LD DE,65525 | Decrease *Saved_Position_X and *Position_X by 11. | ||
| 26521 | LD HL,(60964) | |||
| 26524 | ADD HL,DE | |||
| 26525 | LD (60964),HL | |||
| 26528 | LD (60960),HL | |||
| 26531 | LD HL,(60966) | Copy *Saved_Position_Y to *Position_Y. | ||
| 26534 | LD (60962),HL | |||
| 26537 | LD A,1 | Write 1 to *Frame_Flag. | ||
| 26539 | LD (61141),A | |||
| 26542 | HALT | Halt. | ||
| 26543 | POP DE | Restore the counters from the stack. | ||
| 26544 | DEC D | Decrease the frame counter by one and jump to Initialise_Slot_Table_Slide until it is zero. | ||
| 26545 | JR NZ,Initialise_Slot_Table_Slide | |||
|
Convert each slot into a 16-bit step.
|
||||
| 26547 | LD IX,23296 | Point IX at Slot_Table. | ||
| 26551 | LD A,(61328) | Copy *Slot_Table_Count to B. | ||
| 26554 | LD B,A | |||
| 26555 | LD DE,9 | Set the slot stride to 9 in DE. | ||
| Initialise_Slot_Table_Convert | 26558 | LD A,(IX+1) | Subtract 128 from the X coordinate. | |
| 26561 | SUB 128 | |||
| 26563 | LD (IX+1),A | |||
| 26566 | LD H,A | Copy the result to HL as a high byte. | ||
| 26567 | LD L,0 | |||
| 26569 | SRA H | Divide HL by eight. | ||
| 26571 | RR L | |||
| 26573 | SRA H | |||
| 26575 | RR L | |||
| 26577 | SRA H | |||
| 26579 | RR L | |||
| 26581 | LD (IX+4),L | Write the X step to the slot. | ||
| 26584 | LD (IX+5),H | |||
| 26587 | LD A,(IX+3) | Subtract 64 from the Y coordinate. | ||
| 26590 | SUB 64 | |||
| 26592 | LD (IX+3),A | |||
| 26595 | LD H,A | Copy the result to HL as a high byte. | ||
| 26596 | LD L,0 | |||
| 26598 | SRA H | Divide HL by eight. | ||
| 26600 | RR L | |||
| 26602 | SRA H | |||
| 26604 | RR L | |||
| 26606 | SRA H | |||
| 26608 | RR L | |||
| 26610 | LD (IX+6),L | Write the Y step to the slot. | ||
| 26613 | LD (IX+7),H | |||
| 26616 | ADD IX,DE | Advance the slot pointer by the slot stride. | ||
| 26618 | 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.
|
||||
| 26620 | LD HL,23613 | Point HL at 23613. | ||
| 26623 | LD A,(HL) | Restart if *23613 is not 176. | ||
| 26624 | CP 176 | |||
| 26626 | JP NZ,0 | |||
| 26629 | INC HL | Restart if *23614 is not 92. | ||
| 26630 | LD A,(HL) | |||
| 26631 | CP 92 | |||
| 26633 | JP NZ,0 | |||
| 26636 | POP HL | Restore HL' from the stack. | ||
| 26637 | EXX | Switch back. | ||
| 26638 | RET | Return. | ||
| Prev: 26387 | Up: Map | Next: 26639 |