Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .StandardControls:
- .ReadUp_P1:
- LDA buttons1 ;player 1 - Up
- AND #%00001000
- BEQ .ReadUp_P1Done
- LDA #$01 ;1=up,2=down,3=left,4=right
- STA CharacterDirection
- JSR MoveCartUp
- JSR CartToIsoConvert
- RTS
- .ReadUp_P1Done:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .ReadDown_P1:
- LDA buttons1 ;Player 1 - Down
- AND #%00000100
- BEQ .ReadDown_P1Done
- LDA #$02 ;1=up,2=down,3=left,4=right
- STA CharacterDirection
- JSR MoveCartDown
- JSR CartToIsoConvert
- RTS
- .ReadDown_P1Done:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .ReadLeft_P1:
- LDA buttons1 ;Player 1 - Left
- AND #%00000010
- BEQ .ReadLeft_P1Done
- LDA #$03 ;1=up,2=down,3=left,4=right
- STA CharacterDirection
- JSR MoveCartLeft
- JSR CartToIsoConvert
- RTS
- .ReadLeft_P1Done:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .ReadRight_P1:
- LDA buttons1 ;Player 1 - Right
- AND #%00000001
- BEQ .ReadRight_P1Done
- LDA #$04 ;1=up,2=down,3=left,4=right
- STA CharacterDirection
- JSR MoveCartRight
- JSR CartToIsoConvert
- RTS
- .ReadRight_P1Done:
- PlayingInputDone:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- RTS
- MoveCartUp:
- LDA main_char_cart_y_lo ;Subpixel Movement
- SEC
- SBC #movement_speed
- STA main_char_cart_y_lo
- BCS MoveCartUpDone ;If the Carry Flag is set, don't move character
- LDA main_char_cart_y_hi
- SBC #$01 ;Subtract Carry and $01
- STA main_char_cart_y_hi
- MoveCartUpDone:
- RTS
- MoveCartDown:
- LDA main_char_cart_y_lo ;Subpixel Movement
- CLC
- ADC #movement_speed
- STA main_char_cart_y_lo
- BCC MoveCartDownDone ;If the Carry Flag is cleared, don't move character
- LDA main_char_cart_y_hi
- ADC #$01 ;Add Carry and $01
- STA main_char_cart_y_hi
- MoveCartDownDone:
- RTS
- MoveCartLeft:
- LDA main_char_cart_x_lo ;Subpixel Movement
- SEC
- SBC #movement_speed
- STA main_char_cart_x_lo
- BCS MoveCartLeftDone ;If the Carry Flag is set, don't move character
- LDA main_char_cart_x_hi
- SBC #$01 ;Subtract Carry and $01
- STA main_char_cart_x_hi
- MoveCartLeftDone:
- RTS
- MoveCartRight:
- LDA main_char_cart_x_lo ;Subpixel Movement
- CLC
- ADC #movement_speed
- STA main_char_cart_x_lo
- BCC MoveCartRightDone ;If the Carry Flag is cleard, don't move character
- LDA main_char_cart_x_hi
- ADC #$01 ;Add Carry and $01
- STA main_char_cart_x_hi
- MoveCartRightDone:
- RTS
- CartToIsoConvert: ;Convert the Coords to show the sprites on the correct part of the screen
- ;Convert Cartesian X Coord to Isometric X Coord
- LDA main_char_cart_x_hi ;isoX = cartX - cartY
- SEC
- SBC main_char_cart_y_hi
- STA main_char_screen_x
- CLC
- ADC room_x_offset ;Add the Offset to Iso X for the room type
- STA main_char_screen_x
- ;Convert Cartesian Y Coord to Isometric Y Coord
- LDA main_char_cart_x_hi ;isoY = (cartX + cartY) / 2
- CLC
- ADC main_char_cart_y_hi
- STA main_char_screen_y
- LSR A ;Divide By 2
- CLC
- ADC room_y_offset ;Add the Offset to Iso Y for the room type
- STA main_char_screen_y
- ;ROR main_char_screen_y ;Must use ROR because when going down, if (cartX + cartY) cause a carry over,
- RTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement