Prev: 8F8B Up: Map Next: 903E
8F9A: TREPUT
Used by the routine at main_routine.
TREPUT 8F9A LD HL,map_object_table Set HL to address of map_object_table.
8F9D LD (object_table_entry_pointer),HL Store in object_table_entry_pointer.
8FA0 LD B,$9F Set B to 159 as loop counter.
TRFILO 8FA2 PUSH BC Preserve loop counter.
8FA3 LD A,(HL) If object is not $24 (Magic Wood) jump to N_HERE.
8FA4 CP $24
8FA6 JP NZ,N_HERE
8FA9 LD DE,$0281 Add $0281 to address to get corresponding entry in fifth_map_table.
8FAC ADD HL,DE
8FAD LD A,(HL) Load entry from fifth_map_table.
8FAE OR A If zero jump to N_HERE.
8FAF JP Z,N_HERE
8FB2 LD (STRENG),A Store in STRENG ???
8FB5 CALL RANDY Get a random number from 0 to 9.
8FB8 CP $04 If greater than 4 jump to N_HERE.
8FBA JP P,N_HERE
8FBD LD A,(STRENG) Else subtract 41 from value in STRENG to get wizard number and store result in current_player.
8FC0 SUB $29
8FC2 LD (current_player),A
8FC5 LD A,$46 Set ATTR-T to $46 (bright yellow on black) and print message M_16 at coordinates (0,22).
8FC7 LD ($5C8F),A
8FCA LD A,$0F
8FCC LD BC,$1600
8FCF CALL M2PRIN
8FD2 INC C Increment column coordinate to leave a space.
8FD3 LD A,(STRENG) Print wizard name.
8FD6 CALL MPRINT
8FD9 LD HL,S61 Play S61 sound effect.
8FDC CALL play_sound_effect_in_HL
8FDF EI Enable interrupts.
8FE0 LD B,$0A Set B to 10 as a loop counter.
WAYLOO 8FE2 CALL PAUSER Call PAUSER ten times to pause for approximately 1.5 seconds.
8FE5 DJNZ WAYLOO
8FE7 CALL clear_bottom_row Clear bottom row.
RUNDY 8FEA CALL RANDY Get a random number with lower nibble less than 10 in RANUM.
8FED LD A,(RANUM) Jump back to RUNDY if RANUM is less than $02 or greater than $41.
8FF0 CP $02
8FF2 JP M,RUNDY
8FF5 CP $41
8FF7 JP P,RUNDY
8FFA LD (CURSP),A Else store in CURSP.
8FFD CALL GETHIS Calculate address of spell table for player.
9000 LD HL,(HISPEL) Load address of first spell into HL.
9003 INC HL Add two to skip over first spell (always Disbelieve).
9004 INC HL
9005 LD B,$13 Set B to 19 as a loop counter.
PRILOO 9007 LD A,(HL) If spell number is 0 jump to INITGO.
9008 OR A
9009 JR Z,INITGO
900B INC HL Else move address on to next spell.
900C INC HL
900D DJNZ PRILOO Loop back to PRILOO for 19 iterations.
INITGO 900F LD A,(CURSP) Store CURSP at the address in HL.
9012 LD (HL),A
9013 LD A,(STRENG) Load STRENG into A ???
9016 LD HL,(object_table_entry_pointer) Store at current position in map_object_table.
9019 LD (HL),A
901A LD DE,$0281 Add $0281 to address to get corresponding entry in fifth_map_table.
901D ADD HL,DE
901E LD (HL),$00 Set entry to zero.
9020 LD HL,(object_table_entry_pointer) Add $01E1 to address of current position in map_object_table to get corresponding entry in map_object_properties_table.
9023 LD DE,$01E1
9026 ADD HL,DE
9027 LD A,(STRENG) Subtract 41 from STRENG to get wizard number and store in map_object_properties_table.
902A SUB $29
902C LD (HL),A
902D CALL routine50 call routine at routine50 ???
9030 HALT Wait for next interrupt.
N_HERE 9031 POP BC Restore loop counter.
9032 LD HL,(object_table_entry_pointer) Increment position in map_object_table.
9035 INC HL
9036 LD (object_table_entry_pointer),HL
9039 DEC B Jump back to TRFILO for 159 iterations then return.
903A JP NZ,TRFILO
903D RET
Prev: 8F8B Up: Map Next: 903E