From 6a2ffb1b4f6d2976e23e5a5f34e0a315de0c7036 Mon Sep 17 00:00:00 2001 From: alpine9000 Date: Thu, 12 May 2016 09:39:37 +1000 Subject: [PATCH] new joystick wait --- 028.bs/foreground.tmx | 2 +- 028.bs/game1.s | 51 ++++++++++++++----------------------------- 028.bs/joystick.s | 19 +++++++++++++++- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/028.bs/foreground.tmx b/028.bs/foreground.tmx index 5b86e11..1e5ad4d 100644 --- a/028.bs/foreground.tmx +++ b/028.bs/foreground.tmx @@ -18,7 +18,7 @@ - eJztVVsOgzAMo9fZLRiDsfe0rdv9b7IhrVKoSOOkFeIDf4LtJPZHq2rFkrB1ek0Nah5ONyPwjoadJM+5UGLekG8q48aNuRZ/6vEUPE6ZNzUFMrF6IDrp/pAxkjXtbsfwz8x3jh/jkOC9MrKe2ivHD9Fas/C//+0/655w75GO9uEVPQa0ANcTDsK/ALflQKPfKL2H++L9pTz7RCdxXwg6QWPxfCs03Pxr4beG85Pun4L2ndBmuE/wLX3MiZuw32fh+6/A8QXUoxQE + eJztVVsOgjAQpNfxFooooqIBq/e/CZDQpJbusw3hg/mEmdnZ2Y8WxY4t4WTkmiNT0xnZDMdrFJkoz7WQY97UL9Zxaf65Gn/foyc87ok7lRk60XpwdNT+ruNY1x+z5DreGfB9AN8hfogbwgvzSBDLleLH0Wq7sOP/au669rhv5B4WuSOEisG1HofDfzJ2S4FEfxB6T/uF+ak+a+Qm4b04uBAajedXoIHmt5nfGsiP2j8G6Tsh7fCK8DX3WBMvIt9v4/l38DEAYj8UWQ== diff --git a/028.bs/game1.s b/028.bs/game1.s index 8acfdb5..c071960 100644 --- a/028.bs/game1.s +++ b/028.bs/game1.s @@ -150,12 +150,7 @@ SetupBoardLoop: bra SetupBoardLoop .gotoGameLoop: add.l #1,d6 - jsr WaitVerticalBlank - cmp.l #50,d6 - ble .gotoGameLoop - jsr ReadJoystick - btst.b #0,joystick - beq .gotoGameLoop + jsr WaitForJoystick move.w #0,moving move.l #FOREGROUND_SCROLL_PIXELS,foregroundScrollPixels bsr HideMessagePanel @@ -181,7 +176,8 @@ FadeInLoop: bra GameLoop .c1: bra FadeInLoop - + + GameLoop: move.l verticalBlankCount,d0 @@ -306,18 +302,9 @@ GameOver: move.w #128,d0 jsr Message jsr InstallPaletteA - - move.l #100,d0 -.pause: - jsr WaitVerticalBlank - dbra d0,.pause - -.waitForJoystick: - jsr ReadJoystick - btst.b #0,joystick - bne .gotJoystick - bra .waitForJoystick -.gotJoystick: + + jsr WaitForJoystick + move.l #level1ForegroundMap,startForegroundMapPtr move.l #level1PathwayMap,startPathwayMapPtr move.l #'0004',livesCounterText @@ -345,19 +332,9 @@ LevelComplete: lea levelCompleteMessage,a1 move.w #100,d0 jsr Message + + jsr WaitForJoystick - move.l #100,d0 -.pause: - jsr WaitVerticalBlank - jsr PlayNextSound - dbra d0,.pause - -.waitForJoystick: - jsr ReadJoystick - btst.b #0,joystick - bne .gotJoystick - bra .waitForJoystick -.gotJoystick: move.l #level1ForegroundMap,startForegroundMapPtr move.l #level1PathwayMap,startPathwayMapPtr move.l #'0004',livesCounterText @@ -532,9 +509,9 @@ RenderPathway: rts -ClearPathway: +ClearPathway: sub.w #1,pathwayClearPending - move.w pathwayXIndex,d5 ; x index + move.w pathwayXIndex,d5 ; x index .loopX: move.w #6,d6 ; y index .loopY: @@ -542,6 +519,12 @@ ClearPathway: bsr GetMapTile move.l d0,a2 move.w (a2),d0 + + if 0 + move.l foregroundMapPtr,a3 + move.w (a3),d0 + endif + cmp.w #0,d0 beq .dontBlit @@ -565,8 +548,6 @@ ClearPathway: jsr BlitTile bra .next .dontBlit: - cmp.w pathwayXIndex,d5 - beq .next .next: dbra d6,.loopY dbra d5,.loopX diff --git a/028.bs/joystick.s b/028.bs/joystick.s index 760ec8a..7443e86 100644 --- a/028.bs/joystick.s +++ b/028.bs/joystick.s @@ -1,6 +1,7 @@ ;; http://eab.abime.net/showpost.php?p=986196&postcount=2 xdef ReadJoystick + xdef WaitForJoystick xdef joystick xdef joystickpos @@ -28,7 +29,23 @@ ReadJoystick: .conv: dc.b 0,5,4,3,1,0,3,2,8,7,0,1,7,6,5,0 +WaitForJoystick: +.joystickPressed: + jsr ReadJoystick + jsr WaitVerticalBlank + jsr PlayNextSound + btst.b #0,joystick + bne .joystickPressed +.wait: + jsr ReadJoystick + jsr WaitVerticalBlank + jsr PlayNextSound + btst.b #0,joystick + beq .wait + rts + joystick: dc.b 0 joystickpos: - dc.b 0 \ No newline at end of file + dc.b 0 + \ No newline at end of file