; --------------------------------------------------------------------------- ; Subroutine to change what you're selecting in the level select ; --------------------------------------------------------------------------- ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| LevSelControls: ; XREF: LevelSelect move.b (v_jpadpress1).w,d1 andi.b #btnUp+btnDn,d1 ; is up/down pressed and held? bne.s LevSel_UpDown ; if yes, branch subq.w #1,(v_levseldelay).w ; subtract 1 from time to next move bpl.w LevSel_ChkSndTest ; if time remains, branch LevSel_UpDown: move.w #$B,(v_levseldelay).w ; reset time delay move.b (v_jpadhold1).w,d1 andi.b #btnUp+btnDn,d1 ; is up/down pressed? beq.w LevSel_ChkSndTest ; if not, branch move.w (v_levselitem).w,d0 btst #bitUp,d1 ; is up pressed? beq.s LevSel_Down ; if not, branch subq.w #1,d0 ; move up 1 selection bhs.s LevSel_Down moveq #$15,d0 ; if selection moves below 0, jump to selection $15 LevSel_Down: btst #bitDn,d1 ; is down pressed? beq.s LevSel_Refresh ; if not, branch addq.w #1,d0 ; move down 1 selection cmpi.w #$16,d0 blo.s LevSel_Refresh moveq #0,d0 ; if selection moves above $15, jump to selection 0 LevSel_Refresh: move.w d0,(v_levselitem).w ; set new selection bsr.w LevSelTextLoad ; refresh text rts ; =========================================================================== LevSel_ChkSndTest: ; XREF: LevSelControls cmpi.w #$14,(v_levselitem).w ; is item $14 selected? bne.s LevSel_ChkGimmickChoice ; if not, branch move.b (v_jpadpress1).w,d1 andi.b #btnR+btnL,d1 ; is left/right pressed? beq.s LevSel_NoMove ; if not, branch move.w (v_levselsound).w,d0 btst #bitL,d1 ; is left pressed? beq.s LevSel_Right ; if not, branch subq.w #1,d0 ; subtract 1 from sound test bhs.s LevSel_Right moveq #$4F,d0 ; if sound test moves below 0, set to $4F LevSel_Right: btst #bitR,d1 ; is right pressed? beq.s LevSel_Refresh2 ; if not, branch addq.w #1,d0 ; add 1 to sound test cmpi.w #$4F,d0 blo.s LevSel_Refresh2 moveq #0,d0 ; if sound test moves above $4F, set to 0 LevSel_Refresh2: move.w d0,(v_levselsound).w ; set sound test number bsr.w LevSelTextLoad ; refresh text LevSel_NoMove: rts ; =========================================================================== LevSel_ChkGimmickChoice: ; XREF: LevSelControls cmpi.w #$15,(v_levselitem).w ; is item $15 selected? bne.s LevSel_NoMove_Gim ; if not, branch move.b (v_jpadpress1).w,d1 andi.b #btnR+btnL,d1 ; is left/right pressed? beq.s LevSel_NoMove_Gim ; if not, branch move.w (v_gimmickchoice).w,d0 btst #bitL,d1 ; is left pressed? beq.s LevSel_Right_Gim ; if not, branch subq.w #1,d0 ; subtract 1 from gimmick choice bhs.s LevSel_Right_Gim moveq #$10,d0 ; if gimmick choice moves below 0, set to $4F LevSel_Right_Gim: btst #bitR,d1 ; is right pressed? beq.s LevSel_Refresh2_Gim ; if not, branch addq.w #1,d0 ; add 1 to gimmick choice cmpi.w #$10,d0 blo.s LevSel_Refresh2_Gim moveq #0,d0 ; if gimmick choice moves above $10, set to 0 LevSel_Refresh2_Gim: move.w d0,(v_gimmickchoice).w ; set gimmick choice number bsr.w LevSelTextLoad ; refresh text LevSel_NoMove_Gim: rts ; End of function LevSelControls ; --------------------------------------------------------------------------- ; Subroutine to load level select text ; --------------------------------------------------------------------------- ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| LevSelTextLoad: ; XREF: GM_Title textpos: = ($40000000+(($E210&$3FFF)<<16)+(($E210&$C000)>>14)) ; $E210 is a VRAM address lea (LevelMenuText).l,a1 lea (vdp_data_port).l,a6 move.l #textpos,d4 ; text position on screen move.w #$E680,d3 ; VRAM setting (4th palette, $680th tile) moveq #$15,d1 ; number of lines of text LevSel_DrawAll: move.l d4,4(a6) bsr.w LevSel_ChgLine ; draw line of text addi.l #$800000,d4 ; jump to next line dbf d1,LevSel_DrawAll moveq #0,d0 move.w (v_levselitem).w,d0 move.w d0,d1 move.l #textpos,d4 lsl.w #7,d0 swap d0 add.l d0,d4 lea (LevelMenuText).l,a1 lsl.w #3,d1 move.w d1,d0 add.w d1,d1 add.w d0,d1 adda.w d1,a1 move.w #$C680,d3 ; VRAM setting (3rd palette, $680th tile) move.l d4,4(a6) bsr.w LevSel_ChgLine ; recolour selected line move.w #$E680,d3 cmpi.w #$15,(v_levselitem).w beq.w LevSel_ChkSndTest2 bsr.w LevSel_DrawGim LevSel_ChkSndTest2: cmpi.w #$14,(v_levselitem).w bne.s LevSel_DrawSnd move.w #$C680,d3 LevSel_DrawSnd: locVRAM $EC30 ; sound test position on screen move.w (v_levselsound).w,d0 addi.w #$80,d0 move.b d0,d2 lsr.b #4,d0 bsr.w LevSel_ChgSnd ; draw 1st digit move.b d2,d0 bsr.w LevSel_ChgSnd ; draw 2nd digit rts LevSel_DrawGim: locVRAM $ECB0 ; gimmick option position on screen move.w (v_gimmickchoice).w,d0 move.b d0,d2 lsr.b #4,d0 bsr.w LevSel_ChgSnd ; draw 1st digit move.b d2,d0 bsr.w LevSel_ChgSnd ; draw 2nd digit rts ; End of function LevSelTextLoad ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| LevSel_ChgSnd: ; XREF: LevSelTextLoad andi.w #$F,d0 cmpi.b #$A,d0 ; is digit $A-$F? blo.s LevSel_Numb_Snd ; if not, branch addi.b #4,d0 ; use alpha characters LevSel_Numb_Snd: add.w d3,d0 move.w d0,(a6) rts ; End of function LevSel_ChgSnd ; ||||||||||||||| S U B R O U T I N E ||||||||||||||||||||||||||||||||||||||| LevSel_ChgLine: ; XREF: LevSelTextLoad moveq #$17,d2 ; number of characters per line LevSel_LineLoop: moveq #0,d0 move.b (a1)+,d0 ; get character bpl.s LevSel_CharOk ; branch if valid move.w #0,(a6) ; use blank character dbf d2,LevSel_LineLoop rts LevSel_CharOk: cmp.w #$40,d0 ; Check for $40 (End of ASCII number area) blt.s @notText ; If this is not an ASCII text character, branch sub.w #$3,d0 ; Subtract an extra 3 (Compensate for missing characters in the font) @notText: sub.w #$30,d0 ; Subtract #$33 (Convert to S2 font from ASCII) add.w d3,d0 ; combine char with VRAM setting move.w d0,(a6) ; send to VRAM dbf d2,LevSel_LineLoop rts ; End of function LevSel_ChgLine ; =========================================================================== ; --------------------------------------------------------------------------- ; Level select menu text ; --------------------------------------------------------------------------- LevelMenuText: if Revision=0 dc.b "GREEN HILL ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "LABYRINTH STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "MARBLE ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "STAR LIGHT ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "SPRING YARD ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "SCRAP BRAIN ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "FINAL ZONE " dc.b "SPECIAL STAGE " dc.b "SOUND TEST " dc.b "GIM CHOICE " even else dc.b "GREEN HILL ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "MARBLE ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "SPRING YARD ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "LABYRINTH STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "STAR LIGHT ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "SCRAP BRAIN ZONE STAGE 1" dc.b " STAGE 2" dc.b " STAGE 3" dc.b "FINAL ZONE " dc.b "SPECIAL STAGE " dc.b "SOUND TEST " dc.b "CHOSEN GIMMICK " endc
Comments
0 B
|0 👍
/0 👎
0 B
|👍
/👎