Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- moveBall:
- horizontalCheck:
- lda #horizontalMovementRight
- bit ballDirection ;check if direction to the right
- bne right
- left:
- lda ballX
- cmp #AREA_MIN_X
- beq switchHorizontalDirection
- dec ballX ; no left wall, x-- and go to vertical
- jmp verticalCheck
- right:
- lda ballX
- cmp #AREA_MAX_X ;check for right wall
- beq switchHorizontalDirection
- inc ballX ; no right wall, x++ and go to vertical check
- jmp verticalCheck ;
- switchHorizontalDirection:
- lda ballDirection ; toggle horizontal bit
- eor #horizontalMovementRight
- sta ballDirection
- jmp horizontalCheck ; and check again for the new direction
- verticalCheck:
- lda #verticalMovementDown
- bit ballDirection ;check if direction to the down
- bne down
- up:
- lda ballY
- cmp #AREA_MIN_Y
- beq switchVerticalDirection
- dec ballY ; no top wall
- jmp endMoveBall
- down:
- lda ballY
- cmp #AREA_MAX_Y
- beq switchVerticalDirection
- inc ballY ; no bottom wall
- jmp endMoveBall
- switchVerticalDirection:
- lda ballDirection ; toggle horizontal bit
- eor #verticalMovementDown
- sta ballDirection
- jmp verticalCheck ; and check again for the new direction
- endMoveBall:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement