Page 1 of 2

Arkanoid Paddle Read program doesn't work :(

Posted: Fri Apr 02, 2010 3:09 pm
by 3gengames
Anone know why? :( Emulating in FCEUX, maybe I just don't know how to work the emulator yet?

Code: Select all

ReadPaddle:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  LDA $4017
  LSR A
  ROL PaddleButtons
  RTS

EDIT:


NEVERMIND IT DOES WORK......I think? It turns out I guess you use keys W,S,A,D,L, and ; to input a hex code, and this goes from 00 to CF unlike everything else says like starting at 96 or something? :D Well atleast I found something out that everyone else has wrong?......

Posted: Fri Apr 02, 2010 3:26 pm
by bunnyboy
The paddle returns data in bits 3 and 4, your code is only looking at bit 0. Complete info: http://wiki.nesdev.com/w/index.php/Arkanoid_controller

Posted: Fri Apr 02, 2010 3:42 pm
by 3gengames
Ahhh will look into it bunny, Also this is me from the mail.....


Edit:

Question, if the data is not returned at $4017 bit 0, why does it work in both emulators? Is it just bad emulation? Because the documentation here says different....


http://nocash.emubase.de/everynes.htm#c ... erspaddles

Posted: Fri Apr 02, 2010 3:56 pm
by bunnyboy
That site is obviously wrong for the NES, and also doesn't mention reading bit 0 like you think. Data for both the position and the button are returned in bit 1 on $4016 and $4017, so the controller would need to be plugged into both ports. Definitely Famicom only where it would go into the expansion port.

Posted: Fri Apr 02, 2010 4:02 pm
by 3gengames
Ahhh so thats the famicom layout? Okay I got it. I will re-write it a little later. Just going to make dinner now......



Well thanks bunny, so what did you think about the game idea, think people'd like it?

Posted: Fri Apr 02, 2010 5:10 pm
by tepples
The page says the data is inverted, so you have to LDA PaddleButtons EOR #$FF at the end. Or skip the inverting and assume $0B is the right side and $AB is the left side.

Posted: Sat Apr 03, 2010 10:56 am
by 3gengames
Sorry for slow update, I am very busy and will write that routine later...


Aaron

Posted: Sat Apr 03, 2010 11:03 am
by tepples
On that note, is there a place where I can buy the Vaus controller for NES for less than the $40-$50 that I see on eBay? Or are there compatible reproductions? I feel like making a driving game for my PowerPak.

Posted: Sat Apr 03, 2010 1:18 pm
by 3gengames
tepples wrote:On that note, is there a place where I can buy the Vaus controller for NES for less than the $40-$50 that I see on eBay? Or are there compatible reproductions? I feel like making a driving game for my PowerPak.

Actually I need to know this too because I somehow, don't have one 0_o XD



Edit:

Hmmm..........


http://cgi.ebay.com/Nintendo-NES-Arkano ... _500wt_877

Posted: Sat Apr 03, 2010 2:49 pm
by tepples
The snipers got to that one.

Posted: Sat Apr 03, 2010 10:40 pm
by 3gengames
^ Damn, I posted that with like an hour and a half to go and it was only like $20 total, Why is the Vaus controller so freaking expensive? They released TONS of them, one with every game, it should be dirt cheap 0_o

Posted: Sun Apr 04, 2010 2:10 pm
by 3gengames
Okay guys I got the paddle reading done, progress is going good. Thanks so much. Incase anyone else needs it, heres the code.

Code: Select all

ReadPaddle:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA PaddleButtons
  EOR #$FF
  SEC
  SBC #$62
  STA PaddleButtons
  RTS

It puts a value of 0-90 in PaddleButtons, which youhave to reserve space for in RAM.





EDIT:


New version,returns 0 to FE in PaddleButtons variable.....

Code: Select all

ReadPaddle:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA PaddleButtons
  EOR #$FF
  SEC
  SBC #$73
  BPL PaddleValueSet
  LDA #$00
PaddleValueSet:
  ASL A
  STA PaddleButtons
  RTS

Posted: Fri Apr 16, 2010 11:19 am
by Noobiscus
65024U wrote:Okay guys I got the paddle reading done, progress is going good. Thanks so much. Incase anyone else needs it, heres the code.

Code: Select all

ReadPaddle:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ROL A
  ROL A
  ROL A
  ROL A
  ROL PaddleButtons
  LDA PaddleButtons
  EOR #$FF
  SEC
  SBC #$62
  STA PaddleButtons
  RTS

It puts a value of 0-90 in PaddleButtons, which youhave to reserve space for in RAM.





EDIT:


New version,returns 0 to FE in PaddleButtons variable.....

Code: Select all

ReadPaddle:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA $4016
  AND #$10
  ASL A
  ASL A
  ASL A
  ASL A
  ROL PaddleButtons
  LDA PaddleButtons
  EOR #$FF
  SEC
  SBC #$73
  BPL PaddleValueSet
  LDA #$00
PaddleValueSet:
  ASL A
  STA PaddleButtons
  RTS
Thanks, I'm going to give it a go.

Posted: Sun Apr 18, 2010 7:24 pm
by 3gengames
You get it to work? :shock:

Re: Arkanoid Paddle Read program doesn't work :(

Posted: Sat Nov 08, 2014 9:58 am
by chadalem
I realize that this is a very old thread and that probably no one will ever see this, but I wonder if anyone could explain how to use this code? I'm not totally unfamiliar with coding, but don't know it well, and see no way to input a code like this in FCEUX. I am connecting my Arkanoid paddle with an NES-to-USB connector I just bought and having no success with FCEUX (or any emulator) and Arkanoid reading it. They instead just emulate the paddle with the movement of my mouse, which is not nearly as good as the paddle.

From what I can tell from other people's comments, you have developed a code that would work, but I have no idea what to do with it. For now, I'll just assume that I cannot play Arkanoid on my PC. But if anyone could help me out with this, I'd appreciate it!