![]() |
Routines |
| Prev: 77D5 | Up: Map | Next: 788D |
|
This is the address passed to RANDOMIZE USR 30698 in the BASIC loader. The loader is believed to have been: 10 LOAD "" SCREEN$ 20 LOAD "" CODE 30 RANDOMIZE USR 30698
Execution begins here with the loading screen already visible. The address has no special significance in the Spectrum architecture — it was chosen freely by the author.
Waits for a keypress on the loading screen, then fades out and draws the high-score / author credits frame (frame_hiscore_author) with the record holder name (var_record_name) printed at row 9 in red, yellow and bright. Waits for a second keypress, then resets all inventory flags, score and money, seeds the PRNG from the FRAMES counter ($5C78), and jumps into the main game loop (main_0).
|
||||
|
Loading screen — wait for keypress
|
||||
| randomize_usr | 77EA | LD A,$00 | Clear LAST K and poll until any key pressed | |
| 77EC | LD ($5C08),A | |||
| 77EF | NOP | |||
| 77F0 | NOP | |||
| 77F1 | NOP | |||
| randomize_usr_0 | 77F2 | LD A,($5C08) | ||
| 77F5 | CP $00 | |||
| 77F7 | JR Z,randomize_usr_0 | |||
| 77F9 | NOP | NOPs (padding) | ||
| 77FA | NOP | |||
| 77FB | NOP | |||
| 77FC | NOP | |||
|
Fade out and draw title/credits
|
||||
| randomize_usr_1 | 77FD | LD A,$10 | Set fade-out colour to $10, call fade_out (fade-out) | |
| 77FF | LD ($C34F),A | |||
| 7802 | CALL fade_out | |||
| 7805 | LD A,$02 | Border beep (OUT $FE, value 2) | ||
| 7807 | OUT ($FE),A | |||
| 7809 | LD DE,$3C00 | Set CHARS=$3C00 (ROM font) | ||
| 780C | CALL set_chars | |||
| 780F | LD HL,$788D | Draw high-score / author credits frame (frame_hiscore_author) | ||
| 7812 | CALL draw_frame | |||
|
Print record holder name
|
||||
| 7815 | LD HL,$89A6 | HL = name buffer (var_record_name) | ||
| 7818 | LD B,$20 | B = 32 (unused — overwritten below) | ||
| 781A | LD A,$16 | Emit PRINT AT control code ($16) | ||
| 781C | RST $10 | |||
| 781D | LD A,$09 | Row = 9 | ||
| 781F | RST $10 | |||
| 7820 | LD A,$00 | Column = 0 | ||
| 7822 | RST $10 | |||
| 7823 | LD A,$11 | Emit PAPER control code ($11) | ||
| 7825 | RST $10 | |||
| 7826 | LD A,$02 | PAPER = 2 (red) | ||
| 7828 | RST $10 | |||
| 7829 | LD A,$10 | Emit INK control code ($10) | ||
| 782B | RST $10 | |||
| 782C | LD A,$06 | INK = 6 (yellow) | ||
| 782E | RST $10 | |||
| 782F | LD A,$13 | Emit BRIGHT control code ($13) | ||
| 7831 | RST $10 | |||
| 7832 | LD A,$01 | BRIGHT = 1 | ||
| 7834 | RST $10 | |||
| 7835 | LD B,$20 | B = 32 (character count) | ||
| randomize_usr_2 | 7837 | PUSH BC | Print loop: PUSH BC / print (HL) via RST $10 / INC HL / POP BC / DJNZ $7837 | |
| 7838 | LD A,(HL) | |||
| 7839 | RST $10 | |||
| 783A | INC HL | |||
| 783B | POP BC | |||
| 783C | DJNZ randomize_usr_2 | |||
| 783E | LD A,$13 | BRIGHT=0 | ||
| 7840 | RST $10 | |||
| 7841 | LD A,$00 | |||
| 7843 | RST $10 | |||
|
Title screen — wait for keypress
|
||||
| 7844 | LD A,$00 | Clear LAST K and poll until any key pressed | ||
| 7846 | LD ($5C08),A | |||
| randomize_usr_3 | 7849 | LD A,($5C08) | ||
| 784C | CP $00 | |||
| 784E | JR Z,randomize_usr_3 | |||
| 7850 | LD A,$01 | Border beep (OUT $FE, value 1) | ||
| 7852 | OUT ($FE),A | |||
| 7854 | LD A,$00 | |||
|
Reset inventory and score
|
||||
| 7856 | LD ($C33D),A | var_inv_gun (gun) = 0 | ||
| 7859 | LD ($C337),A | var_inv_drugs (drugs) = 0 | ||
| 785C | LD A,$01 | var_inv_wallet (wallet) = 1 | ||
| 785E | LD ($C33C),A | |||
| 7861 | LD A,$30 | |||
| 7863 | LD ($C346),A | var_score_digits12 / var_score_digits34 (score) = "0000" | ||
| 7866 | LD ($C347),A | |||
| 7869 | LD ($C348),A | |||
| 786C | LD ($C349),A | |||
| 786F | LD ($C340),A | var_money_digits12 / var_money_digits34 (money) = "0300" (displayed as 030000$ = 30000 escudos) | ||
| 7872 | LD ($C341),A | |||
| 7875 | LD ($C33F),A | |||
| 7878 | LD A,$33 | |||
| 787A | LD ($C33E),A | |||
|
Seed PRNG from hardware timer
|
||||
| 787D | LD A,($5C78) | Load FRAMES counter from $5C78 into A (pseudo-random seed) | ||
| 7880 | SUB $80 | SUB $80 — ensure A is positive | ||
| 7882 | LD B,A | Advance PRNG (prng_tick) A times to warm up the state | ||
| randomize_usr_4 | 7883 | PUSH BC | ||
| 7884 | CALL prng_tick | |||
| 7887 | POP BC | |||
| 7888 | DJNZ randomize_usr_4 | |||
| 788A | JP main_0 | Jump to main game loop (main_0) | ||
| Prev: 77D5 | Up: Map | Next: 788D |