Prev: BC94 Up: Map Next: BDA5
BC96: routine41
routine41 BC96 CALL $02BF Call KEYBOARD in ROM.
BC99 CP $49 If decoded key is 'I' call display_object_info to display information about the object at the current cursor position.
BC9B JR NZ,not_I
BC9D CALL display_object_info
BCA0 HALT On return wait for next interrupt, then jump to test_cursor_key.
BCA1 JR test_cursor_key
not_I BCA3 CALL $02BF Call KEYBOARD in ROM.
BCA6 CP $39 If decoded key is greater than '8' or less than '1' jump to test_cursor_key.
BCA8 JP P,test_cursor_key
BCAB CP $31
BCAD JP M,test_cursor_key
BCB0 SUB $31 Subtract $31 to convert key code into player number.
BCB2 LD HL,NO_PLA If value is greater than or equal to NO_PLA jump to test_cursor_key.
BCB5 CP (HL)
BCB6 JP P,test_cursor_key
BCB9 LD (temp_wizard_number),A Else store number in temp_wizard_number.
BCBC CALL routine50 Call routine50 ???
BCBF HALT Wait for next interrupt then call highlight_objects ???
routine41_0 BCC0 CALL highlight_objects
BCC3 LD A,(temp_wizard_number) Load temp_wizard_number into A and add $29 as offset to wizards in game messages table 1.
BCC6 ADD A,$29
BCC8 LD BC,$1600 Set BC to coordinates (0,22) and set ATTR-T to $46 (bright yellow on black).
BCCB LD HL,$5C8F
BCCE LD (HL),$46
BCD0 CALL MPRINT Print wizard name.
BCD3 LD A,$5F Print s_creations_string.
BCD5 CALL MPRINT
BCD8 CALL $028E Call KEY-SCAN routine in ROM to see if a key was pressed.
BCDB INC E If E is not $FF jump back to routine41_0. This prints messages and flashes the wizard and his creatures again while key is held down.
BCDC JR NZ,routine41_0
BCDE CALL clear_bottom_row Clear bottom of screen.
BCE1 CALL routine50 Call routine50 ???
BCE4 HALT Wait for next interrupt.
test_cursor_key BCE5 LD BC,(cursor_coordinates) Load cursor coordinates into BC and preserve on the stack.
BCE9 PUSH BC
BCEA CALL move_cursor Call move_cursor to move cursor depending on direction key pressed.
BCED POP HL Restore old cursor coordinates into HL.
BCEE PUSH BC Preserve new cursor coordinates on stack.
BCEF XOR A Clear carry flag.
BCF0 SBC HL,BC If cursor coordinates have changed call clear_bottom_row.
BCF2 CALL NZ,clear_bottom_row
BCF5 POP BC Restore new cursor coordinates and store in cursor_coordinates.
BCF6 LD (cursor_coordinates),BC
BCFA CALL print_cursor Call print_cursor to print cursor sprite at cursor coordinates.
BCFD CALL coordinate_to_address Set object_table_entry_pointer to address of new coordinates in map_object_table.
BD00 LD (object_table_entry_pointer),HL
BD03 LD HL,(object_table_entry_pointer) Read value back pointlessly.
BD06 LD DE,$01E1 Add $01E1 to get corresponding address in map_object_properties_table.
BD09 ADD HL,DE
BD0A LD A,(HL) Copy entry into unknown27.
BD0B LD (unknown27),A
BD0E LD HL,(object_table_entry_pointer) Load address in map_object_table again.
BD11 LD A,$45 Set ATTR-T to bright cyan on black.
BD13 LD ($5C8F),A
BD16 LD A,(HL) If object number is zero (nothing) jump to routine41_5.
BD17 OR A
BD18 JR Z,routine41_5
BD1A LD BC,$1600 Else print the current object name at coordinates (0,22).
BD1D CALL MPRINT
BD20 LD A,$44 Set ATTR-T to bright green on black.
BD22 LD ($5C8F),A
BD25 LD A,(unknown27) If bit 3 of unknown27 is set print asleep_string.
BD28 BIT 3,A
BD2A JR Z,routine41_1
BD2C LD A,$31
BD2E CALL MPRINT
BD31 JR Z,routine41_5 On return jump to routine41_5 (Z flag is always set).
routine41_1 BD33 LD DE,$0141 Else Add $0141 to address to get corresponding entry in map_animation_frame_table.
BD36 ADD HL,DE
BD37 LD A,(HL) If animation frame is 4 print dead_string and jump to routine41_5.
BD38 CP $04
BD3A JR NZ,routine41_2
BD3C LD A,$32
BD3E CALL MPRINT
BD41 JR routine41_5
routine41_2 BD43 LD DE,$0140 Else Add $0140 to address to get corresponding entry in fifth_map_table.
BD46 ADD HL,DE
BD47 LD A,$47 Set ATTR-T to bright white on black.
BD49 LD ($5C8F),A
BD4C LD A,(HL) If entry is not zero ??? jump to routine41_3.
BD4D OR A
BD4E JR NZ,routine41_3
BD50 LD DE,$00A0 Else add $00A0 to address to get corresponding entry in sixth_map_table.
BD53 ADD HL,DE
BD54 LD A,(HL) If entry is zero ??? jump to routine41_4.
BD55 OR A
BD56 JR Z,routine41_4
BD58 LD A,$43 Else set ATTR-T to bright magenta on black.
BD5A LD ($5C8F),A
routine41_3 BD5D LD A,$23 Print '#' character.
BD5F CALL DH_P
routine41_4 BD62 LD HL,(object_table_entry_pointer) If the object is a wizard jump to routine41_5.
BD65 LD A,(HL)
BD66 CP $29
BD68 JP P,routine41_5
BD6B LD DE,$01E1 Else get address of entry in map_object_properties_table.
BD6E ADD HL,DE
BD6F LD A,$46 Set ATTR-T to bright yellow on black.
BD71 LD ($5C8F),A
BD74 LD A,$28 Print '(' character.
BD76 PUSH HL
BD77 CALL DH_P
BD7A POP HL
BD7B LD A,(HL) Read entry from map_object_properties_table and mask bits to get wizard number.
BD7C AND $07
BD7E ADD A,$29 Convert wizard number to object number and print the wizard name.
BD80 CALL MPRINT
BD83 LD A,$29 Print ')' character.
BD85 CALL DH_P
routine41_5 BD88 LD B,$3C Perform a busy wait delay.
wait_outer_loop BD8A PUSH BC
BD8B LD B,$F8
wait_inner_loop BD8D DJNZ wait_inner_loop
BD8F POP BC
BD90 DJNZ wait_outer_loop
BD92 CALL print_cursor Call print_cursor to print cursor sprite at cursor coordinates.
BD95 LD HL,(object_table_entry_pointer) Return if object number at cursor position is zero.
BD98 LD A,(HL)
BD99 OR A
BD9A RET Z
BD9B HALT Else wait for three frames and set corresponding entry in map_animation_timeout_table to $01 then return.
BD9C HALT
BD9D HALT
BD9E LD DE,$00A1
BDA1 ADD HL,DE
BDA2 LD (HL),$01
BDA4 RET
Prev: BC94 Up: Map Next: BDA5