diff --git a/source.asm b/source.asm index 5d3b65a..0ffc7ed 100644 --- a/source.asm +++ b/source.asm @@ -220,35 +220,71 @@ mainloop: ; debug command, use w 0 100 2 to set a breakpoint here clr.w $100 + move.w #0,d2 + move.w #0,d3 ; detect joystick left/right - move.w #0,d1 - ; move.l #%100000010,d2 - ; and.l JOY1DAT,d2 - move.w JOY1DAT,d2 - btst.l #9,d2 + ; move.w JOY1DAT,d2 + ; btst.l #9,d2 + ; bne move_left + ; btst.l #1,d2 + ; bne move_right + ; bra done_joy + ; jmp done_joy_left_right + + ; http://eab.abime.net/showthread.php?t=75779&page=3 + move.l JOY0DAT,d0 + move.l d0,d1 + add.l d1,d1 + eor.l d0,d1 + btst.l #9,d0 ; left bne move_left - btst.l #1,d2 + btst.l #1,d0 ; right bne move_right - ; bra done_joy - jmp done_joy + bra joy_up_down move_left: - move.w #-1,d1 - bra done_joy + move.w #-1,d2 + bra joy_up_down move_right: - move.w #1,d1 + move.w #1,d2 + joy_up_down: + + btst.l #9,d1 ; up + bne move_up + btst.l #1,d1 ; down + bne move_down + bra done_joy + move_up: + bra done_joy + move_down: + move.w #$100,d3 done_joy: + move.w #-$100,d3 + ship_update: ; animate the sprite ; first load the current x position (from ship address) into a data register move.w SHIP_DST,d0 - ; add 1 - add.w d1,d0 + add.w d2,d0 andi.w #$00ff,d0 - ; AND with 0xff00? ; then write it back to the the ship address - it is the first word - and.w #$ff00,SHIP_DST + and.w #$ff00,SHIP_DST ; first zero the bits to be used for the new position or.w d0,SHIP_DST + bra skip + ; move vertically + move.w SHIP_DST,d0 + add.l d3,d0 + andi.l #$ff00,d0 + and.l #$00ff,SHIP_DST + or.l d0,SHIP_DST + + move.w SHIP_DST+1,d0 + add.l d3,d0 + andi.l #$ff00,d0 + and.l #$00ff,SHIP_DST+1 + or.l d0,SHIP_DST+1 + skip: + ; if mousebutton/joystick 1 or 2 pressed then exit ; mouse/joy button 1 btst.b #6,CIAAPRA