state_00:
RESET+aRESET+1bRESET+39RESET+40RESET+4eRESET+55RESET+61RESET+65NMI_handler+39DrawNumber+cDrawNumber+1d
0000
.byte
actual_thrust_maybe:
GameLoop+119debris_update+0debris_update+27debris_update+35thrust_smoothing_maybe+30thrust_smoothing_maybe+4aship_compute_accel_xy+eabort_procedure_update+4babort_procedure_update+50
0001
.byte
ship_angle_modulo:
ResetGameState+5game_state_reinit_maybe+4edraw_ship_prep_maybe+16ship_compute_accel_xy+0ship_compute_accel_xy+15ship_reset_saved_angle+0abort_procedure_update+fabort_procedure_update+1babort_procedure_update+24abort_procedure_update+33ship_command_yaw+1fvec_letter_something+8S711c+f6ship_command_yaw_easy+13ship_command_yaw_easy+22
0002
.byte
; Ship angle mod 90 degrees, from 0 - 31.
yaw_rate:
ship_reset+8ship_command_yaw+11ship_command_yaw+23ship_command_yaw+4eship_command_yaw+6aship_command_yaw+7cship_command_yaw+8fship_command_yaw+91
0003
.word
; 16-bit yaw rate for momentum mode
yaw_slow:
ship_command_yaw+37ship_command_yaw+6f
0005
.byte
; Is the yaw rate slow enough to decay
yaw_nonzero:
ResetGameState+aship_command_yaw+73ship_command_yaw+95
0006
.byte
; Is the yaw rate non-zero
ship_pos[0]:
game_state_reinit_maybe+2fship_update+28ship_update+2bship_update+34ship_update+36S711c+10S711c+3bS711c+c9S711c+cbS711c+d2S711c+d5S711c+d7S711c+daS711c+dcS711c+e0shuffle_7_to_9+0shuffle_7_to_9+2shuffle_7_to_9+bshuffle_7_to_9+dS711c+122S711c+1b8S711c+1baS711c+1dbS711c+1df
0007
.word[2]
; Ship position 16-bit
thrust_value:
ship_compute_accel_xy+13ship_compute_accel_xy+2dfuel_drain_thrust+2
000b
.byte
; one of the 16 levels of thrust
Z0c:
ResetGameState+f
000c
.byte
vec_letter_ptr_maybe:
S711c+a2shuffle_7_to_9+12vec_letter_something+26vec_letter_something+36S711c+190
000d
.byte
Z0e:
S711c+a4shuffle_7_to_9+16vec_letter_something+2avec_letter_something+38S711c+18e
000e
.byte
score_dec_maybe:
S711c+69score_add_landing_bonus+0shuffle_7_to_9+9vec_letter_something+14vec_letter_something+2eS711c+160
000f
.byte
Z10:
S711c+70score_add_landing_bonus+7shuffle_7_to_9+7vec_letter_something+19vec_letter_something+32S711c+167
0010
.byte
Z11:
game_state_reinit_maybe+34
0011
.byte
Z15:
GameRunningLoop+159FUN_706e+1fexplode_something_lots_math+cdebris_something_setup_gb3c+3
0015
.byte
Z16:
GameRunningLoop+162FUN_706e+23
0016
.byte
Z17:
GameRunningLoop+180GameRunningLoop+1b8FUN_706e+8explode_something_lots_math+24explode_something_lots_math+32debris_something_setup_gb3c+7
0017
.byte
Z18:
GameRunningLoop+189GameRunningLoop+1bcexplode_something_lots_math+28explode_something_lots_math+38debris_something_setup_gb3c+c
0018
.byte
ThisDebrisX:
debris_something+1fdebris_position_update_2+adebris_position_update+ddebris_position_update+28debris_position_update+2fGameRunningLoop+95GameRunningLoop+157GameRunningLoop+15eGameRunningLoop+19aGameRunningLoop+1dfGameRunningLoop+210CalcDebrisPos+aCalcDebrisPos+10CalcDebrisPos+32CalcDebrisPos+49CalcDebrisPos+67CalcDebrisPos+7cdebris_something_setup_gb3c+0
0019
.byte
Z1a:
debris_something+21debris_position_update_2+cdebris_position_update+fdebris_position_update+31debris_position_update+35GameRunningLoop+a1GameRunningLoop+160GameRunningLoop+166GameRunningLoop+18fGameRunningLoop+19eGameRunningLoop+1e3GameRunningLoop+212CalcDebrisPos+0CalcDebrisPos+8CalcDebrisPos+14CalcDebrisPos+36CalcDebrisPos+40CalcDebrisPos+51CalcDebrisPos+69CalcDebrisPos+88
001a
.byte
ThisDebrisY:
debris_something+34debris_position_update_2+18debris_position_update+1edebris_position_update+37debris_position_update+3eGameRunningLoop+84GameRunningLoop+17eGameRunningLoop+185GameRunningLoop+1acGameRunningLoop+216CalcDebrisPos+23CalcDebrisPos+29CalcDebrisPos+34CalcDebrisPos+6fdebris_something_setup_gb3c+17
001b
.byte
Z1c:
debris_something+36debris_position_update_2+1adebris_position_update+20debris_position_update+40debris_position_update+44GameRunningLoop+8dGameRunningLoop+187GameRunningLoop+18dGameRunningLoop+1b0GameRunningLoop+21aCalcDebrisPos+19CalcDebrisPos+21CalcDebrisPos+2dCalcDebrisPos+38CalcDebrisPos+77debris_something_setup_gb3c+1d
001c
.byte
Z1d:
GameRunningLoop+35GameRunningLoop+19cGameRunningLoop+1e1GameRunningLoop+206vec_letter_something+16vec_letter_something+30FUN_706e+29explode_something_lots_math+9
001d
.byte
Z1e:
GameRunningLoop+3bGameRunningLoop+1a0GameRunningLoop+1e5GameRunningLoop+20cvec_letter_something+1bvec_letter_something+34FUN_706e+2b
001e
.byte
Z1f:
GameRunningLoop+1aaGameRunningLoop+1baGameRunningLoop+218vec_letter_something+3eFUN_706e+bexplode_something_lots_math+3e
001f
.byte
Z20:
GameRunningLoop+1aeGameRunningLoop+1c0GameRunningLoop+21evec_letter_something+3cexplode_something_lots_math+40
0020
.byte
language_setting:
GameLoop+42coin_credit_configure+18draw_lots_of_stuff+11fWriteText+8WriteText+3b
0021
.byte
; 7------- Exploding?
; -6------ Game playing?
; --5----- Start screen
; ---4---- Attract mode?
game_state_flags:
NMI_handler+58NMI_handler+8cGameLoop+6GameLoop+13GameLoop+34GameLoop+4aGameLoop+6bGameLoop+7dGameLoop+83GameLoop+a7GameLoop+107GameLoop+133GameLoop+142GameLoop+149GameLoop+176GameLoop+1fbgame_state_reinit_maybe+45vec_draw_subroutines+10thrust_smoothing_maybe+0thrust_smoothing_maybe+46
0022
.byte
; Bitmask of the current game mode
; Missions are selected with the "Game Select" button and range from 0 - 3:
;
; 0 "Training" Light gravity Friction Controlled Rotation
; 1 "Cadet" Moderate gravity No Friction Controlled Rotation
; 2 "Prime" Strong gravity No Friction Controlled Rotation
; 3 "Command" Moderate gravity No Friction Rotational Momentum
;
mission_difficulty:
GameLoop+23GameLoop+abfuel_drain_thrust+6ship_update+5fmission_button_handler+9mission_button_handler+bmission_button_handler+fship_reset+fship_command_yaw+5ship_command_yaw_easy+15
0023
.byte
; Mission difficulty 0 - 3
mission_debounce:
mission_button_handler+5ship_reset+21
0024
.byte
start_game_debounce:
GameLoop+165GameLoop+169
0025
.byte
Z26:
io_in0_diagstep+5io_in0_diagstep+a
0026
.byte
VecRamPtr:
RESET+bdRESET+d3RESET+daRESET+e7RESET+edRESET+f9RESET+107RESET+1bcRESET+1c0RESET+1e6RESET+21bRESET+294RESET+296RESET+29bRESET+29dVecRamPtr_reset_0x4000+6GameLoop+69GameLoop+8fDrawString+15DrawString+1bDrawString+24DrawString+26vecram_memcpy_vecptr+5vecram_memcpy_vecptr+cvecram_memcpy_vecptr+edraw_lots_of_stuff+12draw_lots_of_stuff+39draw_lots_of_stuff+3fdraw_lots_of_stuff+48draw_lots_of_stuff+4cdraw_lots_of_stuff+52draw_lots_of_stuff+57draw_lots_of_stuff+acdraw_lots_of_stuff+b1draw_lots_of_stuff+e8draw_lots_of_stuff+10edraw_lots_of_stuff+113draw_lots_of_stuff+12dvec_draw_51ba_table+24draw_ship_prep_maybe+eDrawShip+4DrawShip+17DrawShip+1cDrawShip+23DrawShip+2aDrawShip+2dDrawShip+31debris_something+5edebris_something+64debris_something+6edebris_something+79draw_bonus_maybe+26SetDigitVecPtr+13SetDigitVecPtr+19WriteText_wrapper+aVecRomJSRL+8VecPtrUpdate_dupe+2VecPtrUpdate_dupe+4vec_copy_and_invert_maybe+bvec_copy_and_invert_maybe+16vec_copy_and_invert_maybe+1evec_copy_and_invert_maybe+27CalcDebrisPos+71CalcDebrisPos+7aCalcDebrisPos+7fCalcDebrisPos+8bVecPtrUpdate+2VecPtrUpdate+4
0027
.word
; Address of the end of the current commands for the DVG (starts at 0x4000)
vecdata_ptr_start:
RESET+1e8RESET+219GameLoop+8ddraw_ship_prep_maybe+10
0029
.byte
Z2a:
RESET+1e4RESET+21dGameLoop+91draw_ship_prep_maybe+14
002a
.byte
draw_string_ptr:
RESET+15aRESET+171DrawString+2DrawString+8DrawString+2eDrawString+30draw_lots_of_stuff+1edraw_lots_of_stuff+cddraw_lots_of_stuff+cfdraw_lots_of_stuff+d9draw_lots_of_stuff+145draw_bonus_maybe+28draw_bonus_maybe+4fdraw_bonus_maybe+53GameRunningLoop+7aGameRunningLoop+7fGameRunningLoop+87GameRunningLoop+90GameRunningLoop+98GameRunningLoop+b3GameRunningLoop+d2GameRunningLoop+dcGameRunningLoop+e0GameRunningLoop+fcGameRunningLoop+105GameRunningLoop+10bGameRunningLoop+11dGameRunningLoop+127GameRunningLoop+12cVecRomJSRL+dVecRomJSRL+11
002b
.word
; Pointer to character in a string being copied to vector ram
VecRamPtr_copy:
vec_draw_51ba_table+26GameRunningLoop+bfGameRunningLoop+d0
002d
.byte
Z2e:
vec_draw_51ba_table+2aGameRunningLoop+c3GameRunningLoop+d4
002e
.byte
VecRamPtr_copy2:
WriteText_wrapper+cWriteText+2bWriteText+2dWriteText+31WriteText+33
002f
.byte
Z30:
WriteText_wrapper+10
0030
.byte
vec_letter_ptr_something:
vec_letter_something+2vec_letter_something+evec_letter_something+20
0031
.byte
Z32:
vec_letter_something+0
0032
.byte
nmi_counter_4:
game_state_reinit_maybe+4draw_bonus_maybe+4score_add_landing_bonus+12
0033
.byte
nmi_counter_next:
game_state_reinit_maybe+b
0034
.byte
Z35:
game_state_reinit_maybe+1c
0035
.byte
Z36:
game_state_reinit_maybe+23
0036
.byte
GenByte_0037:
RESET+cfRESET+e2RESET+efRESET+f7DrawNumber+aDrawNumber+1bDrawNumber+22draw_lots_of_stuff+16draw_lots_of_stuff+a0draw_lots_of_stuff+a4draw_lots_of_stuff+aadraw_lots_of_stuff+103draw_lots_of_stuff+108draw_lots_of_stuff+10bdraw_lots_of_stuff+125draw_lots_of_stuff+14adraw_ship_prep_maybe+4cdraw_ship_prep_maybe+52draw_ship_prep_maybe+58debris_something+6cdebris_something+77draw_out_of_fuel_screen+2adraw_out_of_fuel_screen+2fship_vel_decay+4ship_vel_decay+bship_vel_decay+15draw_bonus_maybe+6draw_bonus_maybe+2edraw_bonus_maybe+5ethrust_smoothing_maybe+ethrust_smoothing_maybe+1fship_compute_accel_xy+21ship_compute_accel_xy+34fuel_drain_thrust+14bcd_score_maybe+abcd_score_maybe+42bcd_score_maybe+48bcd_score_maybe+4bbcd_score_maybe+4fship_update+2ship_update+32ship_update+53ship_update+76GameRunningLoop+101GameRunningLoop+117S711c+eS711c+30score_add_landing_bonus+5score_add_landing_bonus+1adec_to_bcd_16bit+0dec_to_bcd+bvec_clear_genbytes_37_3a+2multiply+7multiply+13CalcDebrisPos+17CalcDebrisPos+30CalcDebrisPos+55CalcDebrisPos+58CalcDebrisPos+5cCalcDebrisPos+73CalcDebrisPos+81debris_get_animation_maybe2+0fuel_drain+5fuel_drain+afuel_drain+3dGameRunningLoop+238GameRunningLoop+23eGameRunningLoop+25aFUN_706e+12FUN_706e+1aFUN_706e+1cexplode_something_lots_math+13explode_something_lots_math+1bexplode_something_lots_math+1dexplode_something_lots_math+34
0037
.byte
GenByte_0038:
DrawNumber+2DrawNumber+5DrawNumber+16DrawNumber+25draw_lots_of_stuff+18draw_lots_of_stuff+cadraw_ship_prep_maybe+4eship_vel_decay+10ship_vel_decay+1bGameRunningLoop+55GameRunningLoop+70GameRunningLoop+a8score_add_landing_bonus+1fscore_add_landing_bonus+35dec_to_bcd+0dec_to_bcd+dVecRomJSRL+bVecRomJSRL+14vec_clear_genbytes_37_3a+8multiply+2fuel_drain+3fuel_drain+fGameRunningLoop+243GameRunningLoop+248GameRunningLoop+24cmultiply+1cmultiply+23
0038
.byte
GenByte_0039:
RESET+183RESET+188RESET+1aaRESET+1d9DrawString+aDrawString+1fdraw_lots_of_stuff+1adraw_lots_of_stuff+b7draw_lots_of_stuff+bbdraw_ship_prep_maybe+55draw_ship_prep_maybe+65draw_ship_prep_maybe+6bdraw_ship_prep_maybe+71draw_ship_prep_maybe+7ddebris_update+43debris_update+53debris_update+58debris_position_update_2+10debris_position_update+11bcd_score_maybe+2bcd_score_maybe+16bcd_score_maybe+37GameRunningLoop+57GameRunningLoop+9fGameRunningLoop+a3GameRunningLoop+12fvec_clear_genbytes_37_3a+4multiply+dfuel_drain+1fuel_drain+14GameRunningLoop+236GameRunningLoop+231multiply+20multiply+25
0039
.byte
GenByte_003a:
RESET+18bRESET+1a5RESET+257RESET+260DrawNumber_decimal_1+2draw_lots_of_stuff+5edraw_lots_of_stuff+7fdraw_ship_prep_maybe+5fdraw_ship_prep_maybe+84debris_something+10debris_something+23debris_something+4fdebris_something+7edebris_update+4bdebris_position_update_2+2debris_position_update+0fuel_lost_to_crash+22fuel_lost_to_crash+39bcd_score_maybe+ebcd_score_maybe+1fbcd_score_maybe+39GameRunningLoop+6aGameRunningLoop+acscore_add_landing_bonus+14score_add_landing_bonus+29score_add_landing_bonus+42vec_clear_genbytes_37_3a+6
003a
.byte
GenByte_003b:
draw_lots_of_stuff+60draw_lots_of_stuff+7afuel_lost_to_crash+26fuel_lost_to_crash+3b
003b
.byte
io_genbyte:
io_audio_set+2io_audio_set+4io_lamps_set+2io_lamps_set+4
003c
.byte
; Temp variable for the io functions
GenByte_003c:
draw_ship_prep_maybe+45DrawShip+21DrawShip+2fdebris_something+1adebris_update+1bdebris_update+4ddebris_position_update_2+5debris_position_update+8draw_bonus_maybe+21GameRunningLoop+129GameRunningLoop+14cGameRunningLoop+15clanded_choose_random+20vec_add_to_offset+9vec_copy_and_invert_maybe+23GameRunningLoop+258FUN_706e+3explode_something_lots_math+4S732c+6S731b+6debris_something_setup_gb3c+5S736b+6S736b+17
003d
.byte
GenByte_003e:
draw_ship_prep_maybe+7draw_ship_prep_maybe+26draw_ship_prep_maybe+3edebris_update+14debris_update+5adebris_position_update+22draw_bonus_maybe+1aGameRunningLoop+155GameRunningLoop+164vec_add_to_offset+dvec_copy_and_invert_maybe+25S732c+cS731b+cS736b+aS736b+19
003e
.byte
GenByte_003f:
draw_ship_prep_maybe+47DrawShip+15DrawShip+28debris_something+2fdebris_update+25debris_update+46debris_position_update_2+13debris_position_update+19GameRunningLoop+124GameRunningLoop+150GameRunningLoop+16cGameRunningLoop+177GameRunningLoop+183landed_choose_random+bGameRunningLoop+23cGameRunningLoop+253S7354+6S733d+6S738a+6S738a+17
003f
.byte
GenByte_0040:
draw_ship_prep_maybe+9draw_ship_prep_maybe+28draw_ship_prep_maybe+34debris_update+1edebris_update+5cdebris_position_update+24GameRunningLoop+137GameRunningLoop+14eGameRunningLoop+171GameRunningLoop+17cGameRunningLoop+18bGameRunningLoop+264explode_something_lots_math+1fS7354+cS733d+cdebris_something_setup_gb3c+26S738a+aS738a+19
0040
.byte
GenByte_0041:
draw_bonus_maybe+2draw_bonus_maybe+71GameRunningLoop+142GameRunningLoop+147score_add_landing_bonus+10score_add_landing_bonus+39
0041
.byte
mult_y:
mult16_repeat+0mult16_repeat+15
0042
.byte
; Argument 1 to multiply
mult_a:
mult16+0mult16_repeat+2mult16_repeat+7mult16_repeat+11mult16_repeat+20
0043
.byte
; Argument 2 to multiply
mult_acc:
mult16_repeat+b
0044
.word
; Multiply accumulator
ship_accel_sign[0]:
ship_compute_accel_xy+9ship_compute_accel_xy+cship_update+5b
0046
.byte[2]
; The sign bits for the X and Y accelerations
delta2:
ship_update+12ship_update+1bship_update+20ship_update+41ship_update+59ship_update+65ship_update+69ship_update+6bS711c+93S711c+b8add16_signed_mag_core+9FUN_706e+21delta_something+8delta_something+cdelta_something+14explode_something_lots_math+26explode_something_lots_math+36add16_signed_mag_core+3dS711c+183S711c+1a5S711c+1acS711c+1cb
0048
.word
; 16-bit magnitude for add16_signed_mag
delta1:
S711c+acS711c+afadd16_signed_mag_arg1_low+0add16_signed_mag_core+7add16_signed_mag_core+18get_next_5bits+0get_next_5bits+2get_next_5bits+5get_next_5bits+9add16_signed_mag_core+3badd16_signed_mag_core+23S711c+197S711c+19a
004a
.word
; 16-bit magnitude for add16_signed_mag
delta2_sign:
ship_update+26ship_update+45ship_update+5dGameRunningLoop+13eGameRunningLoop+168S711c+9eS711c+cdadd16_signed_mag_core+0GameRunningLoop+260delta_something+1cadd16_signed_mag_core+34S711c+18cS711c+1b4
004c
.byte
; Sign byte for the 16-bit delta2
delta1_sign:
ship_update+8add16_signed_mag_core+2add16_signed_mag_core+1cadd16_signed_mag+0delta_something+20add16_signed_mag_core+36add16_signed_mag_core+21
004d
.byte
; Sign byte for the 16-bit delta1
drawing_scale:
game_state_reinit_maybe+66vec_draw_51ba_table+8vec_draw_subroutines+0draw_ship_prep_maybe+61finish_ship_drawing_maybe+3debris_update+6draw_bonus_maybe+12draw_bonus_maybe+39bcd_score_maybe+44ship_update+16GameRunningLoop+4fGameRunningLoop+5cS711c+8S711c+34S711c+e4vec_letter_something+4S736b+10S711c+1b6S738a+10
004e
.byte
score_dec_something1:
game_state_reinit_maybe+57vec_draw_51ba_table+0draw_bonus_maybe+1fGameRunningLoop+5aS711c+1fS711c+2cS711c+2eS711c+32S711c+74S711c+84score_add_landing_bonus+9S711c+169S711c+17a
004f
.byte
Z50:
S711c+c1S732c+3S732c+8S731b+3S731b+8S711c+1bc
0050
.byte
score_dec_something2:
GameRunningLoop+38GameRunningLoop+93S711c+6cS711c+6eS711c+7aS711c+7dscore_add_landing_bonus+3vec_copy_and_invert_maybe+1cS732c+aS732c+eS731b+aS731b+eS711c+163S711c+165S711c+16eS711c+171
0051
.byte
Z52:
S711c+c3S7354+3S7354+8S733d+3S733d+8S711c+14fS711c+1be
0052
.byte
Z53:
GameRunningLoop+82S711c+91S711c+c5vec_copy_and_invert_maybe+9S7354+aS7354+eS733d+aS733d+eS711c+142S711c+151S711c+1d7
0053
.byte
Z54:
GameRunningLoop+8bS711c+98S711c+c7vec_copy_and_invert_maybe+10S7354+10S7354+14S733d+10S733d+14S711c+144S711c+153S711c+1d5
0054
.byte
ship_enable_x:
ship_update+cS711c+2S736b+2
0055
.byte
; Disable physics for the X and Y axes (bit 7)
ship_abort:
RESET+12cRESET+148RESET+1d7RESET+24fRESET+251RESET+271GameLoop+197GameLoop+19bGameLoop+1ccGameLoop+1ffdebris_something+cdebris_something+55debris_something+84thrust_smoothing_maybe+4ship_command_yaw+0abort_procedure_update+2abort_procedure_update+39abort_procedure_update+4dmultiply+5abort_procedure_update+52
0056
.byte
; Has the abort button been triggered?
ship_enable_y:
GameLoop+1f1S711c+4S738a+2
0057
.byte
; Accessed via array from ship_enable_x
ship_accel[0]:
ship_compute_accel_xy+32ship_compute_accel_xy+3cship_update+57
0058
.byte[2]
; The X and Y acceleration magnitudes for the ship's thrust
ship_vel_sign_x:
bcd_score_maybe+29ship_update+24ship_update+47ship_update+78S711c+12landed_choose_random+17
005a
.byte
; Sign bit for the X velocity
Z5c:
GameLoop+184S711c+3dabort_procedure_update+3fS711c+124
005c
.byte
; 0x8F == exploding?
; 0x00 == +50 points
; 0x4x == +15 points
; 0x0x == + 5 points (bottom bits ignored?)
; initialized to 0 by ResetGameState
ship_state_maybe:
InitGame+5GameLoop+aGameLoop+16dGameLoop+188GameLoop+19fGameLoop+1a4GameLoop+1d3fuel_lost_to_crash_wrapper+0ship_update+6GameRunningLoop+1d0GameRunningLoop+22eS711c+62explode_something_lots_math+49S711c+114S711c+116S711c+11fscore_landing_bonus+2score_landing_bonus+8S711c+119
005d
.byte
; Bit map of stuff about the ship
ship_vel[0]:
GameLoop+203ResetGameState+14ResetGameState+16ResetGameState+1agame_state_reinit_maybe+2aship_vel_decay+2ship_vel_decay+6ship_vel_decay+12ship_vel_decay+17ship_vel_decay+19ship_vel_decay+1dbcd_score_maybe+6bcd_score_maybe+8ship_update+10ship_update+14ship_update+49ship_update+4cship_update+7aship_update+7dabort_procedure_update+29abort_procedure_update+2dabort_procedure_update+31abort_procedure_update+43landed_choose_random+0landed_choose_random+dS711c+ffS711c+10dS736b+4S736b+cS738a+4S738a+c
005e
.word[2]
; Ship horizontal X and Y
touchdown_velocities_maybe:
GameLoop+87GameLoop+180GameLoop+19dGameLoop+1d5draw_level_over_screen+29draw_level_over_screen+33
0062
.byte
gravity:
GameLoop+2bGameLoop+207ResetGameState+1eship_update+3fship_reset+14
0063
.byte
VecPtr:
vecram_memcpy_update_vecptr+2vecram_memcpy_vecptr+3vecram_memcpy_vecptr+16vecram_memcpy_vecptr+18draw_lots_of_stuff+2draw_lots_of_stuff+29draw_lots_of_stuff+2ddraw_lots_of_stuff+50draw_lots_of_stuff+55draw_lots_of_stuff+6cdraw_lots_of_stuff+7ddraw_lots_of_stuff+98draw_lots_of_stuff+c4draw_lots_of_stuff+d7draw_lots_of_stuff+e0draw_lots_of_stuff+f2draw_lots_of_stuff+106draw_lots_of_stuff+13edraw_ship_prep_maybe+6edraw_ship_prep_maybe+82DrawShip+2DrawShip+7DrawShip+1aDrawShip+1fvec_copy_and_invert_maybe+2vec_copy_and_invert_maybe+6vec_copy_and_invert_maybe+evec_copy_and_invert_maybe+19vec_copy_and_invert_maybe+21
0064
.byte
Z65:
vecram_memcpy_update_vecptr+0vecram_memcpy_vecptr+1cdraw_lots_of_stuff+6draw_lots_of_stuff+72draw_lots_of_stuff+84draw_lots_of_stuff+92draw_lots_of_stuff+c8draw_lots_of_stuff+e4draw_lots_of_stuff+13cdraw_ship_prep_maybe+78draw_ship_prep_maybe+88vec_copy_and_invert_maybe+0
0065
.byte
ship_angle:
ship_reset+dship_command_yaw+eship_command_yaw+13
0066
.word
; 16-bit Ship angle
abort_debounce:
GameLoop+1c2GameLoop+1c6
0068
.byte
Z69:
draw_lots_of_stuff+edraw_lots_of_stuff+6edraw_lots_of_stuff+70draw_lots_of_stuff+76draw_lots_of_stuff+78draw_lots_of_stuff+8edraw_lots_of_stuff+90draw_lots_of_stuff+94draw_lots_of_stuff+96draw_lots_of_stuff+9aGameRunningLoop+5GameRunningLoop+c1GameRunningLoop+c8GameRunningLoop+caGameRunningLoop+ccGameRunningLoop+f0GameRunningLoop+f4GameRunningLoop+f8GameRunningLoop+faGameRunningLoop+109GameRunningLoop+10dGameRunningLoop+113GameRunningLoop+115
0069
.byte
Z6a:
draw_lots_of_stuff+14GameRunningLoop+9
006a
.byte
dvg_timer:
NMI_handler+30NMI_handler+a6dvg_wait_done+0
0073
.byte
; Waits for acks from the vector generator
nmi_counter:
NMI_handler+2eNMI_handler+90ResetGameState+18game_state_reinit_maybe+0game_state_reinit_maybe+dlanded_choose_random+22
0074
.byte
; Track how many NMI have been received
divisor:
divide+0divide_core+7divide_core+bdivide_core+15
0075
.byte
divisor2:
divide+eFUN_706e+14explode_something_lots_math+15
0076
.byte
remainder:
divide+5FUN_706e+dexplode_something_lots_math+e
0077
.byte
dividend_working:
divide+9divide_setup_0+0divide_core+2divide_core+10divide_core+12
0078
.byte
Z79:
game_state_reinit_maybe+5fGameRunningLoop+13GameRunningLoop+1c9
0079
.byte
Z7a:
GameRunningLoop+15GameRunningLoop+1c7
007a
.byte
Z7b:
GameRunningLoop+26GameRunningLoop+227
007b
.byte
Z7c:
GameRunningLoop+28GameRunningLoop+225
007c
.byte
min16_a:
GameRunningLoop+17GameRunningLoop+1f2min16+4min16+emin16+14
007d
.word
; Arg 1 for min16
min16_b:
GameRunningLoop+2aGameRunningLoop+1f9min16+cmin16+12min16+1a
007f
.word
; Arg 2 for min16
min16_b_high_high:
GameRunningLoop+10GameRunningLoop+23GameRunningLoop+196GameRunningLoop+1a6GameRunningLoop+1b6GameRunningLoop+1d9GameRunningLoop+1ecGameRunningLoop+1fd
0081
.byte
thrust_delta_last_raw:
RESET+230RESET+233NMI_handler+1cNMI_handler+24thrust_smoothing_maybe+12thrust_smoothing_maybe+19thrust_smoothing_maybe+23
0082
.byte
thrust_high:
RESET+23NMI_handler+aNMI_handler+ethrust_smoothing_maybe+3a
0083
.byte
; High point for the thrust level (used for smoothing)
thrust_low:
NMI_handler+12NMI_handler+16NMI_handler+18thrust_smoothing_maybe+8thrust_smoothing_maybe+16thrust_smoothing_maybe+25thrust_smoothing_maybe+3cthrust_smoothing_maybe+3e
0084
.byte
; Low point for the thrust level (used for smoothing)
thrust_something_counter:
NMI_handler+26thrust_smoothing_maybe+34thrust_smoothing_maybe+40
0085
.byte
FrameCounter:
GameLoop+5eGameLoop+afGameLoop+ddGameLoop+efGameLoop+151GameLoop+192draw_insert_coin_screen+14draw_out_of_fuel_screen+20debris_update+2fdraw_bonus_maybe+47GameRunningLoop+babort_procedure_update+a
0086
.byte
nmi_counter_250:
NMI_handler+5cNMI_handler+62
0087
.byte
; Count every 250 NMI's to create a 1 Hz counter
lamps_cache:
io_lamps_set+0io_lamps_set+9
0088
.byte
; Cache of last value written to the lamp hardware
audio_cache:
RESET+1dbio_audio_set+0io_audio_set+9
0089
.byte
; Cache of last value written to the audio hardware
delay_6:
RESET+27NMI_handler+9eNMI_handler+a4
008a
.byte
vec_src_offst_maybe:
vec_draw_51ba_table+6finish_ship_drawing_maybe+1debris_update+4draw_bonus_maybe+adraw_bonus_maybe+33vec_add_to_offset+1vec_compute_offset_maybe+1
008b
.byte
vecgen_offset_something:
vec_draw_51ba_table+3vecgen_copy_10+1
008c
.byte
time_in_seconds:
NMI_handler+64GameLoop+1affuel_drain+28
008d
.byte
; Increments once per second, triggered by nmi_counter_250 going to zero
landing_bonus:
score_add_landing_bonus+48score_add_landing_bonus+5d
008e
.byte
GenByte08f:
debris_something+4debris_update+41CalcDebrisPos+86
008f
.byte
fuel_lost_timeout:
draw_level_over_screen+0draw_level_over_screen+4draw_out_of_fuel_screen+0draw_out_of_fuel_screen+4fuel_lost_to_crash+47
0090
.byte
random_message:
draw_level_over_screen+4alanded_choose_random+28debris_get_animations_maybe+0
0091
.byte
bcd_output[0]:
bcd_score_maybe+23bcd_score_maybe+25score_add_landing_bonus+51score_add_landing_bonus+53score_add_landing_bonus+57score_add_landing_bonus+5bscore_add_landing_bonus+61dec_to_bcd+4dec_to_bcd+6dec_to_bcd+8dec_to_bcd+fdec_to_bcd+11dec_to_bcd+13dec_to_bcd+15dec_to_bcd+17dec_to_bcd+19dec_to_bcd+1bdec_to_bcd+1ddec_to_bcd+1fdec_to_bcd+24dec_to_bcd+26dec_to_bcd+28
0092
.byte[3]
; Working buffer for the dec_to_bcd function as well as its output
fuel_lost_bcd:
fuel_lost_to_crash+3d
0095
.byte
Z96:
fuel_lost_to_crash+3ffuel_lost_to_crash+41
0096
.byte
; Bitmask tracking the current fuel (and game) state
; 0x80 = Have fuel
; 0x40 = Out of fuel
; 0x00 = Not playing
fuel_state:
GameLoop+0GameLoop+8GameLoop+1abdraw_out_of_fuel_screen+18coin_inserted+5thrust_smoothing_maybe+42fuel_lost_to_crash+35abort_procedure_update+6fuel_increase_limit_9999+2ship_command_yaw+39fuel_drain+18fuel_drain+1eship_command_yaw_easy+0
0097
.byte
; Bitmask of fuel state
fuel_per_coin:
GameLoop+2fdraw_insert_coin_screen+2coin_credit_configure+2dfuel_add_credit+0
0098
.byte
credits_per_coin:
coin_credit_configure+9coin_inserted+1e
0099
.byte
Z9a:
RESET+2bdraw_even_more_stuff+49bcd_score_maybe+33
009a
.byte
Z9b:
RESET+2ddraw_even_more_stuff+41
009b
.byte
time_bcd[0]:
NMI_handler+78NMI_handler+83NMI_handler+85NMI_handler+89game_state_reinit_maybe+3e
009c
.byte[2]
; BCD mission timer (4 digits, first byte is seconds, second byte is minutes)
score_bcd_maybe[0]:
NMI_handler+6eNMI_handler+70fuel_lost_to_crash+1fuel_lost_to_crash+7fuel_lost_to_crash+c
009e
.byte[3]
; BCD score value (6 digits, not sure how different from a4)
fuel_used[0]:
fuel_lost_to_crash+4fuel_lost_to_crash+9fuel_lost_to_crash+2afuel_lost_to_crash+2cfuel_lost_to_crash+31fuel_lost_to_crash+33fuel_drain+3bfuel_drain+3f
00a1
.byte[3]
; BCD amount of fuel used during the mission
score_bcd:
GameLoop+25score_landing_bonus+13score_landing_bonus+15
00a4
.byte
Za5:
GameLoop+27score_landing_bonus+17score_landing_bonus+1b
00a5
.byte
Za6:
bcd_score_maybe+1d
00a6
.byte
Za7:
bcd_score_maybe+18
00a7
.byte
Za8:
bcd_score_maybe+1a
00a8
.byte
bcd_score_maybe2:
mult16_repeat+2a
00a9
.byte
; The remaining fuel is stored as a 3-byte BCD amount,
; which gives a maximum of 6 digits in base 10.
; It is stored in reverse order, so fuel_tank[0] is the LSB and fuel_tank[2] is MSB.
fuel_tank[0]:
draw_out_of_fuel_screen+1cfuel_lost_to_crash+20fuel_lost_to_crash+24fuel_increase_limit_9999+6fuel_increase_limit_9999+afuel_increase_limit_9999+12fuel_increase_limit_9999+14fuel_drain+7fuel_drain+dfuel_drain+12fuel_drain+22fuel_drain+24fuel_drain+26fuel_drain+2cfuel_drain+2efuel_drain+30fuel_drain+32
00ac
.byte[3]
; BCD amount of fuel in the tank
Zaf:
GameLoop+1e9bcd_score_maybe+54
00af
.byte
math_something:
GameLoop+1ebbcd_score_maybe+56
00b0
.byte
Zb1:
GameLoop+1edbcd_score_maybe+58
00b1
.byte
ValidCoins:
CheckCoinsInserted+63CheckCoinsInserted+6eCheckCoinsInserted+7c
00b2
.byte
WaitCoinTimer_0:
CheckCoinsInserted+35CheckCoinsInserted+38CheckCoinsInserted+3cCheckCoinsInserted+56CheckCoinsInserted+5d
00b3
.byte
; This is actually an array, but the slam timer is in the middle
WaitCoinTimer_2:
CheckCoinsInserted+29CheckCoinsInserted+2bCheckCoinsInserted+2f
00b4
.byte
; Coin slot 2 timer
NumCredits_maybe:
CheckCoinsInserted+61coin_inserted+ccoin_inserted+10
00b6
.byte
; The coin drop switches are only valid if they have been through
; 16 debounce timers, which is 16 * NMI/8, or about 0.5 seconds
CoinDropTimers[0]:
CheckCoinsInserted+6CheckCoinsInserted+1eCheckCoinsInserted+33CheckCoinsInserted+47CheckCoinsInserted+54coin_inserted+15coin_inserted+19
00b7
.byte[3]
; Debounce timer for each coin slot
coin_check_counter:
CheckCoinsInserted+13CheckCoinsInserted+69CheckCoinsInserted+6b
00ba
.byte
; Track how often the coin handling routine is called
Zbb:
RESET+15eRESET+194RESET+1b6RESET+221RESET+280RESET+285RESET+2cb
00bb
.byte
Zbc:
RESET+d1RESET+121RESET+123RESET+125RESET+131RESET+14cRESET+15cRESET+181RESET+196RESET+19fRESET+1b2
00bc
.byte
Zbd:
RESET+1f0RESET+200RESET+211
00bd
.byte
Zbe:
RESET+1faRESET+206RESET+215
00be
.byte
Zbf:
RESET+1feRESET+213
00bf
.byte
Zc0:
RESET+204RESET+217
00c0
.byte
state_c1:
RESET+1dNMI_handler+3b
00c1
.byte
state_c2:
RESET+1fNMI_handler+3d
00c2
.byte
IO_in0:
RESET+fRESET+85RESET+8aRESET+1f5GameLoop+cfGameLoop+f3vecgen_wait+5vecgen_wait+aio_in0_diagstep+0CheckCoinsInserted+20dvg_wait_done+4
2000
.byte
IO_in1_start:
RESET+1ecGameLoop+15e
2400
.byte
; Memory mapped active high button for start game
IO_in1_coin[0]:
CheckCoinsInserted+2
2401
.byte[3]
; Three memory mapped active high coin slots
IO_in1_select:
mission_button_handler+0
2404
.byte
; Memory mapped active high button for select difficulty level
IO_in1_abort:
GameLoop+1bb
2405
.byte
; Memory mapped active high button for abort the mission
IO_in1_yaw_right:
IO_read_rotate_buttons+2
2406
.byte
; Memory mapped active high button for rotate to the right
IO_in1_yaw_left:
IO_read_rotate_buttons+8
2407
.byte
; Memory mapped active high button for rotate to the left
IO_dsw1_0:
coin_credit_configure+20
2800
.byte
IO_dsw1_1:
coin_credit_configure+1b
2801
.byte
IO_dsw1_2:
coin_credit_configure+12
2802
.byte
IO_dsw1_RightCoin:
coin_credit_configure+0
2803
.byte
IO_thrust:
RESET+22cNMI_handler+6
2c00
.byte
IO_DMAGO:
GameLoop+ecvecgen_go_wait+0
3000
.byte
; Active low output for starting the Digital Vector Generator
; --------0 Attract lamp 0
; -------1- Attract lamp 1
; ------2-- Attract lamp 2
; -----3--- Attract lamp 3
; ----4---- Start/select LEDs
; ---5----- Coin counter enable
IO_output_latch:
RESET+127RESET+1dfRESET+265io_lamps_set+6
3200
.byte
; Lamps 0 - 3, Start, Select, Coin enable
IO_watchdog:
RESET+2fRESET+4aRESET+8fRESET+b0RESET+e4RESET+14eRESET+16eNMI_handler+36vecgen_wait+0
3400
.byte
; -----210 Thrust intensity
; ----3--- Thrust pitch
; --54--- Tone intensity
IO_audio_latch:
RESET+6RESET+7eRESET+99RESET+137RESET+13fRESET+27dio_audio_set+6
3c00
.byte
; Audio output control
IO_audio_reset:
ResetGameState+0
3e00
.byte
; Turn off the audio device
IO_vecgen_ram:
GameLoop+54
4000
.byte
D4001:
GameLoop+57
4001
.byte
D4002:
GameLoop+e9
4002
.byte
D4003:
GameLoop+e6
4003
.byte
D4bb3:
ResetGameState+c
4bb3
.byte c5
zoomed_in_settings_4bbc:
S711c+b5S711c+180
4bbc
.byte e8
D4bbd:
S711c+baS711c+185
4bbd
.byte a0
D4e44:
score_add_landing_bonus+1c
4e44
.byte 00
D4e45:
score_add_landing_bonus+22
4e45
.byte 0a
debris_subroutines_4e9e:
debris_something+5b
4e9e
.byte 57
D4e9f:
debris_something+61
4e9f
.byte c7
debris0_anim:
debris_get_animations_maybe+22
4eec
.byte 8e
debris1_anim:
debris_get_animations_maybe+1b
4ef8
.byte b7
debris2_anim:
debris_get_animations_maybe+14
4f04
.byte 9d
debris3_anim:
debris_get_animations_maybe+d
4f10
.byte bc
vectors_not_zoomed_51e2:
S711c+8d
51e2
.byte 80
D51e3:
S711c+95
51e3
.byte 03
D5222:
S711c+1c8
5222
.byte 68
D5223:
S711c+1cd
5223
.byte 03
twenty_subroutines[0]:

53ee
.word[20] c98f, c998, c99e, c9a7, c9b1, c9bb, c9c2, c9c9, c9d3, c9d7, c9db, c9e1, c9e5, c9e9, c9ef, c9f3, c98f, c998, c99e, c9a7
; Twenty subroutine calls, maybe ships or stars?
setup_display_2[0]:

5576
.word[8] 5140, 0240, f0cf, f3c3, 3680, c000, f3c7, d000
; ???
setup_display_3[0]:

5586
.word[9] 4640, 0300, f3c8, f7c7, f8c3, f3c7, 44c0, 0700, d000
; ???
setup_display_4[0]:

5598
.word[9] 40c0, 0300, f7c8, f3c7, f8c3, f7c7, 4240, 0700, d000
; ???
font_start:
game_state_reinit_maybe+31
55ae
.byte 00
setup_font[0]:

55b2
.word[6] f201, f070, f200, f070, fe01, d000
; ???
font_a[0]:

55be
.word[8] fac0, f2c2, f6c2, fec0, f906, f8c2, f602, d000
; Character "A"
; The characters are stored in the order ' ', 0 - 9, A - Z
CharPtrTbl[0]:
DrawString+12DrawString+18SetDigitVecPtr+10SetDigitVecPtr+15
57a2
.word[47] cb93, cb44, cb95, cb99, cba1, cba8, cbaf, cbb6, cbbd, cbc2, cbca, cadf, cae7, caf4, cafa, cb02, cb0a, cb11, cb1a, cb21, cb28, cb2e, cb34, cb39, cb3f, cb44, cb4a, cb51, cb5a, cb62, cb69, cb6f, cb75, cb7a, cb81, cb86, cb8d, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 0000, 3700
; Subroutine calls for each font character
string_table_language_offset[0]:
coin_credit_configure+dWriteText+41
5800
.byte[3] 00, 30, 60
; Amount to add to string IDs to get the localized version for each language
string_table_localized[0]:
WriteText+45WriteText+48
5804
.ptr[72] str_APPUYER_SUR_START[0], str_CARBURANT_DIMINUE[0], str_PLUS_DE_CARBURANT[0], str_PERDUES[0], str_INTRODUIRE_LES_PIECES[0], str_PAR_PIECE[0], str_RESERVOIR_AUXILIAIRE_DE_CARBURANT_DETRUIT[0], str_FELICITATIONS[0], str_VOUS_AVEZ_ATTERRI_DIFFICILEMENT[0], str_SPLENDIDE_ATTERRISSAGE[0], str_LE_EAGLE_A_ATTERRI[0], str_LE_COLUMBIA_A_ATTERRI[0], str_VOUS_AVEZ_ATTERRI[0], str_LE_SUPPORT_DE_SAUVETAGE_EST_PARTI[0], str_VOTRE_VOYAGE_EST_SANS_RETOUR[0], str_PERDU_SANS_ESPOIR[0], str_SYSTEME_DE_COMMUNICATION_DETRUIT[0], str_SYSTEME_DE_COMMUNICATION_DETRUIT[25], str_VOUS_AVEZ_CREE_UN_CRATERE_DE_DEUX_KILOMETRES[0], str_VOUS_AVEZ_UN_CRASH[0], str_IL_NEY_A_PAS_DE_SURVIVANTS[0], None, str_CHOIX_DU_JEU[0], str__UNITES_DE_CARBURANT_[0], str_PULSAR_START[0], str_POCO_COMBUSTIBLE[0], str_SIN_COMBUSTIBLE[0], str_PERDIDAS[0], str_INSERTE_FICHAS[0], str_POR_FICHA[0], str_TANQUES_AUXILIARES_DE_COMBUSTIBLE_DESTRUIDOS[0], str_FELICITACIONES[0], str_USTED_ALUNIZO_VIOLENTAMENTE[0], str_FUE_UN_GRAN_ALUNIZAJE[0], str_EL_AGUILA_HA_ALUNIZADO[0], str_EL_COLUMBIA_HA_ALUNIZADO[0], str_USTED_HA_ALUNIZADO[0], str_EQUIPO_DE_SUPERVIVENCIA_DESTRUIDO[0], str_SU_VIAJE_ES_DE_IDA_SOLAMENTE[0], str_LAMENTABLEMENTE_USTED_NO_PUEDE_VOLVER[0], str_SISTEMA_DE_COMUNICACION_DESTRUIDO[0], str_SISTEMA_DE_COMUNICACION_DESTRUIDO[24], str_USTED_CREO_UN_CRATER_DE_2_KILOMETROS[0], str_DEMOLER[0], str_NO_HUBO_SOBREVIVIENTES[0], str__PUNTOS[0], str_ELEGIR_JUEGO[0], str__UNIDADES_DE_COMBUSTIBLE_[0], str_STARTKNOEPFE_DRUECKEN[0], str_TREIBSTOFF_GEHT_AUS[0], str_TREIBSTOFFTANKS_LEER[0], str_TEILVERLUST[0], str_GELD_AUSWERFEN[0], str_ZUKAUF_PRO_MUENZE[0], str_ZUSATZTREIBSTOFFTANKS_ZERSTOERT[0], str_GRATULATION[0], str_SIE_SIND_HART_GELANDET[0], str_DIES_WAR_EINE_GROSSARTIGE_LANDUNG[0], str_EAGLE_IST_GELANDET[0], str_COLUMBIA_IST_GELANDET[0], str_SIE_SIND_GELANDET[0], str_LEBENSRETTUNGSSYSTEME_SIND_AUSGEFALLEN[0], str_REISE_OHNE_RUECKKEHR[0], str_KEIN_RUECKSTART_ZUR_ERDE_MOEGLICH[0], str_KOMMUNIKATIONSSYSTEM_ZERSTOERT[0], str_KOMMUNIKATIONSSYSTEM_ZERSTOERT[21], str_SIE_HABEN_EINEN_2_KILOMETER_KRATER_AUFGERISSEN[0], str_50_000_000_MARK_SIND_IN_DIE_LUFT_GEJAGT[0], str_KEINE_UEBERLEBENDEN[0], str__PUNKTE[0], str_SPIELWAHL[0], str__TREIBSTOFF_[0]
; Localized strings
D5e69:
draw_lots_of_stuff+136
5e69
.byte 6f
D5e6a:
draw_lots_of_stuff+133
5e6a
.byte 5e
localized_language_offset[0]:
WriteText+d
5fa1
.byte[3] 00, 1d, 3a
; String id mapping for each language
localized_string_offset[0]:
WriteText+11
5fa4
.byte[93] eb, ee, ee, f7, e5, fd, df, 06, d0, 06, 12, 09, 15, f7, 06, 27, fa, 63, f4, 42, 2a, 00, 03, e5, 00, 00, 00, 00, 00, fa, f1, f4, f4, fa, fd, d6, 03, dc, 09, 06, 00, 12, f7, 06, eb, f7, 5d, 0c, 63, 36, 00, 03, d9, 00, 00, 00, 00, 00, df, e8, e5, eb, fa, e5, fd, 0c, eb, e5, 12, 09, 15, e8, 1e, f7, 00, 5d, ee, 03, 3f, 00, 0c, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 6b
; Index into the big string table for localized strings
InitGame:
RESET+32GameLoop+1b5
6001
201362
JSR ResetGameState↓
6004
a980
LDA #$80
6006
855d
STA ship_state_maybe
GameLoop:
GameLoop+1a1
6008
2497
BIT fuel_state
600a
300f
BMI L601b↓
600c
a900
LDA #$00
600e
8522
STA game_state_flags
6010
8597
STA fuel_state
6012
245d
BIT ship_state_maybe
6014
104c
BPL GameLoop_maybe↓
6016
201362
JSR ResetGameState↓
6019
d028
BNE L6043↓
L601b:
600a
601b
a522
LDA game_state_flags
601d
d021
BNE L6040↓
601f
201362
JSR ResetGameState↓
6022
a9f0
LDA #$f0
6024
a208
LDX #$08
6026
205f79
JSR io_lamps_set↓
6029
a200
LDX #$00
602b
8623
STX mission_difficulty
602d
86a4
STX score_bcd
602f
86a5
STX Za5
6031
a911
LDA #$11
6033
8563
STA gravity
6035
a920
LDA #$20
6037
a698
LDX fuel_per_coin
6039
d001
BNE L603c↓
603b
4a
LSR
L603c:
6039
603c
8522
STA game_state_flags
603e
d003
BNE L6043↓
L6040:
601d6182725a
6040
203562
JSR game_state_reinit_maybe↓
L6043:
6019603e
6043
20a973
JSR draw_lots_of_stuff↓
6046
a22c
LDX #$2c
6048
a0ca
LDY #$ca
604a
a521
LDA language_setting
604c
f004
BEQ L6052↓
604e
a2a0
LDX #$a0
6050
a0c3
LDY #$c3
L6052:
604c
6052
a522
LDA game_state_flags
6054
2920
AND #$20
6056
f004
BEQ L605c↓
6058
a200
LDX #$00
605a
a0f0
LDY #$f0
L605c:
6056
605c
8e0040
STX IO_vecgen_ram
605f
8c0140
STY D4001
GameLoop_maybe:
6014618561c0
6062
a240
LDX #$40
6064
a004
LDY #$04
6066
a586
LDA FrameCounter
6068
4a
LSR
6069
9004
BCC L606f↓
606b
a242
LDX #$42
606d
a084
LDY #$84
L606f:
6069
606f
8628
STX VecRamPtr_high
6071
8427
STY VecRamPtr
6073
a522
LDA game_state_flags
6075
2920
AND #$20
6077
d02d
BNE L60a6↓
6079
209567
JSR draw_even_more_stuff↓
607c
203965
JSR vec_draw_51ba_table↓
607f
206765
JSR vec_draw_subroutines↓
6082
20ad65
JSR draw_ship_prep_maybe↓
6085
a522
LDA game_state_flags
6087
2910
AND #$10
6089
d01b
BNE L60a6↓
608b
2422
BIT game_state_flags
608d
101d
BPL L60ac↓
608f
a562
LDA touchdown_velocities_maybe
6091
290f
AND #$0f
6093
f00b
BEQ L60a0↓
6095
a529
LDA vecdata_ptr_start
6097
8527
STA VecRamPtr
6099
a52a
LDA Z2a
609b
8528
STA VecRamPtr_high
609d
209575
JSR debris_something↓
L60a0:
6093
60a0
20d668
JSR draw_level_over_screen↓
60a3
4cce60
JMP L60ce↓
L60a6:
60776089
60a6
207e68
JSR draw_push_start_screen↓
60a9
4cce60
JMP L60ce↓
L60ac:
608d
60ac
209d66
JSR debris_update↓
60af
2422
BIT game_state_flags
60b1
5018
BVC L60cb↓
60b3
a523
LDA mission_difficulty
60b5
d00b
BNE L60c2↓
60b7
a586
LDA FrameCounter
60b9
290f
AND #$0f
60bb
c908
CMP #$08
60bd
d003
BNE L60c2↓
60bf
200965
JSR ship_vel_decay↓
L60c2:
60b560bd
60c2
209e68
JSR draw_out_of_fuel_screen↓
60c5
20ff67
JSR draw_bonus_maybe↓
60c8
4cce60
JMP L60ce↓
L60cb:
60b1
60cb
209f79
JSR draw_insert_coin_screen↓
L60ce:
60a360a960c8
60ce
a0de
LDY #$de
60d0
a94b
LDA #$4b
60d2
a206
LDX #$06
60d4
20a67e
JSR vecram_memcpy_update_vecptr↓
60d7
ad0020
LDA IO_in0
60da
2902
AND #$02
L60dc:
60dc
60dc
f0fe
BEQ L60dc↺
60de
202d65
JSR dvg_wait_done↓
60e1
a002
LDY #$02
60e3
a2f0
LDX #$f0
60e5
a586
LDA FrameCounter
60e7
4a
LSR
60e8
9004
BCC L60ee↓
60ea
a2e1
LDX #$e1
60ec
a042
LDY #$42
L60ee:
60e8
60ee
8e0340
STX D4003
60f1
8c0240
STY D4002
60f4
8d0030
STA IO_DMAGO
60f7
e686
INC FrameCounter
60f9
a200
LDX #$00
60fb
ad0020
LDA IO_in0
60fe
2904
AND #$04
6100
d002
BNE L6104↓
6102
a220
LDX #$20
L6104:
6100
6104
a91f
LDA #$1f
6106
205379
JSR io_audio_set↓
6109
20e662
JSR coin_inserted↓
610c
201464
JSR thrust_smoothing_maybe↓
610f
2422
BIT game_state_flags
6111
3037
BMI L614a↓
6113
501f
BVC L6134↓
6115
20326b
JSR ship_compute_accel_xy↓
6118
203c63
JSR ship_command_yaw↓
611b
20716b
JSR fuel_drain_thrust↓
611e
201b75
JSR bcd_score_maybe↓
6121
a501
LDA actual_thrust_maybe
6123
c910
CMP #$10
6125
d002
BNE L6129↓
6127
a90f
LDA #$0f
L6129:
6125
6129
4a
LSR
612a
0901
ORA #$01
612c
aa
TAX
612d
a930
LDA #$30
612f
205379
JSR io_audio_set↓
6132
d00d
BNE L6141↓
L6134:
6113
6134
a920
LDA #$20
6136
a200
LDX #$00
6138
205379
JSR io_audio_set↓
613b
a522
LDA game_state_flags
613d
2920
AND #$20
613f
d009
BNE L614a↓
L6141:
6132
6141
20686c
JSR ship_update↓
6144
204f6d
JSR GameRunningLoop↓
6147
201c71
JSR S711c↓
L614a:
6111613f
614a
a522
LDA game_state_flags
614c
f05b
BEQ L61a9↓
614e
20ab62
JSR mission_button_handler↓
6151
2422
BIT game_state_flags
6153
3033
BMI L6188↓
6155
7055
BVS L61ac↓
6157
a200
LDX #$00
6159
a586
LDA FrameCounter
615b
2910
AND #$10
615d
d002
BNE L6161↓
615f
a210
LDX #$10
L6161:
615d
6161
a90f
LDA #$0f
6163
205f79
JSR io_lamps_set↓
6166
2c0024
BIT IO_in1_start
6169
3006
BMI L6171↓
616b
a940
LDA #$40
616d
8525
STA start_game_debounce
616f
d004
BNE L6175↓
L6171:
6169
6171
0625
ASL start_game_debounce
6173
b00d
BCS L6182↓
L6175:
616f
6175
245d
BIT ship_state_maybe
6177
100c
BPL L6185↓
6179
201362
JSR ResetGameState↓
617c
a910
LDA #$10
617e
8522
STA game_state_flags
6180
d003
BNE L6185↓
L6182:
6173
6182
4c4060
JMP L6040↑
L6185:
61776180619d61a1
6185
4c6260
JMP GameLoop_maybe↑
L6188:
6153
6188
2462
BIT touchdown_velocities_maybe
618a
500e
BVC L619a↓
618c
245c
BIT Z5c
618e
1004
BPL L6194↓
6190
245d
BIT ship_state_maybe
6192
3006
BMI L619a↓
L6194:
618e
6194
20686c
JSR ship_update↓
6197
204f6d
JSR GameRunningLoop↓
L619a:
618a6192
619a
a586
LDA FrameCounter
619c
4a
LSR
619d
b0e6
BCS L6185↑
619f
e656
INC ship_abort
61a1
10e2
BPL L6185↑
61a3
0656
ASL ship_abort
61a5
a562
LDA touchdown_velocities_maybe
61a7
855d
STA ship_state_maybe
L61a9:
614c
61a9
4c0860
JMP GameLoop↑
L61ac:
6155
61ac
a55d
LDA ship_state_maybe
61ae
3028
BMI game_next_level_setup↓
61b0
20aa64
JSR abort_procedure_update↓
61b3
2497
BIT fuel_state
61b5
300c
BMI abort_button_handler↓
61b7
a58d
LDA time_in_seconds
61b9
c905
CMP #$05
61bb
9003
BCC call_init_game_thunk↓
61bd
4c0160
JMP InitGame↑
call_init_game_thunk:
61bb61cc61d061d66211
61c0
4c6260
JMP GameLoop_maybe↑
abort_button_handler:
61b5
61c3
2c0524
BIT IO_in1_abort
61c6
3006
BMI L61ce↓
61c8
a940
LDA #$40
61ca
8568
STA abort_debounce
61cc
d0f2
BNE call_init_game_thunk↑
L61ce:
61c6
61ce
0668
ASL abort_debounce
61d0
90ee
BCC call_init_game_thunk↑
61d2
a964
LDA #$64
61d4
8556
STA ship_abort
61d6
d0e8
BNE call_init_game_thunk↑
game_next_level_setup:
61ae
61d8
20e06b
JSR score_add_landing_bonus↓
61db
a55d
LDA ship_state_maybe
61dd
8562
STA touchdown_velocities_maybe
61df
0a
ASL
61e0
d007
BNE L61e9↓
61e2
a000
LDY #$00
61e4
a950
LDA #$50
61e6
201363
JSR fuel_increase_limit_9999↓
L61e9:
61e0
61e9
20906b
JSR fuel_lost_to_crash_wrapper↓
61ec
209476
JSR landed_choose_random↓
61ef
a200
LDX #$00
61f1
86af
STX Zaf
61f3
86b0
STX math_something
61f5
86b1
STX Zb1
61f7
a00a
LDY #$0a
L61f9:
61fc
61f9
9657
STX ship_enable_y,Y
61fb
88
DEY
61fc
10fb
BPL L61f9↑
61fe
a920
LDA #$20
6200
205379
JSR io_audio_set↓
6203
0622
ASL game_state_flags
6205
a901
LDA #$01
6207
8556
STA ship_abort
6209
a90a
LDA #$0a
620b
8561
STA ship_vel_high[1]
620d
a941
LDA #$41
620f
8563
STA gravity
6211
d0ad
BNE call_init_game_thunk↑
ResetGameState:
InitGame+0GameLoop+eGameLoop+17GameLoop+171
6213
8d003e
STA IO_audio_reset
6216
a208
LDX #$08
6218
8602
STX ship_angle_modulo
L621a:
6225
621a
bd0e78
LDA D780e,X
621d
9506
STA yaw_nonzero,X
621f
bdb34b
LDA D4bb3,X
6222
950c
STA Z0c,X
6224
ca
DEX
6225
d0f3
BNE L621a↑
6227
8660
STX ship_vel[1]
6229
8661
STX ship_vel_high[1]
622b
a574
LDA nmi_counter
622d
855f
STA ship_vel_high[0]
622f
a911
LDA #$11
6231
8563
STA gravity
6233
1053
BPL bzero_ship_state↓
game_state_reinit_maybe:
GameLoop+38
6235
a574
LDA nmi_counter
6237
2903
AND #$03
6239
8533
STA nmi_counter_4
623b
18
CLC
623c
6901
ADC #$01
623e
2903
AND #$03
6240
8534
STA nmi_counter_next
6242
a574
LDA nmi_counter
6244
4a
LSR
6245
4a
LSR
6246
290f
AND #$0f
6248
c90f
CMP #$0f
624a
d002
BNE L624e↓
624c
a904
LDA #$04
L624e:
624a
624e
209e62
JSR return_x_plus_1_or_10↓
6251
8535
STA Z35
6253
490f
EOR #$0f
6255
209e62
JSR return_x_plus_1_or_10↓
6258
8536
STA Z36
625a
a203
LDX #$03
L625c:
626c
625c
bd1378
LDA D7813,X
625f
955e
STA ship_vel[0],X
6261
bd0f78
LDA D780f,X
6264
9507
STA ship_pos[0],X
6266
bdae55
LDA font_start,X
6269
9511
STA Z11,X
626b
ca
DEX
626c
10ee
BPL L625c↑
626e
a900
LDA #$00
6270
aa
TAX
6271
a007
LDY #$07
L6273:
6276
6273
969c
STX time_bcd[0],Y
6275
88
DEY
6276
10fb
BPL L6273↑
6278
a940
LDA #$40
627a
8522
STA game_state_flags
627c
a90f
LDA #$0f
627e
205f79
JSR io_lamps_set↓
6281
a910
LDA #$10
6283
8502
STA ship_angle_modulo
6285
20be62
JSR ship_reset↓
bzero_ship_state:
6233
6288
a200
LDX #$00
628a
a00e
LDY #$0e
L628c:
628f
628c
964f
STX score_dec_something1,Y
628e
88
DEY
628f
10fb
BPL L628c↑
6291
ca
DEX
6292
a007
LDY #$07
L6294:
6297
6294
9679
STX Z79,Y
6296
88
DEY
6297
10fb
BPL L6294↑
6299
a940
LDA #$40
629b
854e
STA drawing_scale
629d
60
RTS
return_x_plus_1_or_10:
game_state_reinit_maybe+19game_state_reinit_maybe+20
629e
c904
CMP #$04
62a0
b004
BCS L62a6↓
62a2
6901
ADC #$01
62a4
090a
ORA #$0a
L62a6:
62a0
62a6
60
RTS
mission_gravity[0]:
ship_reset+11
62a7
.byte[4] 11, 11, 22, 11
; Gravity settings for the different missions
mission_button_handler:
GameLoop+146
62ab
2c0424
BIT IO_in1_select
62ae
102d
BPL mission_debounce_reset↓
62b0
0624
ASL mission_debounce
62b2
902d
BCC L62e1↓
62b4
e623
INC mission_difficulty
62b6
a523
LDA mission_difficulty
62b8
2903
AND #$03
62ba
8523
STA mission_difficulty
; Reset the ship but keep the angle the same
ship_reset_saved_angle:
abort_procedure_update+26
62bc
a502
LDA ship_angle_modulo
; Load the current ship angle and fall through
; Reset the ship to a new angle and re-read the mission parameters
; A: Ship's starting angle from 0 - 31
ship_reset:
game_state_reinit_maybe+50
62be
0a
ASL
; Multiply the small angle
62bf
0a
ASL
; by four
62c0
8567
STA ship_angle_high
; and store that in the high byte of the ship angle
62c2
a900
LDA #$00
; Memset the yaw_rate, yaw_slow and yaw_nonzero
62c4
a203
LDX #$03
; parameters to 0
ship_reset_bzero:
62c9
62c6
9503
STA yaw_rate,X
; bzzzzt
62c8
ca
DEX
; x--
62c9
10fb
BPL ship_reset_bzero↑
; keep bzeroing
62cb
8566
STA ship_angle
; zero the low byte of the ship angle
62cd
a623
LDX mission_difficulty
; Read the current mission setting
62cf
bda762
LDA mission_gravity[0],X
; Read the mission specific gravity
62d2
8563
STA gravity
; and store it in a global
62d4
bde262
LDA mission_lamps[0],X
; Read the lamps to illuminate for this mission
62d7
aa
TAX
; Move them to X
62d8
a9f0
LDA #$f0
; Keep the rest of the bits on
62da
4c5f79
JMP io_lamps_set↓
; make a tail call to turn on the lamps
mission_debounce_reset:
62ae
62dd
a940
LDA #$40
62df
8524
STA mission_debounce
L62e1:
62b2
62e1
60
RTS
mission_lamps[0]:
ship_reset+16
62e2
.byte[4] 08, 04, 02, 01
; Bitmask of lamps to illuminate based on the mission difficulty
coin_inserted:
GameLoop+101
62e6
206b79
JSR coin_credit_configure↓
62e9
d007
BNE L62f2↓
62eb
2497
BIT fuel_state
62ed
7003
BVS L62f2↓
62ef
200963
JSR fuel_add_credit↓
L62f2:
62e962ed
62f2
a6b6
LDX NumCredits_maybe
62f4
f005
BEQ L62fb↓
62f6
c6b6
DEC NumCredits_maybe
62f8
200963
JSR fuel_add_credit↓
L62fb:
62f4
62fb
a6b8
LDX CoinDropTimers[1]
62fd
f009
BEQ L6308↓
62ff
c6b8
DEC CoinDropTimers[1]
L6301:
6306
6301
200963
JSR fuel_add_credit↓
6304
c699
DEC credits_per_coin
6306
d0f9
BNE L6301↑
L6308:
62fd
6308
60
RTS
fuel_add_credit:
coin_inserted+9coin_inserted+12coin_inserted+1b
6309
a598
LDA fuel_per_coin
630b
0a
ASL
630c
aa
TAX
630d
bd2a63
LDA fuel_per_coin_bcd_table,X
6310
bc2b63
LDY D632b,X
fuel_increase_limit_9999:
GameLoop+1de
6313
a2ff
LDX #$ff
6315
8697
STX fuel_state
6317
f8
SED
6318
18
CLC
6319
65ad
ADC fuel_tank[1]
631b
aa
TAX
631c
98
TYA
631d
65ae
ADC fuel_tank[2]
631f
d8
CLD
6320
9003
BCC L6325↓
6322
a999
LDA #$99
6324
aa
TAX
L6325:
6320
6325
85ae
STA fuel_tank[2]
6327
86ad
STX fuel_tank[1]
6329
60
RTS
fuel_per_coin_bcd_table:
fuel_add_credit+4
632a
.byte 00
D632b:
fuel_add_credit+7
632b
.byte 09
; ship_command_yaw handles the hard yaw mode in difficulty 3 "Command"
; where the player controls the yaw thrusters, rather than the angle.
; this allows the ship to rotate all the way around and they have to stop
; rotation by firing the opposite thruster. it's really hard!
;
; if the game is in a lower difficulty mission, then ship_command_yaw_easy will
; be called instead.
ship_command_yaw:
GameLoop+110
633c
a556
LDA ship_abort
; Only process commands if ship_abort is not set
633e
f001
BEQ not_aborting↓
;
6340
60
RTS
; Abort in process, nothing to do here
not_aborting:
633e
6341
a523
LDA mission_difficulty
; Use the easy mode for yaw commands other than
6343
c903
CMP #$03
; if mission_difficulty == 3 ("Command")
6345
f003
BEQ yaw_momentum↓
; then we will use yaw momentum that is much harder
6347
4cd463
JMP ship_command_yaw_easy↓
; else Tail position call to ship_command_yaw_easy
yaw_momentum:
6345
634a
a566
LDA ship_angle
; ship_angle += yaw_rate
634c
18
CLC
; these are normal signed
634d
6503
ADC yaw_rate
; 16-bit values, so the
634f
8566
STA ship_angle
; code is much simpler than
6351
a567
LDA ship_angle_high
; the signed magnitude stuff
6353
6504
ADC yaw_rate_high
; that comes later
6355
8567
STA ship_angle_high
; for the ship_update
6357
4a
LSR
; Divide the high-byte of the angle
6358
4a
LSR
; by four
6359
291f
AND #$1f
; And mask it down to 0-31
635b
8502
STA ship_angle_modulo
; Store it in the 8-bit ship angle
635d
a000
LDY #$00
;
635f
a503
LDA yaw_rate
;
6361
a604
LDX yaw_rate_high
;
6363
f00a
BEQ yaw_rate_high_zero↓
; if yaw_rate high == 0, then check low
6365
e8
INX
; increment X
6366
d00b
BNE yaw_check_fuel↓
; if yaw_rate high != 0xFF, then don't set yaw dir
6368
c9c0
CMP #$c0
; if yaw_rate > -0x40
636a
9007
BCC yaw_check_fuel↓
; then don't set yaw dir
set_yaw_slow:
6371
636c
88
DEY
; decrement Y to mark that maybe we are close enough to stopped?
636d
3004
BMI yaw_check_fuel↓
; always taken since Y now = -1
yaw_rate_high_zero:
6363
636f
c941
CMP #$41
; if yaw_rate < 0x41
6371
90f9
BCC set_yaw_slow↑
; then jump to set_yaw_slow
yaw_check_fuel:
6366636a636d
6373
8405
STY yaw_slow
; Set if yaw_rate is close enough to zero to be almost stopped
6375
2497
BIT fuel_state
; Do we have any fuel left?
6377
105a
BPL rts_63d3↓
; If bit 7 is not set, we can't fire yaw thruster, so return
6379
200464
JSR IO_read_rotate_buttons↓
; We have some fuel, so see if the player has pressed yaw button
637c
0a
ASL
; The result in A is +/- 1
637d
0a
ASL
; Shift-left
637e
0a
ASL
; four times
637f
0a
ASL
; to result in +/-16
6380
a000
LDY #$00
; Y is the high-byte for the yaw button command
6382
29f0
AND #$f0
; Mask out the bottom bits of the yaw command (which should already be 0)
6384
f025
BEQ no_yaw_command↓
; If they are not pressing a button?
6386
9001
BCC yaw_cmd_left↓
; If positive yaw command, then we're going left Y:A = +16
6388
88
DEY
; Going right: Y:A = -16
yaw_cmd_left:
6386
6389
18
CLC
; 16-bit add of Y:A and yaw_rate
638a
6503
ADC yaw_rate
; add the low bytes
638c
aa
TAX
; cache the result low byte in X
638d
98
TYA
; move the high byte of the yaw command into A
638e
6504
ADC yaw_rate_high
; add the high bytes
6390
100a
BPL yaw_positive↓
; if yaw_rate > 0 goto yaw_positive
6392
c9fc
CMP #$fc
; if yaw_rate > -0x400
6394
b00e
BCS store_yaw_rate↓
; -- goto yaw_positive
6396
a9fc
LDA #$fc
; cap yaw_rate at -0x400
6398
a200
LDX #$00
; which is 0xFC00 as a 16-bit value
639a
f008
BEQ store_yaw_rate↓
; always taken
yaw_positive:
6390
639c
c904
CMP #$04
; if yaw_rate < +0x400
639e
9004
BCC store_yaw_rate↓
; -- goto yaw_positive
63a0
a903
LDA #$03
; cap yaw_rate at +0x03e0
63a2
a2e0
LDX #$e0
; which is 0x03e0 since it is positive
store_yaw_rate:
6394639a639e
63a4
8504
STA yaw_rate_high
; store the high byte
63a6
8603
STX yaw_rate
; store the low byte
63a8
4cfe63
JMP yaw_drain_fuel↓
; tail position call to spend some fuel for firing the yaw thrusters
no_yaw_command:
6384
63ab
a505
LDA yaw_slow
; if yaw_slow == 0 (are we slow enough?)
63ad
f01e
BEQ update_yaw_nonzero↓
; then nothing to do
63af
a506
LDA yaw_nonzero
; is yaw_nonzero == 0
63b1
f005
BEQ L63b8↓
;
63b3
a900
LDA #$00
; Set the new yaw_rate to be 0
63b5
aa
TAX
; high and low bytes in X:A == 0
63b6
f011
BEQ update_yaw_rate↓
; always taken
L63b8:
63b1
63b8
a503
LDA yaw_rate
; Check for yaw_rate == 0
63ba
0504
ORA yaw_rate_high
; high and low bytes
63bc
f00f
BEQ update_yaw_nonzero↓
; and update the yaw_nonzero value
63be
a950
LDA #$50
; Decay the yaw rate to 0x0050
63c0
a200
LDX #$00
; by setting X:A
63c2
2404
BIT yaw_rate_high
; if yaw_rate is positive
63c4
1003
BPL update_yaw_rate↓
; then use this value
63c6
a9b0
LDA #$b0
; else set X:A to 0xFFB0
63c8
ca
DEX
; (by decrement)
update_yaw_rate:
63b663c4
63c9
8604
STX yaw_rate_high
; Store X:A into the yaw_rate
63cb
8503
STA yaw_rate
; high and low bytes
update_yaw_nonzero:
63ad63bc
63cd
a503
LDA yaw_rate
; are any bits set in the yaw_rate
63cf
0504
ORA yaw_rate_high
; high or low bytes?
63d1
8506
STA yaw_nonzero
; if so update yaw_nonzero
rts_63d3:
ship_command_yaw+3bship_command_yaw_easy+2ship_command_yaw_easy+7ship_command_yaw_easy+28
63d3
60
RTS
; Shared RTS instruction used by several functions
; Control the ship's yaw by adjusting the angle.
; In the three easy modes the player only controls the rotation angle of the ship
; with the rotate left and rotate right buttons.
; In the easiest mode the ship is limited to mostly upright angles.
;
; Yawing does cost a small amount of fuel and there is a tail call
; to yaw_drain_fuel.
;
ship_command_yaw_easy:
ship_command_yaw+b
63d4
2497
BIT fuel_state
; Read the fuel variable
63d6
10fb
BPL rts_63d3↑
; If bit 8 is not set (no fuel) jump to the shared RTS
63d8
200464
JSR IO_read_rotate_buttons↓
; Read the rotation buttons
63db
f0f6
BEQ rts_63d3↑
; If neither (or both) are set, no rotation so jump to the shared RTS
63dd
18
CLC
; Clear carry flag
63de
6567
ADC ship_angle_high
; A = Rotation (+1/-1) plus the high byte of the ship's angle
63e0
8567
STA ship_angle_high
; Store the updated rotation back into the high byte
63e2
aa
TAX
; Cache the high byte in X
63e3
4a
LSR
; A = A / 2
63e4
4a
LSR
; A = A / 2
63e5
291f
AND #$1f
; A = (Rotation / 4) % 32 -- how far is the angle into the quadrant
63e7
8502
STA ship_angle_modulo
; Store this remainder
63e9
a523
LDA mission_difficulty
; What's the current difficulty level?
63eb
d011
BNE yaw_drain_fuel↓
; Non-zero difficulty allows arbitrary rotation angles
63ed
e8
INX
; But level 0 prevents the ship from rotating past +/- 90 deg
63ee
f006
BEQ cancel_rotation↓
; if this is 0, the ship would have rotated too far
63f0
e042
CPX #$42
;
63f2
d00a
BNE yaw_drain_fuel↓
;
63f4
a910
LDA #$10
;
cancel_rotation:
63ee
63f6
8502
STA ship_angle_modulo
; Store the corrected remainder
63f8
0a
ASL
;
63f9
0a
ASL
;
63fa
8567
STA ship_angle_high
; And store the correct high byte for the ship's angle
63fc
90d5
BCC rts_63d3↑
; if no rotation happened do not drain any fuel, otherwise fall through into yaw_drain_fuel
; Wrapper that drains a small amount of fuel when yawing.
; All difficulties use this.
; There is a tail call to fuel_drain
yaw_drain_fuel:
ship_command_yaw+6cship_command_yaw_easy+17ship_command_yaw_easy+1e
63fe
a200
LDX #$00
; Pass a 16-bit BCD value 0x0600 to
6400
a006
LDY #$06
; the fuel drain wrapper
6402
d05d
BNE fuel_drain_16↓
; (Always taken)
IO_read_rotate_buttons:
ship_command_yaw+3dship_command_yaw_easy+4
6404
a200
LDX #$00
; X = 0
6406
2c0624
BIT IO_in1_yaw_right
; Read the right button from the IO port
6409
1001
BPL not_right↓
; If bit 7 is not set, Button is not pressed, jump to 0x640c
640b
ca
DEX
; X = X - 1
not_right:
6409
640c
2c0724
BIT IO_in1_yaw_left
; Read the left button from the IO port
640f
1001
BPL not_left↓
; Button is not pressed, jump to 0x6412
6411
e8
INX
; X = X + 1
not_left:
640f
6412
8a
TXA
; A = X
6413
60
RTS
; Return 0 if neither or both buttons are pessed, -1 for right, +1 for left
thrust_smoothing_maybe:
GameLoop+104
6414
2422
BIT game_state_flags
;
6416
5004
BVC L641c↓
;
6418
a556
LDA ship_abort
;
641a
d044
BNE L6460↓
;
L641c:
6416
641c
a584
LDA thrust_low
;
641e
4a
LSR
;
641f
4a
LSR
;
6420
aa
TAX
;
6421
4a
LSR
;
6422
8537
STA GenByte_0037
;
6424
a000
LDY #$00
;
6426
e482
CPX thrust_delta_last_raw
;
6428
b01a
BCS L6444↓
;
642a
a584
LDA thrust_low
;
642c
38
SEC
;
642d
e582
SBC thrust_delta_last_raw
;
642f
a00f
LDY #$0f
;
6431
9011
BCC L6444↓
;
6433
c537
CMP GenByte_0037
;
6435
900d
BCC L6444↓
;
6437
a582
LDA thrust_delta_last_raw
;
6439
a484
LDY thrust_low
;
643b
20c070
JSR divide↓
;
643e
8a
TXA
;
643f
4a
LSR
;
6440
4a
LSR
;
6441
4a
LSR
;
6442
4a
LSR
;
6443
a8
TAY
;
L6444:
642864316435
6444
8401
STY actual_thrust_maybe
;
6446
a000
LDY #$00
;
6448
a585
LDA thrust_something_counter
;
644a
c94b
CMP #$4b
;
644c
9008
BCC L6456↓
;
644e
e683
INC thrust_high
;
6450
c684
DEC thrust_low
;
6452
c684
DEC thrust_low
;
6454
8485
STY thrust_something_counter
;
L6456:
644c
6456
2497
BIT fuel_state
;
6458
1004
BPL L645e↓
;
645a
a522
LDA game_state_flags
;
645c
d002
BNE L6460↓
;
L645e:
6458
645e
8401
STY actual_thrust_maybe
;
L6460:
641a645c
6460
60
RTS
; Return to caller
; Drain a 16-bit BCD X:Y amount of fuel from the ship.
; This tail calls into fuel_drain
fuel_drain_16:
fuel_drain_thrust+1cyaw_drain_fuel+4
6461
a900
LDA #$00
;
; Drain a 24-bit BCD A:X:Y amount of fuel from the ship
;
fuel_drain:
fuel_lost_to_crash+2e
6463
f8
SED
; Enable Decimal mode since the fuel is in BCD
6464
8539
STA GenByte_0039
; Cache the MSB of the argument into GenBytes 39
6466
8638
STX GenByte_0038
; ... the middle byte into 38
6468
8437
STY GenByte_0037
; ... the lowest byte into 37
646a
a5ac
LDA fuel_tank[0]
; Load LSB of fuel
646c
38
SEC
; Clear the carry (to start a SBC chain)
646d
e537
SBC GenByte_0037
; fuel_tank[0] - GenByte37
646f
a8
TAY
; -> Y
6470
a5ad
LDA fuel_tank[1]
; Load the middle byte of fuel
6472
e538
SBC GenByte_0038
; fuel_tank[1] - GenByte38
6474
aa
TAX
; -> X
6475
a5ae
LDA fuel_tank[2]
; Load the MSB of fuel
6477
e539
SBC GenByte_0039
; fuel_tank[2] - GenByte39 -> A
6479
b014
BCS fuel_no_underflow↓
; If carry is not set, the remaining fule did not go below zero
low_fuel:
6497
647b
2497
BIT fuel_state
; Read the fuel_state global
647d
1029
BPL fuel_drain_done↓
; If bit 7 is not set, then we've already run out of fuel
647f
a940
LDA #$40
; Store 0x40 indicting out of fuel
6481
8597
STA fuel_state
; into fuel_state
6483
a900
LDA #$00
; Write 00:00:00 into fuel_tank
6485
85ac
STA fuel_tank[0]
; no fuel
6487
85ad
STA fuel_tank[1]
; so sad
6489
85ae
STA fuel_tank[2]
; burma shave
648b
858d
STA time_in_seconds
; stop the clock?
648d
f00a
BEQ fuel_track_used↓
; always taken
fuel_no_underflow:
6479
648f
84ac
STY fuel_tank[0]
; Store LSB of the 3-byte remaining fuel
6491
86ad
STX fuel_tank[1]
; Store the middle byte
6493
85ae
STA fuel_tank[2]
; Store the MSB of fuel_tank back in the global
6495
05ad
ORA fuel_tank[1]
; Are both the middle and MSB zero?
6497
f0e2
BEQ low_fuel↑
; If so we are in a low fuel state
fuel_track_used:
648d
6499
18
CLC
; clear the carry to start an ADC chain
649a
a002
LDY #$02
; for x = 0,1,2
649c
a200
LDX #$00
; starting with the LSB
fuel_used_loop:
64a6
649e
b5a1
LDA fuel_used[0],X
; add the amount of fuel drained
64a0
7537
ADC GenByte_0037,X
; to the global fuel_used
64a2
95a1
STA fuel_used[0],X
; storing back in the global
64a4
e8
INX
; x++
64a5
88
DEY
; y--
64a6
10f6
BPL fuel_used_loop↑
; if y isn't negative, do the next byte
fuel_drain_done:
647d
64a8
d8
CLD
; Reset to binary mode (no more BCD)
64a9
60
RTS
; Return to the caller
abort_procedure_update:
GameLoop+1a8
64aa
a000
LDY #$00
64ac
a556
LDA ship_abort
64ae
f049
BEQ L64f9↓
64b0
2497
BIT fuel_state
64b2
1046
BPL L64fa↓
64b4
a586
LDA FrameCounter
64b6
4a
LSR
64b7
901a
BCC L64d3↓
64b9
a502
LDA ship_angle_modulo
64bb
c908
CMP #$08
64bd
900a
BCC L64c9↓
64bf
f012
BEQ L64d3↓
64c1
c919
CMP #$19
64c3
b004
BCS L64c9↓
64c5
c602
DEC ship_angle_modulo
64c7
d007
BNE L64d0↓
L64c9:
64bd64c3
64c9
18
CLC
64ca
6901
ADC #$01
64cc
291f
AND #$1f
64ce
8502
STA ship_angle_modulo
L64d0:
64c7
64d0
20bc62
JSR ship_reset_saved_angle↑
L64d3:
64b764bf
64d3
a55f
LDA ship_vel_high[0]
64d5
d004
BNE L64db↓
64d7
855e
STA ship_vel[0]
64d9
f002
BEQ L64dd↓
L64db:
64d5
64db
c65f
DEC ship_vel_high[0]
L64dd:
64d9
64dd
a502
LDA ship_angle_modulo
64df
c908
CMP #$08
64e1
d016
BNE L64f9↓
64e3
a556
LDA ship_abort
64e5
c93c
CMP #$3c
64e7
b00a
BCS L64f3↓
64e9
245c
BIT Z5c
64eb
3006
BMI L64f3↓
64ed
a561
LDA ship_vel_high[1]
64ef
c910
CMP #$10
64f1
b009
BCS L64fc↓
L64f3:
64e764eb
64f3
a910
LDA #$10
64f5
8501
STA actual_thrust_maybe
64f7
c656
DEC ship_abort
L64f9:
64ae64e1
64f9
60
RTS
L64fa:
64b2
64fa
8401
STY actual_thrust_maybe
L64fc:
64f1
64fc
8456
STY ship_abort
64fe
60
RTS
ship_vel_decay:
GameLoop+b7
6509
a202
LDX #$02
L650b:
652a
650b
b55e
LDA ship_vel[0],X
650d
8537
STA GenByte_0037
650f
b55f
LDA ship_vel_high[0],X
6511
a005
LDY #$05
L6513:
6517
6513
4a
LSR
6514
6637
ROR GenByte_0037
6516
88
DEY
6517
d0fa
BNE L6513↑
6519
8538
STA GenByte_0038
651b
b55e
LDA ship_vel[0],X
651d
38
SEC
651e
e537
SBC GenByte_0037
6520
955e
STA ship_vel[0],X
6522
b55f
LDA ship_vel_high[0],X
6524
e538
SBC GenByte_0038
6526
955f
STA ship_vel_high[0],X
6528
ca
DEX
6529
ca
DEX
652a
10df
BPL L650b↑
652c
60
RTS
dvg_wait_done:
GameLoop+d6dvg_wait_done+2S711c+135
652d
4673
LSR dvg_timer
652f
90fc
BCC dvg_wait_done↑
L6531:
6535
6531
ad0020
LDA IO_in0
6534
4a
LSR
6535
90fa
BCC L6531↑
6537
60
RTS
vec_draw_51ba_table:
GameLoop+74
6539
a54f
LDA score_dec_something1
653b
0a
ASL
653c
858c
STA vecgen_offset_something
653e
0a
ASL
653f
858b
STA vec_src_offst_maybe
6541
244e
BIT drawing_scale
6543
700d
BVS L6552↓
6545
a9e2
LDA #$e2
6547
a251
LDX #$51
6549
20d57e
JSR vec_add_to_offset↓
654c
a9ba
LDA #$ba
654e
a251
LDX #$51
6550
d00b
BNE L655d↓
L6552:
6543
6552
a9bc
LDA #$bc
6554
a24b
LDX #$4b
6556
20d57e
JSR vec_add_to_offset↓
6559
a9f0
LDA #$f0
655b
a244
LDX #$44
L655d:
6550
655d
a427
LDY VecRamPtr
655f
842d
STY VecRamPtr_copy
6561
a428
LDY VecRamPtr_high
6563
842e
STY Z2e
6565
d02b
BNE vecgen_copy_10↓
vec_draw_subroutines:
GameLoop+77
6567
244e
BIT drawing_scale
6569
501c
BVC L6587↓
656b
a2a1
LDX #$a1
656d
209e65
JSR vec_clear_genbytes_37_3a↓
6570
a9fe
LDA #$fe
6572
a252
LDX #$52
6574
209265
JSR vecgen_copy_10↓
6577
2422
BIT game_state_flags
6579
7001
BVS L657c↓
657b
60
RTS
L657c:
6579
657c
a2a3
LDX #$a3
657e
209e65
JSR vec_clear_genbytes_37_3a↓
6581
a90e
LDA #$0e
6583
a253
LDX #$53
6585
d00b
BNE vecgen_copy_10↓
L6587:
6569
6587
a916
LDA #$16
6589
a254
LDX #$54
658b
20d57e
JSR vec_add_to_offset↓
658e
a9ee
LDA #$ee
6590
a253
LDX #$53
vecgen_copy_10:
vec_draw_51ba_table+2cvec_draw_subroutines+dvec_draw_subroutines+1e
6592
18
CLC
6593
658c
ADC vecgen_offset_something
6595
a8
TAY
6596
8a
TXA
6597
6900
ADC #$00
6599
a20a
LDX #$0a
659b
4ca67e
JMP vecram_memcpy_update_vecptr↓
vec_clear_genbytes_37_3a:
vec_draw_subroutines+6vec_draw_subroutines+17
659e
a900
LDA #$00
65a0
8537
STA GenByte_0037
65a2
8539
STA GenByte_0039
65a4
853a
STA GenByte_003a
65a6
8638
STX GenByte_0038
65a8
a037
LDY #$37
65aa
4cdc7e
JMP vec_something_7edc↓
draw_ship_prep_maybe:
GameLoop+7a
65ad
208466
JSR shuffle_7_to_9↓
65b0
a00d
LDY #$0d
65b2
a900
LDA #$00
65b4
853e
STA GenByte_003e
65b6
8540
STA GenByte_0040
65b8
20a47e
JSR vecram_memcpy_8_update_vecptr↓
65bb
a527
LDA VecRamPtr
65bd
8529
STA vecdata_ptr_start
65bf
a528
LDA VecRamPtr_high
65c1
852a
STA Z2a
65c3
a502
LDA ship_angle_modulo
65c5
c909
CMP #$09
65c7
b006
BCS L65cf↓
65c9
206e66
JSR finish_ship_drawing_maybe↓
65cc
4cc97e
JMP vecram_copy_short↓
L65cf:
65c7
65cf
a204
LDX #$04
65d1
a004
LDY #$04
65d3
c63e
DEC GenByte_003e
65d5
c640
DEC GenByte_0040
65d7
c910
CMP #$10
65d9
900e
BCC L65e9↓
65db
c919
CMP #$19
65dd
9006
BCC L65e5↓
65df
a200
LDX #$00
65e1
e640
INC GenByte_0040
65e3
f008
BEQ L65ed↓
L65e5:
65dd
65e5
290f
AND #$0f
65e7
1009
BPL L65f2↓
L65e9:
65d9
65e9
a000
LDY #$00
65eb
e63e
INC GenByte_003e
L65ed:
65e3
65ed
20f967
JSR TwosComplement↓
65f0
2907
AND #$07
L65f2:
65e7
65f2
863d
STX GenByte_003c
65f4
843f
STY GenByte_003f
65f6
206e66
JSR finish_ship_drawing_maybe↓
65f9
8437
STY GenByte_0037
65fb
8538
STA GenByte_0038
65fd
a000
LDY #$00
65ff
b137
LDA (GenByte_0037),Y
6601
0a
ASL
6602
8539
STA GenByte_0039
6604
c8
INY
6605
b137
LDA (GenByte_0037),Y
6607
290f
AND #$0f
6609
0920
ORA #$20
660b
2a
ROL
660c
853a
STA GenByte_003a
660e
244e
BIT drawing_scale
6610
5005
BVC L6617↓
6612
a539
LDA GenByte_0039
6614
18
CLC
6615
9018
BCC L662f↓
L6617:
6610
6617
88
DEY
6618
b139
LDA (GenByte_0039),Y
661a
0a
ASL
661b
8564
STA VecPtr
661d
c8
INY
661e
b139
LDA (GenByte_0039),Y
6620
290f
AND #$0f
6622
0920
ORA #$20
6624
2a
ROL
6625
8565
STA Z65
6627
203766
JSR DrawShip↓
662a
a539
LDA GenByte_0039
662c
18
CLC
662d
6902
ADC #$02
L662f:
6615
662f
8564
STA VecPtr
6631
a53a
LDA GenByte_003a
6633
6900
ADC #$00
6635
8565
STA Z65
DrawShip:
draw_ship_prep_maybe+7a
6637
a000
LDY #$00
NextShipOpCode_maybe:
665d666c
6639
b164
LDA (VecPtr),Y
663b
9127
STA (VecRamPtr),Y
663d
c8
INY
663e
b164
LDA (VecPtr),Y
6640
c9a0
CMP #$a0
6642
9008
BCC DrawShipVect↓
6644
c9f0
CMP #$f0
6646
b017
BCS DrawShipSVEC↓
6648
88
DEY
6649
4cf874
JMP VecPtrUpdate_dupe↓
DrawShipVect:
6642
664c
453f
EOR GenByte_003f
664e
9127
STA (VecRamPtr),Y
6650
c8
INY
6651
b164
LDA (VecPtr),Y
6653
9127
STA (VecRamPtr),Y
6655
c8
INY
6656
b164
LDA (VecPtr),Y
6658
453d
EOR GenByte_003c
665a
9127
STA (VecRamPtr),Y
665c
c8
INY
665d
d0da
BNE NextShipOpCode_maybe↑
DrawShipSVEC:
6646
665f
453f
EOR GenByte_003f
6661
9127
STA (VecRamPtr),Y
6663
88
DEY
6664
b127
LDA (VecRamPtr),Y
6666
453d
EOR GenByte_003c
6668
9127
STA (VecRamPtr),Y
666a
c8
INY
666b
c8
INY
666c
d0cb
BNE NextShipOpCode_maybe↑
finish_ship_drawing_maybe:
draw_ship_prep_maybe+1cdraw_ship_prep_maybe+49
666e
0a
ASL
666f
858b
STA vec_src_offst_maybe
6671
244e
BIT drawing_scale
6673
5007
BVC L667c↓
6675
69f4
ADC #$f4
6677
a8
TAY
6678
a94d
LDA #$4d
667a
d005
BNE L6681↓
L667c:
6673
667c
69a2
ADC #$a2
667e
a8
TAY
667f
a94b
LDA #$4b
L6681:
667a
6681
6900
ADC #$00
6683
60
RTS
shuffle_7_to_9:
draw_ship_prep_maybe+0GameRunningLoop+0
6684
a508
LDA ship_pos_high[0]
6686
a607
LDX ship_pos[0]
6688
20ef6c
JSR get_next_5bits↓
668b
8510
STA Z10
668d
840f
STY score_dec_maybe
668f
a50a
LDA ship_pos_high[1]
6691
a609
LDX ship_pos[1]
6693
20ef6c
JSR get_next_5bits↓
6696
840d
STY vec_letter_ptr_maybe
6698
09a0
ORA #$a0
669a
850e
STA Z0e
L669c:
669f
669c
60
RTS
debris_update:
GameLoop+a4
669d
a501
LDA actual_thrust_maybe
669f
f0fb
BEQ L669c↑
66a1
a58b
LDA vec_src_offst_maybe
66a3
244e
BIT drawing_scale
66a5
5003
BVC L66aa↓
66a7
18
CLC
66a8
6912
ADC #$12
L66aa:
66a5
66aa
aa
TAX
66ab
bc7267
LDY debris_array_maybe,X
66ae
bd7167
LDA debris_vectors,X
66b1
243e
BIT GenByte_003e
66b3
1003
BPL L66b8↓
66b5
20f967
JSR TwosComplement↓
L66b8:
66b3
66b8
853d
STA GenByte_003c
66ba
98
TYA
66bb
2440
BIT GenByte_0040
66bd
1003
BPL L66c2↓
66bf
20f967
JSR TwosComplement↓
L66c2:
66bd
66c2
853f
STA GenByte_003f
66c4
a501
LDA actual_thrust_maybe
66c6
a074
LDY #$74
66c8
20ef70
JSR mult16↓
66cb
a8
TAY
66cc
a586
LDA FrameCounter
66ce
4a
LSR
66cf
9001
BCC L66d2↓
66d1
c8
INY
L66d2:
66cf
66d2
a501
LDA actual_thrust_maybe
66d4
18
CLC
66d5
6910
ADC #$10
66d7
0a
ASL
66d8
0a
ASL
66d9
0a
ASL
66da
9002
BCC L66de↓
66dc
a9f0
LDA #$f0
L66de:
66da
66de
858f
STA GenByte08f
66e0
8439
STY GenByte_0039
66e2
98
TYA
66e3
a43f
LDY GenByte_003f
66e5
20ef70
JSR mult16↓
66e8
863a
STX GenByte_003a
66ea
a53d
LDA GenByte_003c
66ec
20f967
JSR TwosComplement↓
66ef
a8
TAY
66f0
a539
LDA GenByte_0039
66f2
20ef70
JSR mult16↓
66f5
8639
STX GenByte_0039
66f7
a53e
LDA GenByte_003e
66f9
4540
EOR GenByte_0040
66fb
1006
BPL L6703↓
66fd
202867
JSR debris_position_update↓
6700
4c0967
JMP debris_position_update_2↓
L6703:
66fb
6703
200967
JSR debris_position_update_2↓
6706
4c2867
JMP debris_position_update↓
debris_position_update_2:
debris_update+63debris_update+66
6709
a000
LDY #$00
670b
a53a
LDA GenByte_003a
670d
18
CLC
670e
653d
ADC GenByte_003c
6710
1001
BPL L6713↓
6712
88
DEY
L6713:
6710
6713
8519
STA ThisDebrisX
6715
841a
STY Z1a
6717
a200
LDX #$00
6719
a539
LDA GenByte_0039
671b
18
CLC
671c
653f
ADC GenByte_003f
671e
1001
BPL L6721↓
6720
ca
DEX
L6721:
671e
6721
851b
STA ThisDebrisY
6723
861c
STX Z1c
6725
4c4a67
JMP L674a↓
debris_position_update:
debris_update+60debris_update+69
6728
a53a
LDA GenByte_003a
672a
20f967
JSR TwosComplement↓
672d
a200
LDX #$00
672f
18
CLC
6730
653d
ADC GenByte_003c
6732
1001
BPL L6735↓
6734
ca
DEX
L6735:
6732
6735
8519
STA ThisDebrisX
6737
861a
STX Z1a
6739
a539
LDA GenByte_0039
673b
20f967
JSR TwosComplement↓
673e
a200
LDX #$00
6740
18
CLC
6741
653f
ADC GenByte_003f
6743
1001
BPL L6746↓
6745
ca
DEX
L6746:
6743
6746
851b
STA ThisDebrisY
6748
861c
STX Z1c
L674a:
6725
674a
a53e
LDA GenByte_003e
674c
4540
EOR GenByte_0040
674e
101e
BPL L676e↓
6750
a519
LDA ThisDebrisX
6752
f00b
BEQ L675f↓
6754
20f967
JSR TwosComplement↓
6757
8519
STA ThisDebrisX
6759
a51a
LDA Z1a
675b
49ff
EOR #$ff
675d
851a
STA Z1a
L675f:
6752
675f
a51b
LDA ThisDebrisY
6761
f00b
BEQ L676e↓
6763
20f967
JSR TwosComplement↓
6766
851b
STA ThisDebrisY
6768
a51c
LDA Z1c
676a
49ff
EOR #$ff
676c
851c
STA Z1c
L676e:
674e6761
676e
4c4378
JMP CalcDebrisPos↓
debris_vectors:
debris_update+11
6771
00
BRK
debris_array_maybe:
debris_update+e
6772
.byte f9
draw_even_more_stuff:
GameLoop+71
6795
a03c
LDY #$3c
6797
a955
LDA #$55
6799
20a47e
JSR vecram_memcpy_8_update_vecptr↓
679c
a9a4
LDA #$a4
679e
20eb67
JSR DrawNumber_2↓
67a1
a001
LDY #$01
67a3
a99d
LDA #$9d
67a5
18
CLC
67a6
205a7b
JSR DrawNumber↓
67a9
a202
LDX #$02
67ab
20aa7e
JSR vecram_memcpy_vecptr↓
67ae
a001
LDY #$01
67b0
a99c
LDA #$9c
67b2
20ed67
JSR DrawNumber_and_copy↓
67b5
a9ad
LDA #$ad
67b7
20eb67
JSR DrawNumber_2↓
67ba
a9af
LDA #$af
67bc
20f467
JSR DrawNumber_3↓
67bf
20d17e
JSR vecram_memcpy_4↓
67c2
a9a6
LDA #$a6
67c4
20f467
JSR DrawNumber_3↓
67c7
20d17e
JSR vecram_memcpy_4↓
67ca
a9a9
LDA #$a9
67cc
20f467
JSR DrawNumber_3↓
67cf
a955
LDA #$55
67d1
a0aa
LDY #$aa
67d3
20a47e
JSR vecram_memcpy_8_update_vecptr↓
67d6
a59b
LDA Z9b
67d8
0a
ASL
67d9
6960
ADC #$60
67db
20e367
JSR FUN_67e3↓
67de
a59a
LDA Z9a
67e0
0a
ASL
67e1
695a
ADC #$5a
FUN_67e3:
draw_even_more_stuff+46
67e3
a8
TAY
67e4
a955
LDA #$55
67e6
6900
ADC #$00
67e8
4cc97e
JMP vecram_copy_short↓
DrawNumber_2:
draw_even_more_stuff+9draw_even_more_stuff+22
67eb
a002
LDY #$02
DrawNumber_and_copy:
draw_even_more_stuff+1d
67ed
18
CLC
67ee
205a7b
JSR DrawNumber↓
67f1
4cd17e
JMP vecram_memcpy_4↓
DrawNumber_3:
draw_even_more_stuff+27draw_even_more_stuff+2fdraw_even_more_stuff+37
67f4
a003
LDY #$03
67f6
4c597b
JMP DrawNumber_no_leading_zero↓
TwosComplement:
draw_ship_prep_maybe+40debris_update+18debris_update+22debris_update+4fdebris_position_update+2debris_position_update+13debris_position_update+2cdebris_position_update+3b
67f9
49ff
EOR #$ff
67fb
18
CLC
67fc
6901
ADC #$01
67fe
60
RTS
draw_bonus_maybe:
GameLoop+bd
67ff
a203
LDX #$03
L6801:
6873
6801
8641
STX GenByte_0041
6803
b533
LDA nmi_counter_4,X
6805
8537
STA GenByte_0037
6807
0a
ASL
6808
0a
ASL
6809
858b
STA vec_src_offst_maybe
680b
a24e
LDX #$4e
680d
a906
LDA #$06
680f
a003
LDY #$03
6811
244e
BIT drawing_scale
6813
7004
BVS L6819↓
6815
a942
LDA #$42
6817
a00f
LDY #$0f
L6819:
6813
6819
843e
STY GenByte_003e
681b
207668
JSR vec_compute_offset_maybe↓
681e
a64f
LDX score_dec_something1
6820
863d
STX GenByte_003c
6822
20e47e
JSR vec_copy_and_invert_maybe↓
6825
a527
LDA VecRamPtr
6827
852b
STA draw_string_ptr
6829
a528
LDA VecRamPtr_high
682b
852c
STA draw_string_ptr_high
682d
a637
LDX GenByte_0037
682f
bd546c
LDA D6c54,X
6832
858b
STA vec_src_offst_maybe
6834
a247
LDX #$47
6836
a900
LDA #$00
6838
244e
BIT drawing_scale
683a
7004
BVS L6840↓
683c
a24e
LDX #$4e
683e
a97e
LDA #$7e
L6840:
683a
6840
207668
JSR vec_compute_offset_maybe↓
6843
20a47e
JSR vecram_memcpy_8_update_vecptr↓
6846
a586
LDA FrameCounter
6848
2910
AND #$10
684a
d00a
BNE L6856↓
684c
a003
LDY #$03
684e
b12b
LDA (draw_string_ptr),Y
6850
290f
AND #$0f
6852
912b
STA (draw_string_ptr),Y
6854
101a
BPL L6870↓
L6856:
684a
6856
a965
LDA #$65
6858
a007
LDY #$07
685a
20c97e
JSR vecram_copy_short↓
685d
a637
LDX GenByte_0037
685f
bd456c
LDA landing_bonus_amount,X
6862
0a
ASL
6863
69a4
ADC #$a4
6865
a8
TAY
6866
a957
LDA #$57
6868
20c97e
JSR vecram_copy_short↓
686b
a918
LDA #$18
686d
204f7a
JSR WriteText↓
L6870:
6854
6870
a641
LDX GenByte_0041
6872
ca
DEX
6873
108c
BPL L6801↑
6875
60
RTS
vec_compute_offset_maybe:
draw_bonus_maybe+1cdraw_bonus_maybe+41
6876
18
CLC
6877
658b
ADC vec_src_offst_maybe
6879
a8
TAY
687a
8a
TXA
687b
6900
ADC #$00
687d
60
RTS
draw_push_start_screen:
GameLoop+9e
687e
202d7f
JSR font_fixup_0↓
6881
a200
LDX #$00
6883
a916
LDA #$16
6885
20347a
JSR WriteText_wrapper↓
6888
a21c
LDX #$1c
688a
a900
LDA #$00
688c
20347a
JSR WriteText_wrapper↓
688f
a220
LDX #$20
6891
20327a
JSR WriteText_newline↓
6894
a9ad
LDA #$ad
6896
20577b
JSR DrawNumber_2_no_leading_zero↓
6899
a917
LDA #$17
689b
4c4f7a
JMP WriteText↓
draw_out_of_fuel_screen:
GameLoop+ba
689e
a590
LDA fuel_lost_timeout
68a0
f00f
BEQ L68b1↓
68a2
c690
DEC fuel_lost_timeout
68a4
a208
LDX #$08
68a6
20327a
JSR WriteText_newline↓
68a9
a995
LDA #$95
68ab
20577b
JSR DrawNumber_2_no_leading_zero↓
68ae
4c297a
JMP draw_lost_fuel_units_message↓
L68b1:
68a0
68b1
a8
TAY
68b2
a204
LDX #$04
68b4
a902
LDA #$02
68b6
2497
BIT fuel_state
68b8
100e
BPL L68c8↓
68ba
a5ae
LDA fuel_tank[2]
68bc
d011
BNE L68cf↓
68be
a586
LDA FrameCounter
68c0
2910
AND #$10
68c2
d00b
BNE L68cf↓
68c4
a901
LDA #$01
68c6
a010
LDY #$10
L68c8:
68b8
68c8
8437
STY GenByte_0037
68ca
20347a
JSR WriteText_wrapper↓
68cd
a437
LDY GenByte_0037
L68cf:
68bc68c2
68cf
98
TYA
68d0
aa
TAX
68d1
a92f
LDA #$2f
68d3
4c5379
JMP io_audio_set↓
draw_level_over_screen:
GameLoop+98
68d6
a590
LDA fuel_lost_timeout
68d8
f016
BEQ L68f0↓
68da
c690
DEC fuel_lost_timeout
68dc
a210
LDX #$10
68de
a906
LDA #$06
68e0
20347a
JSR WriteText_wrapper↓
68e3
a208
LDX #$08
68e5
20327a
JSR WriteText_newline↓
68e8
a995
LDA #$95
68ea
20577b
JSR DrawNumber_2_no_leading_zero↓
68ed
20297a
JSR draw_lost_fuel_units_message↓
L68f0:
68d8
68f0
a218
LDX #$18
68f2
20327a
JSR WriteText_newline↓
68f5
a992
LDA #$92
68f7
20577b
JSR DrawNumber_2_no_leading_zero↓
68fa
a915
LDA #$15
68fc
204f7a
JSR WriteText↓
68ff
a562
LDA touchdown_velocities_maybe
6901
290f
AND #$0f
6903
d020
BNE L6925↓
6905
a214
LDX #$14
6907
a907
LDA #$07
6909
2462
BIT touchdown_velocities_maybe
690b
500b
BVC L6918↓
690d
a908
LDA #$08
690f
20347a
JSR WriteText_wrapper↓
6912
a22c
LDX #$2c
6914
a90d
LDA #$0d
6916
d007
BNE L691f↓
L6918:
690b
6918
20347a
JSR WriteText_wrapper↓
691b
a228
LDX #$28
691d
a909
LDA #$09
L691f:
69166929
691f
18
CLC
6920
6591
ADC random_message
6922
4c347a
JMP WriteText_wrapper↓
L6925:
6903
6925
a224
LDX #$24
6927
a911
LDA #$11
6929
d0f4
BNE L691f↑
string_table[0]:
WriteText+50WriteText+53
692b
.ptr[33] str_PUSH_START[0], str_LOW_ON_FUEL[0], str_OUT_OF_FUEL[0], str_LOST[0], str_INSERT_COINS[0], str_PER_COIN[0], str_AUXILIARY_FUEL_TANKS_DESTROYED[0], str_CONGRATULATIONS[0], str_YOU_LANDED_HARD[0], str_THAT_WAS_A_GREAT_LANDING[0], str_THE_EAGLE_HAS_LANDED[0], str_THE_COLUMBIA_HAS_LANDED[0], str_YOU_HAVE_LANDED[0], str_LIFE_SUPPORT_IS_GONE[0], str_YOUR_TRIP_IS_ONE_WAY[0], str_YOU_ARE_HOPELESSLY_MAROONED[0], str_COMMUNICATION_SYSTEM_DESTROYED[0], str_COMMUNICATION_SYSTEM_DESTROYED[21], str_YOU_CREATED_A_TWO_MILE_CRATER[0], str_YOU_JUST_DESTROYED_A_100_MEGABUCK_LANDER[0], str_THERE_WERE_NO_SURVIVORS[0], str__POINTS[0], str_SELECT_OPTION[0], str__FUEL_UNITS_[0], str_X[0], str_450[0], str_600[0], str_750[0], str_900[0], str_1100[0], str_1300[0], str_1550[0], str_1800[0]
; Pointers to the English strings
string_table_fixup_something_else:
WriteText+23
696d
.byte 00
; Update the ship's acceleration in the screen reference frame
; Compute sin and cos of the ship's angle and multiplies the
; current thrust setting to get the X and Y acceleration.
; Also computes the sign bit for these accelerations
ship_compute_accel_xy:
GameLoop+10d
6b32
a502
LDA ship_angle_modulo
; Read the reduced ship's angle (updated by ship_command_yaw_easy )
6b34
4a
LSR
; This is 0-31, where 0 is horizontal facing right, 8 is vertical,
6b35
4a
LSR
; 16 is horizontal facing left, 31 is straight down
6b36
4a
LSR
; Divide this reduced angle by 8 to get the quadrant that it is in
6b37
aa
TAX
;
6b38
bdf276
LDA sine_quadrants[0],X
; Read the quadrant bits (bit 7 = X direction, bit 6 = Y direction)
6b3b
8546
STA ship_accel_sign[0]
; Store the X accleration sign bit (used by add16_signed_mag)
6b3d
0a
ASL
; Shift it left once
6b3e
8547
STA ship_accel_sign[1]
; Store the Y acceleration sign bit
6b40
a601
LDX actual_thrust_maybe
;
6b42
bdf676
LDA thrust_to_acc[0],X
;
6b45
850b
STA thrust_value
;
6b47
a502
LDA ship_angle_modulo
; Get the ship's angle (0-31)
6b49
290f
AND #$0f
; Get how far from horizontal it is (up or down)
6b4b
c909
CMP #$09
; If it is 0-8, use the first half of the sine table
6b4d
9004
BCC flip_to_other_half↓
; (
6b4f
490f
EOR #$0f
; Invert the clamped angle, which flips it around 45 degrees
6b51
6900
ADC #$00
; Why carry?
flip_to_other_half:
6b4d
6b53
8537
STA GenByte_0037
;
6b55
4907
EOR #$07
;
6b57
6901
ADC #$01
;
6b59
290f
AND #$0f
;
6b5b
aa
TAX
;
6b5c
bde976
LDA sine_table[0],X
;
6b5f
a40b
LDY thrust_value
;
6b61
20ef70
JSR mult16↓
;
6b64
8558
STA ship_accel[0]
;
6b66
a637
LDX GenByte_0037
;
6b68
bde976
LDA sine_table[0],X
;
6b6b
20ef70
JSR mult16↓
;
6b6e
8559
STA ship_accel[1]
;
6b70
60
RTS
;
; While the main engine is thrusting, fuel is drained based on the lever position
fuel_drain_thrust:
GameLoop+113
6b71
a9da
LDA #$da
; Default is to lose 218 fuel per thrust unit
6b73
a40b
LDY thrust_value
; If thrust mode is negative
6b75
3008
BMI fuel_thrust_multiply↓
; then use the default
6b77
a623
LDX mission_difficulty
; Otherwise if the mission is
6b79
e002
CPX #$02
; not equal to 2 ("Prime") with strong gravity
6b7b
d002
BNE fuel_thrust_multiply↓
; then also use the default
6b7d
a990
LDA #$90
; Mission 2 gets a little less burn per thrust unit
fuel_thrust_multiply:
6b756b7b
6b7f
20ef70
JSR mult16↓
; A = thrust cost Y = thrust setting
6b82
aa
TAX
; Ignores the low bits, uses just the high byte of the result
6b83
a000
LDY #$00
; Only use the bits in X
6b85
8437
STY GenByte_0037
; So store 0 in gb37
6b87
a007
LDY #$07
; 8 digits requested
6b89
20c679
JSR dec_to_bcd↓
; Converts the binary result to BCD
6b8c
a8
TAY
; Return is in Y:X:A, but fuel_drain_16 wants X:Y
6b8d
4c6164
JMP fuel_drain_16↑
; drains that much fuel (tail call)
; When the ship crashes, a random amount of fuel is lost
fuel_lost_to_crash_wrapper:
GameLoop+1e1
6b90
a55d
LDA ship_state_maybe
; If any of the bottom bits in ship_state are set
6b92
290f
AND #$0f
; (bottom bits mean exploding?)
6b94
f049
BEQ rts_6bdf↓
; then return immediately
fuel_lost_to_crash:
S711c+138
6b96
f8
SED
;
6b97
a59e
LDA score_bcd_maybe[0]
;
6b99
38
SEC
;
6b9a
e5a2
SBC fuel_used[1]
;
6b9c
aa
TAX
;
6b9d
a59f
LDA score_bcd_maybe[1]
;
6b9f
e5a3
SBC fuel_used[2]
;
6ba1
a8
TAY
;
6ba2
a5a0
LDA score_bcd_maybe[2]
;
6ba4
e900
SBC #$00
;
6ba6
d8
CLD
;
6ba7
9036
BCC rts_6bdf↓
;
6ba9
f004
BEQ L6baf↓
;
6bab
a299
LDX #$99
;
6bad
a099
LDY #$99
;
L6baf:
6ba9
6baf
8a
TXA
;
6bb0
d003
BNE L6bb5↓
;
6bb2
98
TYA
;
6bb3
f02a
BEQ rts_6bdf↓
;
L6bb5:
6bb0
6bb5
98
TYA
;
6bb6
a4ad
LDY fuel_tank[1]
;
6bb8
843a
STY GenByte_003a
;
6bba
a4ae
LDY fuel_tank[2]
;
6bbc
843b
STY GenByte_003b
;
6bbe
a000
LDY #$00
;
6bc0
84a2
STY fuel_used[1]
;
6bc2
84a3
STY fuel_used[2]
;
6bc4
206364
JSR fuel_drain↑
;
6bc7
a5a2
LDA fuel_used[1]
;
6bc9
a6a3
LDX fuel_used[2]
;
6bcb
2497
BIT fuel_state
;
6bcd
3004
BMI L6bd3↓
;
6bcf
a53a
LDA GenByte_003a
;
6bd1
a63b
LDX GenByte_003b
;
L6bd3:
6bcd
6bd3
8595
STA fuel_lost_bcd
;
6bd5
8696
STX Z96
;
6bd7
0596
ORA Z96
;
6bd9
f004
BEQ rts_6bdf↓
;
6bdb
a97f
LDA #$7f
;
6bdd
8590
STA fuel_lost_timeout
;
; Another shared RTS
rts_6bdf:
fuel_lost_to_crash_wrapper+4fuel_lost_to_crash+11fuel_lost_to_crash+1dfuel_lost_to_crash+43
6bdf
60
RTS
; Shared with a few nearby functions
score_add_landing_bonus:
GameLoop+1d0
6be0
a50f
LDA score_dec_maybe
6be2
18
CLC
6be3
6551
ADC score_dec_something2
6be5
8537
STA GenByte_0037
6be7
a510
LDA Z10
6be9
654f
ADC score_dec_something1
6beb
290f
AND #$0f
6bed
a8
TAY
6bee
a203
LDX #$03
L6bf0:
6c1c
6bf0
8641
STX GenByte_0041
6bf2
b533
LDA nmi_counter_4,X
6bf4
853a
STA GenByte_003a
6bf6
0a
ASL
6bf7
0a
ASL
6bf8
aa
TAX
6bf9
38
SEC
6bfa
a537
LDA GenByte_0037
6bfc
fd444e
SBC D4e44,X
6bff
8538
STA GenByte_0038
6c01
98
TYA
6c02
fd454e
SBC D4e45,X
6c05
9012
BCC L6c19↓
6c07
d010
BNE L6c19↓
6c09
a63a
LDX GenByte_003a
6c0b
bd546c
LDA D6c54,X
6c0e
4a
LSR
6c0f
4a
LSR
6c10
4a
LSR
6c11
aa
TAX
6c12
bd636c
LDA D6c63,X
6c15
c538
CMP GenByte_0038
6c17
b009
BCS L6c22↓
L6c19:
6c056c07
6c19
a641
LDX GenByte_0041
6c1b
ca
DEX
6c1c
10d2
BPL L6bf0↑
6c1e
a901
LDA #$01
6c20
d005
BNE L6c27↓
L6c22:
6c17
6c22
a63a
LDX GenByte_003a
6c24
bd456c
LDA landing_bonus_amount,X
L6c27:
6c20
6c27
a8
TAY
6c28
858e
STA landing_bonus
L6c2a:
6c2e
6c2a
207675
JSR score_landing_bonus↓
6c2d
88
DEY
6c2e
d0fa
BNE L6c2a↑
6c30
f8
SED
6c31
8692
STX bcd_output[0]
6c33
8493
STY bcd_output[1]
6c35
98
TYA
L6c36:
6c3f
6c36
18
CLC
6c37
6592
ADC bcd_output[0]
6c39
9002
BCC L6c3d↓
6c3b
e693
INC bcd_output[1]
L6c3d:
6c39
6c3d
c68e
DEC landing_bonus
6c3f
d0f5
BNE L6c36↑
6c41
8592
STA bcd_output[0]
6c43
d8
CLD
6c44
60
RTS
landing_bonus_amount:
draw_bonus_maybe+60score_add_landing_bonus+44
6c45
.byte 02
D6c54:
draw_bonus_maybe+30score_add_landing_bonus+2b
6c54
.byte 00
D6c63:
score_add_landing_bonus+32
6c63
.byte ff
; Update ship acceleration, velocity and position in the XY frame once per clock tick
;
; The 16-bit velocity is normally divided by 256, but if the screen is zoomed in
; then it is only divided by 64. Since the NMI runs at 250 HZ, this division
; effectively is the same as multiplying the velocity by dt.
;
; This updates the ship position on each axis
;
; x = x + vx * dt
; vx = vx + thrust_x * dt
; y = y + vy * dt
; vy = vy + (thrust_y - gravity) * dt
;
; add16_signed_mag_arg1 is used for position update since the position sign is always positive
; add16_signed_mag_core is used to accumulate the thrust_y - gravity plus velocity
;
ship_update:
GameLoop+139GameLoop+18c
6c68
a202
LDX #$02
; Make two loops, one for X and one for Y. Note that i is decremented by 2 each time through the loop 6ce7
ship_update_loop:
6ceb
6c6a
8637
STX GenByte_0037
; Store the iterator temporary
6c6c
a900
LDA #$00
; Initialize the global helper variables
6c6e
855d
STA ship_state_maybe
;
6c70
854d
STA delta1_sign
; Position sign is always positive
6c72
8549
STA delta2_high
; velocity_high = 0
6c74
b555
LDA ship_enable_x,X
; is bit 7 set in ship_enable_x or ship_enable_y (depending on X)
6c76
3028
BMI skip_physics↓
; if so skip the physics for this axis
6c78
b55f
LDA ship_vel_high[0],X
; Copy the high byte of the velocity for this axis
6c7a
8548
STA delta2
; into the low-byte of delta2
6c7c
b55e
LDA ship_vel[0],X
; Load the low byte of the ship's velocity
6c7e
244e
BIT drawing_scale
; Check if we have zoomed in on the ship and terrain
6c80
700a
BVS skip_zoom↓
; Skip the zoom if we haven't zoomed in (bit 6 is not set)
6c82
0a
ASL
; Double the low byte of the velocity
6c83
2648
ROL delta2
; Double the high byte of the velocity (shifting in from the low byte)
6c85
2649
ROL delta2_high
; Double the high high byte of the velocity
6c87
0a
ASL
; And do it again...
6c88
2648
ROL delta2
; This multiplies the velocity by four
6c8a
2649
ROL delta2_high
; Note that the bottom byte is otherwise unused
skip_zoom:
6c80
6c8c
b55a
LDA ship_vel_sign_x,X
; Get the sign bit for the velocity for this axis
6c8e
854c
STA delta2_sign
; and store it in the delta2 workspace
6c90
b508
LDA ship_pos_high[0],X
; Get the position high byte for this axis
6c92
48
PHA
; Push it
6c93
b507
LDA ship_pos[0],X
; Get the position low byte
6c95
aa
TAX
; move it into X
6c96
68
PLA
; Pop the high byte so that the 16-bit position is in A:X
6c97
20006d
JSR add16_signed_mag_arg1↓
; Compute Position + Velocity for this axis
6c9a
a637
LDX GenByte_0037
; Restore the iterator
6c9c
9508
STA ship_pos_high[0],X
; Write the high byte for this axis
6c9e
9407
STY ship_pos[0],X
; and write the low byte for this axis
skip_physics:
6c76
6ca0
a900
LDA #$00
; Gravity always has a zero high-byte
6ca2
8549
STA delta2_high
;
6ca4
8a
TXA
; Move the iterator to the accumulator for testing
6ca5
f002
BEQ no_gravity↓
; If i == 0, don't add any gravity (x axis)
6ca7
a563
LDA gravity
; gravity global is updated based on the mission difficulty
no_gravity:
6ca5
6ca9
8548
STA delta2
; Store either 0 or the gravity into the low-byte of delta2
6cab
a980
LDA #$80
; Since gravity is always negative
6cad
854c
STA delta2_sign
; set the sign bit for delta2 to negative
6caf
b45a
LDY ship_vel_sign_x,X
; Get the sign bit of this axis' velocity into Y
6cb1
b55f
LDA ship_vel_high[0],X
; And load A:X with this axis' 16-bit velocity magnitutde
6cb3
48
PHA
; (same logic as before
6cb4
b55e
LDA ship_vel[0],X
; to push things onto the stack
6cb6
aa
TAX
; and the pop them off again
6cb7
68
PLA
; into the right registers)
6cb8
20fe6c
JSR add16_signed_mag↓
; Compute Velocity + Gravity for this axis
6cbb
a537
LDA GenByte_0037
; Restore the iterator
6cbd
4a
LSR
; Divide it by two
6cbe
aa
TAX
; and move it back to X
6cbf
b558
LDA ship_accel[0],X
; Get the 8-bit magnitude of the ship's thrust on this axis
6cc1
8548
STA delta2
; and copy it into delta2
6cc3
b546
LDA ship_accel_sign[0],X
; Get the thrust sign bit
6cc5
854c
STA delta2_sign
; and copy it into delta2
6cc7
a523
LDA mission_difficulty
; Depending on the mission difficulty
6cc9
c902
CMP #$02
; 2 == "Prime", which has strong gravity
6ccb
d00c
BNE add_thrust_to_vel↓
; other missions don't need to tweak the thrust
6ccd
a548
LDA delta2
; Multiply the delta2 value by 1.5
6ccf
4a
LSR
; through clever shift and addition
6cd0
18
CLC
; tricks with the carry flags
6cd1
6548
ADC delta2
; delta2 = delta2 + (delta2 / 2)
6cd3
8548
STA delta2
; effectively
6cd5
9002
BCC add_thrust_to_vel↓
; no overflow
6cd7
e649
INC delta2_high
; add the overflow to the high byte
add_thrust_to_vel:
6ccb6cd5
6cd9
20046d
JSR add16_signed_mag_core↓
; delta1 already has Velocity + Gravity, so this is Velocity + Gravity + Thrust
6cdc
48
PHA
; Result is in A:Y, push the high byte
6cdd
8a
TXA
; Result sign bit is in X
6cde
a637
LDX GenByte_0037
; Restore the iterator
6ce0
955a
STA ship_vel_sign_x,X
; Update the velocity sign bit
6ce2
945e
STY ship_vel[0],X
; Update the velocity low byte
6ce4
68
PLA
; Restore the high byte
6ce5
955f
STA ship_vel_high[0],X
; And store the high byte
6ce7
ca
DEX
; Decrement i twice
6ce8
ca
DEX
; since the loop is over 16-bit values
6ce9
3003
BMI ship_update_done↓
; If i is now negative (2 -> 0 -> -2), we're done
6ceb
4c6a6c
JMP ship_update_loop↑
; If not make another pass through the loop
ship_update_done:
6ce9
6cee
60
RTS
; Ship position and velocity updated. Return!
get_next_5bits:
shuffle_7_to_9+4shuffle_7_to_9+f
6cef
864a
STX delta1
6cf1
064a
ASL delta1
6cf3
2a
ROL
6cf4
264a
ROL delta1
6cf6
2a
ROL
6cf7
a8
TAY
6cf8
a54a
LDA delta1
6cfa
2a
ROL
6cfb
2903
AND #$03
6cfd
60
RTS
; Update delta1 with signed byte Y and 16-bit magnitude in A:X.
; Falls through...
add16_signed_mag:
ship_update+50S711c+a8S711c+194
6cfe
844d
STY delta1_sign
;
; Update delta1 with 16-bit magnitude in A:X; does not modify the sign
; Falls through...
add16_signed_mag_arg1:
ship_update+2f
6d00
854b
STA delta1_high
;
; Update only the low-byte of of delta1 from X; does not modify the sign or high byte
; Falls through...
add16_signed_mag_arg1_low:
delta_something+22
6d02
864a
STX delta1
;
; Compute the 16-bit signed addition of delta1 and delta2
; Returns the result in delta1 and delta1_sign, as well as X and A:Y
; Why is the return different from the calling convention?
add16_signed_mag_core:
ship_update+71S711c+cfS711c+1a7S711c+1c0S711c+1d2
6d04
a54c
LDA delta2_sign
; Compare the sign bits for delta1 and delta2
6d06
454d
EOR delta1_sign
; which are stored in the 7th bit of the byte
6d08
1034
BPL same_sign↓
; Same sign?
6d0a
38
SEC
; Not the same sign, so this will be a delta1 - delta2
6d0b
a54a
LDA delta1
; Subtract the low bytes of delta1
6d0d
e548
SBC delta2
; and delta2.
6d0f
a8
TAY
; Store this in Y
6d10
a54b
LDA delta1_high
; Subtract the high bytes of delta1
6d12
e549
SBC delta2_high
; and delta2, using the carry from 6d0d
6d14
9016
BCC opposite_underflow↓
; If carry was cleared, an underflow occured
6d16
d00d
BNE return_delta1_sign↓
; Were some bits set in the high byte? Is so return them.
6d18
c000
CPY #$00
; Were some bits set in the low byte in Y?
6d1a
d009
BNE return_delta1_sign↓
; If so, return them
6d1c
854a
STA delta1
; Return result was exactly zero, so store zero in the low byte
6d1e
854b
STA delta1_high
; and zero the high byte
6d20
854d
STA delta1_sign
; and reset the sign (no negative zero)
6d22
aa
TAX
; Return low = 0
6d23
a8
TAY
; Return high = 0
6d24
60
RTS
; And return the triple
return_delta1_sign:
6d166d1a6d486d4d
6d25
a64d
LDX delta1_sign
; Return result has same sign as delta1
return_delta1:
6d3c
6d27
844a
STY delta1
; Store low byte into Y
6d29
854b
STA delta1_high
; Store high byte into A
6d2b
60
RTS
; And return the triple
opposite_underflow:
6d14
6d2c
49ff
EOR #$ff
; The result of the subtraction underflowed, so invert the high byte in A
6d2e
aa
TAX
; and move it to X
6d2f
98
TYA
; Move the low byte of the subtraction from Y into A
6d30
49ff
EOR #$ff
; Invert the low byte as well
6d32
a8
TAY
; and move it back into Y
6d33
c8
INY
; Increment Y, to undo the two's complement negative
6d34
d001
BNE opposite_2c_carry↓
; If this also underflowed,
6d36
e8
INX
; then also increment X to under the high-byte's two's complement negative
opposite_2c_carry:
6d34
6d37
8a
TXA
; Move the high byte of the subtraction into A
6d38
a64c
LDX delta2_sign
; The underflowed result has the same sign as delta2 had
6d3a
864d
STX delta1_sign
; Store the new sign byte into delta1 for the return
6d3c
90e9
BCC return_delta1↑
; I think this is a branch always?
same_sign:
6d08
6d3e
18
CLC
; Clear the carry
6d3f
a54a
LDA delta1
; Add the low bytes of delta1
6d41
6548
ADC delta2
; and delta2
6d43
a8
TAY
; Store the result in Y
6d44
a54b
LDA delta1_high
; Add the high bytes of delta1
6d46
6549
ADC delta2_high
; and delta2, using the carry from the low-byte addition
6d48
90db
BCC return_delta1_sign↑
; If no overflow occured, return the result in delta1
6d4a
a9ff
LDA #$ff
; Overflow, so clamp at 0xFFFF
6d4c
a8
TAY
; in A:Y
6d4d
b0d6
BCS return_delta1_sign↑
; And return it with the same sign as delta1
GameRunningLoop:
GameLoop+13cGameLoop+18f
6d4f
208466
JSR shuffle_7_to_9↑
6d52
a96b
LDA #$6b
6d54
8569
STA Z69
6d56
a200
LDX #$00
6d58
866a
STX Z6a
6d5a
a586
LDA FrameCounter
6d5c
4a
LSR
6d5d
b011
BCS L6d70↓
6d5f
8681
STX min16_b_high_high
6d61
ca
DEX
6d62
8679
STX Z79
6d64
867a
STX Z7a
6d66
867d
STX min16_a
6d68
867e
STX min16_a_high
6d6a
a007
LDY #$07
6d6c
a277
LDX #$77
6d6e
d011
BNE L6d81↓
L6d70:
6d5d
6d70
a9c0
LDA #$c0
6d72
8581
STA min16_b_high_high
6d74
ca
DEX
6d75
867b
STX Z7b
6d77
867c
STX Z7c
6d79
867f
STX min16_b
6d7b
8680
STX min16_b_high
6d7d
a087
LDY #$87
6d7f
a277
LDX #$77
L6d81:
6d6e
6d81
20b86f
JSR vec_letter_something↓
6d84
a51d
LDA Z1d
6d86
18
CLC
6d87
6551
ADC score_dec_something2
6d89
a8
TAY
6d8a
a51e
LDA Z1e
6d8c
2903
AND #$03
6d8e
6900
ADC #$00
6d90
aa
TAX
6d91
98
TYA
6d92
38
SEC
6d93
e930
SBC #$30
6d95
a8
TAY
6d96
8a
TXA
6d97
e900
SBC #$00
6d99
b003
BCS L6d9e↓
6d9b
a000
LDY #$00
6d9d
98
TYA
L6d9e:
6d99
6d9e
244e
BIT drawing_scale
6da0
7002
BVS L6da4↓
6da2
a000
LDY #$00
L6da4:
6da0
6da4
8438
STY GenByte_0038
6da6
8539
STA GenByte_0039
6da8
18
CLC
6da9
654f
ADC score_dec_something1
6dab
244e
BIT drawing_scale
6dad
7008
BVS L6db7↓
6daf
290f
AND #$0f
6db1
a0e2
LDY #$e2
6db3
a251
LDX #$51
6db5
d010
BNE L6dc7↓
L6db7:
6dad
6db7
2903
AND #$03
6db9
853a
STA GenByte_003a
6dbb
a0bc
LDY #$bc
6dbd
a24b
LDX #$4b
6dbf
2438
BIT GenByte_0038
6dc1
1004
BPL L6dc7↓
6dc3
a0ce
LDY #$ce
6dc5
a24b
LDX #$4b
L6dc7:
6db56dc1
6dc7
862c
STX draw_string_ptr_high
6dc9
842b
STY draw_string_ptr
6dcb
0a
ASL
6dcc
0a
ASL
6dcd
a8
TAY
6dce
b12b
LDA (draw_string_ptr),Y
6dd0
38
SEC
6dd1
e553
SBC Z53
6dd3
851b
STA ThisDebrisY
6dd5
c8
INY
6dd6
b12b
LDA (draw_string_ptr),Y
6dd8
290f
AND #$0f
6dda
e554
SBC Z54
6ddc
851c
STA Z1c
6dde
c8
INY
6ddf
b12b
LDA (draw_string_ptr),Y
6de1
38
SEC
6de2
e551
SBC score_dec_something2
6de4
8519
STA ThisDebrisX
6de6
c8
INY
6de7
b12b
LDA (draw_string_ptr),Y
6de9
2903
AND #$03
6deb
e900
SBC #$00
6ded
18
CLC
6dee
6539
ADC GenByte_0039
6df0
851a
STA Z1a
6df2
a539
LDA GenByte_0039
6df4
aa
TAX
6df5
0a
ASL
6df6
18
CLC
6df7
2438
BIT GenByte_0038
6df9
1024
BPL L6e1f↓
6dfb
a53a
LDA GenByte_003a
6dfd
0a
ASL
6dfe
a8
TAY
6dff
b90778
LDA D7807,Y
6e02
852b
STA draw_string_ptr
6e04
b90878
LDA D7808,Y
6e07
852c
STA draw_string_ptr_high
6e09
a000
LDY #$00
6e0b
e8
INX
6e0c
8a
TXA
6e0d
0a
ASL
6e0e
652d
ADC VecRamPtr_copy
6e10
9169
STA (Z69),Y
6e12
a52e
LDA Z2e
6e14
6900
ADC #$00
6e16
c8
INY
6e17
9169
STA (Z69),Y
6e19
e669
INC Z69
6e1b
e669
INC Z69
6e1d
d00a
BNE L6e29↓
L6e1f:
6df9
6e1f
652d
ADC VecRamPtr_copy
6e21
852b
STA draw_string_ptr
6e23
a52e
LDA Z2e
6e25
6900
ADC #$00
6e27
852c
STA draw_string_ptr_high
L6e29:
6e1d6e71
6e29
a000
LDY #$00
L6e2b:
6e4d6f82
6e2b
b12b
LDA (draw_string_ptr),Y
6e2d
c8
INY
6e2e
aa
TAX
6e2f
b12b
LDA (draw_string_ptr),Y
6e31
c8
INY
6e32
c9a0
CMP #$a0
6e34
903d
BCC L6e73↓
6e36
c9d0
CMP #$d0
6e38
9016
BCC L6e50↓
6e3a
f003
BEQ L6e3f↓
6e3c
4c856f
JMP L6f85↓
L6e3f:
6e3a
6e3f
c669
DEC Z69
6e41
a000
LDY #$00
6e43
b169
LDA (Z69),Y
6e45
852c
STA draw_string_ptr_high
6e47
c669
DEC Z69
6e49
b169
LDA (Z69),Y
6e4b
852b
STA draw_string_ptr
6e4d
4c2b6e
JMP L6e2b↑
L6e50:
6e38
6e50
8537
STA GenByte_0037
6e52
98
TYA
6e53
18
CLC
6e54
652b
ADC draw_string_ptr
6e56
a000
LDY #$00
6e58
9169
STA (Z69),Y
6e5a
862b
STX draw_string_ptr
6e5c
e669
INC Z69
6e5e
a52c
LDA draw_string_ptr_high
6e60
6900
ADC #$00
6e62
9169
STA (Z69),Y
6e64
e669
INC Z69
6e66
a537
LDA GenByte_0037
6e68
290f
AND #$0f
6e6a
0920
ORA #$20
6e6c
062b
ASL draw_string_ptr
6e6e
2a
ROL
6e6f
852c
STA draw_string_ptr_high
6e71
d0b6
BNE L6e29↑
L6e73:
6e34
6e73
863f
STX GenByte_003f
6e75
aa
TAX
6e76
b12b
LDA (draw_string_ptr),Y
6e78
853d
STA GenByte_003c
6e7a
c8
INY
6e7b
b12b
LDA (draw_string_ptr),Y
6e7d
c8
INY
6e7e
8439
STY GenByte_0039
6e80
2903
AND #$03
6e82
a8
TAY
6e83
8a
TXA
6e84
2903
AND #$03
6e86
8540
STA GenByte_0040
6e88
8a
TXA
6e89
6a
ROR
6e8a
6a
ROR
6e8b
6a
ROR
6e8c
6a
ROR
6e8d
854c
STA delta2_sign
6e8f
290f
AND #$0f
6e91
8541
STA GenByte_0041
6e93
a909
LDA #$09
6e95
38
SEC
6e96
e541
SBC GenByte_0041
6e98
aa
TAX
6e99
98
TYA
L6e9a:
6ea2
6e9a
4a
LSR
6e9b
663d
ROR GenByte_003c
6e9d
4640
LSR GenByte_0040
6e9f
663f
ROR GenByte_003f
6ea1
ca
DEX
6ea2
d0f6
BNE L6e9a↑
L6ea4:
6fb5
6ea4
853e
STA GenByte_003e
6ea6
a519
LDA ThisDebrisX
6ea8
8515
STA Z15
6eaa
18
CLC
6eab
653d
ADC GenByte_003c
6ead
8519
STA ThisDebrisX
6eaf
a51a
LDA Z1a
6eb1
8516
STA Z16
6eb3
653e
ADC GenByte_003e
6eb5
851a
STA Z1a
6eb7
244c
BIT delta2_sign
6eb9
1012
BPL L6ecd↓
6ebb
a53f
LDA GenByte_003f
6ebd
49ff
EOR #$ff
6ebf
aa
TAX
6ec0
a540
LDA GenByte_0040
6ec2
49ff
EOR #$ff
6ec4
a8
TAY
6ec5
e8
INX
6ec6
863f
STX GenByte_003f
6ec8
d001
BNE L6ecb↓
6eca
c8
INY
L6ecb:
6ec8
6ecb
8440
STY GenByte_0040
L6ecd:
6eb9
6ecd
a51b
LDA ThisDebrisY
6ecf
8517
STA Z17
6ed1
18
CLC
6ed2
653f
ADC GenByte_003f
6ed4
851b
STA ThisDebrisY
6ed6
a51c
LDA Z1c
6ed8
8518
STA Z18
6eda
6540
ADC GenByte_0040
6edc
851c
STA Z1c
6ede
a51a
LDA Z1a
6ee0
1003
BPL L6ee5↓
6ee2
4c806f
JMP L6f80↓
L6ee5:
6ee0
6ee5
2481
BIT min16_b_high_high
6ee7
303f
BMI L6f28↓
6ee9
a519
LDA ThisDebrisX
6eeb
c51d
CMP Z1d
6eed
a51a
LDA Z1a
6eef
e51e
SBC Z1e
6ef1
9006
BCC L6ef9↓
6ef3
a980
LDA #$80
6ef5
8581
STA min16_b_high_high
6ef7
b028
BCS L6f21↓
L6ef9:
6ef1
6ef9
a51f
LDA Z1f
6efb
c51b
CMP ThisDebrisY
6efd
a520
LDA Z20
6eff
e51c
SBC Z1c
6f01
907d
BCC L6f80↓
6f03
a980
LDA #$80
6f05
8581
STA min16_b_high_high
6f07
a517
LDA Z17
6f09
c51f
CMP Z1f
6f0b
a518
LDA Z18
6f0d
3012
BMI L6f21↓
6f0f
e520
SBC Z20
6f11
900e
BCC L6f21↓
6f13
206e70
JSR FUN_706e↓
6f16
857a
STA Z7a
6f18
8479
STY Z79
6f1a
8a
TXA
6f1b
1004
BPL L6f21↓
6f1d
a98f
LDA #$8f
6f1f
855d
STA ship_state_maybe
L6f21:
6ef76f0d6f116f1b
6f21
a047
LDY #$47
6f23
a277
LDX #$77
6f25
20b86f
JSR vec_letter_something↓
L6f28:
6ee7
6f28
a581
LDA min16_b_high_high
6f2a
290f
AND #$0f
6f2c
d027
BNE L6f55↓
6f2e
a519
LDA ThisDebrisX
6f30
c51d
CMP Z1d
6f32
a51a
LDA Z1a
6f34
e51e
SBC Z1e
6f36
9048
BCC L6f80↓
6f38
202270
JSR explode_something_lots_math↓
6f3b
2481
BIT min16_b_high_high
6f3d
7007
BVS L6f46↓
6f3f
857e
STA min16_a_high
6f41
847d
STY min16_a
6f43
4c7f6f
JMP L6f7f↓
L6f46:
6f3d
6f46
8580
STA min16_b_high
6f48
847f
STY min16_b
6f4a
a2cf
LDX #$cf
6f4c
8681
STX min16_b_high_high
6f4e
a0c7
LDY #$c7
6f50
a277
LDX #$77
6f52
20b86f
JSR vec_letter_something↓
L6f55:
6f2c
6f55
a51d
LDA Z1d
6f57
18
CLC
6f58
6930
ADC #$30
6f5a
aa
TAX
6f5b
a51e
LDA Z1e
6f5d
6900
ADC #$00
6f5f
e419
CPX ThisDebrisX
6f61
e51a
SBC Z1a
6f63
901a
BCC L6f7f↓
6f65
a51b
LDA ThisDebrisY
6f67
c51f
CMP Z1f
6f69
a51c
LDA Z1c
6f6b
3013
BMI L6f80↓
6f6d
e520
SBC Z20
6f6f
900f
BCC L6f80↓
6f71
206e70
JSR FUN_706e↓
6f74
857c
STA Z7c
6f76
847b
STY Z7b
6f78
8a
TXA
6f79
3004
BMI L6f7f↓
6f7b
a98f
LDA #$8f
6f7d
855d
STA ship_state_maybe
L6f7f:
6f436f636f79
6f7f
60
RTS
L6f80:
6ee26f016f366f6b6f6f
6f80
a439
LDY GenByte_0039
6f82
4c2b6e
JMP L6e2b↑
L6f85:
6e3c
6f85
8439
STY GenByte_0039
6f87
8537
STA GenByte_0037
6f89
2903
AND #$03
6f8b
853f
STA GenByte_003f
6f8d
a537
LDA GenByte_0037
6f8f
2908
AND #$08
6f91
4a
LSR
6f92
8538
STA GenByte_0038
6f94
8a
TXA
6f95
2908
AND #$08
6f97
0538
ORA GenByte_0038
6f99
4a
LSR
6f9a
4a
LSR
6f9b
8638
STX GenByte_0038
6f9d
a8
TAY
6f9e
8a
TXA
6f9f
2903
AND #$03
L6fa1:
6fa5
6fa1
0a
ASL
6fa2
063f
ASL GenByte_003f
6fa4
88
DEY
6fa5
10fa
BPL L6fa1↑
6fa7
853d
STA GenByte_003c
6fa9
a537
LDA GenByte_0037
6fab
4a
LSR
6fac
4a
LSR
6fad
6a
ROR
6fae
6a
ROR
6faf
854c
STA delta2_sign
6fb1
a900
LDA #$00
6fb3
8540
STA GenByte_0040
6fb5
4ca46e
JMP L6ea4↑
vec_letter_something:
GameRunningLoop+32GameRunningLoop+1d6GameRunningLoop+203
6fb8
8632
STX Z32
6fba
8431
STY vec_letter_ptr_something
6fbc
244e
BIT drawing_scale
6fbe
7026
BVS L6fe6↓
6fc0
a502
LDA ship_angle_modulo
6fc2
0a
ASL
6fc3
a8
TAY
6fc4
a200
LDX #$00
6fc6
b131
LDA (vec_letter_ptr_something),Y
6fc8
1001
BPL L6fcb↓
6fca
ca
DEX
L6fcb:
6fc8
6fcb
18
CLC
6fcc
650f
ADC score_dec_maybe
6fce
851d
STA Z1d
6fd0
8a
TXA
6fd1
6510
ADC Z10
6fd3
851e
STA Z1e
6fd5
c8
INY
6fd6
a200
LDX #$00
6fd8
b131
LDA (vec_letter_ptr_something),Y
6fda
1001
BPL L6fdd↓
6fdc
ca
DEX
L6fdd:
6fda
6fdd
18
CLC
6fde
650d
ADC vec_letter_ptr_maybe
6fe0
a8
TAY
6fe1
8a
TXA
6fe2
650e
ADC Z0e
6fe4
d00c
BNE L6ff2↓
L6fe6:
6fbe
6fe6
a50f
LDA score_dec_maybe
6fe8
851d
STA Z1d
6fea
a510
LDA Z10
6fec
851e
STA Z1e
6fee
a40d
LDY vec_letter_ptr_maybe
6ff0
a50e
LDA Z0e
L6ff2:
6fe4
6ff2
290f
AND #$0f
6ff4
8520
STA Z20
6ff6
841f
STY Z1f
6ff8
60
RTS
debris_something_setup_gb3c:
FUN_706e+0explode_something_lots_math+0
6ff9
a519
LDA ThisDebrisX
6ffb
38
SEC
6ffc
e515
SBC Z15
6ffe
853d
STA GenByte_003c
7000
a517
LDA Z17
7002
49ff
EOR #$ff
7004
a8
TAY
7005
a518
LDA Z18
7007
49ff
EOR #$ff
7009
aa
TAX
700a
c8
INY
700b
d001
BNE L700e↓
700d
e8
INX
L700e:
700b
700e
98
TYA
700f
18
CLC
7010
651b
ADC ThisDebrisY
7012
a8
TAY
7013
8a
TXA
7014
a200
LDX #$00
7016
651c
ADC Z1c
7018
1005
BPL L701f↓
701a
98
TYA
701b
49ff
EOR #$ff
701d
a8
TAY
701e
ca
DEX
L701f:
7018
701f
8640
STX GenByte_0040
7021
60
RTS
explode_something_lots_math:
GameRunningLoop+1e9
7022
20f96f
JSR debris_something_setup_gb3c↑
7025
98
TYA
7026
a43d
LDY GenByte_003c
7028
20c070
JSR divide↓
702b
a51d
LDA Z1d
702d
38
SEC
702e
e515
SBC Z15
7030
a477
LDY remainder
7032
20ef70
JSR mult16↓
7035
8637
STX GenByte_0037
7037
a476
LDY divisor2
7039
20f170
JSR mult16_repeat↓
703c
18
CLC
703d
6537
ADC GenByte_0037
703f
8537
STA GenByte_0037
7041
2440
BIT GenByte_0040
7043
300e
BMI L7053↓
7045
18
CLC
7046
6517
ADC Z17
7048
8548
STA delta2
704a
a518
LDA Z18
704c
6900
ADC #$00
704e
8549
STA delta2_high
7050
4c6070
JMP L7060↓
L7053:
7043
7053
38
SEC
7054
a517
LDA Z17
7056
e537
SBC GenByte_0037
7058
8548
STA delta2
705a
a518
LDA Z18
705c
e900
SBC #$00
705e
8549
STA delta2_high
L7060:
7050
7060
a61f
LDX Z1f
7062
a520
LDA Z20
7064
209b70
JSR delta_something↓
7067
1004
BPL L706d↓
7069
a28f
LDX #$8f
706b
865d
STX ship_state_maybe
L706d:
7067
706d
60
RTS
FUN_706e:
GameRunningLoop+1c4GameRunningLoop+222
706e
20f96f
JSR debris_something_setup_gb3c↑
7071
a53d
LDA GenByte_003c
7073
20c070
JSR divide↓
7076
a517
LDA Z17
7078
38
SEC
7079
e51f
SBC Z1f
707b
a477
LDY remainder
707d
20ef70
JSR mult16↓
7080
8637
STX GenByte_0037
7082
a476
LDY divisor2
7084
20f170
JSR mult16_repeat↓
7087
18
CLC
7088
6537
ADC GenByte_0037
708a
8537
STA GenByte_0037
708c
18
CLC
708d
6515
ADC Z15
708f
8548
STA delta2
7091
a516
LDA Z16
7093
6900
ADC #$00
7095
8549
STA delta2_high
7097
a61d
LDX Z1d
7099
a51e
LDA Z1e
delta_something:
explode_something_lots_math+42
709b
854b
STA delta1_high
709d
a980
LDA #$80
709f
2449
BIT delta2_high
70a1
1014
BPL L70b7↓
70a3
a548
LDA delta2
70a5
49ff
EOR #$ff
70a7
8548
STA delta2
70a9
a549
LDA delta2_high
70ab
49ff
EOR #$ff
70ad
8549
STA delta2_high
70af
e648
INC delta2
70b1
d002
BNE L70b5↓
70b3
e649
INC delta2_high
L70b5:
70b1
70b5
a900
LDA #$00
L70b7:
70a1
70b7
854c
STA delta2_sign
70b9
a000
LDY #$00
70bb
844d
STY delta1_sign
70bd
4c026d
JMP add16_signed_mag_arg1_low↑
divide:
thrust_smoothing_maybe+27FUN_706e+5explode_something_lots_math+6
70c0
8475
STY divisor
70c2
20d170
JSR divide_setup_0↓
70c5
8677
STX remainder
70c7
a200
LDX #$00
70c9
8678
STX dividend_working
70cb
20d570
JSR divide_core↓
70ce
8676
STX divisor2
70d0
60
RTS
divide_setup_0:
divide+2
70d1
8578
STA dividend_working
70d3
a900
LDA #$00
divide_core:
divide+b
70d5
a007
LDY #$07
L70d7:
70e3
70d7
2678
ROL dividend_working
70d9
2a
ROL
70da
b00e
BCS L70ea↓
70dc
c575
CMP divisor
70de
9002
BCC L70e2↓
70e0
e575
SBC divisor
L70e2:
70de70ed
70e2
88
DEY
70e3
10f2
BPL L70d7↑
70e5
2678
ROL dividend_working
70e7
a678
LDX dividend_working
70e9
60
RTS
L70ea:
70da
70ea
e575
SBC divisor
70ec
38
SEC
70ed
b0f3
BCS L70e2↑
; Multiply two 8-bit values in A and Y, returning a 16-bit value in A:X.
; Falls through to mult16_repeat
mult16:
debris_update+2bdebris_update+48debris_update+55ship_compute_accel_xy+2fship_compute_accel_xy+39fuel_drain_thrust+eFUN_706e+fexplode_something_lots_math+10
70ef
8543
STA mult_a
; Store A into mult_a for repeated calls to mult16_repeat (which this now implicitly calls by falling through)
; Multiply the 8-bit values in Y with the previously used value in A
mult16_repeat:
FUN_706e+16explode_something_lots_math+17
70f1
8442
STY mult_y
; Store Y into mult_y
70f3
a543
LDA mult_a
; Load mult_a...
70f5
48
PHA
; and store it on the stack
70f6
49ff
EOR #$ff
; Invert the high byte (to make a test easier later)...
70f8
8543
STA mult_a
; and store it back in mult_a
70fa
a900
LDA #$00
; A = 0
70fc
8544
STA mult_acc
; Zero the multiply output low...
70fe
8545
STA mult_acc_high
; and high bytes
7100
a208
LDX #$08
; Number of rounds (8 since this is an 8x8 to 16-bit multiply)
mult_start_round:
7119
7102
0643
ASL mult_a
; Shift the inverted high byte to the left
7104
b006
BCS mult_bit_not_set↓
; If the top bit was set, skip the increment
7106
6542
ADC mult_y
; Add mult_y to A
7108
9002
BCC mult_bit_not_set↓
; If this doesn't carry, skip updating the high byte
710a
e645
INC mult_acc_high
; The addition overflowed, increment the high byte
mult_bit_not_set:
71047108
710c
ca
DEX
; Decrement our round counter
710d
d007
BNE mult_continue_round↓
; If it is not zero, do another round
710f
aa
TAX
; Move the multiply accumulator low-byte to X
7110
68
PLA
; Restore the non-inverted mult_a from the stack,
7111
8543
STA mult_a
; and store it back in the memory location
7113
a545
LDA mult_acc_high
; Load the high byte of the multiply accumulator into A
7115
60
RTS
; return the 16-bit value as the register pair X:A
mult_continue_round:
710d
7116
0a
ASL
; Multiply the low-byte of the result by 2
7117
2645
ROL mult_acc_high
; Multiply the high-byte by two, shifting in the carry
7119
90e7
BCC mult_start_round↑
; If this doesn't overflow, start another round
711b
55a9
EOR bcd_score_maybe2,X
711e
8555
STA ship_enable_x
7120
8557
STA ship_enable_y
7122
a90f
LDA #$0f
7124
244e
BIT drawing_scale
7126
5002
BVC L712a↓
7128
a903
LDA #$03
L712a:
7126
712a
8537
STA GenByte_0037
712c
a508
LDA ship_pos_high[0]
712e
245a
BIT ship_vel_sign_x
7130
100d
BPL L713f↓
7132
c920
CMP #$20
7134
b01a
BCS L7150↓
7136
202c73
JSR S732c↓
7139
b015
BCS L7150↓
713b
c64f
DEC score_dec_something1
713d
900b
BCC L714a↓
L713f:
7130
713f
c9e0
CMP #$e0
7141
900d
BCC L7150↓
7143
201b73
JSR S731b↓
7146
9008
BCC L7150↓
7148
e64f
INC score_dec_something1
L714a:
713d
714a
a54f
LDA score_dec_something1
714c
2537
AND GenByte_0037
714e
854f
STA score_dec_something1
L7150:
7134713971417146
7150
244e
BIT drawing_scale
7152
5003
BVC L7157↓
7154
4c3e72
JMP L723e↓
L7157:
7152
7157
a50a
LDA ship_pos_high[1]
7159
245c
BIT Z5c
715b
100a
BPL L7167↓
715d
c940
CMP #$40
715f
b003
BCS L7164↓
7161
205473
JSR S7354↓
L7164:
715f7169
7164
4c0372
JMP L7203↓
L7167:
715b
7167
c9a5
CMP #$a5
7169
90f9
BCC L7164↑
716b
20fe72
JSR min16↓
716e
c902
CMP #$02
7170
9006
BCC L7178↓
7172
d00a
BNE L717e↓
7174
e008
CPX #$08
7176
b006
BCS L717e↓
L7178:
7170
7178
203d73
JSR S733d↓
717b
4c0372
JMP L7203↓
L717e:
71727176
717e
245d
BIT ship_state_maybe
7180
1003
BPL L7185↓
7182
4c3972
JMP L7239↓
L7185:
7180
7185
a50f
LDA score_dec_maybe
7187
18
CLC
7188
6551
ADC score_dec_something2
718a
8551
STA score_dec_something2
718c
a510
LDA Z10
718e
2903
AND #$03
7190
654f
ADC score_dec_something1
7192
290f
AND #$0f
7194
aa
TAX
7195
4a
LSR
7196
6651
ROR score_dec_something2
7198
4a
LSR
7199
6651
ROR score_dec_something2
719b
18
CLC
719c
6902
ADC #$02
719e
2903
AND #$03
71a0
854f
STA score_dec_something1
71a2
8a
TXA
71a3
290c
AND #$0c
71a5
48
PHA
71a6
0a
ASL
71a7
0a
ASL
71a8
aa
TAX
71a9
bde251
LDA vectors_not_zoomed_51e2,X
71ac
38
SEC
71ad
e553
SBC Z53
71af
8548
STA delta2
71b1
bde351
LDA D51e3,X
71b4
e554
SBC Z54
71b6
8549
STA delta2_high
71b8
a980
LDA #$80
71ba
854c
STA delta2_sign
71bc
a000
LDY #$00
71be
a60d
LDX vec_letter_ptr_maybe
71c0
a50e
LDA Z0e
71c2
290f
AND #$0f
71c4
20fe6c
JSR add16_signed_mag↑
71c7
4a
LSR
71c8
664a
ROR delta1
71ca
4a
LSR
71cb
664a
ROR delta1
71cd
854b
STA delta1_high
71cf
68
PLA
71d0
aa
TAX
71d1
bdbc4b
LDA zoomed_in_settings_4bbc,X
71d4
8548
STA delta2
71d6
bdbd4b
LDA D4bbd,X
71d9
8549
STA delta2_high
71db
a900
LDA #$00
71dd
8550
STA Z50
71df
8552
STA Z52
71e1
8553
STA Z53
71e3
8554
STA Z54
71e5
8509
STA ship_pos[1]
71e7
8507
STA ship_pos[0]
71e9
854c
STA delta2_sign
71eb
20046d
JSR add16_signed_mag_core↑
71ee
840a
STY ship_pos_high[1]
71f0
4a
LSR
71f1
660a
ROR ship_pos_high[1]
71f3
6609
ROR ship_pos[1]
71f5
4a
LSR
71f6
660a
ROR ship_pos_high[1]
71f8
6609
ROR ship_pos[1]
71fa
a980
LDA #$80
71fc
8508
STA ship_pos_high[0]
71fe
a940
LDA #$40
7200
854e
STA drawing_scale
7202
60
RTS
L7203:
7164717b
7203
20fe72
JSR min16↓
7206
0900
ORA #$00
7208
d02b
BNE L7235↓
720a
e002
CPX #$02
720c
b027
BCS L7235↓
720e
c002
CPY #$02
7210
b023
BCS L7235↓
7212
a502
LDA ship_angle_modulo
7214
38
SEC
7215
e907
SBC #$07
7217
c903
CMP #$03
7219
b01e
BCS L7239↓
721b
a561
LDA ship_vel_high[1]
721d
a280
LDX #$80
721f
c904
CMP #$04
7221
9006
BCC L7229↓
7223
c908
CMP #$08
7225
b012
BCS L7239↓
7227
a2c0
LDX #$c0
L7229:
7221
7229
a55f
LDA ship_vel_high[0]
722b
c904
CMP #$04
722d
b00a
BCS L7239↓
722f
8a
TXA
7230
055d
ORA ship_state_maybe
7232
855d
STA ship_state_maybe
7234
60
RTS
L7235:
7208720c7210
7235
245d
BIT ship_state_maybe
7237
1004
BPL L723d↓
L7239:
718272197225722d
7239
a98f
LDA #$8f
723b
855d
STA ship_state_maybe
L723d:
7237
723d
60
RTS
L723e:
7154
723e
a50a
LDA ship_pos_high[1]
7240
245c
BIT Z5c
7242
301a
BMI L725e↓
7244
c9a5
CMP #$a5
7246
902a
BCC L7272↓
7248
203d73
JSR S733d↓
724b
f010
BEQ L725d↓
724d
c902
CMP #$02
724f
900c
BCC L725d↓
7251
202d65
JSR dvg_wait_done↑
7254
20966b
JSR fuel_lost_to_crash↑
7257
a2ff
LDX #$ff
7259
9a
TXS
725a
4c4060
JMP L6040↑
L725d:
724b724f7267
725d
60
RTS
L725e:
7242
725e
a553
LDA Z53
7260
0554
ORA Z54
7262
f00e
BEQ L7272↓
7264
205473
JSR S7354↓
7267
b0f4
BCS L725d↑
7269
a900
LDA #$00
726b
8552
STA Z52
726d
8553
STA Z53
726f
8554
STA Z54
L7271:
7276727a
7271
60
RTS
L7272:
72467262
7272
20fe72
JSR min16↓
7275
a8
TAY
7276
d0f9
BNE L7271↑
7278
e060
CPX #$60
727a
b0f5
BCS L7271↑
727c
a50f
LDA score_dec_maybe
727e
18
CLC
727f
6551
ADC score_dec_something2
7281
8551
STA score_dec_something2
7283
a510
LDA Z10
7285
654f
ADC score_dec_something1
7287
2903
AND #$03
7289
aa
TAX
728a
0651
ASL score_dec_something2
728c
2a
ROL
728d
0651
ASL score_dec_something2
728f
2a
ROL
7290
48
PHA
7291
38
SEC
7292
e902
SBC #$02
7294
290f
AND #$0f
7296
854f
STA score_dec_something1
7298
8a
TXA
7299
0a
ASL
729a
0a
ASL
729b
aa
TAX
729c
bdbc4b
LDA zoomed_in_settings_4bbc,X
729f
8548
STA delta2
72a1
bdbd4b
LDA D4bbd,X
72a4
8549
STA delta2_high
72a6
a980
LDA #$80
72a8
854c
STA delta2_sign
72aa
a50e
LDA Z0e
72ac
a60d
LDX vec_letter_ptr_maybe
72ae
a000
LDY #$00
72b0
20fe6c
JSR add16_signed_mag↑
72b3
064a
ASL delta1
72b5
2a
ROL
72b6
064a
ASL delta1
72b8
2a
ROL
72b9
854b
STA delta1_high
72bb
a9a3
LDA #$a3
72bd
a278
LDX #$78
72bf
8549
STA delta2_high
72c1
8648
STX delta2
72c3
20046d
JSR add16_signed_mag_core↑
72c6
a918
LDA #$18
72c8
8548
STA delta2
72ca
a9a1
LDA #$a1
72cc
8549
STA delta2_high
72ce
a900
LDA #$00
72d0
854c
STA delta2_sign
72d2
854e
STA drawing_scale
72d4
8507
STA ship_pos[0]
72d6
8509
STA ship_pos[1]
72d8
8550
STA Z50
72da
8552
STA Z52
72dc
20046d
JSR add16_signed_mag_core↑
72df
68
PLA
72e0
290c
AND #$0c
72e2
0a
ASL
72e3
aa
TAX
72e4
bd2252
LDA D5222,X
72e7
8548
STA delta2
72e9
bd2352
LDA D5223,X
72ec
8549
STA delta2_high
72ee
20046d
JSR add16_signed_mag_core↑
72f1
8554
STA Z54
72f3
8453
STY Z53
72f5
a980
LDA #$80
72f7
8508
STA ship_pos_high[0]
72f9
a99e
LDA #$9e
72fb
850a
STA ship_pos_high[1]
72fd
60
RTS
min16:
bcd_score_maybe+3fS711c+4fS711c+e7S711c+156
72fe
a0ff
LDY #$ff
; Not sure what Y is used for in the return result
7300
a57e
LDA min16_a_high
; Assume A is higher, load high byte AH into A
7302
a67d
LDX min16_a
; and low byte AL into X
7304
c580
CMP min16_b_high
; Compare the high bytes of AH and BH
7306
9012
BCC return_ax↓
; AH is lower, return it
7308
d00c
BNE return_b↓
; BH is lower, return it instead
730a
a47f
LDY min16_b
; Need to compare the low bytes, load BL into Y
730c
c47d
CPY min16_a
; Compare BL and AL
730e
b00a
BCS return_ax↓
; A is lower, return it
7310
a67f
LDX min16_b
; move BL into X
7312
a47d
LDY min16_a
; why is Y loaded here?
7314
9004
BCC return_ax↓
; jump to return B (note that AH=BH, so it does not need to be loaded)
return_b:
7308
7316
a580
LDA min16_b_high
; B is larger, move the BH into A
7318
a67f
LDX min16_b
; and BL into X
return_ax:
7306730e7314
731a
60
RTS
; Return the 16-bit value in A:X
S731b:
S711c+27
731b
206b73
JSR S736b↓
731e
a550
LDA Z50
7320
18
CLC
7321
653d
ADC GenByte_003c
7323
8550
STA Z50
7325
a551
LDA score_dec_something2
7327
653e
ADC GenByte_003e
7329
8551
STA score_dec_something2
732b
60
RTS
S732c:
S711c+1a
732c
206b73
JSR S736b↓
732f
a550
LDA Z50
7331
38
SEC
7332
e53d
SBC GenByte_003c
7334
8550
STA Z50
7336
a551
LDA score_dec_something2
7338
e53e
SBC GenByte_003e
733a
8551
STA score_dec_something2
733c
60
RTS
S733d:
S711c+5cS711c+12c
733d
208a73
JSR S738a↓
7340
a552
LDA Z52
7342
18
CLC
7343
653f
ADC GenByte_003f
7345
8552
STA Z52
7347
a553
LDA Z53
7349
6540
ADC GenByte_0040
734b
8553
STA Z53
734d
a554
LDA Z54
734f
6900
ADC #$00
7351
8554
STA Z54
7353
60
RTS
S7354:
S711c+45S711c+148
7354
208a73
JSR S738a↓
7357
a552
LDA Z52
7359
38
SEC
735a
e53f
SBC GenByte_003f
735c
8552
STA Z52
735e
a553
LDA Z53
7360
e540
SBC GenByte_0040
7362
8553
STA Z53
7364
a554
LDA Z54
7366
e900
SBC #$00
7368
8554
STA Z54
736a
60
RTS
S736b:
S732c+0S731b+0
736b
a980
LDA #$80
736d
8555
STA ship_enable_x
736f
a55f
LDA ship_vel_high[0]
7371
853d
STA GenByte_003c
7373
a900
LDA #$00
7375
853e
STA GenByte_003e
7377
a55e
LDA ship_vel[0]
7379
a202
LDX #$02
737b
244e
BIT drawing_scale
737d
7002
BVS L7381↓
737f
a204
LDX #$04
L7381:
737d7387
7381
0a
ASL
7382
263d
ROL GenByte_003c
7384
263e
ROL GenByte_003e
7386
ca
DEX
7387
d0f8
BNE L7381↑
7389
60
RTS
S738a:
S7354+0S733d+0
738a
a980
LDA #$80
738c
8557
STA ship_enable_y
738e
a561
LDA ship_vel_high[1]
7390
853f
STA GenByte_003f
7392
a900
LDA #$00
7394
8540
STA GenByte_0040
7396
a560
LDA ship_vel[1]
7398
a202
LDX #$02
739a
244e
BIT drawing_scale
739c
7002
BVS L73a0↓
739e
a204
LDX #$04
L73a0:
739c73a6
73a0
0a
ASL
73a1
263f
ROL GenByte_003f
73a3
2640
ROL GenByte_0040
73a5
ca
DEX
73a6
d0f8
BNE L73a0↑
73a8
60
RTS
draw_lots_of_stuff:
GameLoop+3b
73a9
a9ba
LDA #$ba
73ab
8564
STA VecPtr
73ad
a951
LDA #$51
73af
8565
STA Z65
73b1
a945
LDA #$45
73b3
8528
STA VecRamPtr_high
73b5
a96b
LDA #$6b
73b7
8569
STA Z69
73b9
a900
LDA #$00
73bb
8527
STA VecRamPtr
73bd
856a
STA Z6a
73bf
8537
STA GenByte_0037
73c1
8538
STA GenByte_0038
73c3
8539
STA GenByte_0039
73c5
a9f0
LDA #$f0
73c7
852b
STA draw_string_ptr
73c9
a944
LDA #$44
73cb
852c
STA draw_string_ptr_high
L73cd:
7468
73cd
200375
JSR VecRomJSRL↓
73d0
a000
LDY #$00
L73d2:
73ec7403742f7447744f
73d2
b164
LDA (VecPtr),Y
73d4
aa
TAX
73d5
c8
INY
73d6
b164
LDA (VecPtr),Y
73d8
c9a0
CMP #$a0
73da
9012
BCC L73ee↓
73dc
c9d0
CMP #$d0
73de
9025
BCC L7405↓
73e0
f04f
BEQ L7431↓
73e2
9127
STA (VecRamPtr),Y
73e4
88
DEY
73e5
8a
TXA
73e6
4908
EOR #$08
73e8
9127
STA (VecRamPtr),Y
73ea
c8
INY
73eb
c8
INY
73ec
d0e4
BNE L73d2↑
L73ee:
73da
73ee
38
SEC
73ef
e920
SBC #$20
73f1
9127
STA (VecRamPtr),Y
73f3
88
DEY
73f4
8a
TXA
73f5
9127
STA (VecRamPtr),Y
73f7
c8
INY
73f8
c8
INY
73f9
b164
LDA (VecPtr),Y
73fb
9127
STA (VecRamPtr),Y
73fd
c8
INY
73fe
b164
LDA (VecPtr),Y
7400
9127
STA (VecRamPtr),Y
7402
c8
INY
7403
d0cd
BNE L73d2↑
L7405:
73de
7405
290f
AND #$0f
7407
853a
STA GenByte_003a
7409
863b
STX GenByte_003b
740b
88
DEY
740c
20f874
JSR VecPtrUpdate_dupe↓
740f
c8
INY
7410
c8
INY
7411
98
TYA
7412
a000
LDY #$00
7414
18
CLC
7415
6564
ADC VecPtr
7417
9169
STA (Z69),Y
7419
e669
INC Z69
741b
a565
LDA Z65
741d
6900
ADC #$00
741f
9169
STA (Z69),Y
7421
e669
INC Z69
7423
a53b
LDA GenByte_003b
7425
0a
ASL
7426
8564
STA VecPtr
7428
a53a
LDA GenByte_003a
742a
2a
ROL
742b
0940
ORA #$40
742d
8565
STA Z65
742f
d0a1
BNE L73d2↑
L7431:
73e0
7431
88
DEY
7432
20f874
JSR VecPtrUpdate_dupe↓
7435
a000
LDY #$00
7437
c669
DEC Z69
7439
b169
LDA (Z69),Y
743b
8565
STA Z65
743d
c669
DEC Z69
743f
b169
LDA (Z69),Y
7441
8564
STA VecPtr
7443
a669
LDX Z69
7445
e06b
CPX #$6b
7447
d089
BNE L73d2↑
7449
e637
INC GenByte_0037
744b
a204
LDX #$04
744d
e437
CPX GenByte_0037
744f
d081
BNE L73d2↑
7451
a900
LDA #$00
7453
8537
STA GenByte_0037
7455
9127
STA (VecRamPtr),Y
7457
c8
INY
7458
a9d0
LDA #$d0
745a
9127
STA (VecRamPtr),Y
745c
c8
INY
745d
20f874
JSR VecPtrUpdate_dupe↓
7460
e639
INC GenByte_0039
7462
a204
LDX #$04
7464
e439
CPX GenByte_0039
7466
f003
BEQ L746b↓
7468
4ccd73
JMP L73cd↑
L746b:
7466
746b
a9f0
LDA #$f0
746d
8564
STA VecPtr
746f
a944
LDA #$44
7471
8565
STA Z65
7473
a538
LDA GenByte_0038
7475
18
CLC
7476
652b
ADC draw_string_ptr
7478
852b
STA draw_string_ptr
747a
d002
BNE L747e↓
747c
e62c
INC draw_string_ptr_high
L747e:
747a
747e
a007
LDY #$07
L7480:
7485
7480
b164
LDA (VecPtr),Y
7482
912b
STA (draw_string_ptr),Y
7484
88
DEY
7485
10f9
BPL L7480↑
7487
a97e
LDA #$7e
7489
8564
STA VecPtr
748b
a94e
LDA #$4e
748d
8565
STA Z65
748f
a900
LDA #$00
7491
8527
STA VecRamPtr
7493
a947
LDA #$47
7495
8528
STA VecRamPtr_high
7497
a000
LDY #$00
7499
a200
LDX #$00
L749b:
74c6
749b
b164
LDA (VecPtr),Y
749d
e001
CPX #$01
749f
d005
BNE L74a6↓
74a1
38
SEC
74a2
e920
SBC #$20
74a4
d016
BNE L74bc↓
L74a6:
749f
74a6
e007
CPX #$07
74a8
d012
BNE L74bc↓
74aa
2903
AND #$03
74ac
8537
STA GenByte_0037
74ae
88
DEY
74af
b164
LDA (VecPtr),Y
74b1
4637
LSR GenByte_0037
74b3
6a
ROR
74b4
4637
LSR GenByte_0037
74b6
6a
ROR
74b7
9127
STA (VecRamPtr),Y
74b9
c8
INY
74ba
a904
LDA #$04
L74bc:
74a474a8
74bc
9127
STA (VecRamPtr),Y
74be
e8
INX
74bf
8a
TXA
74c0
2907
AND #$07
74c2
aa
TAX
74c3
c8
INY
74c4
c020
CPY #$20
74c6
90d3
BCC L749b↑
74c8
a521
LDA language_setting
74ca
f02b
BEQ L74f7↓
74cc
a205
LDX #$05
74ce
8637
STX GenByte_0037
74d0
0a
ASL
74d1
aa
TAX
74d2
ca
DEX
74d3
ca
DEX
74d4
a940
LDA #$40
74d6
8527
STA VecRamPtr
74d8
a947
LDA #$47
74da
8528
STA VecRamPtr_high
74dc
bd6a5e
LDA D5e6a,X
74df
bc695e
LDY D5e69,X
74e2
20a47e
JSR vecram_memcpy_8_update_vecptr↓
L74e5:
74f5
74e5
a665
LDX Z65
74e7
a464
LDY VecPtr
74e9
20f279
JSR DrawString↓
74ec
a52c
LDA draw_string_ptr_high
74ee
a42b
LDY draw_string_ptr
74f0
20cd7e
JSR vecram_copy_long↓
74f3
c637
DEC GenByte_0037
74f5
10ee
BPL L74e5↑
L74f7:
74ca
74f7
60
RTS
VecPtrUpdate_dupe:
draw_lots_of_stuff+63draw_lots_of_stuff+89draw_lots_of_stuff+b4DrawShip+12
74f8
98
TYA
74f9
18
CLC
74fa
6527
ADC VecRamPtr
74fc
8527
STA VecRamPtr
74fe
9002
BCC no_carry↓
7500
e628
INC VecRamPtr_high
no_carry:
74fe
7502
60
RTS
VecRomJSRL:
draw_lots_of_stuff+24
7503
a528
LDA VecRamPtr_high
7505
4a
LSR
7506
290f
AND #$0f
7508
09c0
ORA #$c0
750a
aa
TAX
750b
a527
LDA VecRamPtr
750d
6a
ROR
750e
a438
LDY GenByte_0038
7510
912b
STA (draw_string_ptr),Y
7512
8a
TXA
7513
c8
INY
7514
912b
STA (draw_string_ptr),Y
7516
c8
INY
7517
8438
STY GenByte_0038
7519
60
RTS
bcd_score_maybe:
GameLoop+116
751b
a203
LDX #$03
751d
8639
STX GenByte_0039
751f
a202
LDX #$02
L7521:
7558
7521
b55f
LDA ship_vel_high[0],X
7523
b45e
LDY ship_vel[0],X
7525
8437
STY GenByte_0037
7527
a009
LDY #$09
7529
863a
STX GenByte_003a
752b
aa
TAX
752c
20c679
JSR dec_to_bcd↓
752f
48
PHA
7530
8a
TXA
7531
a639
LDX GenByte_0039
7533
95a7
STA Za7,X
7535
94a8
STY Za8,X
7537
68
PLA
7538
95a6
STA Za6,X
753a
a63a
LDX GenByte_003a
753c
a002
LDY #$02
753e
0594
ORA bcd_output[2]
7540
0593
ORA bcd_output[1]
7542
f007
BEQ L754b↓
7544
b55a
LDA ship_vel_sign_x,X
7546
0a
ASL
7547
a900
LDA #$00
7549
2a
ROL
754a
a8
TAY
L754b:
7542
754b
8a
TXA
754c
4a
LSR
754d
aa
TAX
754e
949a
STY Z9a,X
7550
a900
LDA #$00
7552
8539
STA GenByte_0039
7554
a63a
LDX GenByte_003a
7556
ca
DEX
7557
ca
DEX
7558
10c7
BPL L7521↑
755a
20fe72
JSR min16↑
755d
8637
STX GenByte_0037
755f
244e
BIT drawing_scale
7561
5006
BVC L7569↓
7563
0637
ASL GenByte_0037
7565
2a
ROL
7566
0637
ASL GenByte_0037
7568
2a
ROL
L7569:
7561
7569
aa
TAX
756a
a437
LDY GenByte_0037
756c
20c279
JSR dec_to_bcd_16bit↓
756f
85af
STA Zaf
7571
86b0
STX math_something
7573
84b1
STY Zb1
7575
60
RTS
score_landing_bonus:
score_add_landing_bonus+4a
7576
a215
LDX #$15
7578
245d
BIT ship_state_maybe
757a
700a
BVS L7586↓
757c
a205
LDX #$05
757e
a55d
LDA ship_state_maybe
7580
290f
AND #$0f
7582
d002
BNE L7586↓
7584
a250
LDX #$50
L7586:
757a7582
7586
f8
SED
7587
8a
TXA
7588
18
CLC
7589
65a4
ADC score_bcd
758b
85a4
STA score_bcd
758d
a5a5
LDA Za5
758f
6900
ADC #$00
7591
85a5
STA Za5
7593
d8
CLD
7594
60
RTS
debris_something:
GameLoop+95
7595
a20c
LDX #$0c
7597
a900
LDA #$00
7599
858f
STA GenByte08f
L759b:
7617
759b
8a
TXA
759c
4a
LSR
759d
a8
TAY
759e
b98d76
LDA D768d,Y
75a1
c556
CMP ship_abort
75a3
9070
BCC L7615↓
75a5
863a
STX GenByte_003a
75a7
202f76
JSR debris_get_animations_maybe↓
75aa
e00c
CPX #$0c
75ac
d003
BNE L75b1↓
75ae
18
CLC
75af
653d
ADC GenByte_003c
L75b1:
75ac
75b1
20bf76
JSR multiply↓
75b4
8619
STX ThisDebrisX
75b6
841a
STY Z1a
75b8
a63a
LDX GenByte_003a
75ba
e8
INX
75bb
202f76
JSR debris_get_animations_maybe↓
75be
ca
DEX
75bf
e00c
CPX #$0c
75c1
d003
BNE L75c6↓
75c3
18
CLC
75c4
653f
ADC GenByte_003f
L75c6:
75c1
75c6
20bf76
JSR multiply↓
75c9
861b
STX ThisDebrisY
75cb
841c
STY Z1c
75cd
98
TYA
75ce
100b
BPL L75db↓
75d0
49ff
EOR #$ff
75d2
a8
TAY
75d3
8a
TXA
75d4
49ff
EOR #$ff
75d6
aa
TAX
75d7
e8
INX
75d8
d001
BNE L75db↓
75da
c8
INY
L75db:
75ce75d8
75db
c004
CPY #$04
75dd
b03a
BCS L7619↓
75df
204378
JSR CalcDebrisPos↓
75e2
a000
LDY #$00
75e4
a63a
LDX GenByte_003a
75e6
e00c
CPX #$0c
75e8
d013
BNE L75fd↓
75ea
a556
LDA ship_abort
75ec
2907
AND #$07
75ee
0a
ASL
75ef
aa
TAX
75f0
bd9e4e
LDA debris_subroutines_4e9e,X
75f3
9127
STA (VecRamPtr),Y
75f5
c8
INY
75f6
bd9f4e
LDA D4e9f,X
75f9
9127
STA (VecRamPtr),Y
75fb
d013
BNE L7610↓
L75fd:
75e8
75fd
202d76
JSR debris_get_animation_maybe2↓
7600
98
TYA
7601
a437
LDY GenByte_0037
7603
9127
STA (VecRamPtr),Y
7605
c8
INY
7606
e8
INX
7607
202d76
JSR debris_get_animation_maybe2↓
760a
98
TYA
760b
ca
DEX
760c
a437
LDY GenByte_0037
760e
9127
STA (VecRamPtr),Y
L7610:
75fb
7610
203878
JSR VecPtrUpdate↓
7613
a63a
LDX GenByte_003a
L7615:
75a3
7615
ca
DEX
7616
ca
DEX
7617
1082
BPL L759b↑
L7619:
75dd
7619
a556
LDA ship_abort
761b
497f
EOR #$7f
761d
c940
CMP #$40
761f
900b
BCC L762c↓
7621
4a
LSR
7622
4a
LSR
7623
4a
LSR
7624
0908
ORA #$08
7626
aa
TAX
7627
a920
LDA #$20
7629
4c5379
JMP io_audio_set↓
L762c:
761f
762c
60
RTS
debris_get_animation_maybe2:
debris_something+68debris_something+72
762d
8437
STY GenByte_0037
debris_get_animations_maybe:
debris_something+12debris_something+26
762f
a591
LDA random_message
7631
f01b
BEQ L764e↓
7633
c902
CMP #$02
7635
9010
BCC L7647↓
7637
f007
BEQ L7640↓
7639
bd7f76
LDA debris3_setup,X
763c
bc104f
LDY debris3_anim,X
763f
60
RTS
L7640:
7637
7640
bd7176
LDA debris2_setup,X
7643
bc044f
LDY debris2_anim,X
7646
60
RTS
L7647:
7635
7647
bd6376
LDA debris1_setup,X
764a
bcf84e
LDY debris1_anim,X
764d
60
RTS
L764e:
7631
764e
bd5576
LDA debris0_setup,X
7651
bcec4e
LDY debris0_anim,X
7654
60
RTS
debris0_setup:
debris_get_animations_maybe+1f
7655
.byte 00
debris1_setup:
debris_get_animations_maybe+18
7663
.byte 02
debris2_setup:
debris_get_animations_maybe+11
7671
.byte ff
debris3_setup:
debris_get_animations_maybe+a
767f
.byte 01
D768d:
debris_something+9
768d
.byte 5d
landed_choose_random:
GameLoop+1e4
7694
a561
LDA ship_vel_high[1]
7696
4a
LSR
7697
4a
LSR
7698
4a
LSR
7699
c908
CMP #$08
769b
9002
BCC L769f↓
769d
a907
LDA #$07
L769f:
769b
769f
853f
STA GenByte_003f
76a1
a55f
LDA ship_vel_high[0]
76a3
4a
LSR
76a4
4a
LSR
76a5
c908
CMP #$08
76a7
9002
BCC L76ab↓
76a9
a907
LDA #$07
L76ab:
76a7
76ab
245a
BIT ship_vel_sign_x
76ad
3005
BMI L76b4↓
76af
49ff
EOR #$ff
76b1
18
CLC
76b2
6901
ADC #$01
L76b4:
76ad
76b4
853d
STA GenByte_003c
76b6
a574
LDA nmi_counter
76b8
4a
LSR
76b9
4a
LSR
76ba
2903
AND #$03
76bc
8591
STA random_message
76be
60
RTS
multiply:
debris_something+1cdebris_something+31
76bf
a000
LDY #$00
76c1
8538
STA GenByte_0038
76c3
0a
ASL
76c4
a556
LDA ship_abort
76c6
8537
STA GenByte_0037
76c8
9002
BCC L76cc↓
76ca
a0ff
LDY #$ff
L76cc:
76c8
76cc
8439
STY GenByte_0039
76ce
a200
LDX #$00
76d0
a000
LDY #$00
L76d2:
76e6
76d2
4637
LSR GenByte_0037
76d4
b003
BCS L76d9↓
76d6
d00a
BNE L76e2↓
76d8
60
RTS
L76d9:
76d4
76d9
18
CLC
76da
8a
TXA
76db
6538
ADC GenByte_0038
76dd
aa
TAX
76de
98
TYA
76df
6539
ADC GenByte_0039
76e1
a8
TAY
L76e2:
76d6
76e2
0638
ASL GenByte_0038
76e4
2639
ROL GenByte_0039
76e6
4cd276
JMP L76d2↑
sine_table[0]:
ship_compute_accel_xy+2aship_compute_accel_xy+36
76e9
00
BRK
; Reduced sine table for 0-45 degrees
sine_quadrants[0]:
ship_compute_accel_xy+6
76f2
.byte[4] 00, 80, c0, 40
; Define the quadrants
thrust_to_acc[0]:
ship_compute_accel_xy+10
76f6
.byte[16] 00, 02, 05, 08, 0b, 0d, 0f, 10, 11, 12, 13, 14, 16, 18, 1a, 1c
; How much acceleration comes from the different thrust levels
D7807:
GameRunningLoop+b0
7807
.byte 3c
D7808:
GameRunningLoop+b5
7808
.byte 45
D780e:
ResetGameState+7
780e
.byte 46
D780f:
game_state_reinit_maybe+2c
780f
.byte 00
D7813:
game_state_reinit_maybe+27
7813
.byte 00
; Draw a single digit
; This will skip leading zeros when outputing numbers.
; A bottom four bits are the BCD digit to draw
; C include leading zeros if clear
SetDigitVecPtr:
DrawNumber+13DrawNumber+1f
7818
9004
BCC ChkSetDigitPntr↓
; If carry is clear, always display the digit
781a
290f
AND #$0f
; If not, check to see if the bottom nibble is zero
781c
f005
BEQ DisplayDigit↓
; If digit is zero, then draw character 0 which is a blank
ChkSetDigitPntr:
7818
781e
290f
AND #$0f
; Mask out the top nibble
7820
18
CLC
; Clear carry
7821
6901
ADC #$01
; Add one to the digit, which shifts it to the correct font location
DisplayDigit:
781c
7823
08
PHP
; Push the CPU state (preserve the carry flag?)
7824
0a
ASL
; Multiple the digit by 2, since the DVG uses 16-bit words
7825
a000
LDY #$00
; Y is the offset for the vector ram pointer
7827
aa
TAX
; X = A
7828
bda257
LDA CharPtrTbl[0],X
; Read the low-byte of the font command
782b
9127
STA (VecRamPtr),Y
; Store it in the vector pointer at the current location
782d
bda357
LDA CharPtrTbl_high[0],X
; Read the high-byte of the font command
7830
c8
INY
; Increment Y
7831
9127
STA (VecRamPtr),Y
; Store the high byte at the next location
7833
203878
JSR VecPtrUpdate↓
; Add Y to the vector ram pointer
7836
28
PLP
; Restore the carry flag
7837
60
RTS
; Return to the caller
; Increment the vector ram command address
; Y number of bytes minus one added to the vector command list
VecPtrUpdate:
debris_something+7bSetDigitVecPtr+1bvec_copy_and_invert_maybe+29CalcDebrisPos+8d
7838
98
TYA
; Move the number of bytes to A
7839
38
SEC
; Set the carry, which will add the one extra
783a
6527
ADC VecRamPtr
; Add Y+1 to the pointer
783c
8527
STA VecRamPtr
; Store it back in the pointer
783e
9002
BCC VecPtr_no_overflow↓
; If no overflow skip the increment
7840
e628
INC VecRamPtr_high
; Overflowed, so increment the high byte
VecPtr_no_overflow:
783e
7842
60
RTS
; Return to the caller
CalcDebrisPos:
debris_something+4adebris_position_update+46
7843
a51a
LDA Z1a
7845
c980
CMP #$80
7847
9011
BCC ChkYDebris↓
7849
49ff
EOR #$ff
784b
851a
STA Z1a
784d
a519
LDA ThisDebrisX
784f
49ff
EOR #$ff
7851
6900
ADC #$00
7853
8519
STA ThisDebrisX
7855
9002
BCC NoIncX↓
7857
e61a
INC Z1a
NoIncX:
7855
7859
38
SEC
ChkYDebris:
7847
785a
2637
ROL GenByte_0037
785c
a51c
LDA Z1c
785e
c980
CMP #$80
7860
9011
BCC ChkPosXYUB↓
7862
49ff
EOR #$ff
7864
851c
STA Z1c
7866
a51b
LDA ThisDebrisY
7868
49ff
EOR #$ff
786a
6900
ADC #$00
786c
851b
STA ThisDebrisY
786e
9002
BCC NoIncY↓
7870
e61c
INC Z1c
NoIncY:
786e
7872
38
SEC
ChkPosXYUB:
7860
7873
2637
ROL GenByte_0037
7875
a519
LDA ThisDebrisX
7877
c51b
CMP ThisDebrisY
7879
a51a
LDA Z1a
787b
e51c
SBC Z1c
787d
a200
LDX #$00
787f
b002
BCS L7883↓
7881
a202
LDX #$02
L7883:
787f
7883
b51a
LDA Z1a,X
7885
a009
LDY #$09
L7887:
7891
7887
c902
CMP #$02
7889
b009
BCS L7894↓
788b
88
DEY
788c
1619
ASL ThisDebrisX,X
788e
f003
BEQ L7893↓
7890
2a
ROL
7891
10f4
BPL L7887↑
L7893:
788e
7893
2a
ROL
L7894:
7889
7894
951a
STA Z1a,X
7896
98
TYA
7897
0a
ASL
7898
6637
ROR GenByte_0037
789a
2a
ROL
789b
6637
ROR GenByte_0037
789d
2a
ROL
789e
0a
ASL
789f
8537
STA GenByte_0037
78a1
8a
TXA
78a2
4902
EOR #$02
78a4
aa
TAX
L78a5:
78ae
78a5
c009
CPY #$09
78a7
b007
BCS SetScaleAndDirBits↓
78a9
c8
INY
78aa
1619
ASL ThisDebrisX,X
78ac
361a
ROL Z1a,X
78ae
10f5
BPL L78a5↑
SetScaleAndDirBits:
78a7
78b0
a000
LDY #$00
78b2
a51b
LDA ThisDebrisY
78b4
9127
STA (VecRamPtr),Y
78b6
a537
LDA GenByte_0037
78b8
29fc
AND #$fc
78ba
051c
ORA Z1c
78bc
c8
INY
78bd
9127
STA (VecRamPtr),Y
78bf
a519
LDA ThisDebrisX
78c1
c8
INY
78c2
9127
STA (VecRamPtr),Y
78c4
a537
LDA GenByte_0037
78c6
2902
AND #$02
78c8
0a
ASL
78c9
058f
ORA GenByte08f
78cb
051a
ORA Z1a
78cd
c8
INY
78ce
9127
STA (VecRamPtr),Y
78d0
4c3878
JMP VecPtrUpdate↑
; There are three coin buttons with active high coin detectors.
; They are potentially bouncy, so timers are used to try to avoid multiple triggers.
; And the player might be slamming the cabinet to try to trigger the sensor,
; so also check the vibration sensor.
;
; Note that only the two coin slots are used (0 and 2)
;
; Returns a set carry flag if a coin was detected.
;
CheckCoinsInserted:
NMI_handler+46
78d3
a202
LDX #$02
; for each coin slot = 2, 0: (middle one is ignored)
check_coin:
793a
78d5
bd0124
LDA IO_in1_coin[0],X
; read coin[i] from external device
78d8
0a
ASL
; move bit 7 into the carry flag (0 == no coin, 1 == coin)
78d9
b5b7
LDA CoinDropTimers[0],X
; read the debounce timer for this coin slot
78db
291f
AND #$1f
; mask out the bottom bits of the debounce
78dd
b037
BCS CheckDropTimerVal↓
; if carry flag is set (coin) check how long it has been active
78df
f010
BEQ CheckSlamSw↓
; if the debounce timer is 0, check if the slam switch has been triggered
78e1
c91b
CMP #$1b
; if the debounce timer is less than 0x1b
78e3
b00a
BCS DecDropTimer↓
; then goto debounce timer decrement
78e5
a8
TAY
; store the debounce timer in Y
78e6
a5ba
LDA coin_check_counter
; only decrement the debounce timer every
78e8
2907
AND #$07
; eight NMI clock cycles
78ea
c907
CMP #$07
; which is 250/8 or about 30 Hz
78ec
98
TYA
; restore the debounce timer
78ed
9002
BCC CheckSlamSw↓
; skip the decrement until the eight NMI clock
DecDropTimer:
78e3
78ef
e901
SBC #$01
; decrement the debounce timer
CheckSlamSw:
78df78ed791e7925
78f1
95b7
STA CoinDropTimers[0],X
; store the (possibly updated) debounce timer
78f3
ad0020
LDA IO_in0
; read the memory mapped switches at 0x2000
78f6
2904
AND #$04
; check bit 2, the slam switch
78f8
d004
BNE CheckSlamTimer↓
; if it is not set, goto the slam timer check
78fa
a9f0
LDA #$f0
; it is set, set the slam timer counter at 0xF0
78fc
85b4
STA WaitCoinTimer_2
; and store it
CheckSlamTimer:
78f8
78fe
a5b4
LDA WaitCoinTimer_2
; Read the slam timer
7900
f008
BEQ CheckWaitTimer↓
; If it is zero, check to see how the coin debouncers are doing
7902
c6b4
DEC WaitCoinTimer_2
; We're still waiting for slam timer to expire, so
7904
a900
LDA #$00
; zero out the debounce counters
7906
95b7
STA CoinDropTimers[0],X
; for this coin slot
7908
95b3
STA WaitCoinTimer_0,X
; so that no coins will be accepted
CheckWaitTimer:
7900
790a
18
CLC
; clear carry flag
790b
b5b3
LDA WaitCoinTimer_0,X
; is this coin slot in a cool down?
790d
f023
BEQ CheckNextMech↓
; yes, goto check the next slot
790f
d6b3
DEC WaitCoinTimer_0,X
; decrement the cool down timer
7911
d01f
BNE CheckNextMech↓
; if it is not yet zero, check the next coin slot
7913
38
SEC
; set carry (indicating no coins from this slot)
7914
b01c
BCS CheckNextMech↓
; and go check the next coin slot
CheckDropTimerVal:
78dd
7916
c91b
CMP #$1b
;
7918
b009
BCS ResetDropTimer↓
;
791a
b5b7
LDA CoinDropTimers[0],X
;
791c
6920
ADC #$20
;
791e
90d1
BCC CheckSlamSw↑
;
7920
f001
BEQ ResetDropTimer↓
;
7922
18
CLC
; clear carry (no coins)
ResetDropTimer:
79187920
7923
a91f
LDA #$1f
;
7925
b0ca
BCS CheckSlamSw↑
;
7927
95b7
STA CoinDropTimers[0],X
; Reset the debounce timer for this slot
7929
b5b3
LDA WaitCoinTimer_0,X
; and the check if the cool down timer
792b
f001
BEQ SetWaitTimer↓
; is zero (which means we haven't been waiting for a coin) so don't set the carry flag
792d
38
SEC
; cool down was non-zero, so it is time to give them a credit by setting the carry
SetWaitTimer:
792b
792e
a978
LDA #$78
; Initialze the cool down timer to 120
7930
95b3
STA WaitCoinTimer_0,X
; which is about 1/2 a second between coins
CheckNextMech:
790d79117914
7932
9004
BCC DoNextCoinMech↓
; if carry is not set, there is no coin in this slot, go to the next one
7934
f6b6
INC NumCredits_maybe,X
; carry was set, so increment the number of credits for this slot!
7936
e6b2
INC ValidCoins
; and also increment the total number of coins inserted
DoNextCoinMech:
7932
7938
ca
DEX
; double decrement the index
7939
ca
DEX
; since the middle one is ignored
793a
1099
BPL check_coin↑
; if it is non-negative, make another loop
793c
e6ba
INC coin_check_counter
; increment our counter for each time the function is called
793e
a5ba
LDA coin_check_counter
; Re read it the number of calls
7940
4a
LSR
; Shift the bottom bit of the counter into the carry
7941
a5b2
LDA ValidCoins
; Read the number of valid coins
7943
b00c
BCS EndCoinCheck↓
; if this is an odd numbered call, goto EndCoinCheck
7945
f00a
BEQ EndCoinCheck↓
; if there are no valid coins, goto EndCoinCheck
7947
c910
CMP #$10
; if the valid coins are more than 10
7949
b002
BCS NextValidCoin_maybe↓
; ??
794b
69ff
ADC #$ff
; ??
NextValidCoin_maybe:
7949
794d
69ef
ADC #$ef
; ??
794f
85b2
STA ValidCoins
; Store this result back in ValidCoins
EndCoinCheck:
79437945
7951
0a
ASL
; Shift it left (into the carry)
7952
60
RTS
; and return the result to the caller
; Set the audio output hardware
;
; A = keep_bits
; X = set_bits
;
; last_set = set_bits
; cache = (keep & cache) | set_bits
; output = cache
io_audio_set:
RESET+20eRESET+26eGameLoop+feGameLoop+127GameLoop+130GameLoop+1f8debris_something+94draw_out_of_fuel_screen+35
7953
2589
AND audio_cache
; Mask the last written value to preserve the keep bits in A
7955
863c
STX io_genbyte
; Store the set bits from X in the temp variable
7957
053c
ORA io_genbyte
; Set the set bits in A
7959
8d003c
STA IO_audio_latch
; Write the new set bits and the kept bits out to the audio hardware
795c
8589
STA audio_cache
; Store this last written value in the cache
795e
60
RTS
; And we're done!
; Set the lamps hardware
;
; A = keep_bits
; X = set_bits
;
; last_set = set_bits
; cache = (keep & cache) | set_bits
; output = cache
io_lamps_set:
NMI_handler+55NMI_handler+9bGameLoop+1eGameLoop+15bgame_state_reinit_maybe+49ship_reset+1c
795f
2588
AND lamps_cache
; Mask the last written value to preserve the keep bits in A
7961
863c
STX io_genbyte
; Store the set bits from X in the temp variable
7963
053c
ORA io_genbyte
; Set the set bits in A
7965
8d0032
STA IO_output_latch
; Write the new set bits and the kept bits out to the lamp hardware
7968
8588
STA lamps_cache
; Store this last written value in the cache
796a
60
RTS
; And we're done!
coin_credit_configure:
RESET+242coin_inserted+0
796b
ad0328
LDA IO_dsw1_RightCoin
796e
2903
AND #$03
7970
aa
TAX
7971
bd9b79
LDA CoinMultTbl,X
7974
8599
STA credits_per_coin
7976
a200
LDX #$00
7978
ee0058
INC string_table_language_offset[0]
797b
f006
BEQ L7983↓
797d
ad0228
LDA IO_dsw1_2
7980
2903
AND #$03
7982
aa
TAX
L7983:
797b
7983
8621
STX language_setting
7985
38
SEC
7986
ad0128
LDA IO_dsw1_1
7989
2a
ROL
798a
2a
ROL
798b
2d0028
AND IO_dsw1_0
798e
290f
AND #$0f
7990
6900
ADC #$00
7992
c909
CMP #$09
7994
9002
BCC L7998↓
7996
a900
LDA #$00
L7998:
7994
7998
8598
STA fuel_per_coin
799a
60
RTS
CoinMultTbl:
coin_credit_configure+6
799b
.byte 01
draw_insert_coin_screen:
RESET+23aGameLoop+c3
799f
a20c
LDX #$0c
79a1
a598
LDA fuel_per_coin
79a3
18
CLC
79a4
6918
ADC #$18
79a6
20347a
JSR WriteText_wrapper↓
79a9
a917
LDA #$17
79ab
204f7a
JSR WriteText↓
79ae
a905
LDA #$05
79b0
204f7a
JSR WriteText↓
79b3
a586
LDA FrameCounter
79b5
2920
AND #$20
79b7
f007
BEQ L79c0↓
79b9
a200
LDX #$00
79bb
a904
LDA #$04
79bd
4c347a
JMP WriteText_wrapper↓
L79c0:
79b7
79c0
60
RTS
; Convert a 16-bit binary value into BCD, outputing to bcd_output or Y:X:A.
; Y:X input 16-bit value
dec_to_bcd_16bit:
DrawNumber_decimal_1+4bcd_score_maybe+51
79c2
8437
STY GenByte_0037
; Store MSB of argument in gb37
79c4
a00f
LDY #$0f
; Pass 16 as the number of bits to convert
; Convert an arbitrary bit width binary value into BCD using the Double Dabble algorithm.
; Y: Number of bits to convert
; X: LSB of 16-bit input value
; GenByte_0038: MSB of the 16-bit input value
;
; Returns the data in bcd_output or in Y:X:A
dec_to_bcd:
fuel_drain_thrust+18bcd_score_maybe+11
79c6
8638
STX GenByte_0038
; Store LSB of argument in gb38
79c8
a900
LDA #$00
; Zero the bcd output
79ca
8592
STA bcd_output[0]
; lsb
79cc
8593
STA bcd_output[1]
; mid
79ce
8594
STA bcd_output[2]
; msb
79d0
f8
SED
; turn on BCD mode
dd_loop:
79e8
79d1
0637
ASL GenByte_0037
; D
79d3
2638
ROL GenByte_0038
; -O
79d5
a592
LDA bcd_output[0]
; --U
79d7
6592
ADC bcd_output[0]
; ---B
79d9
8592
STA bcd_output[0]
; ----L
79db
a593
LDA bcd_output[1]
; -----E
79dd
6593
ADC bcd_output[1]
; ------D
79df
8593
STA bcd_output[1]
; -------A
79e1
a594
LDA bcd_output[2]
; --------B
79e3
6594
ADC bcd_output[2]
; ---------B
79e5
8594
STA bcd_output[2]
; ----------L
79e7
88
DEY
; -----------E
79e8
10e7
BPL dd_loop↑
; if bits-- > 0 do it again
79ea
a494
LDY bcd_output[2]
; load the bcd output
79ec
a693
LDX bcd_output[1]
; into the registers
79ee
a592
LDA bcd_output[0]
; for some callers who want that
79f0
d8
CLD
; back into binary mode
79f1
60
RTS
; return to caller
; DrawString
; X:Y Pointer to the string to write, terminated with 0x80 on the last character
; Copies the font subroutines to VecRamPtr
; Sets draw_string_ptr to point to the end of the string
DrawString:
RESET+1d2draw_lots_of_stuff+140WriteText+4c
79f2
862c
STX draw_string_ptr_high
; Store the pointer high
79f4
842b
STY draw_string_ptr
; and low bytes
79f6
a900
LDA #$00
; for i = 0 ... strlen * 2
copy_next_vec_instruction:
7a13
79f8
4a
LSR
; halve i since we're copying 16-bit JSRL vector subroutine
79f9
a8
TAY
; calls for each letter and it is going up by two each byte
79fa
b12b
LDA (draw_string_ptr),Y
; Read low byte from the string
79fc
8539
STA GenByte_0039
; Cache it in gen byte
79fe
297f
AND #$7f
; Strings are terminated by setting the high bit
7a00
aa
TAX
; so strip the high bit from the letter
7a01
98
TYA
; move y back into a
7a02
0a
ASL
; and double it back to by index by words
7a03
a8
TAY
; and back into y (what a dance)
7a04
bda257
LDA CharPtrTbl[0],X
; Index into the font table to get the low byte
7a07
9127
STA (VecRamPtr),Y
; and store it in the vector ram ptr
7a09
c8
INY
; next byte...
7a0a
bda357
LDA CharPtrTbl_high[0],X
; store the high byte of the font into the vector ram ptr
7a0d
9127
STA (VecRamPtr),Y
; indexed by y
7a0f
c8
INY
; and increment y again since we moved two bytes
7a10
98
TYA
; and back into a
7a11
2439
BIT GenByte_0039
; Test the cached version of the letter
7a13
10e3
BPL copy_next_vec_instruction↑
; If positive, keep copying
7a15
18
CLC
; Clear carry
7a16
6527
ADC VecRamPtr
; Add number of bytes written to vector ram
7a18
8527
STA VecRamPtr
; to the VecRamPtr
7a1a
9002
BCC increment_char_ptr↓
; Did the low byte overflow?
7a1c
e628
INC VecRamPtr_high
; if so increment the high byte as well
increment_char_ptr:
7a1a
7a1e
98
TYA
; Copy number of bytes copied to vector ram back to A
7a1f
4a
LSR
; Divide it by two to get the number of characters in the string
7a20
652b
ADC draw_string_ptr
; Increase the character pointer
7a22
852b
STA draw_string_ptr
; so it points to the end of the string
7a24
9002
BCC draw_string_return↓
; did the low byte overflow?
7a26
e62c
INC draw_string_ptr_high
; if so increment the high byte as well
draw_string_return:
7a24
7a28
60
RTS
; return to the caller
draw_lost_fuel_units_message:
draw_level_over_screen+17draw_out_of_fuel_screen+10
7a29
a917
LDA #$17
7a2b
204f7a
JSR WriteText↓
7a2e
a903
LDA #$03
7a30
d01d
BNE WriteText↓
WriteText_newline:
draw_level_over_screen+fdraw_level_over_screen+1cdraw_push_start_screen+13draw_out_of_fuel_screen+8
7a32
a980
LDA #$80
WriteText_wrapper:
draw_insert_coin_screen+7draw_insert_coin_screen+1edraw_level_over_screen+adraw_level_over_screen+39draw_level_over_screen+42draw_level_over_screen+4cdraw_push_start_screen+7draw_push_start_screen+edraw_out_of_fuel_screen+2c
7a34
48
PHA
7a35
8a
TXA
7a36
18
CLC
7a37
690c
ADC #$0c
7a39
a8
TAY
7a3a
a955
LDA #$55
7a3c
6900
ADC #$00
7a3e
a627
LDX VecRamPtr
7a40
862f
STX VecRamPtr_copy2
7a42
a628
LDX VecRamPtr_high
7a44
8630
STX Z30
7a46
20cd7e
JSR vecram_copy_long↓
7a49
20107f
JSR vecgen_beam_off_maybe↓
7a4c
68
PLA
7a4d
3058
BMI rts_7aa7↓
; Write a localized string to the screen
; A String id
WriteText:
draw_insert_coin_screen+cdraw_insert_coin_screen+11draw_level_over_screen+26draw_push_start_screen+1ddraw_bonus_maybe+6edraw_lost_fuel_units_message+2draw_lost_fuel_units_message+7
7a4f
c918
CMP #$18
; If id < 24
7a51
9003
BCC write_localized_string↓
; then this is a localized string (display strings start at 24 == "X")
7a53
0a
ASL
; multiply id by two since we need a word address
7a54
d048
BNE write_unlocalized_string↓
;
write_localized_string:
7a51
7a56
48
PHA
; Cache the string id
7a57
a621
LDX language_setting
; Read the current language (set by dip switches)
7a59
f010
BEQ write_language_zero↓
; If language is zero (english) handle it specially
7a5b
ca
DEX
; Starting index into the localized string table
7a5c
7da15f
ADC localized_language_offset[0],X
; based on the language setting - 1
7a5f
aa
TAX
; Strings in the localized table
7a60
bda45f
LDA localized_string_offset[0],X
; ???
7a63
a200
LDX #$00
;
7a65
0a
ASL
;
7a66
900f
BCC L7a77↓
;
7a68
ca
DEX
;
7a69
b00c
BCS L7a77↓
;
write_language_zero:
7a59
7a6b
e908
SBC #$08
; There's some fixups, not sure what is going on here
7a6d
c90c
CMP #$0c
;
7a6f
b013
BCS L7a84↓
;
7a71
aa
TAX
;
7a72
bd6d69
LDA string_table_fixup_something_else,X
;
7a75
a200
LDX #$00
;
L7a77:
7a667a69
7a77
18
CLC
;
7a78
a002
LDY #$02
;
7a7a
712f
ADC (VecRamPtr_copy2),Y
; Maybe special characters? I'm really not sure yet.
7a7c
912f
STA (VecRamPtr_copy2),Y
;
7a7e
8a
TXA
;
7a7f
c8
INY
;
7a80
712f
ADC (VecRamPtr_copy2),Y
;
7a82
912f
STA (VecRamPtr_copy2),Y
;
L7a84:
7a6f
7a84
68
PLA
; Restore original string id from the stack
7a85
0a
ASL
; Double it to get a word offset
7a86
c930
CMP #$30
; Check if the original id is >= 24
7a88
b014
BCS write_unlocalized_string↓
; this is a non-localized string (24 == "X")
7a8a
a621
LDX language_setting
; If the language is zero
7a8c
f010
BEQ write_unlocalized_string↓
; then this is also un-localized
7a8e
ca
DEX
; Get the starting
7a8f
18
CLC
; string id in the big localized string table
7a90
7d0058
ADC string_table_language_offset[0],X
; for this string language and add it to the string id
7a93
aa
TAX
; Read A:Y = string_table_localized[string_id + string_table_lang_offset[language-1]]
7a94
bc0458
LDY string_table_localized[0],X
; low byte
7a97
bd0558
LDA string_table_localized_high[0],X
; and high bytes fo the pointer
call_draw_string:
7aa5
7a9a
aa
TAX
; Convert the string pointer from A:Y into X:Y
7a9b
4cf279
JMP DrawString↑
; and tall call DrawString
write_unlocalized_string:
7a547a887a8c
7a9e
aa
TAX
; Index into the english string table
7a9f
bc2b69
LDY string_table[0],X
; and read the low
7aa2
bd2c69
LDA string_table_high[0],X
; and high bytes into A:Y
7aa5
d0f3
BNE call_draw_string↑
;
; Shared return instruction for a few functions
rts_7aa7:
WriteText_wrapper+19
7aa7
60
RTS
; Return to caller
; NMI Handler invoked at 250 Hz
; This is the core game tick that invokes all of the ship updates and reads from the player.
; It ensures that the vector drawing system is making progress
; and also pets the watchdog to ensure that the system doesn't reset.
NMI_handler:

7aa8
48
PHA
; Push the accumulator onto the stack
7aa9
8a
TXA
; Move X to A
7aaa
48
PHA
; Push X to the stack
7aab
98
TYA
; Move Y to A
7aac
48
PHA
; Push Y to the stack
7aad
d8
CLD
; Clear decimal mode
nmi_thrust_process:

7aae
ad002c
LDA IO_thrust
; Read the thrust potentiometer for low pass smoothing
7ab1
38
SEC
; Clear carry for SBC
7ab2
e583
SBC thrust_high
; if IO_thrust > thrust_high
7ab4
b004
BCS thrust_higher↓
; skip decrement
7ab6
c683
DEC thrust_high
; decay thrust_high towards the reading
7ab8
a900
LDA #$00
; force skip increment
thrust_higher:
7ab4
7aba
c584
CMP thrust_low
; if IO_thrust < thrust_low
7abc
9004
BCC thrust_lower↓
; skip increment
7abe
e684
INC thrust_low
; Increase thrust_low towards the reading
7ac0
a584
LDA thrust_low
;
thrust_lower:
7abc
7ac2
aa
TAX
;
7ac3
38
SEC
; Clear carry for SBC
7ac4
e582
SBC thrust_delta_last_raw
;
7ac6
900a
BCC L7ad2↓
;
7ac8
4a
LSR
;
7ac9
4a
LSR
;
7aca
f00a
BEQ nmi_check_dvg↓
;
L7acc:
7ad4
7acc
8682
STX thrust_delta_last_raw
;
7ace
e685
INC thrust_something_counter
;
7ad0
d004
BNE nmi_check_dvg↓
;
L7ad2:
7ac6
7ad2
6903
ADC #$03
;
7ad4
30f6
BMI L7acc↑
;
nmi_check_dvg:
7aca7ad0
7ad6
e674
INC nmi_counter
; Track the number of NMI's received
7ad8
a573
LDA dvg_timer
; If the vector generator has been stalled
7ada
c903
CMP #$03
; for more than 4 NMI's
7adc
b00d
BCS wait_for_watchdog↓
; then just wait for the watchdog
7ade
8d0034
STA IO_watchdog
; else pet the watchdog
7ae1
a500
LDA state_00
;
7ae3
45c1
EOR state_c1
;
7ae5
45c2
EOR state_c2
;
7ae7
c985
CMP #$85
;
7ae9
f003
BEQ nmi_check_coins↓
;
wait_for_watchdog:
7adc7aeb
7aeb
4ceb7a
JMP wait_for_watchdog↺
; Infinite loop, waiting for the watchdog to bark
nmi_check_coins:
7ae9
7aee
20d378
JSR CheckCoinsInserted↑
; Has the player inserted any new coins?
7af1
9006
BCC nmi_no_coins↓
; Carry clear == no coins, goto
7af3
a220
LDX #$20
; set coin counter output lamp
7af5
a9ff
LDA #$ff
; keep all the other lamps the same
7af7
d004
BNE nmi_update_lights↓
; (always taken)
nmi_no_coins:
7af1
7af9
a9df
LDA #$df
; unset coin counter output lamp
7afb
a200
LDX #$00
; also reset the rest of them
nmi_update_lights:
7af7
7afd
205f79
JSR io_lamps_set↑
; update the lamps based on if a coin was received
7b00
2422
BIT game_state_flags
; Is there a game in progress?
7b02
502f
BVC not_a_second↓
; If bit 6 is not set (no game playing) do not update the per second timer
7b04
c687
DEC nmi_counter_250
; Decrement the 250 divider
7b06
d02b
BNE not_a_second↓
; if it is non zero, skip ahead
7b08
a9fa
LDA #$fa
; Reset the divider with 250 (0xFA)
7b0a
8587
STA nmi_counter_250
; and store it in the global
7b0c
e68d
INC time_in_seconds
; Increment our once-per-second counter
7b0e
f8
SED
; Enable decimal mode to increment score
7b0f
18
CLC
; Clear the carry for the addition
7b10
a200
LDX #$00
; for x = 0, 1, 2
7b12
a002
LDY #$02
; (although y is used for the counter)
7b14
a908
LDA #$08
; add 8 to the score
nmi_score_bcd_update:
7b1e
7b16
759e
ADC score_bcd_maybe[0],X
; add A to the bcd score[X]
7b18
959e
STA score_bcd_maybe[0],X
; and store it back in bcd store[X]
7b1a
a900
LDA #$00
; zero A
7b1c
e8
INX
; x++
7b1d
88
DEY
; y--
7b1e
10f6
BPL nmi_score_bcd_update↑
; if y > 0 do another digit
nmi_time_bcd_update:

7b20
a59c
LDA time_bcd[0]
; get the first digit of the BCD timer
7b22
18
CLC
; clear the carry
7b23
6901
ADC #$01
; add one to the seconds timer
7b25
c960
CMP #$60
; if it has not reached 60
7b27
9002
BCC nmi_time_seconds_no_overflow↓
; then goto no overflow
7b29
a900
LDA #$00
; otherwise zero the seconds
nmi_time_seconds_no_overflow:
7b27
7b2b
859c
STA time_bcd[0]
; and store it back in the LSB
7b2d
a59d
LDA time_bcd[1]
; load the minutes of the timer
7b2f
6900
ADC #$00
; and if the seconds overflowed 60, add it to the minutes
7b31
859d
STA time_bcd[1]
; store it back in the MSB
not_a_second:
7b027b06
7b33
d8
CLD
; exit decimal mode (whew)
7b34
a522
LDA game_state_flags
; read the current game state
7b36
d00e
BNE L7b46↓
; if any bits are set,
7b38
a574
LDA nmi_counter
; game state is zero, so no game right now
7b3a
a21f
LDX #$1f
; let's make the lights flash (1F == *all the lamps*)
7b3c
4a
LSR
; shift the bottom bit from the nmi counter into carry
7b3d
9002
BCC L7b41↓
; every other NMI turn on all the lamps
7b3f
a210
LDX #$10
; and every odd one turn off all the lamps
L7b41:
7b3d
7b41
a900
LDA #$00
; don't keep any of the old bits
7b43
205f79
JSR io_lamps_set↑
; and toggle the lamps
L7b46:
7b36
7b46
c68a
DEC delay_6
; divide the NMI counter by 6 for the vector generator timer
7b48
d006
BNE nmi_rti↓
; if it is not zero, just return
7b4a
a906
LDA #$06
; reset the dvg divisor
7b4c
858a
STA delay_6
; store it back in the delay counter
7b4e
e673
INC dvg_timer
; and increment the vector generator timer
nmi_rti:
7b48
7b50
68
PLA
; Pop the CPU state from the stack
7b51
a8
TAY
; -> Y
7b52
68
PLA
; and
7b53
aa
TAX
; -> X
7b54
68
PLA
; -> A
7b55
40
RTI
; Return from interrupt
DrawNumber_2_no_leading_zero:
draw_level_over_screen+14draw_level_over_screen+21draw_push_start_screen+18draw_out_of_fuel_screen+d
7b57
a002
LDY #$02
; Draw a BCD number without a leading zero
; A address of number on zero page
; Y number of digits
DrawNumber_no_leading_zero:
RESET+237RESET+249DrawNumber_3+2
7b59
38
SEC
; Set carry flag and fall through into DrawNumber
; Draw a BCD number from the zero page
; A address of number on zero page
; Y number of digits
; C include leading zeros (carry flag clear)
DrawNumber:
DrawNumber_decimal_1+cdraw_even_more_stuff+11DrawNumber_and_copy+1
7b5a
08
PHP
; Push the status register onto the stack (save the carry flag)
7b5b
88
DEY
; decrement the number of digits (to compute last address)
7b5c
8438
STY GenByte_0038
; store number of digits in genbyte
7b5e
18
CLC
; Clear the carry
7b5f
6538
ADC GenByte_0038
; Add A to Y-1, which is the address of the MSB of the BCD digit
7b61
28
PLP
; Restore the carry flag from the stack
7b62
aa
TAX
; Move the starting address for the MSB digit into X
DrawNumStringLoop:
7b81
7b63
08
PHP
; Push the carry flag again
7b64
8637
STX GenByte_0037
; Store the address into genbyte
7b66
b500
LDA state_00,X
; Treat the zero page as an array and read the BCD digit
7b68
4a
LSR
; Shift
7b69
4a
LSR
; it
7b6a
4a
LSR
; right
7b6b
4a
LSR
; four times to get the upper digit from the top nibble into A
7b6c
28
PLP
; Restore the carry flag
7b6d
201878
JSR SetDigitVecPtr↑
; Draw the upper digit
7b70
a538
LDA GenByte_0038
; Do we do more digits?
7b72
d001
BNE DoLowerDigit↓
; if so do the lower digit for this value
7b74
18
CLC
; Clear the carry (we will always do zeros now)
DoLowerDigit:
7b72
7b75
a637
LDX GenByte_0037
; Get the current digit address
7b77
b500
LDA state_00,X
; Zero-page array read for the digit
7b79
201878
JSR SetDigitVecPtr↑
; Draw the lower digit
7b7c
a637
LDX GenByte_0037
; Decrement the digit address
7b7e
ca
DEX
; to move to the next digit
7b7f
c638
DEC GenByte_0038
; Decrement our digit counter
7b81
10e0
BPL DrawNumStringLoop↑
; If still positive, draw more digits
7b83
60
RTS
; And we're done!
RESET:

7b84
a2ff
LDX #$ff
7b86
9a
TXS
7b87
d8
CLD
7b88
a900
LDA #$00
7b8a
8d003c
STA IO_audio_latch
7b8d
aa
TAX
bzero_ram:
7b91
7b8e
9500
STA state_00,X
7b90
e8
INX
7b91
d0fb
BNE bzero_ram↑
7b93
ad0020
LDA IO_in0
7b96
4a
LSR
7b97
4a
LSR
7b98
b003
BCS reset_in0_bit2_set↓
7b9a
4cb97b
JMP DoSelfTest↓
reset_in0_bit2_set:
7b987e56
7b9d
a985
LDA #$85
7b9f
8500
STA state_00
7ba1
85c1
STA state_c1
7ba3
85c2
STA state_c2
7ba5
a9ff
LDA #$ff
7ba7
8583
STA thrust_high
7ba9
a906
LDA #$06
7bab
858a
STA delay_6
7bad
a902
LDA #$02
7baf
859a
STA Z9a
7bb1
859b
STA Z9b
7bb3
8d0034
STA IO_watchdog
7bb6
4c0160
JMP InitGame↑
DoSelfTest:
7b9a
7bb9
a211
LDX #$11
7bbb
9a
TXS
7bbc
8a
TXA
7bbd
8500
STA state_00
7bbf
a000
LDY #$00
L7bc1:
7be7
7bc1
a201
LDX #$01
L7bc3:
7bca
7bc3
c8
INY
7bc4
b90000
LDA state_00,Y
7bc7
d023
BNE L7bec↓
7bc9
e8
INX
7bca
d0f7
BNE L7bc3↑
7bcc
ba
TSX
7bcd
8a
TXA
7bce
8d0034
STA IO_watchdog
7bd1
c8
INY
7bd2
d90000
CMP state_00,Y
7bd5
d012
BNE L7be9↓
7bd7
a200
LDX #$00
7bd9
9600
STX state_00,Y
7bdb
c8
INY
7bdc
d005
BNE L7be3↓
7bde
0a
ASL
7bdf
a200
LDX #$00
7be1
b00a
BCS L7bed↓
L7be3:
7bdc
7be3
aa
TAX
7be4
9a
TXS
7be5
9600
STX state_00,Y
7be7
d0d8
BNE L7bc1↑
L7be9:
7bd5
7be9
590000
EOR state_00,Y
L7bec:
7bc7
7bec
aa
TAX
L7bed:
7be1
7bed
8a
TXA
7bee
a010
LDY #$10
7bf0
290f
AND #$0f
7bf2
f002
BEQ L7bf6↓
7bf4
a020
LDY #$20
L7bf6:
7bf2
7bf6
8a
TXA
7bf7
a210
LDX #$10
7bf9
29f0
AND #$f0
7bfb
f002
BEQ L7bff↓
7bfd
a220
LDX #$20
L7bff:
7bfb
7bff
98
TYA
7c00
9a
TXS
7c01
aa
TAX
L7c02:
7c29
7c02
8e003c
STX IO_audio_latch
7c05
a00c
LDY #$0c
L7c07:
7c21
7c07
a264
LDX #$64
L7c09:
7c0c7c17
7c09
2c0020
BIT IO_in0
7c0c
70fb
BVS L7c09↑
L7c0e:
7c11
7c0e
2c0020
BIT IO_in0
7c11
50fb
BVC L7c0e↑
7c13
8d0034
STA IO_watchdog
7c16
ca
DEX
7c17
d0f0
BNE L7c09↑
7c19
c005
CPY #$05
7c1b
d003
BNE L7c20↓
7c1d
8e003c
STX IO_audio_latch
L7c20:
7c1b
7c20
88
DEY
7c21
d0e4
BNE L7c07↑
7c23
a8
TAY
7c24
3005
BMI L7c2b↓
7c26
0980
ORA #$80
7c28
ba
TSX
7c29
10d7
BPL L7c02↑
L7c2b:
7c24
7c2b
c990
CMP #$90
7c2d
d005
BNE L7c34↓
7c2f
ba
TSX
7c30
e010
CPX #$10
7c32
f006
BEQ L7c3a↓
L7c34:
7c2d7c37
7c34
8d0034
STA IO_watchdog
7c37
4c347c
JMP L7c34↑
L7c3a:
7c32
7c3a
a2ff
LDX #$ff
7c3c
9a
TXS
7c3d
20597e
JSR VecRamPtr_reset_0x4000↓
7c40
a8
TAY
L7c41:
7c447c4c
7c41
9127
STA (VecRamPtr),Y
7c43
c8
INY
7c44
d0fb
BNE L7c41↑
7c46
e628
INC VecRamPtr_high
7c48
a628
LDX VecRamPtr_high
7c4a
e048
CPX #$48
7c4c
90f3
BCC L7c41↑
7c4e
20597e
JSR VecRamPtr_reset_0x4000↓
L7c51:
7c87
7c51
a911
LDA #$11
7c53
8537
STA GenByte_0037
7c55
84bc
STY Zbc
7c57
9127
STA (VecRamPtr),Y
L7c59:
7c7f
7c59
98
TYA
7c5a
aa
TAX
L7c5b:
7c62
7c5b
c8
INY
7c5c
f006
BEQ L7c64↓
7c5e
b127
LDA (VecRamPtr),Y
7c60
d02b
BNE L7c8d↓
7c62
f0f7
BEQ L7c5b↑
L7c64:
7c5c
7c64
8a
TXA
7c65
a8
TAY
7c66
a537
LDA GenByte_0037
7c68
8d0034
STA IO_watchdog
7c6b
d127
CMP (VecRamPtr),Y
7c6d
d01c
BNE L7c8b↓
7c6f
a900
LDA #$00
7c71
9127
STA (VecRamPtr),Y
7c73
a537
LDA GenByte_0037
7c75
c8
INY
7c76
d003
BNE L7c7b↓
7c78
0a
ASL
7c79
b006
BCS L7c81↓
L7c7b:
7c76
7c7b
8537
STA GenByte_0037
7c7d
9127
STA (VecRamPtr),Y
7c7f
d0d8
BNE L7c59↑
L7c81:
7c79
7c81
e628
INC VecRamPtr_high
7c83
a528
LDA VecRamPtr_high
7c85
c948
CMP #$48
7c87
90c8
BCC L7c51↑
7c89
b01e
BCS L7ca9↓
L7c8b:
7c6d
7c8b
5127
EOR (VecRamPtr),Y
L7c8d:
7c60
7c8d
a200
LDX #$00
7c8f
48
PHA
7c90
29f0
AND #$f0
7c92
f002
BEQ L7c96↓
7c94
a202
LDX #$02
L7c96:
7c92
7c96
68
PLA
7c97
290f
AND #$0f
7c99
f001
BEQ L7c9c↓
7c9b
e8
INX
L7c9c:
7c99
7c9c
8a
TXA
7c9d
a628
LDX VecRamPtr_high
7c9f
e044
CPX #$44
7ca1
9002
BCC L7ca5↓
7ca3
0a
ASL
7ca4
0a
ASL
L7ca5:
7ca1
7ca5
05bc
ORA Zbc
7ca7
85bc
STA Zbc
L7ca9:
7c89
7ca9
a5bc
LDA Zbc
7cab
8d0032
STA IO_output_latch
7cae
a903
LDA #$03
7cb0
8556
STA ship_abort
7cb2
18
CLC
L7cb3:
7cce
7cb3
a910
LDA #$10
7cb5
66bc
ROR Zbc
7cb7
08
PHP
7cb8
9001
BCC L7cbb↓
7cba
0a
ASL
L7cbb:
7cb8
7cbb
8d003c
STA IO_audio_latch
7cbe
a050
LDY #$50
7cc0
207f7e
JSR vecgen_wait↓
7cc3
8e003c
STX IO_audio_latch
7cc6
a028
LDY #$28
7cc8
207f7e
JSR vecgen_wait↓
7ccb
28
PLP
7ccc
c656
DEC ship_abort
7cce
10e3
BPL L7cb3↑
7cd0
66bc
ROR Zbc
L7cd2:
7cd5
7cd2
8d0034
STA IO_watchdog
7cd5
d0fb
BNE L7cd2↑
7cd7
a948
LDA #$48
7cd9
852c
STA draw_string_ptr_high
7cdb
20597e
JSR VecRamPtr_reset_0x4000↓
7cde
852b
STA draw_string_ptr
7ce0
85bc
STA Zbc
7ce2
85bb
STA Zbb
7ce4
202d7f
JSR font_fixup_0↓
7ce7
a912
LDA #$12
7ce9
20627e
JSR FUN_7e62↓
7cec
a237
LDX #$37
7cee
8a
TXA
7cef
0a
ASL
L7cf0:
7d34
7cf0
a000
LDY #$00
7cf2
8d0034
STA IO_watchdog
L7cf5:
7cf8
7cf5
512b
EOR (draw_string_ptr),Y
7cf7
c8
INY
7cf8
d0fb
BNE L7cf5↑
7cfa
a8
TAY
7cfb
8a
TXA
7cfc
2903
AND #$03
7cfe
c901
CMP #$01
7d00
98
TYA
7d01
b02e
BCS L7d31↓
7d03
f02b
BEQ L7d30↓
7d05
85bc
STA Zbc
7d07
8639
STX GenByte_0039
7d09
a934
LDA #$34
7d0b
38
SEC
7d0c
e539
SBC GenByte_0039
7d0e
4a
LSR
7d0f
853a
STA GenByte_003a
7d11
38
SEC
7d12
e904
SBC #$04
7d14
c904
CMP #$04
7d16
b002
BCS L7d1a↓
7d18
c6bb
DEC Zbb
L7d1a:
7d16
7d1a
a5bc
LDA Zbc
7d1c
290f
AND #$0f
7d1e
f003
BEQ L7d23↓
7d20
20177f
JSR DrawNumber_decimal_1↓
L7d23:
7d1e
7d23
a5bc
LDA Zbc
7d25
29f0
AND #$f0
7d27
f005
BEQ L7d2e↓
7d29
e63a
INC GenByte_003a
7d2b
20177f
JSR DrawNumber_decimal_1↓
L7d2e:
7d27
7d2e
a639
LDX GenByte_0039
L7d30:
7d03
7d30
8a
TXA
L7d31:
7d01
7d31
e62c
INC draw_string_ptr_high
7d33
ca
DEX
7d34
10ba
BPL L7cf0↑
7d36
a6bc
LDX Zbc
7d38
f016
BEQ L7d50↓
7d3a
24bb
BIT Zbb
7d3c
101b
BPL L7d59↓
7d3e
a940
LDA #$40
7d40
8527
STA VecRamPtr
7d42
a918
LDA #$18
7d44
8527
STA VecRamPtr
7d46
a922
LDA #$22
7d48
a20e
LDX #$0e
7d4a
20647e
JSR font_lookup_table_memcpy↓
7d4d
4c597d
JMP L7d59↓
L7d50:
7d38
7d50
ae7f7f
LDX D7f7f
7d53
ac7e7f
LDY D7f7e
7d56
20f279
JSR DrawString↑
L7d59:
7d3c7d4d
7d59
a900
LDA #$00
7d5b
8556
STA ship_abort
7d5d
8539
STA GenByte_0039
7d5f
8589
STA audio_cache
7d61
a911
LDA #$11
7d63
8d0032
STA IO_output_latch
7d66
a528
LDA VecRamPtr_high
7d68
852a
STA Z2a
7d6a
a527
LDA VecRamPtr
7d6c
8529
STA vecdata_ptr_start
L7d6e:
7dfc
7d6e
a207
LDX #$07
L7d70:
7d77
7d70
bd0024
LDA IO_in1_start,X
7d73
0a
ASL
7d74
26bd
ROL Zbd
7d76
ca
DEX
7d77
10f7
BPL L7d70↑
7d79
ad0020
LDA IO_in0
7d7c
2904
AND #$04
7d7e
85be
STA Zbe
7d80
a200
LDX #$00
7d82
a5bf
LDA Zbf
7d84
45bd
EOR Zbd
7d86
d006
BNE L7d8e↓
7d88
a5c0
LDA Zc0
7d8a
45be
EOR Zbe
7d8c
f002
BEQ L7d90↓
L7d8e:
7d86
7d8e
a230
LDX #$30
L7d90:
7d8c
7d90
a90f
LDA #$0f
7d92
205379
JSR io_audio_set↑
7d95
a5bd
LDA Zbd
7d97
85bf
STA Zbf
7d99
a5be
LDA Zbe
7d9b
85c0
STA Zc0
7d9d
a529
LDA vecdata_ptr_start
7d9f
8527
STA VecRamPtr
7da1
a52a
LDA Z2a
7da3
8528
STA VecRamPtr_high
7da5
24bb
BIT Zbb
7da7
3027
BMI L7dd0↓
7da9
a91a
LDA #$1a
7dab
20627e
JSR FUN_7e62↓
7dae
a001
LDY #$01
7db0
ad002c
LDA IO_thrust
7db3
18
CLC
7db4
6582
ADC thrust_delta_last_raw
7db6
6a
ROR
7db7
8582
STA thrust_delta_last_raw
7db9
a982
LDA #$82
7dbb
20597b
JSR DrawNumber_no_leading_zero↑
7dbe
209f79
JSR draw_insert_coin_screen↑
7dc1
a93a
LDA #$3a
7dc3
20627e
JSR FUN_7e62↓
7dc6
206b79
JSR coin_credit_configure↑
7dc9
a999
LDA #$99
7dcb
a001
LDY #$01
7dcd
20597b
JSR DrawNumber_no_leading_zero↑
L7dd0:
7da7
7dd0
20717e
JSR activate_spot_killer_maybe↓
7dd3
e656
INC ship_abort
7dd5
a556
LDA ship_abort
7dd7
c920
CMP #$20
7dd9
901c
BCC L7df7↓
7ddb
a63a
LDX GenByte_003a
7ddd
e8
INX
7dde
e005
CPX #$05
7de0
9002
BCC L7de4↓
7de2
a200
LDX #$00
L7de4:
7de0
7de4
863a
STX GenByte_003a
7de6
bd807f
LDA D7f80,X
7de9
8d0032
STA IO_output_latch
7dec
bd857f
LDA D7f85,X
7def
aa
TAX
7df0
a930
LDA #$30
7df2
205379
JSR io_audio_set↑
7df5
8456
STY ship_abort
L7df7:
7dd9
7df7
20957e
JSR io_in0_diagstep↓
7dfa
b003
BCS L7dff↓
7dfc
4c6e7d
JMP L7d6e↑
L7dff:
7dfa
7dff
a200
LDX #$00
7e01
8e003c
STX IO_audio_latch
L7e04:
7e54
7e04
86bb
STX Zbb
7e06
20597e
JSR VecRamPtr_reset_0x4000↓
7e09
a4bb
LDY Zbb
7e0b
c003
CPY #$03
7e0d
d023
BNE L7e32↓
7e0f
a930
LDA #$30
7e11
20627e
JSR FUN_7e62↓
7e14
a9fb
LDA #$fb
L7e16:
7e2e
7e16
a000
LDY #$00
7e18
9127
STA (VecRamPtr),Y
7e1a
e627
INC VecRamPtr
7e1c
48
PHA
7e1d
a9f8
LDA #$f8
7e1f
9127
STA (VecRamPtr),Y
7e21
e627
INC VecRamPtr
7e23
a938
LDA #$38
7e25
a202
LDX #$02
7e27
20647e
JSR font_lookup_table_memcpy↓
7e2a
68
PLA
7e2b
38
SEC
7e2c
e910
SBC #$10
7e2e
b0e6
BCS L7e16↑
7e30
9012
BCC L7e44↓
L7e32:
7e0d
7e32
bef47f
LDX D7ff4,Y
7e35
98
TYA
7e36
0a
ASL
7e37
a8
TAY
7e38
b9ef7f
LDA D7fef,Y
7e3b
48
PHA
7e3c
b9ee7f
LDA D7fee,Y
7e3f
a8
TAY
7e40
68
PLA
7e41
20a67e
JSR vecram_memcpy_update_vecptr↓
L7e44:
7e30
7e44
20717e
JSR activate_spot_killer_maybe↓
L7e47:
7e4d
7e47
207a7e
JSR vecgen_go_wait↓
7e4a
20957e
JSR io_in0_diagstep↓
7e4d
90f8
BCC L7e47↑
7e4f
a6bb
LDX Zbb
7e51
e8
INX
7e52
e004
CPX #$04
7e54
90ae
BCC L7e04↑
7e56
4c9d7b
JMP reset_in0_bit2_set↑
VecRamPtr_reset_0x4000:
RESET+b9RESET+caRESET+157RESET+282
7e59
a940
LDA #$40
7e5b
8528
STA VecRamPtr_high
7e5d
a900
LDA #$00
7e5f
8527
STA VecRamPtr
7e61
60
RTS
FUN_7e62:
RESET+165RESET+227RESET+23fRESET+28d
7e62
a208
LDX #$08
font_lookup_table_memcpy:
RESET+1c6RESET+2a3font_fixup_0+4DrawNumber_decimal_1+13
7e64
18
CLC
7e65
6d7c7f
ADC D7f7c
7e68
a8
TAY
7e69
ad7d7f
LDA D7f7d
7e6c
6900
ADC #$00
7e6e
4ca67e
JMP vecram_memcpy_update_vecptr↓
activate_spot_killer_maybe:
RESET+24cRESET+2c0
7e71
a94b
LDA #$4b
7e73
a0de
LDY #$de
7e75
a206
LDX #$06
7e77
20a67e
JSR vecram_memcpy_update_vecptr↓
vecgen_go_wait:
RESET+2c3
7e7a
8d0030
STA IO_DMAGO
7e7d
a003
LDY #$03
vecgen_wait:
RESET+13cRESET+144vecgen_wait+13
7e7f
8d0034
STA IO_watchdog
7e82
a214
LDX #$14
L7e84:
7e877e8f
7e84
2c0020
BIT IO_in0
7e87
70fb
BVS L7e84↑
L7e89:
7e8c
7e89
2c0020
BIT IO_in0
7e8c
50fb
BVC L7e89↑
7e8e
ca
DEX
7e8f
d0f3
BNE L7e84↑
7e91
88
DEY
7e92
d0eb
BNE vecgen_wait↑
7e94
60
RTS
io_in0_diagstep:
RESET+273RESET+2c6
7e95
2c0020
BIT IO_in0
7e98
3003
BMI L7e9d↓
7e9a
0626
ASL Z26
L7e9c:
7ea2
7e9c
60
RTS
L7e9d:
7e98
7e9d
a920
LDA #$20
7e9f
8526
STA Z26
7ea1
18
CLC
7ea2
90f8
BCC L7e9c↑
vecram_memcpy_8_update_vecptr:
draw_lots_of_stuff+139draw_even_more_stuff+4draw_even_more_stuff+3edraw_ship_prep_maybe+bdraw_bonus_maybe+44
7ea4
a208
LDX #$08
vecram_memcpy_update_vecptr:
RESET+2bdGameLoop+ccfont_lookup_table_memcpy+aactivate_spot_killer_maybe+6vecram_copy_long+2vecram_copy_short+2vecgen_copy_10+9
7ea6
8565
STA Z65
7ea8
8464
STY VecPtr
vecram_memcpy_vecptr:
draw_even_more_stuff+16vecram_memcpy_4+2
7eaa
8a
TXA
7eab
a8
TAY
7eac
88
DEY
L7ead:
7eb2
7ead
b164
LDA (VecPtr),Y
7eaf
9127
STA (VecRamPtr),Y
7eb1
88
DEY
7eb2
10f9
BPL L7ead↑
7eb4
8a
TXA
7eb5
18
CLC
7eb6
6527
ADC VecRamPtr
7eb8
8527
STA VecRamPtr
7eba
9002
BCC L7ebe↓
7ebc
e628
INC VecRamPtr_high
L7ebe:
7eba
7ebe
8a
TXA
7ebf
18
CLC
7ec0
6564
ADC VecPtr
7ec2
8564
STA VecPtr
7ec4
9002
BCC L7ec8↓
7ec6
e665
INC Z65
L7ec8:
7ec4
7ec8
60
RTS
vecram_copy_short:
FUN_67e3+5draw_ship_prep_maybe+1fdraw_bonus_maybe+5bdraw_bonus_maybe+69
7ec9
a202
LDX #$02
7ecb
d0d9
BNE vecram_memcpy_update_vecptr↑
vecram_copy_long:
draw_lots_of_stuff+147WriteText_wrapper+12vecgen_beam_off_maybe+4
7ecd
a204
LDX #$04
7ecf
d0d5
BNE vecram_memcpy_update_vecptr↑
vecram_memcpy_4:
draw_even_more_stuff+2adraw_even_more_stuff+32DrawNumber_and_copy+4
7ed1
a204
LDX #$04
7ed3
d0d5
BNE vecram_memcpy_vecptr↑
vec_add_to_offset:
vec_draw_51ba_table+10vec_draw_51ba_table+1dvec_draw_subroutines+24
7ed5
18
CLC
7ed6
658b
ADC vec_src_offst_maybe
7ed8
a8
TAY
7ed9
8a
TXA
7eda
6900
ADC #$00
vec_something_7edc:
65aa
7edc
a200
LDX #$00
7ede
863d
STX GenByte_003c
7ee0
a20f
LDX #$0f
7ee2
863e
STX GenByte_003e
vec_copy_and_invert_maybe:
draw_bonus_maybe+23
7ee4
8565
STA Z65
7ee6
8464
STY VecPtr
7ee8
a000
LDY #$00
7eea
b164
LDA (VecPtr),Y
7eec
38
SEC
7eed
e553
SBC Z53
7eef
9127
STA (VecRamPtr),Y
7ef1
c8
INY
7ef2
b164
LDA (VecPtr),Y
7ef4
e554
SBC Z54
7ef6
290f
AND #$0f
7ef8
09a0
ORA #$a0
7efa
9127
STA (VecRamPtr),Y
7efc
c8
INY
7efd
b164
LDA (VecPtr),Y
7eff
38
SEC
7f00
e551
SBC score_dec_something2
7f02
9127
STA (VecRamPtr),Y
7f04
c8
INY
7f05
b164
LDA (VecPtr),Y
7f07
e53d
SBC GenByte_003c
7f09
253e
AND GenByte_003e
7f0b
9127
STA (VecRamPtr),Y
7f0d
203878
JSR VecPtrUpdate↑
vecgen_beam_off_maybe:
WriteText_wrapper+15
7f10
a955
LDA #$55
7f12
a0ae
LDY #$ae
7f14
4ccd7e
JMP vecram_copy_long↑
DrawNumber_decimal_1:
RESET+19cRESET+1a7
7f17
a200
LDX #$00
7f19
a43a
LDY GenByte_003a
7f1b
20c279
JSR dec_to_bcd_16bit↑
7f1e
a992
LDA #$92
7f20
38
SEC
7f21
a001
LDY #$01
7f23
205a7b
JSR DrawNumber↑
7f26
a910
LDA #$10
7f28
a202
LDX #$02
7f2a
4c647e
JMP font_lookup_table_memcpy↑
font_fixup_0:
RESET+160draw_push_start_screen+0
7f2d
a900
LDA #$00
7f2f
a210
LDX #$10
7f31
4c647e
JMP font_lookup_table_memcpy↑
font_fixup_something:

7f34
00
BRK
D7f7c:
font_lookup_table_memcpy+1
7f7c
.byte 34
D7f7d:
font_lookup_table_memcpy+5
7f7d
.byte 7f
D7f7e:
RESET+1cf
7f7e
.byte 76
D7f7f:
RESET+1cc
7f7f
.byte 7f
D7f80:
RESET+262
7f80
.byte 11
D7f85:
RESET+268
7f85
.byte 01
D7fee:
RESET+2b8
7fee
.byte 8a
D7fef:
RESET+2b4
7fef
.byte 7f
D7ff4:
RESET+2ae
7ff4
.byte 0e
NMI_vector:

7ffa
.word 7aa8
; NMI vector pointer