2 player input reading

I talked to some people in discord and they agree that its worth posting here this is the 2 player input script used to read not just the first controller but the second controller.

The whole thing is here:
http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=7155

You can read more about this specifically here:
http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=7974

LDA #$01
  STA $4016
  LDA #$00
  STA $4016     ; tell both the controllers to latch buttons

  LDA $4016     ; player 1 - A
  LDA $4016     ; player 1 - B
  LDA $4016     ; player 1 - Select
  LDA $4016     ; player 1 - Start
  LDA $4016     ; player 1 - Up
  LDA $4016     ; player 1 - Down
  LDA $4016     ; player 1 - Left
  LDA $4016     ; player 1 - Right


  LDA $4017     ; player 2 - A
  LDA $4017     ; player 2 - B
  LDA $4017     ; player 2 - Select
  LDA $4017     ; player 2 - Start
  LDA $4017     ; player 2 - Up
  LDA $4017     ; player 2 - Down
  LDA $4017     ; player 2 - Left
  LDA $4017     ; player 2 - Right

A better controller reading scrtip is below:
ReadController1:
LDA #$01
STA $4016
LDA #$00
STA $4016
LDX #$08
ReadController1Loop:
LDA $4016
LSR A ; bit0 -> Carry
ROL buttons1 ; bit0 <- Carry
DEX
BNE ReadController1Loop
RTS

ReadController2:
LDA #$01
STA $4016
LDA #$00
STA $4016
LDX #$08
ReadController2Loop:
LDA $4017
LSR A ; bit0 -> Carry
ROL buttons2 ; bit0 <- Carry
DEX
BNE ReadController2Loop
RTS


I have been working on 2 player support but this so far requires me to duplicate alot of scripts just to get it to be meaningful. I posted this because it help others with getting 2 player in there game.
 

dale_coop

Moderator
Staff member
Thanks Gildertmaxter.
Interesting to share... I think members who was interested in 2 players, that require a lot dev, already found those scripts... and the one who didn't... will not know what to do with that ;)
As I was saying to another member some days ago, I already am working of a 2 player mode (started some months ago with the previous version... then I stopped... then tried again)... currently the result is not yet quite working/playable :p

The competition is over in a few days, my game is... well, my demo, is far from finish... and there is a lot to do.
(andy free time is sooooo limited)
 
dale_coop said:
Thanks Gildertmaxter.
Interesting to share... I think members who was interested in 2 players, that require a lot dev, already found those scripts... and the one who didn't... will not know what to do with that ;)
As I was saying to another member some days ago, I already am working of a 2 player mode (started some months ago with the previous version... then I stopped... then tried again)... currently the result is not yet quite working/playable :p

The competition is over in a few days, my game is... well, my demo, is far from finish... and there is a lot to do.
(andy free time is sooooo limited)

I know dale there isn't enough time for this and at most i was only able to read the 2nd controller and that was it. This isn't to really do anything and i know that 2 player modules for something meaningful will take time which is why i abandon this for now but after some discussion in discord they said its worth posting. Who know maybe after this contest we can make something more meaningful. :)
 

dale_coop

Moderator
Staff member
You right, we need to keep that infos in mind ;)
If I can find some free time (nights... this weekend or next week)... I was (secretly) dreaming about adding a 2nd player for my game :p
 
dale_coop said:
You right, we need to keep that infos in mind ;)
If I can find some free time (nights... this weekend or next week)... I was (secretly) dreaming about adding a 2nd player for my game :p

Me as well dale lol :)

Lets see what we can build together.
 

dale_coop

Moderator
Staff member
I will focus on finishing my game (tile assets, monsters, some scripts, cutscenes, levels, ...)... If I can finish all that, then, I will take a look at my old 2 players scripts :p If not for the competition, it will be for later ;)
 
Top Bottom