Jump to content



1

Using Port A as output


17 replies to this topic

#1 ibogost OFFLINE  

ibogost

    Chopper Commander

  • 136 posts
  • Location:Atlanta

Posted Wed Jun 30, 2010 7:10 PM

Port A, which is read on SWCHA, is typically used as input to read the P0 and P1 joystick controllers. However, as specified in the Stella Programmers Guide, the port can be set either for input or for output:

Port A has an 8 bit wide Data Direction Register (DDR) that is written to at SWACNT (HEX 281) to set each individual pin of Port A to either input or output. The Port A pins are labeled PA0 thru PA7, and writing a "0" to a pins' DDR bit sets that pin as input, and a "1" sets it as an output. For example, writing all 0's to SWACNT (the DDR for Port A) sets PA0 thru PA7 (all 8 pins of Port A) as inputs. If F0 (11110000) were written to SWACNT then PA7, PA6, PA5 & PA4 would be outputs, and PA3, PA2, PA1 & PA0 would be inputs.


I'm wondering if anyone has ever used Port A as an output port and communicated with another computer or device from the VCS. If so, what did you do (write a serial communication protocol, for example)? Such a task would also require rigging the two 9-pin joystick ports to act as a DCE device. It's not clear to me how the SWCHA register relates to the 9-pin input device itself, and what sort of hack I'd have to concoct to succeed at transmitting data from the VCS to the foreign computer.

#2 Rybags OFFLINE  

Rybags

    Quadrunner

  • 10,313 posts
  • Location:Australia

Posted Wed Jun 30, 2010 7:44 PM

I've done it, although on the computer but the principle is much the same.

I used one bit for input, another for output and a third bit as the clock.

Not sure about the 2600, but 0->1 transitions take a bit of time on the computer, possibly due to the resistors used on the lines. But you'd probably manage one bit transferred per scanline which equates to about 2K/second.

Best method would probably be to change data state while doing a 0->1 transition on clock, do a 1->0 transition on clock "mid-cycle" where you would have the data sampled.

As you've got 4 bits of output per port, you could quite easily transmit/receive 4 bits at a time.

The scenario I used was A8 to a C64 (via it's serial port). I just wrote a handler on the C64 which acted as a slave.

#3 Wickeycolumbus OFFLINE  

Wickeycolumbus

    River Patroller

  • 4,064 posts
  • Location:Michigan

Posted Wed Jun 30, 2010 7:47 PM

View Postibogost, on Wed Jun 30, 2010 7:10 PM, said:

Port A, which is read on SWCHA, is typically used as input to read the P0 and P1 joystick controllers. However, as specified in the Stella Programmers Guide, the port can be set either for input or for output:

Port A has an 8 bit wide Data Direction Register (DDR) that is written to at SWACNT (HEX 281) to set each individual pin of Port A to either input or output. The Port A pins are labeled PA0 thru PA7, and writing a "0" to a pins' DDR bit sets that pin as input, and a "1" sets it as an output. For example, writing all 0's to SWACNT (the DDR for Port A) sets PA0 thru PA7 (all 8 pins of Port A) as inputs. If F0 (11110000) were written to SWACNT then PA7, PA6, PA5 & PA4 would be outputs, and PA3, PA2, PA1 & PA0 would be inputs.


I'm wondering if anyone has ever used Port A as an output port and communicated with another computer or device from the VCS. If so, what did you do (write a serial communication protocol, for example)? Such a task would also require rigging the two 9-pin joystick ports to act as a DCE device. It's not clear to me how the SWCHA register relates to the 9-pin input device itself, and what sort of hack I'd have to concoct to succeed at transmitting data from the VCS to the foreign computer.

Port A output has been used in a number of applications, here are some from the top of my head:

-SaveKey/Atarivox communication
-Dumping cartridges
-Reading NES controllers
-Communication between 2600 consoles

I am currently working on a code uploader that uses a RAM cart and parallel communication (one nybble at a time) using port A as input, and an unused port B bit as output.

Here is how SWCHA relates to the joystick ports:

SWCHA    Joystick Port    Pin

D0       Right            1
D1       Right            2
D2       Right            3
D3       Right            4
D4       Left             1
D5       Left             2
D6       Left             3
D7       Left             4


Some relevant links:

http://www.atariage....your-fb2-games/
http://www.atariage....&showentry=5561

Edited by Wickeycolumbus, Wed Jun 30, 2010 7:49 PM.


#4 ibogost OFFLINE  

ibogost

    Chopper Commander

  • 136 posts
  • Location:Atlanta

Posted Wed Jun 30, 2010 7:59 PM

Thanks, this is a good start. I'll read through these materials and see what I want to do next.

#5 yuppicide OFFLINE  

yuppicide

    I am the Black Knight. Give me your money!

  • 6,933 posts
  • Location:New Jersey

Posted Thu Jul 1, 2010 11:36 AM

I always thought it would be nice to trigger the output during a game when something happens.. for example, you can have an adult game that triggers a vibrator to go off when you get certain points, or one of those USB humping dogs that moves.

#6 Pioneer4x4 OFFLINE  

Pioneer4x4

    Stargunner

  • 1,724 posts
  • Atari + R.O.B. = Completed
  • Location:PA

Posted Thu Jul 1, 2010 7:21 PM

I had my own idea for a game to use it. I started working on it in batari basic, but can't get it to work with limited ram, so I never bothered with the write to port part yet.
I have one other idea for indicators of game progress type things I need to test first.

#7 Animan OFFLINE  

Animan

    River Patroller

  • 2,124 posts
  • I'm a guy... I just happen to like Sailor Moon.

Posted Sat Aug 28, 2010 5:19 PM

Always wanted to hook up two 2600's via there controller ports, and make a game that can have multiplayer over two systems. That would be really cool to do...

#8 supercat OFFLINE  

supercat

    Quadrunner

  • 6,367 posts

Posted Sun Aug 29, 2010 5:45 PM

View PostWickeycolumbus, on Wed Jun 30, 2010 7:47 PM, said:

Port A output has been used in a number of applications, here are some from the top of my head:

Reading keypad controllers. The bidirectional ability was used and acknowledged 'back in the day'; I don't know if the keypads were part of the original 2600 design concept, but Atari certainly produced them soon after the 2600 was released.

#9 Pioneer4x4 OFFLINE  

Pioneer4x4

    Stargunner

  • 1,724 posts
  • Atari + R.O.B. = Completed
  • Location:PA

Posted Mon Aug 30, 2010 3:52 PM

View Postsupercat, on Sun Aug 29, 2010 5:45 PM, said:

Reading keypad controllers. The bidirectional ability was used and acknowledged 'back in the day'; I don't know if the keypads were part of the original 2600 design concept, but Atari certainly produced them soon after the 2600 was released.
Excellent! That is the only way I have figured out how to use them for the project I am working on, you output on 3 pins and read 4 others. Is there any source documentation on how they are used on the console?

#10 Wickeycolumbus OFFLINE  

Wickeycolumbus

    River Patroller

  • 4,064 posts
  • Location:Michigan

Posted Mon Aug 30, 2010 4:21 PM

View PostPioneer4x4, on Mon Aug 30, 2010 3:52 PM, said:

View Postsupercat, on Sun Aug 29, 2010 5:45 PM, said:

Reading keypad controllers. The bidirectional ability was used and acknowledged 'back in the day'; I don't know if the keypads were part of the original 2600 design concept, but Atari certainly produced them soon after the 2600 was released.
Excellent! That is the only way I have figured out how to use them for the project I am working on, you output on 3 pins and read 4 others. Is there any source documentation on how they are used on the console?

How Keyboard controllers are used? From the Stella Programmer's Manual:

Quote

5.5 Keyboard controllers

The keyboard controller has 12 buttons arranged into 4 rows and 3 columns. A signal is sent to a row, then the columns are checked to see if a button is pushed, then the next row is signaled and all columns sensed, etc. until the entire keyboard is scanned and sensed. The PIA sends the signals to the rows, and the columns are sensed by reading INPT0, INPT1, and INPT4 of the TIA. With Port A configured as an output port, the data bits will send a signal to the keyboard controller rows according to the following table :

Data Bit Keyboard Row Player
D7 bottom P0
D6 third P0
D5 second P0
D4 top P0
D3 bottom P1
D2 third P1
D1 second P1
D0 top P1
(P0 = left player, P1 = right player)

NOTE : a delay of 400 microseconds is necessary between writing to this port and reading the TIA input ports.




#11 Pioneer4x4 OFFLINE  

Pioneer4x4

    Stargunner

  • 1,724 posts
  • Atari + R.O.B. = Completed
  • Location:PA

Posted Mon Aug 30, 2010 6:03 PM

View PostWickeycolumbus, on Mon Aug 30, 2010 4:21 PM, said:

View PostPioneer4x4, on Mon Aug 30, 2010 3:52 PM, said:

View Postsupercat, on Sun Aug 29, 2010 5:45 PM, said:

Reading keypad controllers. The bidirectional ability was used and acknowledged 'back in the day'; I don't know if the keypads were part of the original 2600 design concept, but Atari certainly produced them soon after the 2600 was released.
Excellent! That is the only way I have figured out how to use them for the project I am working on, you output on 3 pins and read 4 others. Is there any source documentation on how they are used on the console?

How Keyboard controllers are used? From the Stella Programmer's Manual:

Quote

5.5 Keyboard controllers

The keyboard controller has 12 buttons arranged into 4 rows and 3 columns. A signal is sent to a row, then the columns are checked to see if a button is pushed, then the next row is signaled and all columns sensed, etc. until the entire keyboard is scanned and sensed. The PIA sends the signals to the rows, and the columns are sensed by reading INPT0, INPT1, and INPT4 of the TIA. With Port A configured as an output port, the data bits will send a signal to the keyboard controller rows according to the following table :

Data Bit Keyboard Row Player
D7 bottom P0
D6 third P0
D5 second P0
D4 top P0
D3 bottom P1
D2 third P1
D1 second P1
D0 top P1
(P0 = left player, P1 = right player)

NOTE : a delay of 400 microseconds is necessary between writing to this port and reading the TIA input ports.


THANKS!!!!!
I was doing it by setting a column to high and reading the rows. The main reason I did it that way was I have more inputs available, maybe I'll try it the other way, it might work better with those damn resistors in the controller.
This is what I am working on.

#12 Syntaxerror999 OFFLINE  

Syntaxerror999

    Moonsweeper

  • 398 posts

Posted Sun Nov 7, 2010 4:26 PM

View Postibogost, on Wed Jun 30, 2010 7:10 PM, said:

Port A, which is read on SWCHA, is typically used as input to read the P0 and P1 joystick controllers. However, as specified in the Stella Programmers Guide, the port can be set either for input or for output:

Port A has an 8 bit wide Data Direction Register (DDR) that is written to at SWACNT (HEX 281) to set each individual pin of Port A to either input or output. The Port A pins are labeled PA0 thru PA7, and writing a "0" to a pins' DDR bit sets that pin as input, and a "1" sets it as an output. For example, writing all 0's to SWACNT (the DDR for Port A) sets PA0 thru PA7 (all 8 pins of Port A) as inputs. If F0 (11110000) were written to SWACNT then PA7, PA6, PA5 & PA4 would be outputs, and PA3, PA2, PA1 & PA0 would be inputs.


I'm wondering if anyone has ever used Port A as an output port and communicated with another computer or device from the VCS. If so, what did you do (write a serial communication protocol, for example)? Such a task would also require rigging the two 9-pin joystick ports to act as a DCE device. It's not clear to me how the SWCHA register relates to the 9-pin input device itself, and what sort of hack I'd have to concoct to succeed at transmitting data from the VCS to the foreign computer.

At the time the only device that used this feature was the Keyboard controlers. I think a couple later devices (circa 1986) were made that utilized this feature. Imagine what the atari could have done if more companies realized this. they could of even kept the use of two joysticks by making them work like a keyboard controler in one port and their device in the other (hint hint Atarivox designers)

Edited by Syntaxerror999, Sun Nov 7, 2010 4:27 PM.


#13 Propane13 ONLINE  

Propane13

    Stargunner

  • 1,386 posts
  • Location:Philly

Posted Thu Nov 11, 2010 8:23 AM

I made a 300 baud communication program a long time back that did this.
It was called Teleterm 2600. Not much, but it allowed you to have 2 systems communicating with each other via special wire (or even eventually hook it to a computer). No UART required-- it was the genuine RS-232 protocol.

Here's the info I dug up about it:
http://www.biglist.c...8/msg00119.html

If someone breathed new life into this thing, it would make my day. :)

-John

#14 doppel OFFLINE  

doppel

    Star Raider

  • 65 posts

Posted Fri Dec 3, 2010 1:18 PM

One important detail that keeps getting glossed over is that in order to read the keypad in the right controller port, INPT2, INPT3, and INPT5 are used, not INPT0, INPT1, and INPT4.

#15 supercat OFFLINE  

supercat

    Quadrunner

  • 6,367 posts

Posted Fri Dec 3, 2010 10:09 PM

View Postdoppel, on Fri Dec 3, 2010 1:18 PM, said:

One important detail that keeps getting glossed over is that in order to read the keypad in the right controller port, INPT2, INPT3, and INPT5 are used, not INPT0, INPT1, and INPT4.
BTW, I'm surprised nobody BITD ever made a 48-key keypad for the 2600. Electrically, it would have required nothing more than two keypad controllers, but it would have allowed Basic Programming, as well as letter and number learning games, to be a lot more practical.

Edited by supercat, Fri Dec 3, 2010 10:09 PM.


#16 Syntaxerror999 OFFLINE  

Syntaxerror999

    Moonsweeper

  • 398 posts

Posted Sun Apr 3, 2011 2:47 PM

View Postyuppicide, on Thu Jul 1, 2010 11:36 AM, said:

I always thought it would be nice to trigger the output during a game when something happens.. for example, you can have an adult game that triggers a vibrator to go off when you get certain points, or one of those USB humping dogs that moves.

I like your idea... maybe not for a sex game... that just be weird... but it be good for an atari joystick with rumble feature.

#17 player 0ne OFFLINE  

player 0ne

    Chopper Commander

  • 160 posts
  • apprentice repair tech
  • Location:usa

Posted Thu Sep 15, 2011 8:24 PM

You could have lights. i think the teleterm idea is really cool. how do you make the connection cable. . Get 2 carts of teleterm. would teeterm fit with other stuff onto a cart? or 1 burned cart and a harmony cart. the teleterm bin looked pretty cool. i am very interested in this stuff. after market atari stuff. non-game uses.

#18 Propane13 ONLINE  

Propane13

    Stargunner

  • 1,386 posts
  • Location:Philly

Posted Fri Sep 16, 2011 10:24 AM

From the stella-list post, I have this written:

"I can't remember which pin it transfers on, but I made a cable which connected 2 9-pin connectors via pins 1 to 3, 3 to 1, 4 to 2, and 2 to 4, but I made the demo rs232 compliant, so only 2 of those wires should really be useful. To test on itself, take a 9-pin connector and wire pin 1 to 3 and pin 2 to 4."

So, that's what you need to do.

The ROM is 4K, so can fit with other ROMS on certain media.
I believe I tested it back in the day with one burned cart and one via SuperCharger.
So, if you have a SuperCharger and a Harmony cart, you have all you need.

-John




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users