**************************************************************************** **************************************************************************** ** ** Monster (Game over routines) ** ** Copyright 2004 by Patrick Davidson. This software may be freely ** modified and/or copied with no restrictions. There is no warranty. ** ** by Patrick Davidson (pad@calc.org, http://pad.calc.org/) ** ** Last updated September 15, 2004 ** **************************************************************************** **************************************************************************** IFND ti89 EG_FONT set 2 EG_TY set 16 EG_TX set 65 EG_SY set 36 EG_SPACE set 11 EG_FY set 80 EG_HS1 set 96 EG_HS2 set 108 IS89 set 0 ENDIF IFD ti89 EG_FONT set 1 EG_TY set 12 EG_TX set 45 EG_SY set 22 EG_SPACE set 8 EG_FY set 56 EG_HS1 set 80 EG_HS2 set 90 IS89 set 1 ENDIF ******************************************** GAME FINISHED Clear_Screen: lea LCD_MEM,a0 move.w #959,d0 \l: clr.l (a0)+ dbra d0,\l rts Game_Finished: bsr.s Clear_Screen moveq #EG_FONT,d0 bsr Set_Font ; Set font to very large lea endt1(pc),a0 ; Monster - Game Completed moveq #2,d0 moveq #14-8*IS89,d1 bsr Display_String lea endt3(pc),a0 ; Base Score move.l score(a5),d0 moveq #EG_SY,d7 bsr Display_Score lea endt4(pc),a0 ; Speed score move.l speed_bonus(a5),d0 moveq #EG_SY+EG_SPACE,d7 bsr Display_Score_ lea endt5(pc),a0 ; Lives score move.w lives(a5),d0 add.w d0,d0 bsr Convert_To_BCD move.b temp_buffer(a5),d0 ext.w d0 ext.l d0 mulu #$1000,d0 moveq #EG_SY+EG_SPACE*2,d7 bsr Display_Score_ lea endt6(pc),a0 ; Victory bonus moveq #0,d0 tst.w lives(a5) beq.s \lost move.l victory_bonus(a5),d0 \lost: moveq #EG_SY+EG_SPACE*3,d7 bsr Display_Score_ lea endt7(pc),a0 ; Total score move.l score(a5),d6 move.l #$999999,d0 cmp.l d0,d6 ble.s \ok move.l d0,d6 \ok: move.l d6,d0 moveq #EG_FY,d7 bsr Display_Score lea High_Score_Data+192(pc),a2 ; See if player entered table moveq #-7,d4 ; D4 = # longs to shift down find_place_loop: cmp.l -(a2),d6 ble.s not_beaten addq.w #6,d4 lea -20(a2),a2 bra.s find_place_loop not_beaten: cmp.w #-7,d4 beq.s no_high_score tst.w d4 blt.s no_shift_scores lea High_Score_Data+192(pc),a4 lea High_Score_Data+168(pc),a3 shift_scores: move.l -(a3),-(a4) dbra d4,shift_scores no_shift_scores: move.l d6,24(a2) addq.l #4,a2 ; A2 -> Name entry place bsr Input_Name bra.s Display_High_Scores no_high_score: moveq #EG_HS1,d0 ; Sorry - No Highscore moveq #0,d1 lea endt8(pc),a0 bsr Display_String moveq #EG_HS2,d0 ; Press enter to continue moveq #0,d1 lea endt10(pc),a0 bsr Display_String gf_wait_enter: bsr Get_Key cmp.w #13,d0 bne.s gf_wait_enter ******************************************** DISPLAY HIGH SCORES Display_High_Scores: bsr Clear_Screen ; Display high scores moveq #EG_FONT,d0 bsr Set_Font ; Set font lea endt11(pc),a0 moveq #2,d0 moveq #34-(IS89*10),d1 bsr Display_String moveq #EG_HS2,d0 ; Press enter to continue moveq #0,d1 lea endt10(pc),a0 bsr Display_String lea High_Score_Data,a3 moveq #18-(IS89*4),d7 moveq #7,d6 hs_show_loop: move.l d7,d0 moveq #1,d1 lea (a3),a0 bsr Display_String lea 20(a3),a3 move.l (a3)+,-(sp) pea endt7-5(pc) pea _string_buffer(a5) bsr ____sprintf lea 12(sp),sp lea _string_buffer(a5),a0 move.l d7,d0 move.w #166-(44*IS89),d1 bsr Display_String add.w #11-(3*IS89),d7 dbra d6,hs_show_loop hs_wait_enter: bsr Get_Key cmp.w #13,d0 bne.s hs_wait_enter rts Display_Score_: lea temp_buffer(a5),a6 move.l d0,(a6)+ bsr Display_Score lea (a6),a0 lea score+4(a5),a1 bra Add_BCD Display_Score: lea _string_buffer(a5),a4 ; A4 -> string buffer move.l d0,-(sp) ; Push number pea (a0) ; Push string pea (a4) ; Push buffer address bsr ____sprintf lea 12(sp),sp lea (a4),a0 moveq #3,d1 move.l d7,d0 bra Display_String ******************************************** GET PLAYER'S NAME Input_Name: lea (a2),a4 ; A4 -> Entry area moveq #19,d0 in_loop_clear: ; Blank out the name move.b #32,(a2)+ dbra d0,in_loop_clear lea (a4),a1 moveq #0,d6 ; D6 = Character number moveq #EG_HS1,d0 ; Sorry - No Highscore moveq #0,d1 lea endt9(pc),a0 bsr Display_String inpuths: lea (a4),a0 ; Display text moveq #EG_HS2,d0 moveq #0,d1 bsr Display_String bsr Get_Key ; Read a keypress cmp.w #13,d0 ; Done if [ENTER] pressed beq.s done_hs cmp.w #255,d0 ble.s char cmp.w #257,d0 beq.s backsp bra.s inpuths backsp: tst.w d6 beq.s inpuths sub.w #1,d6 move.b #32,0(a4,d6.w) bra.s inpuths char: cmp.w #20,d6 beq.s inpuths move.b d0,0(a4,d6.w) addq.w #1,d6 bra.s inpuths done_hs: rts ******************************************** SCORING DATA endt1: dc.b 'Monster - Game Over!!',0 endt2: dc.b 'Final Scoring:',0 endt3: dc.b 'Base score %6lx',0 endt4: dc.b 'Speed bonus %6lx',0 endt5: dc.b 'Lives bonus %6lx',0 endt6: dc.b 'Victory bonus %6lx',0 endt7: dc.b 'Total score %6lx',0 endt8: dc.b 'You don''t have a highscore.',0 endt9: dc.b 'Highscore! Enter your name',0 endt10: dc.b '> Press enter to continue <',0 endt11: dc.b 'Monster High Scores',0 CNOP 0,2 dc.l $79999999 High_Score_Data: dc.b 'Patrick Davidson ',0 dc.l $150000 dc.b 'Madonna ',0 dc.l $100000 dc.b 'Britney ',0 dc.l $75000 dc.b 'Alizée ',0 dc.l $50000 dc.b 'Jean-Marie Le Pen ',0 dc.l $40000 dc.b 'no one ',0 dc.l $30000 dc.b 'no one ',0 dc.l $20000 dc.b 'no one ',0 dc.l $10000