Dutchman2000 Posted November 26, 2001 Share Posted November 26, 2001 Cafeman- I found it, but one question... cmp #c_STICK_PULLED_LEFT bmi JoystickMoveLeft -->> What is this? cmp #c_STICK_PULLED_RIGHT bpl JoystickMoveRight -->> and this? these must be subroutines I don't have... Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted November 26, 2001 Share Posted November 26, 2001 Oh, yeah, I didn't do it that way. I just used simpler statements like this: cmp #$1A bmi JoystickMoveLeft Just use literals. [ 11-26-2001: Message edited by: Cafeman ] Quote Link to comment Share on other sites More sharing options...
calamari Posted November 26, 2001 Share Posted November 26, 2001 I'm guessing those are fake labels.. imagine that those will jump to places in your code for what to do when the joytick is moved in the specified direction. Example: . . . cmp #c_STICK_PULLED_UP bmi JoystickMoveUp cmp #c_STICK_PULLED_DOWN bpl JoystickMoveDown rts . . . other code here, etc . . JoystickMoveUp: ; here is where you put your routines for ; what to do if the joystick was moved in ; the up direction . . . . HTH, calamari [ 11-26-2001: Message edited by: calamari ] Quote Link to comment Share on other sites More sharing options...
+Cafeman Posted November 26, 2001 Share Posted November 26, 2001 Oh. I think I misunderstood what part of the code you were confused about! Don't mind me, I'm old and swiss-cheese for brains. Yeah, here is literally what I have in my routine: code: horizmove lda SPOT0 ; Check the value of POT0 to see if the joystick is centered. The ; documentation states that the POT range is 0-228. ;added on 10/27/01 per debro: lsr ;divide by 2 to prevent overflow cmp #$1A ; stick pulled left bmi mvleft cmp #$50 ; stick pulled right bpl mvright ;end of added new code on 10/27/01 rts horizmove1 clc sbc #$78 ; Subtract 120 from the POT0 value bmi mvleft ; If this value is negative then the ; user is pushing to the left mvright cpx #$CA ; If the player is at the right most (used to be $B0) ; side of the playfield then don't bne mvright1 ; move right rts mvright1 lda leftright sta PrevDir ; save off previous direction faced, for middle animation lda #$01 ; this code means draw right-facing helicoper sta leftright inx ; Move 1 pixels to the right rts mvleft cpx #$30 ; If the player is at the left most (used to be $40) ; side of the playfield then don't bne mvleft1 ; move left. rts mvleft1 lda leftright sta PrevDir ; save off previous direction faced, for middle animation lda #$00 ; this code means draw right-facing helicoper sta leftright dex ; Move 1 pixels to the left rts [ 11-26-2001: Message edited by: Cafeman ] Quote Link to comment Share on other sites More sharing options...
Dutchman2000 Posted November 26, 2001 Author Share Posted November 26, 2001 Thanks! Is it the same for vertical movement?? Quote Link to comment Share on other sites More sharing options...
Dutchman2000 Posted November 26, 2001 Author Share Posted November 26, 2001 Still having problems, here is my movement code: ;************ Horizontal move **************************************** horizmove lda SPOT0 lsr ; Divide by 2 to prevent overflow... cmp #$1A ; stick pulled left bmi mvleft cmp #$50 ; stick pulled right bpl mvright ldy #$00 ; clear hmove flag sty hmFlag rts horizmove1 ldy #$01 sty hmFlag ; set hmove flag clc sbc #$78 ; Subtract 100 from the POT0 value bmi mvleft ; If this value is negative then the ; user is pushing to the left ; ; FALL THROUGH ; mvright cpx #$C8 ; If the player is at the right most bne mvright1 ; side of the playfield then don't move right ldy #$01 ;right jsr changeroom rts mvright1 inx ; Move 1 pixels to the right lda bFrame ; If animation is already in the direction cmp # beq mvrs lda # sta pFrame sta bFrame lda # sta mFrame lda # sta sFrame mvrs rts mvleft cpx #$30 ; If the player is at the left most bne mvleft1 ; side of the playfield then don't move left ldy #$00 ;left jsr changeroom rts mvleft1 dex ; Move 1 pixels to the left lda bFrame ; If animation is already in this direction cmp # beq mvls lda # sta pFrame sta bFrame lda # sta mFrame lda # sta sFrame mvls rts ;************ Vertical move **************************************** vertmove lda SPOT1 cmp #$1A ; stick pulled up bmi vertmove1 cmp #$50 ; stick pulled down bne vertmove1 ldy #$00 sty vmFlag ; clear vmove Flag rts vertmove1 ldy #$01 sty vmFlag ; set vmove Flag clc sbc #$78 ; Subtract 100 from the POT1 value bmi mvup ; If this value is negative then the ; user is pushing to the left ; ; FALL THROUGH ; mvdown lda pmbase0 cmp lowbound bne mvdown1 ldy #$03 ;down jsr changeroom rts mvdown1 inc pmbase0 rts mvup lda pmbase0 cmp topbound bne mvup1 ldy #$02 ;up jsr changeroom rts mvup1 dec pmbase0 rts any suggestions?? Quote Link to comment Share on other sites More sharing options...
DEBRO Posted November 26, 2001 Share Posted November 26, 2001 What are your results with this routine? Also I'm assuming you are using the low and high byte notation with the > and < in your code. If you post that here you must use "& + lt" for a less than sign and "& + gt" for a greater than sign. Try it with those combinations because right now the code is hard to read without them. Quote Link to comment Share on other sites More sharing options...
Dutchman2000 Posted November 27, 2001 Author Share Posted November 27, 2001 Having a problem with airworld, the character constantly runs up and to the left no matter what you do with the stick. I am using Debro's original joystick code. I built a ROMCART and it show's this behavior on the real deal. Any tips on how to acheive full movement?? Quote Link to comment Share on other sites More sharing options...
Dutchman2000 Posted November 27, 2001 Author Share Posted November 27, 2001 Fixed it! Just needed to change a bne to a bpl.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.