How do we use the ReadController and the ReadControllerLoop to read the controller. According to the post, we need to write to the appropiate bit. So, for example, if I want one of my tiles to move up, I kow that I need to write to bit 3, or %00001000.
bit: 7 6 5 4 3 2 1 0
button: A B select start up down left right
I guess that if I wanted to read up I would use the following instruction.
LDA #%00001000
STA button1
What I'm confused about is where to write this? Do I use a JSR to hop to ReadControllerLoop and then write to button one? Before we used an instruction like this:
ReadUp:
LDA $4016
AND #%00000001
BEQ ReadUpDone
LDA $0200
SEC
SBC #$01
STA $0200
ReadUpDone:
How do I combine these instructions to write to up?
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin
How do we use the ReadController and the ReadControllerLoop to read the controller. According to the post, we need to write to the appropiate bit. So, for example, if I want one of my tiles to move up, I kow that I need to write to bit 3, or %00001000.
bit: 7 6 5 4 3 2 1 0
button: A B select start up down left right
I guess that if I wanted to read up I would use the following instruction.
LDA #%00001000
STA button1
What I'm confused about is where to write this? Do I use a JSR to hop to ReadControllerLoop and then write to button one? Before we used an instruction like this:
ReadUp:
LDA $4016
AND #%00000001
BEQ ReadUpDone
LDA $0200
SEC
SBC #$01
STA $0200
ReadUpDone:
How do I combine these instructions to write to up?
So I've created a paddle using a tile from Mario.chr. I'm sure there's an easier way to do it, but I'll worry about that later. I've successfully been able to make the paddle move up and down using the older routing. This can be seen in the below link:
http://www.acsalaska.net/~themaincamarojoe/Pong_with_old_con...
This works fine, but I'd like to use the newer routing. The below link shows this attempt.
http://www.acsalaska.net/~themaincamarojoe/Pong_with_new_Con...
Now, I know I'm doing something wrong here.
On line 204 and 205 I jump to the routine which handles ReadUp and ReadDown, which is called after ReadController1 and ReadController2. Lines 381 through 515 are the actual subroutines. I thought I new a decent amount about assembly, but it seems as if the 6502 and the NES archeticture is more challenging that I anticipated.
Can you all please assist in pointing out my mistake. Thank you everyone for being so helpful.
By the way, if you all know of a better way for me to show my code, let me know.
Well, assuming that all the formatting issues came from the file transfer, I found the following. Your ReadUpDone: and ReadDownDone: are outside of your "RTS" commands.
And I would say that you need to change the controller reading routine back to the old way. I've never seen it done the way you are trying to do it, that doesn't mean it won't work, it just looks confusing to me. Why change what works?
Also, why do you have so many sprites on your up and down routines?
This is my shiny thing, and if you try to take it off me, I may have to eat you.
Check out my dev blog.
I'd like to my code to be efficent and clean as possible. Plus, I'd like to follow BunnyBoy's advice as layed out in this tutorial. This is why I'd like to change my old ways and adopt new better ways.
I moved the ReadUpDone: and ReadDownDone: inside RTS and it still is not working.
Thanks a lot everyone. I'm still having problems. I did notice that my sprite wasn't bouncing around. I got rid of the Player1Engine and moved the JSR ReadController1 back to where it was in the original tutorial. I also placed my JSR ReadUp and JSR ReadDown to the same section (lines176 to 179). However, my paddle still does not move.
Below is the link for my souce code. I recommend saving it and opening it in a notepad++ (my text editor of choice).
http://www.acsalaska.net/~themaincamarojoe/post/Pong_with_ne...
gauauu: look, we all paid $10K at some point in our lives for the privilege of hanging out with Kevin