This page contains notes for the game Kwirk.
Unrandomized Heading Out? mode#
This is the code responsible.
0x05ef af xor a
0x05f0 ea3acf ld [0xcf3a], a
0x05f3 ea45cf ld [floor_schedule_preinitialized], a ; Zero the "preinitialized" flag at 0xcf45.
0x05f6 fab8c2 ld a, [game_mode]
0x05f9 fe01 cp 0x01 ; Heading Out? mode?
0x05fb 2009 jr nZ, skip_code_check ; If not, don't check for the code.
0x05fd f08b ld a, [joypad_input]
0x05ff e624 and 0x24
0x0601 fe24 cp 0x24 ; Left and Select pressed?
0x0603 cca93e call Z, heading_out_fixed_floor_schedule ; If so, use a fixed floor schedule.
skip_code_check:
0x0606 af xor a
heading_out_fixed_floor_schedule:
0x3ea9 af xor a
0x3eaa ea74c3 ld [num_floors_completed], a
0x3ead 3e28 ld a, 40
0x3eaf ea45cf ld [floor_schedule_preinitialized], a ; Set a flag to prevent randomization of floor schedule.
0x3eb2 cdc93e call heading_out_num_floors_for_skill_level
; a = number of floors in Heading Out? before this skill level
; b = number of floors in this skill level
0x3eb5 c61e add 30 ; Add 30 to account for the 30 floors of Going Up? mode.
0x3eb7 eabfc2 ld [current_floor], a
0x3eba 78 ld a, b
0x3ebb eab9c2 ld [num_floors], a
0x3ebe 2111c3 ld hl, heading_out_floor_schedule ; Array of floors that will be played.
0x3ec1 3e1e ld a, 30 ; Fill the schedule incrementally starting from 30.
next:
0x3ec3 22 ldi [hl], a
0x3ec4 3c inc a
0x3ec5 05 dec b
0x3ec6 20fb jr nZ, next
0x3ec8 c9 ret
Careful Movement Mode#
0x10e5 fa43cf ld a, [in_demo]
0x10e8 a7 and a
0x10e9 c26970 jp nZ, direction_inputs ; If playing the demo, don't read hardware buttons.
0x10ec cdd20f call wait_for_vblank_flag
0x10ef cd452b call read_joypad
0x10f2 c5 push bc
0x10f3 cde410 call noop
0x10f6 c1 pop bc
0x10f7 f08b ld a, [joypad_input]
0x10f9 e6f0 and 0xf0 ; Any of Up, Down, Left, or Right pressed?
0x10fb 2004 jr nZ, direction_inputs
0x10fd af xor a ; If no directions are pressed, clear careful movement flag.
0x10fe ea47cf ld [disable_direction_autorepeat], a
direction_inputs:
0x1101 cb7f bit 7, a ; Down pressed?
0x120f f08b ld a, [joypad_input]
0x1211 cb4f bit 1, a ; B pressed?
0x1213 280d jr Z, play_movement_sound
0x1215 fa47cf ld a, [disable_direction_autorepeat]
0x1218 a7 and a ; If B is pressed, is autorepeat disabled from the last move?
0x1219 2802 jr Z, set_autorepeat_flag
0x121b 1833 jr finish_move ; If so, don't actually move.
set_autorepeat_flag:
0x121d 3e01 ld a, 0x01 ; Set the flag to disable autorepeat for the next move, if B is pressed then.
0x121f ea47cf ld [disable_direction_autorepeat], a
play_movement_sound:
0x1222 fa43cf ld a, [in_demo]