;############## CMonster by Patrick Davidson - TI-84 Plus CSE decompressor/loader #include ti84pcse.inc #define WORDLEN 2 #include data.asm data_save =saved_flag score_save =high_scores load_area =$c000 .org userMem-2 .db $EF,$69 call _maybe_RunIndicOff ld hl,copy_source ld de,plotSScreen ld bc,768 ldir ld a,1 out ($20),a ; maximum CPU speed ld a,$45 out ($30),a ; set timer frequency to 2048Hz call Read_Files ; read from variables if possible ld a,7 ; map temporary page at $C000 out (5),a ld hl,compressed_data ld de,load_area call Decompress ; decompress the game to the $C000 page call load_area ; run main game code xor a ; restore usual RAM at $C000 out (5),a call Write_Files ; write to variables if needed bcall(_DrawStatusBar) bcall(_maybe_ClrScrn) bjump(_DelRes) Add_6_Digits_BCD: ld b,6 loop_add_nocarry: xor a loop_add: dec hl dec de ld a,(de) adc a,(hl) sub '0' ; '0' was added twice because both ASCII cp '0'+10 jr c,loop_add_nocarry_end sub 10 ccf ld (hl),a djnz loop_add ret loop_add_nocarry_end: ld (hl),a djnz loop_add_nocarry ret compressed_data: #import compressed.bin #if ($ > $c000) .echo "CSE Loader overflow of available memory by ",eval($ - $c000) .error "!!!!!!!!!!!!!!!!!!!! DISASTER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!" #else .echo "Bytes left over for CSE loader: ",eval($c000 - $) #endif #include savedata.asm copy_source: .org plotSScreen #include "..\ti86\lite86\lite86.asm" #include save.asm