home *** CD-ROM | disk | FTP | other *** search
/ News-Disk 5 / News_Disk_Issue_05_19xx___BASIC.atr / piainfo.doc < prev    next >
Text File  |  2023-02-26  |  6KB  |  1 lines

  1. This article was taken from the newsnet system. It is an excellent (but technical) article about the PIA chip. Tidied by Dean Garraghty.¢-----------------------------------¢¢In a msg of <16 Feb 92>, Hussein Rajput writes to All:¢¢¢ HR> (From: hussein@psych.toronto.edu (Hussein Rajput))¢ HR> (Organization: University of Waterloo)¢¢ HR> Fellow Atari 8 bitters:¢¢ HR> lines at will.  Now I need to know the peripheral interface adapter¢ HR> memory locations (DDR and Reg itself) for the Atari.  A brief descrip¢¢PIA: 6520 CHIP¢54016-54271 D300-D3FF¢¢The Peripheral Interface adapter (PIA) integrated circuit is a special microprocessor used to control the atari ports, controller jacks one to four. Ports can be used for both input and output simultaneously or alternately.  Barely tapped at the time of this writing, the ports represent a major resource for external (and internal) control and expansion.¢¢PIA also processes two of the IRQ interrupts; VINTER and VPRCED, vectored at locations 514 to 517¢($202 to $205).  These interrupts are unused by the OS, but also¢may be used to provide greater control over external devices.¢¢54016   d300  porta¢¢(w/r) Reads or writes data from controller jacks one and two if BIT 2 of PACTL (location 54018) is one. Writes to direction control if bit 2 of pactl is zero.¢¢These two port registers also control the direction of data flow to the port, if the controller register (54018, below) is poked with 48 ($30).  Then, if the bits in the register read zero, it is an input (R) mode; if they read one, it is in output (W) mode. A zero POKED here makes all bits input, a 255 makes all bits output. BITs 0 to 3 address pins one to four on jack one, BITs 4 to 7 address pins one to four on jack two.  Poke 54018 with 52 to make this location¢into a data register again. Shadow registers are: STICK0(632; $278, jack one), stick1(633; $279, jack two) and ptrig0-3 (636-639; $27c-$27f).¢¢bits used as data register¢7   6    5    4    3    2    1    0¢    -jack0-           -jack 1 -¢    -stick 1-         -stick 0-¢Forward = bit 0,4 = 1¢Backward = bit 1,5 = 1¢Left = bit 2,6 =1¢right = bit 3,7 =1¢neutral = all four jack bits = 1¢¢porta is also used to test if the paddle 0-3 triggers (PTRIG) have been pressed, using these bits:¢¢      7    6    5    4    3    2    1    0¢PTRIG 3    2    -    -    1    0    -    -¢¢Where zero in the appropriate bit equals trigger pressed, one equals trigger not pressed.¢¢The PORT registers are also used in the keyboard controller (used with a keypad) operation where:¢¢Bit  7    6    5    4    3    2    1    0¢row  4    3    2   top   4    3    2   top¢jack ........2.......    ........1........¢¢¢Columns for the keyboard operations are read through the POT (PADDL) and TRIG registers.¢¢54017 d301 portb¢(w/r) prot b. Reads or writes data to and/or from jacks three and four.  Same as PORTA, above, for the respective jacks.  Shadow registers are:  STICK2(634; $27a, jack three), stick3(635,$27b, jack four), and ptrig4-7(640-643;$280-$283).¢¢54018 d302 pactl¢(w/r) prot a controller (see 54016 above). POKE with 60 ($3c) to turn the cassette motor off, POKE with 52 to turn it on.  You can put a music cassette in your program recorder, press PLAY and then POKE 54018, 52.  Your music will play through the TV speaker or external amplifier while you work at the ATARI.  You can use this technique to add voice tracks to your programs.  To turn off the music or voice, type POKE 54018,60 PACTL can be used for other external applications by the user.  Bit use is aas follows:¢¢¢Bit        Function¢7(rd only) Peripheria A interrupt              (IRQ) status bit. Set by¢           peripheral (PORT) A.                Reset by reading PORTA¢           (53774; $d20e).¢6          set to zero¢5          set to 1¢4          set to 1¢3(write)   peripheral motor control¢           line (turn the cas on or¢           off) 0=on¢2(write)   controls PORTA                      addressing. One equals              porta register; zero¢           equals direction control¢           register.¢1          set to zero.¢0(write)   Peripheral A interrupt¢           (IRQ) enable.  One                  equals enable.¢           Set by the OS but¢           available to the user;¢           reset on pwr up.¢¢¢¢54019 d303 pbctl¢(w/r)Port B controller. Initialized to 60 ($3c) by the OS IRQ code. PBCTL is the same as PACTL, above, with the following exception (this may actually perform the same function as in PACTL, but I am not sure of the distinction between descriptions:¢¢bit       Function¢3         Peripheral command¢          identification (serial¢          bus command),initialized¢          to 60 ($3c).¢¢¢Ports can be used for external control applications by the technically minded reader who is willing to do some soldering to develop cables and connectors.  A good example can be found in COMPUTE, February 1981, where the author gives directions for using jacks three and four as a printer port.  The Macrotronic printer cables use just this method, bypassing the 850 interface entirely (one way of reducing your hadrare costs). Theoretically, the entire atari can be controlled through the ports.¢¢¢**********************************************************************¢Locations 54020 to 54271 ($d304 to $3ff) are repeats of locations¢54016 to 54019 ($d300 to d303).-¢¢¢ HR> of the above locations would help too. Lastly I would like to know how¢ HR> to write a block of memory to a file on disk. I believe that Mapping¢ HR> the Atari listed such informatin for DOS 2.0S (ancient, I realize).¢¢To write a block of info from memory, you set the address of where to write from and jump to CIO.  What language are you using?? You also have to indicate the length you wish to write.¢¢ HR> Any help would be much appreciated.¢¢Not brief, but hopefully helpful.¢¢CLF¢¢Chris Fleshner¢