Jump to content
IGNORED

Using Port A as output


ibogost

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.com/forums/topic/78065-how-to-dump-your-fb2-games/

http://www.atariage.com/forums/index.php?app=blog&module=display&section=blog&blogid=134&showentry=5561

Edited by Wickeycolumbus
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...
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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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:

 

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.

 

 

Link to comment
Share on other sites

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:

 

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.

Link to comment
Share on other sites

  • 2 months later...

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
Link to comment
Share on other sites

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.com/lists/stella/archives/200108/msg00119.html

 

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

 

-John

Link to comment
Share on other sites

  • 4 weeks later...

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
Link to comment
Share on other sites

  • 3 months later...

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.

Link to comment
Share on other sites

  • 5 months later...

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 years later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...