AS09 Assembler for M6809/H6309 [1.11]. Copyright 1994-96, Frank A. Vorstenbosch Page 1 ---------------------------------------------------------------------------------------------- BIOS.ASM ----------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------- Symbol Table --------------------------------------------------------------------------------------------- Symbol Value Decimal Abs_a_b : $f584 62852 Abs_b : $f58b 62859 Add_Score_a : $f85e 63582 Add_Score_d : $f87c 63612 Bitmask_a : $f57e 62846 Bit_Masks : $f9dc 63964 Char_Table : $f9f4 63988 Char_Table_End : $fbd4 64468 Check0Ref : $f34f 62287 Clear_C8_RAM : $f542 62786 Clear_Score : $f84f 63567 Clear_Sound : $f272 62066 Clear_x_b : $f53f 62783 Clear_x_b_a : $f552 62802 Clear_x_b_80 : $f550 62800 Clear_x_d : $f548 62792 Clear_x_256 : $f545 62789 Compare_Score : $f8c7 63687 Copyright_Len : $000b 11 Copyright_Str : $f101 61697 Dec_Counters : $f563 62819 Dec_3_Counters : $f55a 62810 Dec_6_Counters : $f55e 62814 Delay_b : $f57a 62842 Delay_RTS : $f57d 62845 Delay_0 : $f579 62841 Delay_1 : $f575 62837 Delay_2 : $f571 62833 Delay_3 : $f56d 62829 DFC2C : $fc2c 64556 DFC24 : $fc24 64548 DFC6D : $fc6d 64621 DFDC3 : $fdc3 64963 DFDD3 : $fdd3 64979 DFD1D : $fd1d 64797 DFD69 : $fd69 64873 DFD79 : $fd79 64889 DFD81 : $fd81 64897 DFEB2 : $feb2 65202 DFEB6 : $feb6 65206 DFEC6 : $fec6 65222 DFEE8 : $fee8 65256 DFEF8 : $fef8 65272 DFE28 : $fe28 65064 DFE38 : $fe38 65080 DFE66 : $fe66 65126 DFE76 : $fe76 65142 DFF16 : $ff16 65302 DFF26 : $ff26 65318 DFF44 : $ff44 65348 DFF62 : $ff62 65378 DFF7A : $ff7a 65402 DFF8F : $ff8f 65423 DF0FD : $f0fd 61693 Display_Option : $f835 63541 Dot_d : $f2c3 62147 Dot_here : $f2c5 62149 Dot_ix : $f2c1 62145 Dot_ix_b : $f2be 62142 Dot_List : $f2d5 62165 Dot_List_Reset : $f2de 62174 Do_Sound : $f289 62089 Do_Sound_x : $f28c 62092 DP_to_C8 : $f1af 61871 DP_to_D0 : $f1aa 61866 Draw_Grid_VL : $ff9f 65439 Draw_Line_d : $f3df 62431 Draw_Pat_VL : $f437 62519 Draw_Pat_VL_a : $f434 62516 Draw_Pat_VL_d : $f439 62521 Draw_VL : $f3dd 62429 Draw_VLc : $f3ce 62414 Draw_VLcs : $f3d6 62422 Draw_VLp : $f410 62480 Draw_VLp_b : $f40e 62478 Draw_VLp_FF : $f404 62468 Draw_VLp_scale : $f40c 62476 Draw_VLp_7F : $f408 62472 Draw_VL_a : $f3da 62426 Draw_VL_ab : $f3d8 62424 Draw_VL_b : $f3d2 62418 Draw_VL_mode : $f46e 62574 Explosion_Snd : $f92e 63790 Freq_Table : $fc8d 64653 Game_Str : $f79f 63391 Get_Rise_Idx : $f5d9 62937 Get_Run_Idx : $f5db 62939 here__ : $f10c 61708 Init_Music : $f68d 63117 Init_Music_Buf : $f533 62771 Init_Music_chk : $f687 63111 Init_Music_dft : $f692 63122 Init_OS : $f18b 61835 Init_OS_RAM : $f164 61796 Init_VIA : $f14c 61772 Intensity_a : $f2ab 62123 Intensity_1F : $f29d 62109 Intensity_3F : $f2a1 62113 Intensity_5F : $f2a5 62117 Intensity_7F : $f2a9 62121 Intro_Boxes : $f0e9 61673 Intro_Music : $fd0d 64781 Joy_Analog : $f1f5 61941 Joy_Digital : $f1f8 61944 LFFAB : $ffab 65451 LFFAE : $ffae 65454 LFFA3 : $ffa3 65443 LF0A4 : $f0a4 61604 LF0D2 : $f0d2 61650 LF01C : $f01c 61468 LF029 : $f029 61481 LF052 : $f052 61522 LF058 : $f058 61528 LF084 : $f084 61572 LF09E : $f09e 61598 LF092 : $f092 61586 LF097 : $f097 61591 LF1EA : $f1ea 61930 LF1FB : $f1fb 61947 LF1FF : $f1ff 61951 LF173 : $f173 61811 LF19E : $f19e 61854 LF2CC : $f2cc 62156 LF2D2 : $f2d2 62162 LF20B : $f20b 61963 LF213 : $f213 61971 LF22D : $f22d 61997 LF23A : $f23a 62010 LF235 : $f235 62005 LF236 : $f236 62006 LF24C : $f24c 62028 LF240 : $f240 62016 LF275 : $f275 62069 LF282 : $f282 62082 LF291 : $f291 62097 LF299 : $f299 62105 LF3A3 : $f3a3 62371 LF3ED : $f3ed 62445 LF3F4 : $f3f4 62452 LF318 : $f318 62232 LF33B : $f33b 62267 LF33D : $f33d 62269 LF341 : $f341 62273 LF345 : $f345 62277 LF36A_RTS : $f36a 62314 LF383 : $f383 62339 LF4A5 : $f4a5 62629 LF4CB : $f4cb 62667 LF4C7 : $f4c7 62663 LF4EB : $f4eb 62699 LF425 : $f425 62501 LF433 : $f433 62515 LF45C : $f45c 62556 LF459 : $f459 62553 LF47E : $f47e 62590 LF476 : $f476 62582 LF48D : $f48d 62605 LF485 : $f485 62597 LF5B0 : $f5b0 62896 LF5B2 : $f5b2 62898 LF5D0 : $f5d0 62928 LF5D3 : $f5d3 62931 LF5EC : $f5ec 62956 LF5E5 : $f5e5 62949 LF50A : $f50a 62730 LF51A : $f51a 62746 LF51D : $f51d 62749 LF560 : $f560 62816 LF569 : $f569 62825 LF592 : $f592 62866 LF6B3 : $f6b3 63155 LF6B8 : $f6b8 63160 LF6CA : $f6ca 63178 LF6C0 : $f6c0 63168 LF6D2 : $f6d2 63186 LF6EA : $f6ea 63210 LF6EC : $f6ec 63212 LF6E3 : $f6e3 63203 LF635 : $f635 63029 LF637 : $f637 63031 LF66F : $f66f 63087 LF665 : $f665 63077 LF67E : $f67e 63102 LF676 : $f676 63094 LF679 : $f679 63097 LF686 : $f686 63110 LF7B1 : $f7b1 63409 LF7B6 : $f7b6 63414 LF7C5 : $f7c5 63429 LF7F1 : $f7f1 63473 LF712 : $f712 63250 LF735 : $f735 63285 LF74E : $f74e 63310 LF748 : $f748 63304 LF759 : $f759 63321 LF76D : $f76d 63341 LF766 : $f766 63334 LF778 : $f778 63352 LF78C : $f78c 63372 LF788 : $f788 63368 LF793_RTS : $f793 63379 LF8AE : $f8ae 63662 LF8A5 : $f8a5 63653 LF8CA : $f8ca 63690 LF8C6 : $f8c6 63686 LF8DE : $f8de 63710 LF8D5 : $f8d5 63701 LF8D6 : $f8d6 63702 LF8EF : $f8ef 63727 LF8E4 : $f8e4 63716 LF80C : $f80c 63500 LF810 : $f810 63504 LF82A : $f82a 63530 LF82C : $f82c 63532 LF821 : $f821 63521 LF84E : $f84e 63566 LF86D : $f86d 63597 LF861 : $f861 63585 LF878 : $f878 63608 LF88F : $f88f 63631 LF882 : $f882 63618 LF895 : $f895 63637 LF897 : $f897 63639 LF9BC : $f9bc 63932 LF9CA : $f9ca 63946 LF9CF : $f9cf 63951 LF9C2 : $f9c2 63938 LF9C9_RTS : $f9c9 63945 LF9DB_RTS : $f9db 63963 LF90F : $f90f 63759 LF903 : $f903 63747 LF906 : $f906 63750 LF91B : $f91b 63771 LF92A : $f92a 63786 LF928 : $f928 63784 LF95B : $f95b 63835 LF968 : $f968 63848 LF97B : $f97b 63867 LF97D : $f97d 63869 LF98F : $f98f 63887 LF987 : $f987 63879 LF99E : $f99e 63902 LF991 : $f991 63889 LF997 : $f997 63895 Moveto_d : $f312 62226 Moveto_d_7F : $f2fc 62204 Moveto_ix : $f310 62224 Moveto_ix_b : $f30e 62222 Moveto_ix_FF : $f308 62216 Moveto_ix_7F : $f30c 62220 Moveto_x_7F : $f2f2 62194 Move_Mem_a : $f683 63107 Move_Mem_a_1 : $f67f 63103 Mov_Draw_VL : $f3bc 62396 Mov_Draw_VLcs : $f3b5 62389 Mov_Draw_VLc_a : $f3ad 62381 Mov_Draw_VL_a : $f3b9 62393 Mov_Draw_VL_ab : $f3b7 62391 Mov_Draw_VL_b : $f3b1 62385 Mov_Draw_VL_d : $f3be 62398 Music_Table_1 : $f9e4 63972 Music_Table_2 : $f9ea 63978 New_High_Score : $f8d8 63704 Obj_Hit : $f8ff 63743 Obj_Will_Hit : $f8f3 63731 Obj_Will_Hit_u : $f8e5 63717 Player_Str : $f794 63380 Print_List : $f38a 62346 Print_List_Chk : $f38c 62348 Print_List_hw : $f385 62341 Print_Ships : $f393 62355 Print_Ships_x : $f391 62353 Print_Str : $f495 62613 Print_Str_d : $f37a 62330 Print_Str_hwyx : $f373 62323 Print_Str_yx : $f378 62328 Random : $f517 62743 Random_3 : $f511 62737 Read_Btns : $f1ba 61882 Read_Btns_Mask : $f1b4 61876 Recalibrate : $f2e6 62182 Recal_Points : $f9f0 63984 Reset0Int : $f36b 62315 Reset0Ref : $f354 62292 Reset0Ref_D0 : $f34a 62282 Reset_Pen : $f35b 62299 Rise_Run_Angle : $f593 62867 Rise_Run_Idx : $f5ef 62959 Rise_Run_Len : $f603 62979 Rise_Run_X : $f5ff 62975 Rise_Run_Y : $f601 62977 Rot_VL : $f616 62998 Rot_VL_ab : $f610 62992 Rot_VL_Mode : $f61f 63007 Rot_VL_M_dft : $f62b 63019 Select_Game : $f7a9 63401 Set_Refresh : $f1a2 61858 Sound_Byte : $f256 62038 Sound_Bytes : $f27d 62077 Sound_Bytes_x : $f284 62084 Sound_Byte_raw : $f25b 62043 Sound_Byte_x : $f259 62041 Start : $f000 61440 Strip_Zeros : $f8b7 63671 Vec_ADSR_Table : $c84f 51279 Vec_ADSR_Timers : $c85e 51294 Vec_Angle : $c836 51254 Vec_Brightness : $c827 51239 Vec_Btn_State : $c80f 51215 Vec_Buttons : $c811 51217 Vec_Button_1_1 : $c812 51218 Vec_Button_1_2 : $c813 51219 Vec_Button_1_3 : $c814 51220 Vec_Button_1_4 : $c815 51221 Vec_Button_2_1 : $c816 51222 Vec_Button_2_2 : $c817 51223 Vec_Button_2_3 : $c818 51224 Vec_Button_2_4 : $c819 51225 Vec_Cold_Flag : $cbfe 52222 Vec_Counters : $c82e 51246 Vec_Counter_1 : $c82e 51246 Vec_Counter_2 : $c82f 51247 Vec_Counter_3 : $c830 51248 Vec_Counter_4 : $c831 51249 Vec_Counter_5 : $c832 51250 Vec_Counter_6 : $c833 51251 Vec_Default_Stk : $cbea 52202 Vec_Dot_Dwell : $c828 51240 Vec_Duration : $c857 51287 Vec_Expl_Chan : $c85c 51292 Vec_Expl_ChanA : $c853 51283 Vec_Expl_ChanB : $c85d 51293 Vec_Expl_Chans : $c854 51284 Vec_Expl_Flag : $c867 51303 Vec_Expl_Timer : $c877 51319 Vec_Expl_1 : $c858 51288 Vec_Expl_2 : $c859 51289 Vec_Expl_3 : $c85a 51290 Vec_Expl_4 : $c85b 51291 Vec_FIRQ_Vector : $cbf5 52213 Vec_Freq_Table : $c84d 51277 Vec_High_Score : $cbeb 52203 Vec_IRQ_Vector : $cbf8 52216 Vec_Joy_Mux : $c81f 51231 Vec_Joy_Mux_1_X : $c81f 51231 Vec_Joy_Mux_1_Y : $c820 51232 Vec_Joy_Mux_2_X : $c821 51233 Vec_Joy_Mux_2_Y : $c822 51234 Vec_Joy_Resltn : $c81a 51226 Vec_Joy_1_X : $c81b 51227 Vec_Joy_1_Y : $c81c 51228 Vec_Joy_2_X : $c81d 51229 Vec_Joy_2_Y : $c81e 51230 Vec_Loop_Count : $c825 51237 Vec_Max_Games : $c850 51280 Vec_Max_Players : $c84f 51279 Vec_Misc_Count : $c823 51235 Vec_Music_Chan : $c855 51285 Vec_Music_Flag : $c856 51286 Vec_Music_Freq : $c861 51297 Vec_Music_Ptr : $c853 51283 Vec_Music_Twang : $c858 51288 Vec_Music_Wk_A : $c842 51266 Vec_Music_Wk_1 : $c84b 51275 Vec_Music_Wk_5 : $c847 51271 Vec_Music_Wk_6 : $c846 51270 Vec_Music_Wk_7 : $c845 51269 Vec_Music_Work : $c83f 51263 Vec_NMI_Vector : $cbfb 52219 Vec_Num_Game : $c87a 51322 Vec_Num_Players : $c879 51321 Vec_Pattern : $c829 51241 Vec_Prev_Btns : $c810 51216 Vec_Random_Seed : $c87d 51325 Vec_Rfrsh : $c83d 51261 Vec_Rfrsh_hi : $c83e 51262 Vec_Rfrsh_lo : $c83d 51261 Vec_RiseRun_Len : $c83b 51259 Vec_RiseRun_Tmp : $c834 51252 Vec_Rise_Index : $c839 51257 Vec_Run_Index : $c837 51255 Vec_Seed_Ptr : $c87b 51323 Vec_Snd_Shadow : $c800 51200 Vec_Str_Ptr : $c82c 51244 Vec_SWI2_Vector : $cbf2 52210 Vec_SWI3_Vector : $cbf2 52210 Vec_SWI_Vector : $cbfb 52219 Vec_Text_Height : $c82a 51242 Vec_Text_HW : $c82a 51242 Vec_Text_Width : $c82b 51243 Vec_Title : $f10c 61708 Vec_Title_2 : $f118 61720 Vec_Twang_Table : $c851 51281 Vec_0Ref_Enable : $c824 51236 VIA_aux_cntl : $d00b 53259 VIA_cntl : $d00c 53260 VIA_DDR_a : $d003 53251 VIA_DDR_b : $d002 53250 VIA_int_enable : $d00e 53262 VIA_int_flags : $d00d 53261 VIA_port_a : $d001 53249 VIA_port_a_nohs : $d00f 53263 VIA_port_b : $d000 53248 VIA_shift_reg : $d00a 53258 VIA_t1_cnt_hi : $d005 53253 VIA_t1_cnt_lo : $d004 53252 VIA_t1_lch_hi : $d007 53255 VIA_t1_lch_lo : $d006 53254 VIA_t2_hi : $d009 53257 VIA_t2_lo : $d008 53256 Wait_Recal : $f192 61842 Warm_Start : $f06c 61548 Xform_Rise : $f663 63075 Xform_Rise_a : $f661 63073 Xform_Run : $f65d 63069 Xform_Run_a : $f65b 63067 __6809__ : $0001 1 417 labels used 3537 lines read, no errors in pass 1. AS09 Assembler for M6809/H6309 [1.11]. Copyright 1994-96, Frank A. Vorstenbosch Page 2 ---------------------------------------------------------------------------------------------- BIOS.ASM ----------------------------------------------------------------------------------------------- ; 4 KB Bios ; can be assembled correctly now ; corrected and compatibilty added by Christopher Salomon ; ; assemble with comand line: ; .\ass\as09.exe -w200 -h0 -l -mcti bios.asm >error ; ; used the 6809 assembler: ; as09 [1.11]. ; Copyright 1990-1994, Frank A. Vorstenbosch, Kingswood Software. ; Available at: ; http://www.falstaff.demon.co.uk/cross.html ; CODE f000 = ORG $F000 DATA f000 = ORG $F000 BSS f000 = ORG $F000 CODE ;-----------------------------------------------------------------------; ; This disassembly of the Vectrex ROM was done by Bruce Tomlin ; ; (btomlin@aol.com), and is based in part on a disassembly done by ; ; Fred Taft (fred@hp-pcd.cv.hp.com). ; ;-----------------------------------------------------------------------; INCLUDE "VECTREX.INC" c800 = Vec_Snd_Shadow EQU $C800 ; Shadow of sound chip registers (15 bytes) c80f = Vec_Btn_State EQU $C80F ; Current state of all joystick buttons c810 = Vec_Prev_Btns EQU $C810 ; Previous state of all joystick buttons c811 = Vec_Buttons EQU $C811 ; Current toggle state of all buttons c812 = Vec_Button_1_1 EQU $C812 ; Current toggle state of stick 1 button 1 c813 = Vec_Button_1_2 EQU $C813 ; Current toggle state of stick 1 button 2 c814 = Vec_Button_1_3 EQU $C814 ; Current toggle state of stick 1 button 3 c815 = Vec_Button_1_4 EQU $C815 ; Current toggle state of stick 1 button 4 c816 = Vec_Button_2_1 EQU $C816 ; Current toggle state of stick 2 button 1 c817 = Vec_Button_2_2 EQU $C817 ; Current toggle state of stick 2 button 2 c818 = Vec_Button_2_3 EQU $C818 ; Current toggle state of stick 2 button 3 c819 = Vec_Button_2_4 EQU $C819 ; Current toggle state of stick 2 button 4 c81a = Vec_Joy_Resltn EQU $C81A ; Joystick A/D resolution ($80=min $00=max) c81b = Vec_Joy_1_X EQU $C81B ; Joystick 1 left/right c81c = Vec_Joy_1_Y EQU $C81C ; Joystick 1 up/down c81d = Vec_Joy_2_X EQU $C81D ; Joystick 2 left/right c81e = Vec_Joy_2_Y EQU $C81E ; Joystick 2 up/down c81f = Vec_Joy_Mux EQU $C81F ; Joystick enable/mux flags (4 bytes) c81f = Vec_Joy_Mux_1_X EQU $C81F ; Joystick 1 X enable/mux flag (=1) c820 = Vec_Joy_Mux_1_Y EQU $C820 ; Joystick 1 Y enable/mux flag (=3) c821 = Vec_Joy_Mux_2_X EQU $C821 ; Joystick 2 X enable/mux flag (=5) c822 = Vec_Joy_Mux_2_Y EQU $C822 ; Joystick 2 Y enable/mux flag (=7) c823 = Vec_Misc_Count EQU $C823 ; Misc counter/flag byte, zero when not in use c824 = Vec_0Ref_Enable EQU $C824 ; Check0Ref enable flag c825 = Vec_Loop_Count EQU $C825 ; Loop counter word (incremented in Wait_Recal) c827 = Vec_Brightness EQU $C827 ; Default brightness c828 = Vec_Dot_Dwell EQU $C828 ; Dot dwell time? c829 = Vec_Pattern EQU $C829 ; Dot pattern (bits) c82a = Vec_Text_HW EQU $C82A ; Default text height and width c82a = Vec_Text_Height EQU $C82A ; Default text height c82b = Vec_Text_Width EQU $C82B ; Default text width c82c = Vec_Str_Ptr EQU $C82C ; Temporary string pointer for Print_Str c82e = Vec_Counters EQU $C82E ; Six bytes of counters c82e = Vec_Counter_1 EQU $C82E ; First counter byte c82f = Vec_Counter_2 EQU $C82F ; Second counter byte c830 = Vec_Counter_3 EQU $C830 ; Third counter byte c831 = Vec_Counter_4 EQU $C831 ; Fourth counter byte c832 = Vec_Counter_5 EQU $C832 ; Fifth counter byte c833 = Vec_Counter_6 EQU $C833 ; Sixth counter byte c834 = Vec_RiseRun_Tmp EQU $C834 ; Temp storage word for rise/run c836 = Vec_Angle EQU $C836 ; Angle for rise/run and rotation calculations c837 = Vec_Run_Index EQU $C837 ; Index pair for run * $C839 ; Pointer to copyright string during startup c839 = Vec_Rise_Index EQU $C839 ; Index pair for rise * $C83B ; High score cold-start flag (=0 if valid) c83b = Vec_RiseRun_Len EQU $C83B ; length for rise/run * $C83C ; temp byte c83d = Vec_Rfrsh EQU $C83D ; Refresh time (divided by 1.5MHz) c83d = Vec_Rfrsh_lo EQU $C83D ; Refresh time low byte c83e = Vec_Rfrsh_hi EQU $C83E ; Refresh time high byte c83f = Vec_Music_Work EQU $C83F ; Music work buffer (14 bytes, backwards?) c842 = Vec_Music_Wk_A EQU $C842 ; register 10 * $C843 ; register 9 * $C844 ; register 8 c845 = Vec_Music_Wk_7 EQU $C845 ; register 7 c846 = Vec_Music_Wk_6 EQU $C846 ; register 6 c847 = Vec_Music_Wk_5 EQU $C847 ; register 5 * $C848 ; register 4 * $C849 ; register 3 * $C84A ; register 2 c84b = Vec_Music_Wk_1 EQU $C84B ; register 1 * $C84C ; register 0 c84d = Vec_Freq_Table EQU $C84D ; Pointer to note-to-frequency table (normally $FC8D) c84f = Vec_Max_Players EQU $C84F ; Maximum number of players for Select_Game c850 = Vec_Max_Games EQU $C850 ; Maximum number of games for Select_Game c84f = Vec_ADSR_Table EQU $C84F ; Storage for first music header word (ADSR table) c851 = Vec_Twang_Table EQU $C851 ; Storage for second music header word ('twang' table) c853 = Vec_Music_Ptr EQU $C853 ; Music data pointer c853 = Vec_Expl_ChanA EQU $C853 ; Used by Explosion_Snd - bit for first channel used? c854 = Vec_Expl_Chans EQU $C854 ; Used by Explosion_Snd - bits for all channels used? c855 = Vec_Music_Chan EQU $C855 ; Current sound channel number for Init_Music c856 = Vec_Music_Flag EQU $C856 ; Music active flag ($00=off $01=start $80=on) c857 = Vec_Duration EQU $C857 ; Duration counter for Init_Music c858 = Vec_Music_Twang EQU $C858 ; 3 word 'twang' table used by Init_Music c858 = Vec_Expl_1 EQU $C858 ; Four bytes copied from Explosion_Snd's U-reg parameters c859 = Vec_Expl_2 EQU $C859 c85a = Vec_Expl_3 EQU $C85A c85b = Vec_Expl_4 EQU $C85B c85c = Vec_Expl_Chan EQU $C85C ; Used by Explosion_Snd - channel number in use? c85d = Vec_Expl_ChanB EQU $C85D ; Used by Explosion_Snd - bit for second channel used? c85e = Vec_ADSR_Timers EQU $C85E ; ADSR timers for each sound channel (3 bytes) c861 = Vec_Music_Freq EQU $C861 ; Storage for base frequency of each channel (3 words) * $C85E ; Scratch 'score' storage for Display_Option (7 bytes) c867 = Vec_Expl_Flag EQU $C867 ; Explosion_Snd initialization flag? * $C868...$C876 ; Unused? c877 = Vec_Expl_Timer EQU $C877 ; Used by Explosion_Snd * $C878 ; Unused? c879 = Vec_Num_Players EQU $C879 ; Number of players selected in Select_Game c87a = Vec_Num_Game EQU $C87A ; Game number selected in Select_Game c87b = Vec_Seed_Ptr EQU $C87B ; Pointer to 3-byte random number seed (=$C87D) c87d = Vec_Random_Seed EQU $C87D ; Default 3-byte random number seed * $C880 - $CBEA is user RAM cbea = Vec_Default_Stk EQU $CBEA ; Default top-of-stack cbeb = Vec_High_Score EQU $CBEB ; High score storage (7 bytes) cbf2 = Vec_SWI3_Vector EQU $CBF2 ; SWI2/SWI3 interrupt vector (3 bytes) cbf2 = Vec_SWI2_Vector EQU $CBF2 ; SWI2/SWI3 interrupt vector (3 bytes) cbf5 = Vec_FIRQ_Vector EQU $CBF5 ; FIRQ interrupt vector (3 bytes) cbf8 = Vec_IRQ_Vector EQU $CBF8 ; IRQ interrupt vector (3 bytes) cbfb = Vec_SWI_Vector EQU $CBFB ; SWI/NMI interrupt vector (3 bytes) cbfb = Vec_NMI_Vector EQU $CBFB ; SWI/NMI interrupt vector (3 bytes) cbfe = Vec_Cold_Flag EQU $CBFE ; Cold start flag (warm start if = $7321) d000 = VIA_port_b EQU $D000 ; VIA port B data I/O register * 0 sample/hold (0=enable mux 1=disable mux) * 1 mux sel 0 * 2 mux sel 1 * 3 sound BC1 * 4 sound BDIR * 5 comparator input * 6 external device (slot pin 35) initialized to input * 7 /RAMP d001 = VIA_port_a EQU $D001 ; VIA port A data I/O register (handshaking) d002 = VIA_DDR_b EQU $D002 ; VIA port B data direction register (0=input 1=output) d003 = VIA_DDR_a EQU $D003 ; VIA port A data direction register (0=input 1=output) d004 = VIA_t1_cnt_lo EQU $D004 ; VIA timer 1 count register lo (scale factor) d005 = VIA_t1_cnt_hi EQU $D005 ; VIA timer 1 count register hi d006 = VIA_t1_lch_lo EQU $D006 ; VIA timer 1 latch register lo d007 = VIA_t1_lch_hi EQU $D007 ; VIA timer 1 latch register hi d008 = VIA_t2_lo EQU $D008 ; VIA timer 2 count/latch register lo (refresh) d009 = VIA_t2_hi EQU $D009 ; VIA timer 2 count/latch register hi d00a = VIA_shift_reg EQU $D00A ; VIA shift register d00b = VIA_aux_cntl EQU $D00B ; VIA auxiliary control register * 0 PA latch enable * 1 PB latch enable * 2 \ 110=output to CB2 under control of phase 2 clock * 3 > shift register control (110 is the only mode used by the Vectrex ROM) * 4 / * 5 0=t2 one shot 1=t2 free running * 6 0=t1 one shot 1=t1 free running * 7 0=t1 disable PB7 output 1=t1 enable PB7 output d00c = VIA_cntl EQU $D00C ; VIA control register * 0 CA1 control CA1 -> SW7 0=IRQ on low 1=IRQ on high * 1 \ * 2 > CA2 control CA2 -> /ZERO 110=low 111=high * 3 / * 4 CB1 control CB1 -> NC 0=IRQ on low 1=IRQ on high * 5 \ * 6 > CB2 control CB2 -> /BLANK 110=low 111=high * 7 / d00d = VIA_int_flags EQU $D00D ; VIA interrupt flags register * bit cleared by * 0 CA2 interrupt flag reading or writing port A I/O * 1 CA1 interrupt flag reading or writing port A I/O * 2 shift register interrupt flag reading or writing shift register * 3 CB2 interrupt flag reading or writing port B I/O * 4 CB1 interrupt flag reading or writing port A I/O * 5 timer 2 interrupt flag read t2 low or write t2 high * 6 timer 1 interrupt flag read t1 count low or write t1 high * 7 IRQ status flag write logic 0 to IER or IFR bit d00e = VIA_int_enable EQU $D00E ; VIA interrupt enable register * 0 CA2 interrupt enable * 1 CA1 interrupt enable * 2 shift register interrupt enable * 3 CB2 interrupt enable * 4 CB1 interrupt enable * 5 timer 2 interrupt enable * 6 timer 1 interrupt enable * 7 IER set/clear control d00f = VIA_port_a_nohs EQU $D00F ; VIA port A data I/O register (no handshaking) ; ;-----------------------------------------------------------------------; ; F000 Start ; ; ; ; Jump here to restart the Vectrex and re-initialize the OS. If the ; ; cold start flag is correct (it should be unless you just turned the ; ; Vectrex on), the cold start code is skipped. ; ; ; ; On cold start, the high score is cleared, and the power-on screen ; ; is displayed with the power-on music. ; ;-----------------------------------------------------------------------; f000 : 10cecbea [ 4] Start: LDS #Vec_Default_Stk ;Set up stack pointer f004 : bdf18b [ 9] JSR Init_OS ;Initialize system f007 : cc7321 [ 3] LDD #$7321 ;Check cold start flag f00a : 10b3cbfe [ 8] CMPD Vec_Cold_Flag f00e : 275c [ 3] BEQ Warm_Start ;Branch if warm start f010 : fdcbfe [ 6] STD Vec_Cold_Flag ;Initialize cold start flag f013 : 7cc83b [ 7] INC $C83B ;Set high score invalid flag f016 : 8ecbeb [ 3] LDX #Vec_High_Score ;Clear high score f019 : bdf84f [ 9] JSR Clear_Score ; First power-up loop. This prints the "VECTREX" ; power-on screen and plays the power-on music. f01c : bdf1af [ 9] LF01C: JSR DP_to_C8 ;DP to RAM f01f : dc25 [ 5] LDD ;-----------------------------------------------------------------------; ; F06C Warm_Start ; ; ; ; Jump here to restart the Vectrex without re-initializing the OS. ; ;-----------------------------------------------------------------------; ; Prepare for ROM check f06c : bdf1af [ 9] Warm_Start: JSR DP_to_C8 ;DP to RAM f06f : 86cc [ 2] LDA #$CC ;Set new line pattern f071 : 9729 [ 4] STA PB7 enabled f15b : 970b [ 4] STA 0 if joystick is right or up of center. ; ; ; ; Joy_Analog: ; ; A successive approximation algorithm is used to read ; ; the actual value of the joystick pot, a signed value. ; ; In this case, $C81A must be set to a power of 2, to ; ; to control conversion resolution; 0x80 is least ; ; accurate, and 0x00is most accurate. ; ; ; ; ENTRY DP = $D0 ; ; ; ; D-reg, X-reg trashed ; ;-----------------------------------------------------------------------; f1f5 : 7ac823 [ 7] Joy_Analog: DEC $C823 ;Set analog mode flag f1f8 : 8ec81f [ 3] Joy_Digital: LDX #Vec_Joy_Mux_1_X;Point to first pot f1fb : a680 [ 6] LF1FB: LDA ,X+ ;Read it if enabled f1fd : 260c [ 3] BNE LF20B f1ff : 8cc823 [ 4] LF1FF: CMPX #$C823 ;Go back untl all pots read f202 : 26f7 [ 3] BNE LF1FB f204 : 6f84 [ 6] CLR ,X ;X points to $C823, clear it f206 : 8601 [ 2] LDA #$01 f208 : 9700 [ 4] STA = 0, then the music data will be ; ; copied; however, as soon as a register number < 0 is encountered, ; ; the copy will stop. ; ; ; ; ENTRY DP = $D0 ; ; U-reg = pointer to the block of sound data ; ; ; ; D-reg, X-reg, U-reg trashed ; ;-----------------------------------------------------------------------; f27d : 8ec800 [ 3] Sound_Bytes: LDX #Vec_Snd_Shadow ;Point to shadow memory f280 : 2002 [ 3] BRA Sound_Bytes_x f282 : 8dd5 [ 7] LF282: BSR Sound_Byte_x ;Update the sound register f284 : ecc1 [ 8] Sound_Bytes_x: LDD ,U++ ;Get next next pair of bytes f286 : 2afa [ 3] BPL LF282 ;Go back if not end of list f288 : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F289 Do_Sound ; ; F28C Do_Sound_x? (apparently never used) ; ; ; ; This routine will start/continue making the sound which was first ; ; set up by your call to Init_Music. This routine should normally ; ; be called right after your call to Wait_Recal. It takes the next ; ; music information, contained in the music buffer $C83F-$C84C, and ; ; updates only those registers which differ from the last data written ; ; to the sound chip. ; ; ; ; ENTRY DP = $D0 ; ; ; ; D-reg, X-reg, U-reg trashed ; ;-----------------------------------------------------------------------; f289 : 8ec800 [ 3] Do_Sound: LDX #Vec_Snd_Shadow ;point to shadow memory f28c : cec83f [ 3] Do_Sound_x: LDU #Vec_Music_Work ;point to sound buffer f28f : 860d [ 2] LDA #$0D ;init count for 14 registers f291 : e6c0 [ 6] LF291: LDB ,U+ ;get next register f293 : e186 [ 5] CMPB A,X ;skip if unchanged f295 : 2702 [ 3] BEQ LF299 f297 : 8dc0 [ 7] BSR Sound_Byte_x ;else update register f299 : 4a [ 2] LF299: DECA ;go back for next register f29a : 2af5 [ 3] BPL LF291 f29c : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F29D Intensity_1F ; ; F2A1 Intensity_3F ; ; F2A5 Intensity_5F ; ; F2A9 Intensity_7F ; ; F2AB Intensity_a ; ; ; ; Each of these routines are responsible for setting the vector/dot ; ; intensity (commonly used to denote the z axis) to a specific value. ; ; 0x00 is the lowest intensity, and 0xFF is the brightest intensity. ; ; The intensity must be reset to the desired value after each call ; ; to Wait_Recal; however, it can also be changed at any other time. ; ; A copy of the new intensity value is saved in $C827. ; ; ; ; ENTRY DP = $D0 ; ; A-reg = intensity (Intensity_a only) ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f29d : 861f [ 2] Intensity_1F: LDA #$1F f29f : 200a [ 3] BRA Intensity_a f2a1 : 863f [ 2] Intensity_3F: LDA #$3F f2a3 : 2006 [ 3] BRA Intensity_a f2a5 : 865f [ 2] Intensity_5F: LDA #$5F f2a7 : 2002 [ 3] BRA Intensity_a f2a9 : 867f [ 2] Intensity_7F: LDA #$7F f2ab : 9701 [ 4] Intensity_a: STA 0 ; ; is encountered; at that point, it will reset the zero reference ; ; (the integrators). ; ; ; ; ENTRY DP = $D0 ; ; X-reg points to the dot list ; ; ; ; EXIT: X-reg points to next byte after the terminator ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f2de : a680 [ 6] Dot_List_Reset: LDA ,X+ ;get mode byte f2e0 : 2e72 [ 3] BGT Reset0Ref ;if >0 go to Reset0Ref f2e2 : 8ddd [ 7] BSR Dot_ix ;plot the dot f2e4 : 20f8 [ 3] BRA Dot_List_Reset ;dot_list@x_&_reset ;-----------------------------------------------------------------------; ; F2E6 Recalibrate ; ; ; ; Recalibrate the vector generators. ; ; ; ; ENTRY DP = $D0 ; ; ; ; D-reg, X-reg trashed ; ;-----------------------------------------------------------------------; f2e6 : 8ef9f0 [ 3] Recalibrate: LDX #Recal_Points ;$7F7F f2e9 : 8d1d [ 7] BSR Moveto_ix_FF f2eb : bdf36b [ 9] JSR Reset0Int f2ee : 8d20 [ 7] BSR Moveto_ix ;$8080 f2f0 : 2062 [ 3] BRA Reset0Ref ;-----------------------------------------------------------------------; ; F2F2 Moveto_x_7F ; ; ; ; This routine forces the scale factor to 0x7F, and then moves the ; ; pen to the location pointed to by the X register. The relative y ; ; and relative x coordinates are both 2 byte quantities; however, ; ; only the most signicant byte of each is of any interest. The values ; ; pointed to by the X register have the following format: ; ; ; ; X => (rel y hi),(rel y lo), (rel x hi), (rel x lo) ; ; ; ; The position moved to is obtained by y=(0,x) & x=(2,x). ; ; ; ; ENTRY DP = $D0 ; ; X-reg points to double-sized coordinate pair ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f2f2 : c67f [ 2] Moveto_x_7F: LDB #$7F ;Set scale factor to $7F f2f4 : d704 [ 4] STB Moveto_d_7F opt f37d : bdf575 [ 9] JSR Delay_1 f380 : 7ef495 [ 4] JMP Print_Str ;-----------------------------------------------------------------------; ; F385 Print_List_hw ; ; ; ; This displays the group of strings described by the parameter block ; ; which is pointed to by the U register. The string parameter block ; ; has the following format: ; ; ; ; height, width, rel y, rel x, string, 0x80, ; ; height, width, rel y, rel x, string, 0x80, ; ; 0x00 ; ; ; ; ENTRY DP = $D0 ; ; U-reg points to string list ; ; ; ; EXIT: U-reg points to null terminator byte ; ; ; ; D-reg, X-reg trashed ; ;-----------------------------------------------------------------------; f383 : 8dee [ 7] LF383: BSR Print_Str_hwyx f385 : a6c4 [ 4] Print_List_hw: LDA ,U f387 : 26fa [ 3] BNE LF383 f389 : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F38A Print_List ; ; F38C Print_List_chk ; ; ; ; This displays the group of strings described by the parameter block ; ; which is pointed to by the U register. The string parameter block ; ; has the following format: ; ; ; ; rel y, rel x, string, 0x80, ; ; rel y, rel x, string, 0x80, ; ; 0x00 ; ; ; ; The current string height and width to which the hardware is set will ; ; be used. ; ; ; ; Print_List routine will first print the passed-in string, and THEN ; ; check for the end of the string list. Print_List_Chk will check for ; ; the end of the string list first. ; ; ; ; ENTRY DP = $D0 ; ; U-reg points to string list ; ; ; ; EXIT: U-reg points to null terminator byte ; ; ; ; D-reg, X-reg trashed ; ;-----------------------------------------------------------------------; f38a : 8dec [ 7] Print_List: BSR Print_Str_yx f38c : a6c4 [ 4] Print_List_Chk: LDA ,U f38e : 26fa [ 3] BNE Print_List f390 : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F391 Print_Ships_x ; ; F393 Print_Ships ; ; ; ; This routine displays the number of ships passed in the B register ; ; followed by a minus sign and the ship icon character passed in the ; ; A register at the (y,x) coordinates passed in the X register. If ; ; the B-register > 9, then the infinity symbol is displayed. ; ; ; ; Note: This routine uses bytes at a negative offset from the stack as ; ; temporary storage, so hopefully an IRQ won't happen until the ; ; string is finished bring printed! ; ; ; ; ENTRY DP = $D0 ; ; A-reg = ship icon character ; ; B-reg = number of ships ; ; X-reg = (y,x) coordinates (Print_Ships only) ; ; X-reg points to (y,x) coordinates (Print_Ships_x only) ; ; ; ; D-reg, X-reg, U-reg trashed ; ;-----------------------------------------------------------------------; f391 : ae84 [ 5] Print_Ships_x: LDX ,X f393 : 3404 [ 6] Print_Ships: PSHS B ;Save B-reg f395 : c680 [ 2] LDB #$80 f397 : 3378 [ 5] LEAU -8,S ;Point U into the stack f399 : 3606 [ 7] PSHU D ;Save A-reg and a terminator f39b : 3502 [ 6] PULS A ;Get back B-reg f39d : 8109 [ 2] CMPA #$09 ;If B-reg >9 then f39f : 2302 [ 3] BLS LF3A3 f3a1 : 863c [ 2] LDA #$6C-$30 ;load $6C = infinty symbol f3a3 : 8b30 [ 2] LF3A3: ADDA #$30 f3a5 : c62d [ 2] LDB #'-' f3a7 : 3606 [ 7] PSHU D ;Push digit and minus sign f3a9 : 3610 [ 7] PSHU X ;Push (y,x) coordinates f3ab : 20cb [ 3] BRA Print_Str_yx ;Print it ;-----------------------------------------------------------------------; ; F3AD Mov_Draw_VLc_a ; ; ; ; This routine moves to the first location specified in vector list, ; ; and then draws lines between the rest of coordinates in the list. ; ; The number of vectors to draw is specified as the first byte in the ; ; vector list. The current scale factor is used. The vector list has ; ; the following format: ; ; ; ; count, rel y, rel x, rel y, rel x, ... ; ; ; ; ENTRY DP = $D0 ; ; X-reg points to the vector list ; ; ; ; EXIT: X-reg points to next byte after list ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f3ad : a680 [ 6] Mov_Draw_VLc_a: LDA ,X+ f3af : 2008 [ 3] BRA Mov_Draw_VL_a ;-----------------------------------------------------------------------; ; F3B1 Mov_Draw_VL_b ; ; ; ; This routine moves to the first location specified in vector list, ; ; and then draws lines between the rest of coordinates in the list. ; ; The vector list has the following format: ; ; ; ; rel y, rel x, rel y, rel x, ... ; ; ; ; ENTRY DP = $D0 ; ; B-reg = scale factor ; ; $C823 = number of vectors to draw ; ; X-reg points to the vector list ; ; ; ; EXIT: $C823 is cleared ; ; ; ; EXIT: X-reg points to next byte after list ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f3b1 : d704 [ 4] Mov_Draw_VL_b: STB D00A, B->D005 ;-----------------------------------------------------------------------; ; F3CE Draw_VLc ; ; ; ; This routine draws vectors between the set of (y,x) points pointed ; ; to by the X register. The number of vectors to draw is specified ; ; as the first byte in the vector list. The current scale factor is ; ; used. The vector list has the following format: ; ; ; ; count, rel y, rel x, rel y, rel x, ... ; ; ; ; ENTRY DP = $D0 ; ; X-reg points to the vector list ; ; ; ; EXIT: X-reg points to next byte after list ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f3ce : a680 [ 6] Draw_VLc: LDA ,X+ f3d0 : 2008 [ 3] BRA Draw_VL_a ;-----------------------------------------------------------------------; ; F3D2 Draw_VL_b ; ; ; ; This routine draws vectors between the set of (y,x) points pointed to ; ; by the X register. The vector list has the following format: ; ; ; ; rel y, rel x, rel y, rel x, ... ; ; ; ; ENTRY DP = $D0 ; ; B-reg = the scale factor ; ; X-reg points to the vector list ; ; ; ; EXIT: X-reg points to next byte after list ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f3d2 : d704 [ 4] Draw_VL_b: STB 1 draw to specified endpoint ; ; ; ; ENTRY DP = $D0 ; ; X-reg points to the vector list ; ; $C829 contains the line pattern. ; ; ; ; EXIT: X-reg points to next byte after terminator ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f46e : b6c824 [ 5] Draw_VL_mode: LDA Vec_0Ref_Enable ;Save old Check0Ref flag f471 : 3402 [ 6] PSHS A f473 : 7fc824 [ 7] CLR Vec_0Ref_Enable ;Don't reset the zero reference yet f476 : a680 [ 6] LF476: LDA ,X+ ;Get the next mode byte f478 : 2a04 [ 3] BPL LF47E f47a : 8dbb [ 7] BSR Draw_Pat_VL ;If <0, draw a patterned line f47c : 20f8 [ 3] BRA LF476 f47e : 2605 [ 3] LF47E: BNE LF485 f480 : bdf3bc [ 9] JSR Mov_Draw_VL ;If =0, move to the next point f483 : 20f1 [ 3] BRA LF476 f485 : 4a [ 2] LF485: DECA f486 : 2705 [ 3] BEQ LF48D f488 : bdf3dd [ 9] JSR Draw_VL ;If <>1, draw a solid line f48b : 20e9 [ 3] BRA LF476 f48d : 3502 [ 6] LF48D: PULS A ;If =1, exit f48f : b7c824 [ 5] STA Vec_0Ref_Enable ;Restore old Check0Ref flag f492 : 7ef34f [ 4] JMP Check0Ref ;Reset zero reference if necessary ;-----------------------------------------------------------------------; ; F495 Print_Str ; ; ; ; This is the routine which does the actual printing of a string. The ; ; U register points to the start of the string, while $C82A contains ; ; the height of the character, cell, and $C82B contains the width of ; ; the character cell. The string is terminated with an 0x80. ; ; ; ; The string is displayed by drawing 7 horizontal rows of dots. The ; ; first row is drawn for each character, then the second, etc. The ; ; character generation table is located at ($F9D4 + $20). Only ; ; characters 0x20-0x6F (upper case) are defined; the lower case ; ; characters a-o produce special icons. ; ; ; ; ENTRY DP = $D0 ; ; U-reg points to the start of the string ; ; ; ; EXIT: U-reg points to next byte after terminator ; ; ; ; D-reg, X-reg trashed ; ;-----------------------------------------------------------------------; f495 : ffc82c [ 6] Print_Str: STU Vec_Str_Ptr ;Save string pointer f498 : 8ef9d4 [ 3] LDX #Char_Table-$20 ;Point to start of chargen bitmaps f49b : cc1883 [ 3] LDD #$1883 ;$8x = enable RAMP? f49e : 0f01 [ 6] CLR PB7 enabled f50e : 7ef354 [ 4] JMP Reset0Ref ;Reset the zero reference ;-----------------------------------------------------------------------; ; F511 Random_3 ; ; F517 Random ; ; ; ; This routine generates a random 1-byte number, and places it in the ; ; A register. Random_3 runs through the random number generator ; ; algorithm three times. The random number seed is stored in the ; ; three bytes pointed to by $C87B. ; ; ; ; EXIT: A-reg contains the generated random number ; ; ; ; All other registers are preserved. ; ;-----------------------------------------------------------------------; f511 : 3414 [ 8] Random_3: PSHS B,X f513 : c602 [ 2] LDB #$02 f515 : 2003 [ 3] BRA LF51A f517 : 3414 [ 8] Random: PSHS B,X f519 : 5f [ 2] CLRB f51a : bec87b [ 6] LF51A: LDX Vec_Seed_Ptr f51d : a601 [ 5] LF51D: LDA 1,X f51f : 49 [ 2] ROLA f520 : 49 [ 2] ROLA f521 : 49 [ 2] ROLA f522 : 49 [ 2] ROLA f523 : a802 [ 5] EORA 2,X f525 : 46 [ 2] RORA f526 : 6984 [ 6] ROL ,X f528 : 6901 [ 7] ROL 1,X f52a : 6902 [ 7] ROL 2,X f52c : 5a [ 2] DECB f52d : 2aee [ 3] BPL LF51D f52f : a684 [ 4] LDA ,X f531 : 3594 [10] PULS B,X,PC ;-----------------------------------------------------------------------; ; F533 Init_Music_Buf ; ; ; ; This routine clears out the music work buffer, located at ; ; $C83F-$C84C. ; ; ; ; X-reg, D-reg trashed ; ;-----------------------------------------------------------------------; f533 : c60d [ 2] Init_Music_Buf: LDB #$0D f535 : 8ec83f [ 3] LDX #Vec_Music_Work f538 : 8d05 [ 7] BSR Clear_x_b f53a : 863f [ 2] LDA #$3F f53c : a706 [ 5] STA 6,X f53e : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F53F Clear_x_b ; ; ; ; This routine clears to 0 the block of memory starting at the ; ; address contained in the X register, and continuing for the number ; ; of bytes specified by B+1. ; ; ; ; ENTRY X-reg points to the start of the RAM to be cleared. ; ; B-reg = number of bytes minus 1 to clear. ; ; ; ; EXIT: D-reg = $FFFF ; ;-----------------------------------------------------------------------; f53f : 4f [ 2] Clear_x_b: CLRA f540 : 2006 [ 3] BRA Clear_x_d ;-----------------------------------------------------------------------; ; F542 Clear_C8_RAM (never used by GCE carts?) ; ; ; ; This routine clears to 0 the block of memory in the range ; ; $C800-$C8FF. ; ; ; ; EXIT: X-reg = $C800 ; ; D-reg = $FFFF ; ;-----------------------------------------------------------------------; f542 : 8ec800 [ 3] Clear_C8_RAM: LDX #$C800 ;-----------------------------------------------------------------------; ; F545 Clear_x_256 ; ; F548 Clear_x_d ; ; ; ; This routine clears the block of memory starting at the contained ; ; in the X register to zero. ; ; ; ; ENTRY X-reg points to the start of RAM to be cleared ; ; D-reg = number of bytes to clear minus 1 (Clear_x_d only) ; ; ; ; EXIT: D-reg = $FFFF ; ;-----------------------------------------------------------------------; f545 : cc00ff [ 3] Clear_x_256: LDD #$00FF f548 : 6f8b [10] Clear_x_d: CLR D,X f54a : 830001 [ 4] SUBD #$0001 f54d : 2af9 [ 3] BPL Clear_x_d f54f : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F550 Clear_x_b_80 ; ; F552 Clear_x_b_a ; ; ; ; This routine sets the block of memory pointed to by the X register ; ; to $80 or the A register. The B register specifies the number of ; ; bytes to be cleared. ; ; ; ; ENTRY A-reg = byte to be stored (Clear_x_b_a only) ; ; B-reg = number of bytes to clear ($00 = 256) ; ; X-reg points to start of memory block to clear ; ; ; ; EXIT: A-reg = $80 (Clear_x_b_80 only) ; ; B-reg = $00 ; ; ; ; All other registers preserved. ; ;-----------------------------------------------------------------------; f550 : 8680 [ 2] Clear_x_b_80: LDA #$80 f552 : a785 [ 5] Clear_x_b_a: STA B,X f554 : 5a [ 2] DECB f555 : 26fb [ 3] BNE Clear_x_b_a f557 : a784 [ 4] STA ,X f559 : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F55A Dec_3_Counters ; ; F55E Dec_6_Counters ; ; ; ; These routines check either the first three or all six of the ; ; default counters at $C82E-$C833 and decrements those which are not ; ; already zero. ; ; ; ; EXIT: X-reg points to the default counters at $C82E ; ; B-reg = $FF ; ; ; ; All other registers preserved. ; ;-----------------------------------------------------------------------; f55a : c602 [ 2] Dec_3_Counters: LDB #$02 f55c : 2002 [ 3] BRA LF560 f55e : c605 [ 2] Dec_6_Counters: LDB #$05 f560 : 8ec82e [ 3] LF560: LDX #Vec_Counters ;-----------------------------------------------------------------------; ; F563 Dec_Counters ; ; ; ; This routine checks the counters pointed to by the X register and ; ; decrements those which are not already zero. ; ; ; ; ENTRY B-reg = number of counters minus 1 ; ; X-reg points to counter bytes ; ; ; ; EXIT: B-reg = $FF ; ; ; ; All other registers preserved. ; ;-----------------------------------------------------------------------; f563 : 6d85 [ 7] Dec_Counters: TST B,X f565 : 2702 [ 3] BEQ LF569 f567 : 6a85 [ 7] DEC B,X f569 : 5a [ 2] LF569: DECB f56a : 2af7 [ 3] BPL Dec_Counters f56c : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F56D Delay_3 30 cycles ; ; F571 Delay_2 25 cycles ; ; F575 Delay_1 20 cycles ; ; F579 Delay_0 12 cycles ; ; F57A Delay_b 5;B + 10 cycles ; ; F57D Delay_RTS 5 cycles ; ; ; ; Each of these routines loads the B-register with the indicated ; ; value, and then loops until the B register value has decremented ; ; below zero. Delay_RTS is just an RTS instruction, but at least ; ; one GCE cartridge calls it. ; ; ; ; Cycle counts do not include timing of the instructions used to ; ; call the delay routines. ; ; ; ; ENTRY B-reg = delay count (Delay_b only) ; ; ; ; EXIT: B-reg = $FF (except Delay_RTS) ; ;-----------------------------------------------------------------------; f56d : c603 [ 2] Delay_3: LDB #$03 ;2 cycles f56f : 2009 [ 3] BRA Delay_b ;3 cycles f571 : c602 [ 2] Delay_2: LDB #$02 ;2 cycles f573 : 2005 [ 3] BRA Delay_b ;3 cycles f575 : c601 [ 2] Delay_1: LDB #$01 ;2 cycles f577 : 2001 [ 3] BRA Delay_b ;3 cycles f579 : 5f [ 2] Delay_0: CLRB ;2 cycles f57a : 5a [ 2] Delay_b: DECB ;2 cycles f57b : 2afd [ 3] BPL Delay_b ;3 cycles f57d : 39 [ 5] Delay_RTS: RTS ;5 cycles ;-----------------------------------------------------------------------; ; F57E Bitmask_a ; ; ; ; This routine takes a bit number, specified in the A register, and ; ; returns a bit mask with only the specified bit set. ; ; ; ; ENTRY A-reg contains the bit number ; ; ; ; EXIT: A-reg contains the bit mask ; ; ; ; X-reg trashed ; ;-----------------------------------------------------------------------; f57e : 8ef9dc [ 3] Bitmask_a: LDX #Bit_Masks f581 : a686 [ 5] LDA A,X f583 : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F584 Abs_a_b ; ; F58B Abs_b ; ; ; ; This routine returns the absolute value of the two single byte ; ; numbers passed in in the A and B registers. Abs_b only uses the B ; ; register. There is a special case: 0x80 is returned as 0x7F. ; ; ; ; ENTRY A-reg contains first value ; ; B-reg contains second value (Abs_a_b only) ; ; ; ; EXIT: A-reg contains absolute value of first value ; ; B-reg contains absolute value of second value (Abs_a_b only) ; ; ; ; All other registers preserved. ; ;-----------------------------------------------------------------------; f584 : 4d [ 2] Abs_a_b: TSTA f585 : 2a04 [ 3] BPL Abs_b f587 : 40 [ 2] NEGA f588 : 2801 [ 3] BVC Abs_b f58a : 4a [ 2] DECA f58b : 5d [ 2] Abs_b: TSTB f58c : 2a04 [ 3] BPL LF592 f58e : 50 [ 2] NEGB f58f : 2801 [ 3] BVC LF592 f591 : 5a [ 2] DECB f592 : 39 [ 5] LF592: RTS ;-----------------------------------------------------------------------; ; F593 Rise_Run_Angle ; ; ; ; Given a (rise,run) pair, this routine calculates the angle which ; ; corresponds to that (rise,run) pair. The returned angle is relative ; ; to the x-axis (+ is CCW), so to convert it to a Vectrex angle ; ; (relative to the y-axis, + is CCW), you must subtract the number 0x10 ; ; (90 degrees) from the returned value. ; ; ; ; ENTRY DP = $C8 ; ; A-reg = rise value ; ; B-reg = run value ; ; ; ; EXIT: A-reg = the angle from the x-axis ; ; B-reg = the angle from the x-axis ; ; ; ; All other registers preserved. ; ;-----------------------------------------------------------------------; f593 : 3410 [ 7] Rise_Run_Angle: PSHS X f595 : dd34 [ 5] STD positive rise, not on an axis, or ; ; negative run, not on an axis. ; ; 0x80 => negative rise, not on an axis, or ; ; positive run, not on an axis. ; ; 1 => positive rise, on an axis, or ; ; negative run, on an axis. ; ; 0x81 => negative rise, on an axis, or ; ; positive run, on an axis. ; ; ; ; ENTRY A-reg = the angle value ; ; ; ; EXIT: A-reg = slope? ; ; B-reg = slope direction? ; ; ; ; X-reg trashed ; ;-----------------------------------------------------------------------; f5d9 : 8b10 [ 2] Get_Rise_Idx: ADDA #$10 ;Offset angle by 90 degrees f5db : 8efc6d [ 3] Get_Run_Idx: LDX #DFC6D ;Get address of slope table f5de : 5f [ 2] CLRB f5df : 8520 [ 2] BITA #$20 ;If angle in 180-360, f5e1 : 2702 [ 3] BEQ LF5E5 f5e3 : c680 [ 2] LDB #$80 ;flag negative rise or positive run f5e5 : 841f [ 2] LF5E5: ANDA #$1F ;Mask to multiple of 180 degrees f5e7 : 8110 [ 2] CMPA #$10 ;If 90 degrees f5e9 : 2601 [ 3] BNE LF5EC f5eb : 5c [ 2] INCB ;then rise or run is on an axis f5ec : a686 [ 5] LF5EC: LDA A,X ;Get slope from slope table f5ee : 39 [ 5] RTS ;-----------------------------------------------------------------------; ; F5EF Rise_Run_Idx ; ; ; ; This routine gets the index pair for both the rise and run, using ; ; the passed-in angle value. ; ; ; ; ENTRY DP = $C8 ; ; $C836 contains the angle value ; ; ; ; EXIT: $C837-$C838 contains the index pair for the run ; ; $C839-$C83A contains the index pair for the rise ; ; ; ; D-reg trashed ; ;-----------------------------------------------------------------------; f5ef : 3410 [ 7] Rise_Run_Idx: PSHS X ;Save X-reg f5f1 : 9636 [ 4] LDA $C84F 32 nibble ADSR table ; ; header word -> $C851 8-byte "twang" table ; ; data bytes ; ; ; ; The ADSR table is simply 32 nibbles (16 bytes) of amplitude values. ; ; ; ; The twang table is 8 signed bytes to modify the base frequency of ; ; each note being played. Each channel has a different limit to its ; ; twang table index (6-8) to keep them out of phase to each other. ; ; ; ; Music data bytes: ; ; Bits 0-5 = frequency ; ; Bit 6 clear = tone ; ; Bit 6 set = noise ; ; Bit 7 set = next music data byte is for next channel ; ; Bit 7 clear, play note with duration in next music data byte: ; ; bits 0-5 = duration ; ; bit 6 = unused ; ; bit 7 set = end of music ; ; ; ; ENTRY DP = $C8 ; ; U-reg points to the start of the music data ; ; $C84D points to frequency table (Init_Music_dft only) ; ; $C856 may need to be set. ; ; ; ; D-reg, X-reg, Y-reg, U-reg trashed ; ;-----------------------------------------------------------------------; f687 : 9656 [ 4] Init_Music_chk: LDA =$80, advance to next channel f73e : e680 [ 6] LDB ,X+ ;Get second byte of music data f740 : 2a06 [ 3] BPL LF748 ;If >=$80, (terminator) f742 : bdf533 [ 9] JSR Init_Music_Buf ; clear music buffer, f745 : 0f56 [ 6] CLR 0 add twang to base frequency f78a : 8900 [ 2] ADCA #$00 ;Propagate carry to high byte f78c : ed81 [ 8] LF78C: STD ,X++ ;Store freq in regs 5/4, 3/2, 1/0 f78e : 8cc84d [ 4] CMPX #Vec_Music_Work+14 f791 : 26e5 [ 3] BNE LF778 f793 : 39 [ 5] LF793_RTS: RTS ;-----------------------------------------------------------------------; ; F7A9 Select_Game ; ; ; ; This routine provides a game with the means for allowing the player ; ; to choose the game number he would like to play, and the number of ; ; players. The game indicates the number of game versions available, ; ; by placing the value in the B register. The number of players ; ; allowed is specified in the A register. If a parameter is passed in ; ; with a value of 0, then the corresponding question will not be asked. ; ; The number of players selected is returned in $C879, while the game ; ; number selected is returned in $C87A. ; ; ; ; This routine performs most of the work involved in allowing the ; ; player to select a game version and the number of players. It ; ; displays the game # and player options, and allows the player a ; ; certain amount of time to modify their values. Anytime one of the ; ; buttons is used to modify a value, the timer will be restarted. ; ; When a button is pressed, the associated value is modified, ; ; and then redisplayed on the screen. This routine will return when ; ; either the timer expires, or button 4 is pressed. ; ; ; ; ENTRY A-reg = maximum number of players allowed ; ; B-reg = number of game versions available ; ; ; ; EXIT: DP = $C8 ; ; $C879 contains number of players selected ; ; $C87A contains the game version selected ; ; ; ; D-reg, X-reg, Y-reg trashed ; ;-----------------------------------------------------------------------; f794 : 20c0 Player_Str: FDB $20C0 f796 : 40c0 FDB $40C0 f798 : 504c41594552 FCC "PLAYER" f79e : 80 FCB $80 f79f : e0c0 Game_Str: FDB $E0C0 f7a1 : 01c0 FDB $01C0 f7a3 : 2047414d45 FCC " GAME" f7a8 : 80 FCB $80 f7a9 : fdc84f [ 6] Select_Game: STD Vec_Max_Players ;Save max players and games f7ac : 4d [ 2] TSTA ;If non-zero players specified, f7ad : 2702 [ 3] BEQ LF7B1 f7af : 8601 [ 2] LDA #$01 ; set selection to 1 f7b1 : 5d [ 2] LF7B1: TSTB ;If non-zero games specified, f7b2 : 2702 [ 3] BEQ LF7B6 f7b4 : c601 [ 2] LDB #$01 ; set selection to 1 f7b6 : fdc879 [ 6] LF7B6: STD Vec_Num_Players ;Save default selection f7b9 : bdf1af [ 9] JSR DP_to_C8 ;DP to RAM f7bc : ccf850 [ 3] LDD #$F850 f7bf : dd2a [ 5] STD U score: a = 1 ; ; 3) U score > X score: a = 2 ; ; ; ; ENTRY X-reg points to first score string (terminated with $80) ; ; U-reg points to second score string ; ; ; ; EXIT: A-reg returns result of the compare ; ; ; ; B-reg trashed ; ;-----------------------------------------------------------------------; f8c7 : 3450 [ 9] Compare_Score: PSHS X,U ;Save score pointers f8c9 : 4f [ 2] CLRA ;Default to scores are the same f8ca : e680 [ 6] LF8CA: LDB ,X+ f8cc : 2b08 [ 3] BMI LF8D6 ;Return if end of string f8ce : e1c0 [ 6] CMPB ,U+ f8d0 : 27f8 [ 3] BEQ LF8CA ;Continue if byte is the same f8d2 : 2201 [ 3] BHI LF8D5 ;Return 1 if X > U f8d4 : 4c [ 2] INCA ;Return 2 if U > X f8d5 : 4c [ 2] LF8D5: INCA f8d6 : 35d0 [11] LF8D6: PULS X,U,PC ;Restore pointers and return ;-----------------------------------------------------------------------; ; F8D8 New_High_Score ; ; ; ; This routine compares a players score string, pointed to by the ; ; X register, to the current hi score, pointed by the U register. If ; ; the player's score is higher than the currently saved hi score, then ; ; the player's score will be copied into the hi score buffer pointed ; ; to by the U register. ; ; ; ; ENTRY X-reg points to a player's score string ; ; U-reg points to the high score string (usually $CBEB?) ; ; ; ; X-reg, U-reg, D-reg trashed ; ;-----------------------------------------------------------------------; f8d8 : 8ded [ 7] New_High_Score: BSR Compare_Score ;Compare the scores f8da : 8101 [ 2] CMPA #$01 f8dc : 2606 [ 3] BNE LF8E4 ;Return if X is not > U f8de : a680 [ 6] LF8DE: LDA ,X+ ;Copy the new high score f8e0 : a7c0 [ 6] STA ,U+ f8e2 : 2afa [ 3] BPL LF8DE ;until end of string encountered f8e4 : 39 [ 5] LF8E4: RTS ;-----------------------------------------------------------------------; ; F8E5 Obj_Will_Hit_u ; ; F8F3 Obj_Will_Hit ; ; ; ; This routine first modifies the position of the object, and then it ; ; checks to see if the missile has hit the object. The Y register ; ; contains the (y,x) position of the object, the U register contains ; ; a pointer to the (y,x) modification values, the X register contains ; ; the missile (y,x) position, and the D register contains the ; ; (height/2, width/2) of the object. ; ; ; ; (0,u) is temporarily added to the y position of the object, and ; ; (1,u) is temporarily added to the x position. ; ; ; ; ENTRY Y-reg = (y,x) position of the object ; ; X-reg = (y,x) position of the missile ; ; U-reg points to movement (y,x) (Mov_Obj_Hit_u only) ; ; U-reg = movement (y,x) (Mov_Obj_Hit only) ; ; D-reg = (h/2,w/2) size of object ; ; ; ; EXIT: Carry bit set if the object & missile have collided ; ; ; ; ALL registers saved. Even the original Y-register. ; ;-----------------------------------------------------------------------; f8e5 : 3420 [ 7] Obj_Will_Hit_u: PSHS Y ;Save regs for the hit-test code f8e7 : 3436 [11] PSHS D,X,Y f8e9 : ec64 [ 6] LDD 4,S ;Get object position f8eb : abc4 [ 4] ADDA ,U ;Add it to the modification values f8ed : eb41 [ 5] ADDB 1,U f8ef : ed64 [ 6] LF8EF: STD 4,S ;Put updated object position back f8f1 : 2010 [ 3] BRA LF903 ;Go do the hit-test f8f3 : 3420 [ 7] Obj_Will_Hit: PSHS Y ;Save regs for the hit-test code f8f5 : 3436 [11] PSHS D,X,Y f8f7 : 1f30 [ 6] TFR U,D ;Get modification values f8f9 : ab64 [ 5] ADDA 4,S ;Add them to the object position f8fb : eb65 [ 5] ADDB 5,S f8fd : 20f0 [ 3] BRA LF8EF ;Put update position back and hit-test ;-----------------------------------------------------------------------; ; F8FF Obj_Hit ; ; ; ; Thit routine checks to see if a missile hashit an object. If the ; ; missile has hit the object, then the carry bit will be set; ; ; otherwise, the carry bit will be cleared. A hit is checked for in ; ; the following fashion: ; ; ; ; if (object y-height/2) <= missile y <= (object y+height/2) ; ; and ; ; (object x-width/2) <= missile x <= (object x+width/x) ; ; ; ; then the missile hit, otherwise it missed. ; ; ; ; ENTRY Y-reg = (y,x) position of the object ; ; X-reg = (y,x) position of the missile ; ; D-reg = (h/2,w/2) size of object ; ; ; ; EXIT: Carry bit set if the object & missile have collided ; ; ; ; All registers preserved. ; ;-----------------------------------------------------------------------; f8ff : 3420 [ 7] Obj_Hit: PSHS Y ;Save some regs f901 : 3436 [11] PSHS D,X,Y f903 : 1f41 [ 6] LF903: TFR S,X ;Point X to the stack f905 : 5f [ 2] CLRB ;Offset to point to y f906 : 3a [ 3] LF906: ABX f907 : a604 [ 5] LDA 4,X ;Get height/2 f909 : ab84 [ 4] ADDA ,X ;Add object y f90b : 2802 [ 3] BVC LF90F f90d : 867f [ 2] LDA #$7F ;Set to $7F if overflow f90f : a102 [ 5] LF90F: CMPA 2,X ;Branch if missile out of range f911 : 2d15 [ 3] BLT LF928 f913 : a604 [ 5] LDA 4,X ;Get height/2 f915 : a084 [ 4] SUBA ,X ;Subtract object y f917 : 2802 [ 3] BVC LF91B f919 : 8680 [ 2] LDA #$80 ;Set to $80 if overflow f91b : a102 [ 5] LF91B: CMPA 2,X ;Branch if missile out of range f91d : 2e09 [ 3] BGT LF928 f91f : 5c [ 2] INCB ;Offset to point to x f920 : c102 [ 2] CMPB #$02 f922 : 25e2 [ 3] BCS LF906 ;Go back for x f924 : 1a01 [ 3] ORCC #$01 ;Object in range, set carry f926 : 2002 [ 3] BRA LF92A f928 : 1cfe [ 3] LF928: ANDCC #$FE ;Object not in range, clear carry f92a : 3536 [11] LF92A: PULS D,X,Y f92c : 35a0 [ 9] PULS Y,PC ;-----------------------------------------------------------------------; ; F92E Explosion_Snd ; ; ; ; This routine appears to generate some type of an explosion sound, ; ; dependent upon the 4 bytes which are pointed to by the U register. ; ; You will probably need to call Do_Sound for this to do anything. ; ; ; ; The format of the 4-byte block is: ; ; 1) Bits 0-2 = ? Stored in $C85D ; ; Bits 3-5 = ? Stored in $C853 ; ; Bits 6-7 = 0 ; ; Bits 0-2 and 3-5 are ORed and stored in bits 0-2 of ; ; $C854 ; ; 2) <0 = ? Something to do with register 6 ; ; =0 = ? ; ; >0 = ? ; ; 3) <0 = ? ; ; =0 = ? ; ; >0 = ? ; ; 4) Speed? Higher values = lower duration? ; ; ; ; ENTRY DP = $C8 ; ; U-reg points to 4-byte block of data if $C867 high bit set ; ; ; ; D-reg, X-reg trashed ; ;-----------------------------------------------------------------------; f92e : 9667 [ 4] Explosion_Snd: LDA