*************************************************************************** **************************************************************************** ** ** Platinum Edition (Startup/interrupt/timing code) ** ** This software is in the public domain. There is no warranty. ** ** by Patrick Davidson (pad@calc.org, http://pad.calc.org/) ** ** Last updated September 17, 2001 ** **************************************************************************** **************************************************************************** ******************************************** INITIALIZATION data_size equ data_end-data_start score_size equ 24*8 var_size equ data_size+score_size+2+4+7 initialize_all: sf game_started(a5) ; initialize configuration data clr.w ludicrous(a5) clr.w classic(a5) move.w #1,difficulty(a5) clr.w back_type(a5) bra.s data_ready start_program: lea call_old_int1(pc),a0 move.l a0,$64 lea -offset(a7),a7 ; allocate local variables lea (a7),a5 jsr _get_data_file ; attempt to load data file move.l a0,d0 beq.s initialize_all ; NULL -> nothing found cmp.w #var_size-2,(a0)+ bne.s initialize_all ; data invalid if wrong size cmp.l #VERSION,(a0)+ bne.s initialize_all ; data invalid if wrong version lea data_start(a5),a1 move.w #(data_size/2)-1,d0 ; load variable data \lvd: move.w (a0)+,(a1)+ dbra d0,\lvd lea High_Score_Data(pc),a1 ; load score data move.w #(score_size/2)-1,d0 \lsd: move.w (a0)+,(a1)+ dbra d0,\lsd data_ready: bsr Initialize_Info bsr Activate_Grayscale beq.s oh_no_the_sky_is_falling bsr Grayscale_Post_Init bsr main_game exit_program: bsr Deactivate_Grayscale oh_no_the_sky_is_falling: move.w #var_size,d6 ; attempt to create save file jsr _create_save_file move.l a0,d0 ; NULL -> unable to create beq.s \no_save move.w #var_size-2,(a0)+ ; put variable size move.l #VERSION,(a0)+ lea data_start(a5),a1 ; save variables move.w #(data_size/2)-1,d0 \svd: move.w (a1)+,(a0)+ dbra d0,\svd lea High_Score_Data(pc),a1 ; save score data move.w #(score_size/2)-1,d0 \ssd: move.w (a1)+,(a0)+ dbra d0,\ssd lea final_data(pc),a1 ; put system junk at end of data moveq #6,d0 \sfd: move.b (a1)+,(a0)+ dbra d0,\sfd \no_save: lea offset(a5),a7 rts final_data: dc.b 0,'PlEd',0,$F8 EVEN