Home
Atari System Reference Manual
Contents
1. DOW IMER 4 DOW IMER 5 DOW IMER 1 JSR ADDRESS DOW IMER 2 JSR ADDRESS DOW IMER 3 FLAG REPEAT TIMER DOW IMER 4 FLAG IAN S TEMP DOW IMER FLAG 5 DMACTL SHADOW DISPLAY LIST POINTER SKCTL SHADOW 800 UNLISTED XL LOADER TEMP IGH PEN HORIZONTAL IGH PEN VERTICAL 2 SPARE BYTES 800 SPARE 2 BYTES XL LOADER DEVICE COMMAND FRAME BUFFER DEVICE COMMAND AUX 1 DEVICE COMMAND AUX 2 TEMPORARY STORAGE DEVICE ERROR FLAG EXCEPT TIMEOUT FLAGS FROM DISK SECTOR 1 NUMBER OF BOOT DISK SECTORS BOOT LOAD ADDRESS POINTER COLD START FLAG 1 COLD START IN 800 SPARE XL LOADER 800 DISK TIME OUT REGISTER XL RESERVED 39 BYTES 800 CHARACTER LINE BUFFER 40 BYTES XL CHARACTER SE POINTER XL FINE SCROLL EMPORARY XL KEYBOARD DISABLE XL FINE SCROLL FLAG P M PRIORITY AND GTIA MODES XL 3 MORE PADDLES 800 6 MORE PADDLES XL 1 MORE STICK 800 3 MORE STICKS XL 3 MORE PADDLE TRIGGERS 800 6 MORE XL 1 MORE STICK TRIGGER 800 3 MORE 800 5 SPARE BYTES XL OADER RAM TEXT INDEX OLD ROW AND OLD COL FOR TEXT 2 BYTES 4 SPARE BYTES 800 XL NUMBER OF COMMAND FRAME RETRIES 118 0420 042
2. CKEY 03E9 1001 XL START KEY FLAG CASSBT 03EA 1002 XL CASSETTE BOOT FLAG CARTCK 03EB 1003 XL CARTRIDGE CHECKSUM ACMVAR 03ED 1005 XL RESERVED 6 BYTES MINTLK 03F9 1017 XL RESERVED GINTLK 03FA 1018 XL CARTRIDGE INTERLOCK CHLINK 03FB 1019 XL HANDLER CHAIN 2 BYTES CASBUF 03FD 1021 CASSETTE BUFFER 131 BYTES TO 047F r PAGE 4 r 7 USAREA 0480 1152 128 SPARE BYTES r SEE APPENDIX C FOR PAGES 4 AND 5 USAGE r F r PAGE 5 PAGE5 0500 1280 127 FREE BYTES 057E 1406 129 FREE BYTES IF FLOATING POINT ROUTINES NOT USED FLOATING POINT NON ZERO PAGE RAM NEEDED ONLY IF FP IS USE r LBPR1 057E 1406 LBUFF PREFIX 1 LBPR2 05FE 1534 LBUFF PREFIX 2 LBUFF 0580 1408 LINE BUFFER PLYARG 05E0 1504 POLYNOMIAL ARGUMENTS FPSCR 05E6 1510 PLYARG FPREC FPSCR1 05EC 1516 FPSCR FPREC FSCR 05E6 1510 FPSCR FSCR1 05EC 1516 FPSCR1 LBFEND 05FF 1535 END OF LBUFF r PAGE 6 r PAGE6 0600 1536 256 FREE BYTES r PAGE 7 r i BOOTRG 0700 1792 PROGRAM AREA F 7 UPPER ADDRESSES r RITCAR 8000 32768 RAM IF NO CARTRIDGE LFTCAR A000 40960 RAM IF NO CARTRIDGE COPAGE C000 49152 800 EMPTY 4K BYTES COPAGE C000 49152 X
3. G O UMN POINTER H EMPORARY STORAGI E NORTH AMERICA TV FLAG LOGICAL LINE ES TH INTER ES Eas FOR CHANNEL O PEN STAR BUFF OF R ER COUNT OM END OF RAM 1 POIN ER US ED BY EDITOR POIN ER US ED BY EDITOR 116 HIGH BYTI E 0301 ENDPT 74 116 0302 DELTAR 76 118 0303 DELTAC 77 119 0304 ROWINC 79 121 800 0305 KEYDEF 79 121 XL KEY DEFINATION POINTER 2 BYTES 0306 COLINC 7A 122 800 0307 SWPFLG 7B 123 NON 0 IF TEXT AND REGULAR RAM IS SWAPPED 0308 HOLDCH 7C 124 CH MOVED HERE BEFORE CTRL AND SHIFT 0309 INSDAT 7D 125 0310 COUNTR 7E 126 0311 0312 ZROFRE 80 128 FREE ZERO PAGE 84 BYTES 0313 FPZRO D4 212 FLOATING POINT RAM 43 BYTES 0314 FRO D4 212 FP REGISTER 0 0315 FRE SDA 218 0316 FRI SEO 224 FP REGISTER 1 0317 FR2 SE6 230 FP REGISTER 2 0318 FRX SEC 236 SPARE 0319 EEXP SED 237 VALUE OF E 0320 NSIGN SED 237 SIGN OF FP NUMBER 03
4. DVSTAT 0 command stat 1 hardware stat 2 timeout value The command status byte gives the following information Bit 49 invalid command frame received invalid data frame received unsuccessful PUT operation disk is write protected active standby BUNRAO bere Il The hardware status byte contains the status register of the ISN1771 1 disk controller chip The timeout byte contains the maximum allowable response time for the drive in seconds FORMAT DISK The handler will format then verify the the disk The numbers of all bad sectors up to 63 will be put into the specified buffer followed by two bytes of FF The following parameters are set before the call FORMAT parameters DCOMND 21 33 DUNIT 1 4 DBUFLO and DBUFHI address of bad sector list buffer After the operation the status byte is set Also DBYTLO and DBYTHI will contain the number of bytes of bad sector information not including the two FF bytes Useful data base variables and OS equates DVSTAT SO2EA 3 746 device status block 3 bytes DDEVIC 0300 768 serial bus I D DUNIT 0301 769 device number DCOMND 0302 770 command byte DSTATS 0303 771 status byte DBUFLO 0304 772 data buffer DBUFHI 0305 773 pointer DTIMLO 0306 774 timeout value DBYTLO 0308 776 number of bytes transfered DBYTHI 0309 777 DAUX1 030A 778 sector DAUX2 030B 779 number
5. N CREATE MEM SAV A MEM SAV file is used by BASIC and some other programs to save the part of memory which the DUP SYS file loads into If there is no MEM SAV file on the disk when you go to the DOS utilities you will loose that part of memory With BASIC you will loose your program When you type N RETURN you will get the prompt TYPE Y TO CREATE MEM SAV Typing Y RETURN will create a MEM SAV file on the disk in drive one O DUPLICATE FILE This option is used to copy a file from one disk to another using only one disk drive When 26 you type O RETURN you will get the prompt NAME OF FILE TO MOVE If you use wild cards you will be asked to swap disks for each matching file DOS 2 5 also has option P FORMAT SINGLE DOS 2 5 normally formats disks to use enhanced density This option will format a disk in single density for use with the 810 drive DOS 2 5 also has some special utilities on the master disk Use the binary load option to run them RAMDISK SYS This program will cause the extra bank of memory in the 130XE to act like a disk drive called D8 If this program is on the disk it will automatically run lt need not be renamed to AUTORUN SYS COPY32 COM Copies DOS 3 files to DOS 2 DISKFIX COM Can make certain repairs to a disk such as restoring deleted files SETUP COM Used to change the default configuration of DOS AUTORUN SYS DOS 2 0 and 2 5 This program is needed
6. 0379 0380 0381 RELADR 0382 CDEV 0383 CAUX 0384 C 0385 TE ez FU IC 1 AUX2 0386 ERRFLG 0387 DFLAGS 0388 DBSEC 0389 BOOTAD 0390 COLDST PROGRESS 0391 0392 RECL 0393 DSKT 0394 0395 LINB 0396 CHSAI 0397 VSFLAG 0398 KEYD 0399 FINE 0400 GPRIOR 0401 GTIA 0402 PADDLO 0403 0404 0405 0407 0408 0409 0410 NEWA LIM S P S 0406 CSTAT W B DR 0411 TXTROW 0412 TXTCOL 0413 INDEX 0414 TXTMSC 0415 TXTOLD 0416 0417 TMPX1 0418 CRETRY 0419 SUBTMP 021E 0220 0222 0224 0226 0228 022A 022B 022C 022D 022E 022F 0230 0232 0233 0233 0234 0235 0236 0238 0238 023A 023C 023D 023E 023F 0240 0241 0242 0244 0245 0245 0246 0246 0247 026B 026C 026D 026E 026F SO26F 0270 0278 027C 0284 0288 0289 028A 028B 028E 0290 0291 0293 0294 0296 0298 029C 029C 029E 542 544 546 548 550 552 554 5959 556 557 558 5959 560 562 563 563 564 565 566 568 568 570 572 573 574 975 576 577 578 580 581 581 582 582 583 619 620 621 622 623 623 624 632 636 644 648 649 650 651 654 656 657 659 660 662 664 668 668 670
7. RTA RTB TO T1 T2 T3 T4 T5 TZ TGO non maskable interrupt enabl NMI reset NMI status player 0 to graphics collisions player 0 to player collisions player 1 to graphics collisions player 1 to player collisions player 2 to graphics collisions player 2 to player collisions player 3 to graphics collisions player 3 to player collisions port A control Europe North America TV indicator port B control light pen horizontal position light pen vertical position player missile address 256 port A port B game paddl game paddl game paddl game paddl game paddl game paddl game paddl game paddl start pot scan sequence 105 NMI D401 ti D40F D40F D004 DOOC D005 DOOD D006 DOOF PI DOO7 DOOF D302 D014 D303 D40C D40D D407 D300 D301 D200 D201 D202 D203 D204 D205 D206 D207 D20B 54286 54287 54287 53252 53260 53253 53261 53254 53262 53255 53263 54018 53268 54019 54284 54285 54279 54016 54017 53760 53761 53762 53763 53764 53765 53766 53767 93771 ENH ENV STICKO STICK1 STICK2 STICK3 PA PA PA PA PA PA PA PA 0234 0235 0278 0279 SO27A 027B 0270 0271 0272 0273 0274 0275 0276 027
8. 034C ICAX3 the remaining auxiliary 034D ICAX4 bytes are rarely used S034E ICAX5 034F ICAX6 ICHID When a channel is open the handler I D contains an index to the handler table The handler table to be discussed later holds the address of the device handling routines When the chamnel is closed ICHID contains FF ICDNO The device number is used to distinguish between multiple devices with the same name such as disk drives ICCOM The command byte tells CIO what operation to perform CIO command codes HEX DEC Open 03 3 close 0C 12 get 07 7 put 09 11 input 05 5 print 09 9 status request 0D 13 special gt 0D gt 13 command may be made to a closed channel device specific commands ICSTA The status byte contains an error code if something goes wrong If bit 7 is O there have been no errors ICBAL and ICBAH Before a channel is opened the buffer address bytes are set point to the block of memory which contains the name of the device the channel is to be opened to Before actual input or output these bytes are set to point to the block of memory where the l O data is stored or is to be stored ICPTL and ICPTH The put routine pointer is set by CIO to point to the handlers put byte routine When the channel is closed the pointer points to the IOCB closed routine This pointer is only used by BASIC ICBLL and ICBLH The buffer length bytes show the number of byte
9. read player 0 to other player collisions GRAFPO D00D 53261 write player 0 graphics used by OS P1PL y read player 1 to other player collisions GRAPF1 D00E 53262 write player 1 graphics P2PL y read player 2 to other player collisions GRAFP2 SDOOF 53263 write player 2 graphics P3PL m read player 3 to other player collisions GRAPF3 D010 53264 write player 3 graphics GRAFM D011 53265 write missile graphics used by OS COLPMO D012 53266 color for player missile 0 COLPM1 D013 53267 color for player missile 1 COLPM2 D014 53268 color for player missile 2 COLPM3 D015 53269 color for player missile 3 COLPFO DO16 53270 color register 0 COLPF1 D017 53271 color register 1 COLPF2 SD018 53272 color register 2 COLPF3 D0O19 53273 color register 3 COLBK SDO1A 53274 background color register 4 PRIOR D01B 53275 priority select GTIA modes GRACTL D01D 53277 graphics control HITCLR DO1E 53278 writing anything clears all collision bits DMACTL D400 54272 direct memory access DMA control PMBASE D407 54279 start of P M memory Shadow registers SDMCTL 022F 559 DMACTL GPRIOR 026F 623 PRIOR PCOLRO 02C0 704 COLPMO PCOLR1 02C1 705 COLPM1 PCOLR2 02C2 706 COLPM2 PCOLR3 02C3 707 COLPM3 COLORO 02C4 708 COLPFO COLOR1 02C5 709 COLPF1 COLOR2 02C6 710 COLPF2 COLOR3 02C7 711 COLPF3 COLOR4 02C8 712 COLBK Go to chapter 15 Go to chapter
10. 026F 0234 0235 0270 0271 0272 0273 0274 0275 0276 0277 02C0 02C1 02C2 02C3 0010 0231 0230 022F 0232 0278 0279 027A 027B 0284 0285 0286 0287 711 623 564 565 624 625 626 627 628 629 630 631 704 705 706 707 16 561 560 559 563 632 633 634 635 644 NUMERICAL ORDER IRQEN DMACTL SKCTL PENH PRIOR POTO POT1 POT2 POT3 POT4 POT5 POT6 POT7 PORTA PORTB TRIGO TRIG1 TRIG2 TRIG3 COLPMO COLPM1 COLPM2 interrupt request enable Direct Memory access control display list pointer high byte serial port control light pen horizontal position light pen vertical position p m priority and GTIA mode game paddl game paddl game paddl game paddl game paddl game paddl game paddl game paddl port A port B joystick trigger 0 joystick trigger 1 joystick trigger 2 joystick trigger 3 color brightness color brightness color brightness e display list pointer low byte 0 player missile 0 player missile 1 player missile 2 D20E D400 D402 D403 D20F D40C D40D D21B D200 D201 D202 D203 D204 D205 D206 D207 D300 D301 53774 54272 54274 54275 53775 54284 54285 93279 53760
11. 53761 53762 53763 53764 53765 53766 53767 54016 54017 53264 53265 53266 53267 53266 53267 53268 POKMSK SDMCTL SDL SDLSTH SSKCTL PENH iPENV GPRIOR PAD PAD PAD PAD PAD PAD PAD PAD DLO DL1 DL2 DL3 DL4 DL5 DL6 DL7 STICKO STICK1 STICK2 STICK3 STRIGO STRIG1 STRIG2 STRIG3 PCO PCO PCO LRO LR1 LR2 0010 022F 0230 0231 0232 0234 0235 026F 0270 0271 0272 0273 0274 0275 0276 0277 0278 0279 SO27A 027B 0284 0285 0286 0287 02C0 02C1 02C2 16 559 560 561 563 564 565 623 624 625 626 627 628 629 630 631 632 633 634 635 704 705 706 COLPM3 color brightness player missile 3 D015 53269 PCOLR3 02C3 707 COLPFO Color brightness of setcolor 0 D016 53270 COLORO 02C4 708 COLPF1 color brightness of setcolor 1 D017 53271 COLOR1 02C5 709 COLPF2 color brightness of setcolor 2 D018 53272 COLOR2 02C6 710 COLPF3 color brightness of setcolor 3 D019 53273 COLOR3 02C7 711 COLBK color brightness of setcolor 4 SDO1A 53274 COLOR4 02C8 712 CHACTL character control D401 54273 CHART 02F3 755 CHBASE Address of character set 256 D409 54281 CHBAS 02F4 756 KBCODE keyboard code D209 53769
12. The channel numbers is 0 to 3 instead of 1 to 4 The frequency O to 255 is put into the frequency register The noise is put into the high bits of the channel control register with volume in the low bits Therefore SOUND 0 125 10 8 will produce a pure tone of medium frequency and volume in channel 0 called channel 1 in assembly language ADVANCED SOUND The Audio Control register AUDCTL D208 53768 not to be confused with the four audio channel control registers adds more control for assembly language programmers Again to go into technical details will be less productive than experimentation The audio control register AUDCTL 76543210 AUDCTE I JI L 63 1 1804 2 07 242 6 8 7 0 17 bit polynomial noise 1 9 bit below polynomial noise 6 0 clock channel 1 with 64 KHz clock channel 1 with 1 79 MHz 5 0 clock channel 3 with 64 KHz 1 clock channel 3 with 1 79 MHz 4 0 clock channel 2 with 64 KHz 1 clock channel 2 with channel 1 3 0 clock channel 4 with 64 KHz clock channel 4 with channel 3 2 1 insert logical high pass filter in channel 1 clocked by channel 3 1 1 insert logical high pass filter in channel 2 clocked by channel 4 0 0O 64 KHz main clock L 16 KHz main clock All bits of AUDCTL are normally zero The BASIC sound command causes it to be reset to zero By clocking one channel with another the range can be increased This e
13. The following timers are updated during vertical blank VBI as noted above If a timer is decremented to 0 the computer jumps through it s associated vector or sets it s associated flag Label RTCLOK CD CD CD CD CD TMV1 TMV2 TMV3 TMV4 TMV5 address flag vector 0012 3 byte clock 0218 CDTMA1 0226 021A CDTMA2 0228 021C CDIMF3 022A SO21E CDTMF4 022C 0220 CDIMF5 022E 0012 MSB vector SIO time out vector flag flag flag HARDWARE INTERRUPT CONTROL There are two registers on the antic chip which control interrupts These registers can be used to disable interrupts if necessary There are also two associated interrupt status registers The IRQ enable and status registers use the same address The result is that reading the register does not reveal the enabled interrupts but the interrupts pending IRQ interrupt enable data should usually be written to the OS shadow first Reading the OS shadow tells which interrupts are enabled NMIEN bite 7 Non maskabl D401 E interrupt enabl TES Av 352 1 0 not used DLI enabled VBI enabled 55 NMIST IRQEN bit IRQI O H w Ww e 010 J z zZ IRQST bit D H N w OO a Non maskable interrupt status D40F 76543210 l not used 1 DLI pending 1 VBI pending 1 SYSTEM RESET key pending Interrupt request enable SD20E
14. Upper case A for ANTIC modes 2 and 4 mode 2 mode 4 XX yy XXXX yy XX XX XX ZZ XX XX XX ZZ XXXXXX XXYYZZ XX XX XX ZZ Xx yy and zz represent two bit binary numbers controlling one pixel each These numbers determine which color register a pixel is assigned to COLORO COLOR1 COLOR2 or COLOR3 ANTIC mode 5 Antic mode five is identical to ANTIC mode 4 except the characters are displayed twice as tall This makes only 12 lines on the screen ANTIC MODE 6 Graphics 1 This mode uses 8 X 8 pixel characters except they are displayed twice as wide as in ANTIC mode 2 There are 3 colors available at once but only one case upper or lower can be displayed at a time The data base variable CHBAS 02F4 756 controls the character E0 224 upper case E2 226 lower case The color character is controlled by either the color statement or the ATASCII number of the character printed Control characters are controlled by COLORO upper case characters by COLOR1 and lower case characters by COLOR2 Remember that all characters print as upper case alpha characters but of different colors ANTIC MODE 7 Graphics 2 This mode is identical to mode 6 except the characters are displayed twice as tall This 76 results in only 12 lines possible on the screen ANTIC MODE 8 Graphics 3 This is the first graphics non character mode This mode as other non character graphics modes do uses data in the disp
15. Ur Ur Ur DOOF DOOF DO10 DO10 DO11 DO11 D012 D012 D013 D013 D014 D014 D015 D016 D017 D018 D019 DO1A DO1C DO1D DO1 E DO1F D200 D200 D201 D201 D202 D202 D203 D203 53263 53263 53264 53264 53265 53265 53266 53266 53267 53267 53268 53268 53269 53270 53271 53272 53273 53274 54276 53277 54278 53279 53760 53760 53761 53761 53762 53762 53763 53763 STRIGO STRIG1 PCOLRO STRIG2 PCOLR1 STRIG3 PCOLR2 PCOLR3 CO GO Co CO CO LORO LOR1 LOR2 LOR3 LOR4 PADDLO PADDL1 PADDL2 PADDL3 0284 0285 02C0 0286 02C1 0287 02C2 02C3 02C4 02C5 02C6 02C7 02C8 0270 0271 0272 0273 644 705 647 706 707 708 709 710 711 TAZ 624 625 626 627 AUDF3 POT4 AUDC3 POTS AUDF 4 POT6 AUDC4 POT ALLPOT AUDCTL KBCODE STIMER RANDO SKREST POTGO SEROUT SERIN IRQEN IRQST SKSTAT PRIOR PORTA PORTB PACTL PBCTL DMACTL CHACTL Audio frequency 3 control game paddle 4 Audio channel 3 control game paddle 5 Audio frequency 4 control game paddle 6 Audio channel 1 control game paddle 7 game paddle ready indicators general audio control keyboar
16. 124 This area is used by the floating point arithmetic package It is free if the package is not used Page 6 600 6FF Atari has solemnly sworn never to put anything in this page of memory Page 7 the screen region 700 This is called the boot region Most machine language programs which don t use DOS load at this address DOS extends from 700 1CFB MEMLO The address pointed to by the O S database variable MEMLO 02E7 2 743 is the first byte of free memory This pointer is usually changed by any program s initialization routine For example upon power up MEMLO points to 700 When DOS loads in DOS changes MEMLO to point to 2A80 If an AUTORUN SYS program then loads in just above DOS such as DISKIO it will usually change MEMLO to point above itself One important reason for this is to protect the program from BASIC BASIC uses memory starting at MEMLO MEMTOP MEMTOP 2E5 2 741 is set by the O S whenever a graphics mode is entered The graphics region is at the very top of ram and extends downward The address MEMTOP points to depends on how much memory the screen region uses APPMHI APPMHI 0E 2 14 should be set by any program to point to the highest address required by the program If the O S cannot set up a screen without going below APPMHI it will return a not enough memory for screen mode error The cartridge slots 8000 32768 This is the beginning of the 8K bytes used by the right cartridge
17. DSKINV E453 58451 disk handler entry vector Go to chapter 8 Go to chapter 10 50 CHAPTER 10 System interrupts There are four types of interrupts which can occur with the 6502 microprocessor 6502 interrupts 1 chip reset 2 IRQ interrupt request maskable 3 MNI non maskable interrupt 4 software interrupt BRK instruction CHIP RESET On the 400 800 the chip reset occurs only upon power up and causes the computer to do a cold start On later models pressing SYSTEM RESET will cause a chip reset but the computer then does a warm start On the 400 800 the SYSTEM RESET key generates a NMI interrupt COLD START This is a synopsis of the cold start routine 1 The warm start flag 0008 is set to O false 2 If a cartridge slot contains a diagnostic cartridge control is handed to the cartridge 3 The end of RAM is determined by trying to complement the first byte of each 4K block of memory 4 Hardware registers at D000 D4FF except D100 D1FF are cleared 5 RAM is cleared from 0008 to the top of ram 6 The user program jump vector DOSVEC 000A is set to point to the black board mode Atari logo display mode in XL XE models 51 7 The screen margins are set to 2 and 39 8 Interrupt vectors are initialized 9 Bottom of free RAM pointer MEMLO 02E7 is set to point to 0700 10 Resident CIO handlers are initialized 11 If the START key is pressed the cassett
18. If you boot a DOS disk with no cartridge in the slot or with BASIC disabled by holding the OPTION key DOS will try to load the file named DUP SYS This is the disk utility file When using BASIC typing DOS RETURN will load the DUP SYS file When the utilities are loaded the menu will appear on the screen 21 THE DOS UTILITIES MENU DISK OPERATING SYSTEM II VERSION 2 08S COPYRIGHT 1980 ATARI A DISK DIRECTORY I FORMAT DISK B RUN CARTRIDGE J DUPLICATE DISK C COPY FILE K BINARY SAVE D DELETE FILE S L BINARY LOAD E RENA FI M RUN AT ADDRESS F OCK FILE N CREATE MEM SAV G UNLOCK FILE O DUPLICATE DISK H WRITE DOS FILES SELECT ITEM OR RETURN FOR MENU A DIRECTORY After pressing A RETURN you will get the prompt DIRECTORY SEARCH SPEG LIST FILE If you want to see the entire directory just press RETURN again If you wish you may type in a specific file name D is optional or wild cards to search for If you specify a search spec only matching files will be displayed If you want you can have the directory sent to another device To do this type a comma and the device name For example if you type P the directory will be sent to the printer B RUN CARTRIDGE If a cartridge was inserted or BASIC was not disabled when the computer was turned on B RETURN will
19. DA66 55910 FMUL SDADB 56027 FDIV DB28 56104 FLDOR SDD89 56713 FLDOP SDD8D 56717 FLDIR SDD98 56728 FLD1P SDD9C 56732 FSTOR SDDA7 56743 FST1P SDDAB 56747 FMOVE SDDB6 56758 EXP DDCO 56768 EXP10 DDCC 56780 PLYEVL DD40 56640 LOG DECD 57037 LOG10 SDED1 57041 base variables and OS equates system FP buffer system FP buffer INBUFF index pointer to ASCII FP buffer pointer to user FP buffer result buffer for FP to ASCII ASCII to FP FP to ASCII integer to FP FP to integer clear FRO clear zero page FP buffer FRO FRI FRO FR1 FRO FRI FRO FR load FRO by X Y pointer load FRO by FLPTR pointer load FR1 by X Y pointer load FR1 by FLPTR pointer store FRO at buffer by X Y pointer store FRO at buffer by FLPTR pointer move FRO to FRI e exponentiation base 10 exponentiation polynomial evaluation natural log of FRO base 10 log of FRO Go to chapter 10 63 Go to chapter 12 CHAPTER 12 Boot software formats There are three ways which programs may be booted loaded automatically upon power up From the disk drive From the cassette recorder From a ROM cartridge DISK BOOTED SOFTWARE The disk drive is the primary source for programs other than the BASIC interpreter in the computer ROM A program booted from disk must be a machine language program Secondly the program is arranged on disk in a different manner from the D
20. GTIA uses D000 DOFF POKEY uses D200 D2FF and ANTIC uses D400 D4FF Useful data base variables and OS equates SKRES SD20A 53770 serial port status reset SEROUT D20D 53773 serial output data SERIN S D20D 53773 serial input data 98 SKCTL SD20F 53775 serial port control SKSTAT D20E 53775 serial port status VCOUNT D40B 54283 vertical line counter Os shadow registers SSKCTL 0232 562 SKCTL Go to chapter 18 Go to chapter 20 CHAPTER 20 The XL and XE models BASIC B BUGS Most of the Atari 6 00XL and 800XL models were supplied with the debugged version B of Atari BASIC This new BASIC got rid of the minor bugs of BASIC A and introduced some new major bugs of it s own Each time a program is saved 16 extra bytes are tagged onto the end of the program After many saves and reloads as when developing a long program the program becomes too large for the memory The computer may lock up unpredictably Program line links may get messed up leaving garbage in the listing and the program unrunable Large LISTed programs may not run unless SAVed and reLOADed If the length of a listed program is a multiple of a certain number of bytes it will not run unless the length is somehow changed BASIC version B has been replaced by version C All of the XE models have this truly debugged version of BASIC 99 NEW OPERATING SYSTEM PROBLEMS have heard of only on
21. T9 80 81 82 83 84 85 87 88 90 91 93 94 96 96 97 98 99 102 102 104 106 107 108 110 TLI 112 114 STATUS STORAGE SUM WITH CARRY ADDED BACK DATA BUFFE R LOW BYTE ADDRI 800 XL ESS OE NUMB LAST BUFFER BYTE 1 LOW ER OF COMMAND FRAME R ETRIES LOADE R TEMPORARY STORAGE 800 BUFF CE RETRIES DEVI R FULL FLAG RECEIVE DONE FLAG C Cc T CH CH E E RANSMISSI KSUM S KSUM D ON DONE FLAG ENT FLAG O QUIET I OES NOT FOLLOW DATA F O 2 BYTES LAG CRITICAL F DOS Z 800 XL UNCTION FLAG NO DEFF ERED VBI ERO PAGE 7 BYTES STAR HANDL T KEY FLAG ER LOADER TEMP 2 BYT 800 DISPLAY S CASS ETTE BOOT FLAG ATTRACT MA ATTRACT CO ATUS SK LOR SHIFTER EORed WI SCRE EN LEF T MARGIN REGISTER SCRE EN RIG CURSOR ROW CURSOR COL DISP JAY MO HT MARGIN UMN 2 BYTES DE SCRE EN ADD CURSOR BEF DATA ORE DRAW OR FILL UNDER CURSOR ADD 800 XL 800 XL DRAW ESTINATIO FUNCT DRAW ION KEY DEFINATION PO O DESTINATION 2 BYT EUROP
22. The pot value registers contain the number of TV scan lines it last took for the paddle reading capacitors to charge up to 228 These registers are POTO POT7 D200 D207 53760 53767 Their shadow registers are PADDLO PADDL7 0270 0277 624 631 95 THE LIGHT PEN REGISTERS Whenever a joystick trigger is pressed the light pen registers PENH and PENV are updated PENH D40C 54284 takes a value based on a color clock counter The value can be from 0 to 227 PENV D40D 54285 takes the 8 highest bits of the vertical line counter A light pen is simply a photo transistor connected to a joystick trigger line and focused on the TV screen When the electron beam strikes the part of the screen the light pen is focused on the transistor turns on pulling the trigger line low The light pen registers then contain numbers relative to where the light pen was pointing The shadow register for PENH and PENV are LPENH 0234 564 and LPENV 0235 566 Useful operating system equates TRIGO D010 53264 Joystick triggers TRIG3 D013 53268 POTO D200 53760 paddle value POT7 D207 STELE ALLPOT D208 53768 reads validity of pot values POTGO D20B 53771 starts paddle read SKCTL D20F 53775 bit 2 enables fast pot scan PORTA D300 53016 port A data PORTB D301 53017 port B data PACTL D302 54018 port A control PBCTL D303 54019 port B control PENH D
23. eS disp l 2 F display one line of graphics in ANTIC mode 2 F horizontal scroll enabled vertical scroll enabled load memory scan counter with next two bytes lay list interrupt all instructions In the display instruction the ANTIC mode is different from the CIO graphics mode However each CIO graphics mode uses a particular ANTIC mode Below are descriptions of the ANTIC modes with their associated graphics CIO modes ANTIC MODE 2 Graphics 0 Uses 8 pixel by 8 pixel characters 40 characters horizontal 8 TV scan lines vertical Only one color can be displayed at a time ANTIC MODE 3 8 X 10 pixel Graphics 0 type characters This mode requires a custom character set The advantage is that it allows true decenders The custom C set is still 8 X 8 pixels Lower case letters with decenders have the bottom row of pixels put on the top row Lower ca se y for ANTIC mode 3 C set Display XXXXX XX XX XX XX XX XX XX XX XX XX XX XX XXXXX XXXXX XX XX SSS XXXXX 75 ANTIC MODE 4 graphics 12 on XL and XE This mode has characters the same size as graphics 0 However the characters are only 4 X 8 pixels This gives only half the horizontal resolution of graphics 0 The advantage is that up to four colors of graphics 0 characters can be displayed at once This mode also requires a custom C set Below is a comparison of the normal C set to one which works with the ANTIC 4 mode
24. the first three sectors called the boot record have a program which loads the DOS SYS file If there is no DOS SYS file on the disk the computer will display BOOT ERROR BOOT ERROR BOOT ERROR BOOT ERROR BOOT ERROR BOOT ERROR etc When a disk is formatted the drive read write head passes over the entire disk and puts magnetic marks on it These marks divide the disk into 32 concentric tracks With DOS 2 0 each track is divided into 18 sectors each holding 128 bytes of data With DOS 2 5 there are 32 sectors per track giving a total of 1 024 sectors Each sector on the disk is marked with a reference number from 1 to 720 Unfortunately the writers of DOS 2 0 didn t know this so they wrote the DOS to use sectors numbered from 0 to 719 As a result DOS 2 0 cannot access sector 720 The designers of the disk drive were the guilty party in this case lt is normal to number from 0 in computers With DOS 2 5 sectors 720 1 024 can be accessed normally Sector 720 can be accessed using the computer s resident disk handler Some software writers use sector 720 to hide special information to make their programs difficult to copy 14 DOS 2 SECTOR ASSIGNMENTS Sectors 1 through 3 are called the boot record They contain a program which loads the DOS SYS file into memory Sector 360 is called the Volume Table of Contents or VTOC The main purpose of the VTOC is to keep track of what sectors are
25. without changing any other bits you would add 16 to the decimal number already in the register To reset the same bit to 0 you would subtract 16 from the number in the register This is exactly what the command GRAPHICS 8 16 does lt sets bits 3 and 4 of a graphics mode control register MSB and LSB may also mean Most Significant Byte or Least Significant Byte depending on context Table of contents 1 The Central Input Output Utility CIO 2 The Disk Operating System DOS 3 Using the DOS 2 Utilities DUP SYS 4 The Cassette Handler C 5 The Keyboard Handler K 6 The Printer Handler P 7 The Screen Editor E 8 The Display Handler S 9 The Resident Disk Handler 10 System Interrupts 11 The Floating Point Arithmetic Package 12 Boot Software Formats 13 The Serial Input Output Interface SIO 14 The Hardware Chips 15 Display Lists 16 Player and Missile Graphics 17 Sound 18 The Joystick Ports 19 Misc 20 The XL and XE Models A Hardware Registers B Operating System Equates C Memory Use Ivo van Poorten ipoorten cs vu nl CHAPTER 1 The central Input Output utility CIO The ATARI computer uses a very easy to use input and output system called the Central Input Output utility or CIO Nearly all input or output passes through this utility CIO uses eight channels as paths for I O There are not really separate channels for I O but the computer acts as if there were Each channel
26. 17 89 CHAPTER 17 Sound Generating sound can be very simple For simple sounds there are four audio channels each controlled by two control registers GENERATING SOUNDS To generate a sound in channel 1 put the frequency and volume codes into the frequency and control registers The frequency register for channel 1 AUDF1 D200 53760 can have any number from 0 to FF 255 O causes the highest frequency 255 causes the lowest The volume noise control register for channel 1 AUDC1 D201 53761 is more complicated Audio channel control volume noise register LO DAs es de 0 AUDCx noise volumel 6318421 42 6 o N e The noise bits can have various values The best way to learn to use them is by experimentation The technical details of the polynomial counters which generate the noise has little bearing on what is heard The two special values of interest are 1 volume 16 in decimal which causes a DC voltage proportional to the volume bits and A volume 160 which causes a pure tone square wave The volume bits select the relative volume O off Therefore the number A8 168 8 160 in AUDC1 will cause the frequency selected by AUDF1 to be a pure tone of medium volume In BASIC the dirty work is done fore you The SOUND command will do all the calculations for you The Sound command format is shown below The BASIC sound command format SOUND channel frequency noise volume 90
27. 2 02 address of display data buffer 2 02 2 02 2nd ANTIC 2 instruction 2 02 24th ANTIC 2 instruction 65 41 32 20 gt jump back to start of list 78 156 90 9C40 227 27 first byte of display data buffer SOFFF tate 22 last byte of buffer SA000 start of ROM A display list for a higher resolution graphics mode would require more instructions and might cross a 1K boundary It would then include a jump instruction to cross the boundary MULTIPLE DISPLAYS It is possible to set up multiple displays and use one at a time The technique of changing from one display to another is called page flipping Below is the simplest way to set up two displays Setting up two displays e Call a graphics mode through CIO or by using a BASIC GRAPHICS command e Store the display list pointers SDLSTL and SDLSTH and the CIO screen pointer SAVMSC 0058 2 88 e Move the start of ROM pointer RAMTOP 006A 106 to below the current display list RAMTOP is a one byte pointer so it changes in increments of one page 256 bytes e make another graphics call as in the first step e store the new display list pointer and CIO screen pointer This will set up two displays each with it s own display list If the displays are in the same graphics mode or you will not make any changes in the displays with CIO commands PLOT PRINT etc you can flip between the two simply by changing the display list pointer I
28. CH 02FC 764 Go to chapter 20 Go to appendix B APPENDIX B Operating System Equates 0100 0101 ATARI 800 EQUATE LISTING 0102 0103 0104 0105 This listing is based on the original release of Operating System 0106 version A The vectors shown here were not changed in version B 0107 New equates for XL and XE models are included and noted Changes 0108 from version B to XL XE are also noted 0109 0110 Most of th quate names given below are the official Atari 0111 names They are in common use but are not mandatory 0112 0113 0114 DEVICE NAMES OLLE 7 0116 0117 SCREDT E SCREEN EDITOR 0118 KBD k KEYBOARD 0119 DISPLY Ss DISPLAY 0120 PRINTR P PRINTE 0121 CASSET C CASSETTE 0122 DISK p DISK DRIVE 113 0 0 Y UY wY UY Y Y Y uN NN Ny y O 0 J004us YN RPO0o0o JO Oa pep ds HD PB BB ss ds ds ooooo0coqooqo ceqoqo0qo0o0ooocoo0oooo0o0o0o o 0ooocoo0oo0ooco0o co o0o0o0o 0o 0o 0o co0o0o0o 0co0o co cco 0c CCC CCCOOCOOCO OO O dd 010 040 ada a a a FOMWMU WANA OT BRUNE NNN Ow Go Ss o OO MAAN AU BWN FP nao Oo Ae wN 00 E S e EE AY VA VU O O 0 Ar G aB O G a OAD WH o 00 NP EOFERR TRNRCD 7 COMMAND COD STATUS 01 80 82 82 83 84 85 86 87 88 89 8A
29. In mode 8 if a bit is 0 it s pixel is assigned to the register called COLBK If a bit is one it s pixel is assigned to COLPFO See COLORS below for more information on the color registers You may notice a close similarity between mode 0 and mode 8 The major difference between these modes is where the dot by dot information comes from In mode 8 this information comes from the display buffer In mode 0 the display buffer contains codes telling what characters to display The actual dot by dot information comes for the character set at E000 In mode 7 each pixel is controlled by two bits Therefore each byte only controls four pixels 38 There are also only 1 4 as many pixels on the screen as in mode 8 See mode 3 below for an explanation of how the each byte affects the pixels In a graphics mode when CIO sends a byte of data to the screen handler that byte has information for only one pixel Do not confuse a byte which CIO sends to the screen handler with the bytes in the display buffer CIO sends data to or retrieves data from the screen in the following forms 76543210 100000 01 D Modes 3 5 7 D color 10 0000 0 OIDI Modes 4 6 8 D Color 1000 0 D Modes 9 10 11 D data Mode 3 uses a screen which is 40 pixels horizontally and 24 vertically Each pixel is a square the size of a mode 0 character It requires 273 bytes of RAM where each byte controls 4 pixels Each pair of bits controls w
30. all of the data on the present logical line for processing by CIO If characters are typed on the screen and then the cursor is moved off the line then back on the line and new characters are typed only the characters to the right of the reentry point of the cursor are input when RETURN is pressed However if the cursor is moved off the line again then moved back on all characters on that logical line are input If bit O of ICAX1 is 1 the editor will act as if the RETURN key is being held down This bit may be changed at any time Editor control codes The screen editor treats certain ATASCII codes as special control codes Screen editor control codes KEY HEX DEC FUNCTION RETURN 9B 155 carriage return or EOL CLEAR 7D 125 Clear screen put cursor in upper left UP ARROW 1C 28 Move cursor up one screen line DOWN 1D 29 down one line EFT 1E 30 left one character RIGHT 1F 31 right one character BACK S 7E 126 Back space operation SET TAB S9F 159 sets tab stop at cursor CLEAR TAB S9E 158 Clear tab stop at cursor TAB STE 127 move to next tab stop SHIFT INSER 9D T57 Make space for a new line SHIFT DELETE 9C 156 delete the logical line at the cursor CTRL INSER SFE 255 make room for a character CTRL DELETE SFE 254 delete character at cursor ESCAPE 1B 27 causes next non EOL code to be 34 displayed a
31. and OS equates HPOSPO D000 53248 write horizontal position of player 0 OPF i read missile 0 to plotted graphics collisions HPOSP1 D001 53249 write horizontal position of player 1 1PF m m read missile 1 to plotted graphics collisions HPOSP2 D002 53250 write horizontal position of player 2 2PF d y read missile 2 to plotted graphics collisions HPOSP3 D003 53251 write horizontal position of player 3 3PF a y read missile 3 to plotted graphics collisions HPOSMO D004 53252 write horizontal position of missile 0 POPF m y read Player 0 to plotted graphics collisions HPOSM1 D005 53253 write horizontal position of missile 1 88 P1PF read Player 1 to plotted graphics collisions HPOSM2 D006 53254 write horizontal position of missile 2 P2PF y y read Player 2 to plotted graphics collisions HPOSM3 D007 53255 write horizontal position of missile 3 P3PF Y read Player 3 to plotted graphics collisions SIZEPO D008 53256 write size of player 0 OPL ve read missile 0 to player collisions SIZEP1 D009 53257 write size of player 1 1PL read missile 1 to player collisions SIZEP2 SDOOA 53258 write size of player 2 2PL m y read missile 2 to player collisions SIZEP3 D00B 53259 write size of player 3 3PL read missile 3 to player collisions SIZEM SDOOC 53260 write widths for all missiles POPL de
32. and a 1K 4 page boundary for two line resolution The page number where the bit map starts is stored in the PM base register PMBASE D407 54279 For one line resolution this number will be a multiple of 8 For two line resolution it will be a multiple of 4 PMBASE holds the MSB of the address of the PM bit map The LSB will always be 0 so it need not be specified The PM bit maps 2 line resolution 128 bytes 1 2 page per player start 0 t 1 1 2 page 384 bytes unused 180 384 M3 M2 M1 MO fifth player or missiles 200 512 player 0 map F 280 640 player 1 map J 300 768 player 2 map J 380 896 player 3 map F 400 1024 L line resolution 256 bytes 1 page per player start 0 768 bytes 84 O RE 10 20 22 30 32 40 50 60 70 80 90 100 110 120 130 200 210 212 220 230 240 250 260 300 310 320 330 3 pages unused 300 768 fifth player M2 M1 MO or missiles 400 1024 player 0 map 500 1280 player 1 map 8600 1536 player 2 map 5700 1792 player 3 map 800 2048 Example of using P M graphics in BASIC LABEL REGISTERS ETC JINES 2 120 ES 2 THEN VERT VERT 2 1024 ES 2 THEN PMO PM0 2
33. device and file name must be followed by 0 or 9B decimal 155 Once the parameters are set jumping JSR to the CIO vector CIOV at address E456 58454 will cause the channel to be opened In the following example a basic knowledge of assembly language is assumed Routine to open channel 1 to the keyboard ICHID 0340 ICCOM ICHID 2 ICAX1 ICHID 10 ICAX2 ICHID 11 IOCB1 10 channel in four high bits CIOV E456 OPEN 03 OREAD 04 open for input ERROR address of error handling routine START LDX IOCB1 LDA gt NAME STA ICBAH X DA OREAD STA ICAX1 X LDA 0 STA ICAX2 X JSR CIOV BPL OK JMP ERROR NAME BYTE K 9B OK program continues here To open a CIO channel in BASIC the OPEN command is used BASIC OPEN command format OPEN channel auxl aux2 device file nam auxl direction code aux2 special code To open channel 1 to the keyboard in BASIC Type OPEN 1 4 0 K The third parameter aux2 is a rarely used special parameter One use is to keep the screen from erasing when changing graphics modes The fourth parameter is the device to open the channel to It may be either a string in quotes or a string variable CIO device names cassette recorder disk drive screen editor AON K Keyboard P printer R RS 232 I O port S screen handler Uses a non resident handler loaded by the device at powe
34. is O the screen is interpreted as mode 15 If the bit is 1 the screen is interpreted as modes 8 through 11 Modes 8 through 11 are set up identically in memory including the display list The only difference is the data in the PRIOR register of the GTIA chip The shadow register for PRIOR is GPRIOR 026F 623 Mode 8 PRIOR 00 3F 0 63 uses a screen of 320 columns by 192 rows Each byte controls 8 pixels as in modes 4 and 6 Mode 9 PRIOR 40 7F 64 127 uses a screen of 80 columns by 192 rows Each byte controls 2 pixels The pixels are all of the same color controlled by COLBK Each half of a byte in the display buffer controls the luminance of the assigned pixel The format of each byte is as follows 76543210 data data pixel 1 pixel 2 Mode 10 PRIOR 80 BF 128 191 is the same as mode 9 except 9 color luminance combinations are available The data in each half byte chooses one of the 9 color registers for the assigned pixel Mode 11 PRIOR CO FF 192 255 is the same as mode 9 except there is one brightness but 16 colors The pixel data chooses one of the 16 available colors The luminance is that of the background COLBK USING THE SCREEN HANDLER 40 OPENING A CHANNEL TO THE SCREEN HANDLER When a channel is opened to the screen handler the following actions take place The area of memory to be used for the screen data is cleared A display list program for
35. 0 752 753 754 755 756 757 758 760 761 762 763 764 764 766 767 3 MORE PLAYER COLOR R 4 MORE GRAPHICS COLOR R DIRING DRAW FLAG L FLAG 15 BYTE BIT MAP FOR TAB SETTINGS 4 BYTE LOGICAL LINE START BIT MAP NUMBER OF DEVIC 24 NORM 4 SPLIT EGISTERS 23 SPARE BYTES OA ECTOR ECTOR ECTOR ECTOR ECTOR ECTOR ECTOR SIZ RESERVED EY AUTO REPEA EGISTERS EY AUTO REPEAT RA ELP KEY FLAG E KK KKK KX O w D E lt D ve H D w El E EY CLICK DISABLI VOM mA RR DMCTL DMA SAV RINTER BUFFER POI T E R RINTER BUFFER SIZ T n FU D a E E STATUS BUFFER HIBIT CURSOR ELAY AND RATE R FOR SCREEN FIL LAY CONTROL CHARACTERS FLAG LAY START STOP F HARACTER SET POINTER DRAW DESTINATION DRAW DESTINATION 119 ES 4 SPARE BYTES RMANENT START OF ROM POINTER HANDLER LOADER FLAG 4 BYTES TTE BAUD RATE 2 BYTES ATASCII CHARACTER FOR CIO LAFG 0480 0481 0482 0483 0484 0485 0486 0487 0488 0489 0490 0491 0492 0493 0494 0495 0496 0497 0498 0499 0500 RATE 0501 0
36. 0 0 D OLD NEW change name of D OLD to D NEW NOTE and POINT can also be used directly from BASIC NOTE finds the current position of the read write head on the disk POINT moves the read write head to the desired position USING NOTE AND POINT The command format for NOTE and POINT is as follows NOTE channel sector byte POINT EXAMPLE NOTE 1 SECT BYTE 20 BASIC requires the sector and byte parameters in both commands to be variables Fixed numbers cannot be used If you try to do a POINT to a sector outside the file the channel is open to a point error will occur Care may need to be taken to be sure the file being accessed is in contiguous sectors on the disk If it is not it will be difficult to know where to do points to One use of NOTE is to use the command immediately after opening a channel to a disk file After the NOTE command the parameter variables contain the coordinates of the first byte of the file They can then be used as a reference for the POINT command In assembly language ICAX3 and ICAX4 are used for the sector number Isb msb ICAX5 is used for the byte number STATUS REQUEST If the status request command is used one of the following values will be found in ICSTA and the 6502 Y register HEX DEC 01 T OK A7 167 file locked SAA 170 file not found Goto chapter 1 Go to chapter 3 CHAPTER 3 Using the DOS 2 utilities DUP SYS
37. 005 D006 D006 D007 D007 D008 D008 D009 D009 DOOA DOOA DOOB DOOB DOOC DOOC DOOD DOOD DOOE DOOE 53248 53248 53249 53249 53250 53250 53251 93251 53252 53252 53253 53253 53254 53254 53255 53255 53256 53256 53257 53257 53258 53258 53259 53259 53260 53260 53261 53261 53262 53262 GRAFP2 player 2 graphics P3PL player 3 to player collisions GRAFP3 player 3 graphics TRIGO joystick trigger 0 GRAFM missile graphics TRIGL joystick trigger 1 COLPMO color brightness player missile 0 TRIG2 joystick trigger 2 COLPM1 color brightness player missile 1 TRIG3 joystick trigger 3 COLPM2 color brightness player missile 2 PAL Europe North America TV indicator COLPM3 color brightness player missile 3 COLPFO Color brightness of setcolor COLPF1 color brightness of setcolor COLPF2 color brightness of setcolor COLPF3 color brightness of setcolor COLBK color brightness of setcolor VDELAY vertical delay GRACTL graphics control HITCLR clear collisions CONSOL START SELECT OPT speaker AUDF1 Audio frequency 1 control POTO game paddle 0 AUDC1 Audio channel 1 control POT1 game paddle 1 AUDF2 Audio frequency 2 control POT2 game paddle 2 AUDC2 Audio channel 2 control POT3 game paddle 3 108 Ur Ur Ur Ur Ur Ur Ur
38. 1 0422 0423 0424 0425 0426 0427 0428 0429 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 0440 044 044 044 044 044 044 044 044 0449 0450 0451 0452 0453 0454 0455 0456 0457 0458 0459 0460 0461 0462 0463 0464 0465 0466 0467 0468 0469 0470 0471 0472 0473 0474 0475 0476 0477 0478 0479 ArANnD UF Na HOLD2 DMASK TMPLBT ESCFLG TABMAP r DVSTA CBAUDL CRSINH LOGMAP INVFLG FILFLG TMPROW TMPCOL SCRFLG HOLD 4 KEYREP NOCLIK an 1 PFG ASAV PBPNT PBUFSZ U GLBABS RAMSIZ OP 10 7 tr HNDLOD 029F SO2A0 02A1 02A2 02A3 02B2 02B6 02B7 02B8 02B9 02BB 02BC 02B 02B 02BI SO2BF 02C0 02C4 02C9 02C9 02CB 02CD 02CF 02D1 02D3 02D5 02D7 02D9 02DA 02DB 02DC 02DD 02DE 02DF 02E0 02E4 02E5 02E7 02E9 02E9 Hu g SO2EA SO2EE K G C G N N R G C A CH FILDAT DSPFLG SSFLAG r EYDEL H1 HACT HBAS EWROW EWCOL OWINC OLINC HAR TACHR r r 02F0 02F1 02F2 02F3 02F4 02F5 02F6 02F8 02F9 SO2FA 02FB SO2FC 02FC S02FE SO2FF PAGI 671 672 673 674 675 690 694 695 696 697 699 700 701 701 702 703 704 708 713 713 715 AL TL9 Tel 723 129 TAD 729 730 aL 732 133 734 735 736 740 741 1 743 745 745 746 75
39. 1 4000 S7FFF 100 hp 0 8000 SBFFF 1 C000 SFFFF Bits 4 and 5 select which chip sees the switched in RAM at 4000 7FFF Chip select bits bits ANTIC 6502 45 0 0 Ext Ext o 1 EXE ain 10 ain Ext 1 1 ain ain THE XL PARALLEL PORT Pin out of the parallel port top from rear 111112222233333444445 2468024680246802468024680 11111222223333344444 1357913579135791357913579 1 2 GND 3 Al 4 AO 5 A3 6 A2 7 A5 8 A4 9 GND 10 A6 11 A8 12 A7 13 A10 14 A9 15 A12 16 A11 17 A14 18 A13 19 A15 20 GND 21 D1 22 DO 2 3 D3 24 D2 25 D5 26 D4 27 D7 28 D6 29 GND 30 GND 31 GND 32 phase 2 clock 33 RESET 34 35 RDY 36 IRQ 37 37 39 40 41 GND 42 101 43 RAS 44 45 R W 46 GND 47 5V 48 5V 49 GND 50 The phase 2 clock runs at 1 8 MHz When the clock is high the address and R W lines are valid The clock goes from high to low when the data lines are also valid All lines then become invalid The 130XE doesnt have the parallel port However it has a cartridge slot expansion This is a small cartridge slot like connector with the necessary connector to use parallel expansion FINE SCROLLING If address 026E 622 is FF graphics 0 will be in the fine scroll mode OTHER ADDRESSES DSCTLN 0D25 2 725 is the disk sector size should be 80 128 DMASAV 02DD 735 is a copy of the DMA control register SDMCTL 022F 559 It is set up when a channel is opened to the sc
40. 2 CS All 13 Voc P A10 14 Vcc R NC 15 NC S NC The BASIC interpreter resides in the memory used by cartridge A In 400 800 and 1200XL models a BASIC cartridge is required to run BASIC programs On other XL and XE models inserting a cartridge into the slot or pressing the OPTION key upon power up will disable the internal BASIC ROM If BASIC is disabled without inserting another cartridge the area from A000 to BFFF will contain RAM Useful data base variables and OS equates APPMHI 000E 2 14 low limit of screen region DOSVEC 000A 2 10 run and program reset vector DOSINI 000C 2 12 init and reset init CARTB 8000 32768 start of cartridge B CARTA A000 40960 start of cartridge A PACTL D302 54018 port A control register Bit 3 controls the cassette motor Goto chapter 11 Go to chapter 13 CHAPTER 13 67 The Serial Input Output interface SIO Most input and output with the Atari computer passes through the serial I O bus The SIO interface is rather complicated but you are unlikely to need to use it directly CIO usually handles SIO for you However if you want to design your own I O device and it s associated handler you need to know how to use the SIO SIO transfers data at a rate of 19 200 baud on separate input and output lines The data is sent one byte at a time LSB first in an asynchronous format There are also clock in and clock out lines There is a signal on the c
41. 21 ESIGN SEF 239 SIGN OF FP EXPONENT 0322 FCHFLG SFO 240 FIRST CHARACTER FLAG 0323 DIGRI F1 241 NUMBER OF DIGITS RIGHT OF DECIMAL POINT 0324 CIX F2 242 INPUT INDEX 0325 INBUFF F3 243 POINTER TO ASCII FP NUMBER 0326 ZTEMP1 SF5 245 0327 ZTEMP4 SF7 247 0328 ZTEMP3 SF9 249 0329 DEGFLG FB 251 0330 RADFLG SFB 251 O RADIANS 6 DEGREES 0331 FLPTR SFC 252 POINTER TO BCD FP NUMBER 0332 FPTR2 SFE 254 0333 0334 0335 PAGE 1 0336 UIST 6502 STACK 0338 0339 0340 0341 2 0342 PAGE 2 0343 0344 0345 INTABS 0200 512 INTERRUPT RAM 0346 VDSLST 0200 512 NMI VECTOR 0347 VPRCED 0202 514 PROCEED LINE IRQ VECTOR 0348 VINTER 0204 516 INTERRUPT LINE IRQ VECTOR 0349 VBREAK 0206 518 0350 VKEYBD 0208 520 0351 VSERIN 020A 522 SERIAL INPUT READY IRQ 0352 VSEROR 020C 524 SERIAL OUTPUT READY IRQ 0353 VSEROC 020E 526 SERIAL OUTPUT COMPLETE IRQ 0354 VTIMR1 0210 528 TIMER 1 IRQ 0355 VTIMR2 0212 530 TIMER 2 IRQ 0356 VTIMR4 0214 532 TIMER 4 IRQ 0357 VIMIRQ 0216 534 IRQ VECTOR 0358 CDIMV1 0218 536 DOW IMER 1 0359 CDTMV2 021A 538 DOW IMER 2 0360 CDTMV3 021C 540 DOW IMER 3 117 0361 CDIMV4 0362 CDIMV5 0363 VVBLKI 0364 VVBLKD 0365 CDIMA1 0366 CDIMA2 0367 CDIMF3 0368 SRTIMR 0369 CDIMF4 0370 INTEMP 0371 CDIMF5 0372 SDMCTL 0373 SDLSTL 0374 SSKCTL 0375 0376 LCOUNT 0377 LPENH 0378 LPENV
42. 230 560 DLISTH display list pointer high byte D403 54275 SDLSTH 0231 561 HSCROL horizontal scroll D404 54276 VSCROL vertical scroll D405 54277 PMBASE player missile address 256 D407 54279 CHBASE Address of character set 256 D409 54281 CHBAS 02F4 756 WSYNC wait for horizontal sync SD40A 54282 VCOUNT vertical line counter D40B 54283 PENH light pen horizontal position SD40C 54284 LPENH 0234 564 PENV light pen vertical position SD40D 54285 LPENV 0235 565 NMIE non maskable interrupt enabl NMI S D40E 54286 NMIRES NMI reset SD40F 54287 NMIST NMI status SD40F 54287 SHADOW REGISTER ORDER ALPHEBETICAL ORDER Register Shadow Name Description Address Name Address KBCODE keyboard code D209 53769 CH 02FC 764 CHACTL character control D401 54273 CHART 02F3 755 CHBASE Address of character set 256 D409 54281 CHBAS 02F4 756 COLBK color brightness of setcolor 4 SDO1A 53274 COLOR4 02C8 712 COLPFO Color brightness of setcolor 0 DO16 53270 COLORO 02C4 708 COLPF1 color brightness of setcolor 1 D017 53271 COLOR1 02C5 709 COLPF2 color brightness of setcolor 2 D018 53272 COLOR2 02C6 710 110 COLPF3 color brightness of setcolor 3 PRIOR PENH PENV POTO POT1 POT2 POT3 POT4 POTS POT6 POT7 COLP COLP COLP COLP IRQE DLIST DLISTL DMACTI SKCTL PORTA PORTB TRIGO TRIGL TRIG2 TRIG3 p m priority and GTIA mode light pen horizontal posit
43. 3 Address 106 POSPO OPF POSP1 1PF HPOSP2 2PF HPOSP3 3PF HPOSMO POPF HPOSM1 P1PF HPOSM2 P2PF HOP SM3 P3PF SIZEPO MOPL SIZEP1 M1PL SIZEP2 M2PL SIZEP3 M3PL SIZEM POPL GRAFPO P1PL GRAFP1 P2PL horizontal position of pl missile 0 to graphics col horizontal position of pl missile 1 to graphics col horizontal position of pl missile 2 to graphics col horizontal position of pl layer 0 llisions layer 1 llisions layer 2 llisions layer 3 missile 3 to graphics col llisions horizontal position of missile 0 player 0 to graphics collisions horizontal position of missile 1 player 1 to graphics collisions horizontal position of missile 2 player 2 to graphics collisions horizontal position of missile 3 player 3 to graphics collisions player 0 size missile 0 to player collisions player 1 size missile 1 to player collisions player 2 size missile 2 to player collisions player 3 size missile 3 to player collisions missile size player 0 to player collisions player 0 graphics player 1 to player collisions player 1 graphics player 2 to player collisions 107 Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur DO00 DO00 D001 D001 D002 D002 D003 D003 D004 D004 D005 D
44. 3 771 status byte DBUFLO 0304 772 DBUFHI 0305 773 Pointer to 128 byte memory block for data storage DTIMLO 0306 774 Timeout valu response time limit in seconds DBYTLO 0308 776 DBYTHI 0309 777 number of bytes transferred set by handler DAUX1 030A 778 DAUX2 030B 779 sector number DISK HANDLER COMMANDS GET SECTOR Before the JSR to DSKINV is made the following parameters are set GET SECTOR parameters DCOMND 52 82 DUNIT 1 4 DBUFHI and DBUFLO address of 128 byte buffer DAUX1 and DAUX2 Sector number LSB MSB This operation will read the specified sector and put the data into the specified buffer PUT SECTOR PUT SECTOR is used the same as GET SECTOR except for DCOMND 48 PUT SECTOR parameters DCOMND 50 80 This operation sends the data in the specified buffer to the specified disk sector PUT SECTOR WITH VERIFY PUT SECTOR WITH VERIFY is used the same as PUT SECTOR except for DCOMND PUT SECTOR WITH VERIFY parameters DCOMND 57 87 This operation sends the data in the specified buffer to the specified disk sector then checks for errors GET STATUS Only the DUNIT and DCOMND need to be set GET STATUS parameters DCOMND DUNIT 53 83 T The status information will be put in three bytes starting at DVSTAT 02EA 746 Status format 763430 210
45. 4 control D206 53766 CHACTL character control D401 54273 CHART 02F3 755 CHBASE Address of character set 256 D409 54281 CHBAS 5 02F4 756 COLBK color brightness of setcolor 4 DO1A 53274 COLOR4 02C8 712 COLPFO Color brightness of setcolor 0 D016 53270 COLORO 02C4 708 COLPF1 color brightness of setcolor 1 D017 53271 COLOR1 02C5 709 COLPF2 color brightness of setcolor 2 DO18 53272 COLOR2 02C6 710 COLPF3 color brightness of setcolor 3 DO19 53273 COLOR3 02C7 711 COLPMO color brightness player missile 0 D012 53266 PCOLRO 02C0 704 COLPM1 color brightness player missile 1 DO13 53267 PCOLR1 02C1 705 COLPM2 color brightness player missile 2 DO14 53268 PCOLR2 02C2 706 COLPM3 color brightness player missile 3 DO15 53269 PCOLR3 02C3 707 CONSOL START SELECT OPT speaker DO1F 53279 103 DMACTL GRACTL GRAFM GRAFPO GRAFP1 GRAFP 2 GRAFP 3 HITCLR HPOSMO HPOSM1 HPOSM2 HOP SM3 HPOSPO HPOSP1 HPOSP2 HPOSP3 HSCROL IRQEN IROST KBCODE OPF OPL 1PF 1PL 2PF 2PL 3PF 3PL display list pointer high byte Direct Memory access control graphics control missile graphics player 0 graphics player 1 graphics player 2 graphics player 3 graphics clear coll horizon horizon horizon horizon horizon horizon horizon horizon horizon interrupt lisions l position l position l posi
46. 40C 54284 light pen horizontal value PENV D40D 54285 light pen vertical value Shadow registers PENH 0234 564 light pen horizontal value PENV 0235 566 light pen vertical value PADDLO 0270 624 game paddle values PADDL7 0277 631 STICKO 0278 632 joystick registers STICKO 027B 635 PRTIGO 027C 636 paddle triggers PTRIG7 0283 643 STRIGO 0284 644 joystick triggers STRIG3 0287 647 Go to chapter 17 Go to chapter 19 96 CHAPTER 19 Misc Hardware registers and information VERTICAL LINE COUNTER The ANTIC chip has a vertical line counter at 0D4B 54283 This counter shows the high 8 bits of a 9 bit counter This gives two line resolution The value of this counter is placed into PENV D40D 54285 when a joystick trigger is pressed SERIAL PORT REGISTERS The POKEY chip has some registers which control the serial port The serial port control register SKCTL D20F 53775 controls the serial port configuration and the game paddle scan mode and some keyboard circuitry The serial port control register 76543210 SKCTL A O A 16318421 242 6 8 bits 0 1 enable keyboard debounce 1 1 enable keyboard scan both 0 set initialization mode 2 1 fast pot scan 3 1 serial output is two tone for cassette instead of logical true false 4 5 gt serial port mode control 6 7 1 forced logical 0 on output If the serial port control register is read from it g
47. 502 0503 0504 0505 0506 0507 0508 0509 0510 0511 0512 0513 0514 0515 0516 0517 0518 0519 0520 0521 0522 0523 0524 0525 0526 0527 0528 0529 0530 0531 0532 0533 0534 0535 0536 0537 0538 r r SIDENT DISK HANDLER SIO INTER RE DCB 0300 DDEVIC 0300 DUNIT 0301 DCOMND 0302 DSTATS 0303 DBUFLO 0304 DBUFHI 0305 DTIMLO 0306 DBYTLO 0308 DBYTHI 0309 DAUX1 030A DAUX2 030B TIMER1 030C ADDCOR 030E JMPERS 030E CASFLG S030F IMER2 0310 EMP1 0312 EMP2 0313 EMP2 0314 PTIMOT 0314 EMP3 0315 SAVIO 0316 TIMFLG 0317 STACKP 0318 STA 0319 HATABS 031A MAXDEV 0321 PUPBT1 033D PUPBT2 033E PUPBT3 033F TOCBOS IOCB 0340 ICHID 0340 ICDNO 0341 ICCO 0342 ICSTA 0343 ICBAL 0344 ICBAH 0345 ICPTL 0346 ICPTH 0347 ICBLL 0348 ICBLH 0349 ICAX1 034A ICAX2 034B ICAX3 034C ICAX4 034D ICAX5 034E ICAX6 034F PRNBUF 03C0 03E8 SUPERF 03E8 768 768 769 770 771 772 773 774 776 LT 778 779 780 782 782 783 784 786 787 788 788 789 790 791 792 793 794 801 829 830 831 832 832 833 834 835 836 837 838 839 840 84 84 84 84 84 84 84 YOU BP WN Ra 960 1000 1000 FACE DEVICE CONTROL BLOC
48. 5904 0649 FADD SDA66 55910 0650 FMUL SDADB 56027 0651 FDIV SDB28 56104 0652 PLYEVL DD40 56640 0653 FLDOR DD89 56713 0654 FLDOP SDD8D 56717 0655 FLDIR DD98 56728 0656 FLDIP DD9C 56732 0657 FSTOR DDA7 56743 122 0658 0659 0660 0661 0662 1 0663 1 0664 0665 0666 0667 0668 0669 0670 0671 0672 0673 0674 0675 0676 0677 0678 0679 0680 0681 0682 0683 0684 0685 0686 0687 0688 0689 0690 0691 0692 0693 0694 0695 0696 0697 0698 0699 0700 FSTOP DDAB 56747 FMOVE DDB6 56758 EXP DDCO 56768 EXP10 SDDCC 56780 LOG DECD 57037 LOG10 DED1 57041 OPERATING SYSTEM MODULE ORIGIN TABLE CHORG E000 57344 CHARACTER SET 1K VECTBL E400 58368 VECTOR TABLE VCTABL E480 58496 RAM VECTOR INITIAL VALUE TABLE CIOORG SE4A6 58534 CIO HANDLER INTORG E6D5 59093 INTERRUPT HANDLER SIOORG E944 59716 SIO DRIVER DSKORT SEDEA 60906 DISK HANDLER PRNORG SEE78 61048 PRINTER HANDLER CASORG SEE78 61048 CASSETTE HANDLER MONORG F0E3 61667 MONITOR POWER UP MODULE KBDORG F3E4 62436 KEYBOARD DISPLAY HANDLER VECTOR TABLE CONTAINS ADDRESSES OF CIO ROUTINES IN THE FOLLOWING ORDER THE ADDRESSES IN THE TABLE ARE TRUE ADDRESSE ADDRESS 0 OPEN A t 2 CLOSE H 4 GE 6 PUT 8 STATUS t A SPECIAL A FC JMP TO INITIALIZATION F NOT
49. 7 564 565 632 634 634 635 624 625 626 627 628 629 630 631 PRIOR RANDOM SERIN SEROUT SIZEM SIZEPO SIZEP1 SIZEP2 SIZEP3 SKCTL SKRES SKSTAT STIMER TRIGO TRIGL TRIG2 TRIG3 VCOUNT VDELAY VSCROL WSYNC p m priority and GTIA mode random number generator serial port input serial port output missile size player 0 player 1 player 2 player 3 size size size size serial port control reset serial port status serial port status start timer joystick joystick joystick joystick vertical vertical vertical wait for trigger 0 trigger 1 trigger 2 trigger 3 line counter delay scroll horizontal sync NUMERICAL ORDER Registers sharing addresses are listed first when writen to then when read from Name Register Description Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur D21B 53275 GPRIOR 026F 623 D20A 53770 D20D 53774 D20D 53773 DOOC 53260 D008 53256 D009 53257 DOOA 53258 DOOB 53259 D20F 53775 D20A 53770 D20F 53775 D209 53769 DO10 53264 D011 53265 D012 53266 D013 53267 D40B 54283 DO1C 54276 D405 54277 D40A 54282 Address SSKCTL STRIGO STRIG1 STRIG2 STRIG3 Shadow Name 0232 0284 0285 0286 0287 56
50. 7 Cc Default Color Shadow Color Register Register 0 green COLPF1 COLOR1 1 gold COLPF0 COLORO 2 gold COLPF0O COLORO 3 green COLPF1 COLOR1 4 red COLPF3 COLOR3 5 blue COLPF2 COLOR2 6 blue COLPF2 COLOR2 7 red COLPF3 COLOR3 D is a 5 bit ATASCII code which selects the character to be displayed The database variable CHBAS selects between upper case CHBAS E0 224 and lower case CHBAS E2 226 GRAPHICS MODES 3 THROUGH 11 Modes 3 through 8 offer a split screen mode In modes 9 through 11 special programming is required for split screens These modes use dot by dot pixel by pixel graphics instead of character sets Before explaining how graphics are sent to the screen through CIO will describe how the data in the display buffer is interpreted by the ANTIC chip Mode 8 is the simplest of the graphics modes Each byte of the display buffer controls eight pixels horizontally The first 40 bytes of the display buffer control the first horizontal line of graphics This makes a total of 320 pixels horizontally If one of the eight bits of a byte is a 1 then the pixel it controls is on If a bit is a O then it s pixel is off For example if a particular byte is equal to 9B binary 10011011 then its part of the screen would look like k k k k 10011011 In reality the pixels are assigned to different color registers A color register is a byte of memory which controls the color of all pixels assigned to it
51. 76543210 L BREAK key interrupt enabl L keyboard interrupt enable L serial input interrupt enable L serial output interrupt enable L serial output finished interrupt enabl L timer 4 interrupt enable L timer 2 interrupt enable L timer 1 interrupt enable has a shadow register POKMSK 0010 A Interrupt request status D201 ql 1 6 964 302 1 0 1 BREAK key interrupt pending L keyboard interrupt pending L serial input interrupt pending L serial output interrupt pending L serial output finished interrupt pending L timer 4 interrupt pending L timer 2 interrupt pending L timer 1 interrupt pending 56 WAIT FOR HORIZONTAL SYNC Writing any number to WSYNC D40A 54282 will cause the computer to stop and wait for the next TV horizontal sync It is wise to use DLIs one TV line before needed then writing to WSYNC This will keep other interrupts from causing DLIs to be serviced late This can cause a DLI to change something in the middle of a scan line Useful database variables and OS equates POKMSK 0010 16 IROEN shadow TROE SD20E 53774 enables IRQs when written to IRQS SD20E 53774 gives IRQs waiting when read PACTL D302 54018 bit 7 read peripheral A interrupt status bit 0 write peripheral A interrupt enable PBCTL D303 54019 bit 7 read peripheral B interrupt status bit 0 write peripher
52. 8B S8C 8D S8E S8F 90 91 92 93 03 04 05 06 07 08 09 09 10 SOB soc soc SOD SOE 11 12 20 20 21 21 23 24 25 26 50 52 CODES 1 128 BREAK KEY ABOR 130 IOCB ALREADY OPEN 130 NONEXISTANT DEVICE 131 OPENED FOR WRITE ONLY 132 INVALID COMMAND 133 DEVICE OR FILE OT OPEN 134 INVALID IOCB UMBER 135 OPENED FOR READ ONLY 136 END OF FILE 137 TRUNCATED RECORD 138 PERIPHERAL TIME OUT 139 DEVICE DOES NOT ACKNOWLEDGE 140 SERIAL BUS FRAMING ERROR 141 CURSOR OUT OF RANGE 142 SERIAL BUS DATA OVERRUN 143 SERIAL BUS CHECKSU ERROR 144 PERIPHERAL DEVICE ERROR 145 NON EXISTANT SCREEN MODE 146 FUNCTION NOT IMPLEMENTED 147 NOT ENOUGH MEMORY FOR SCREEN MODE ES FOR CIO 3 4 OPEN FOR INPUT 5 GET RECORD 6 OPEN TO DISK DIRECTORY 7 GET BYTE 8 OPEN FOR OUTPUT 9 WRITE RECORD 9 OPEN TO APPEND TO END OF DISK FILE 16 OPEN TO SPLIT SCREEN MIXED MODE 11 PUT BYTE 12 12 OPEN FOR INPUT AND OUTPUT AT THE SAME TIME 13 14 BEGINNING OF SPECIAL COMMANDS 17 SCR
53. APTER 4 The cassette handler C The cassette handler sends data to the cassette recorder in blocks of 128 bytes each The blocks are sent in the following format Cassette record format OnE KOCA 1010 ak speed measurement bytes 001 OT 0 1 01 control byte 128 data bytes checksum handled by SIO The control byte may have one of the following values SFC 252 record is full SFA 250 partly full next record is EOF SFE 254 EOF record data section is all zeroes The cassette handler has two modes of operation The first mode uses only a short gap between records It is called the no IRG interrecord gaps mode The second mode uses longer gaps between records and is called the IRG mode In the IRG mode the computer may stop the cassette recorder between records for processing data When a channel is opened to the cassette recorder bit 7 of ICAUX2 may be set to 1 ICAX2 80 128 This will cause the cassette to use the no IRG mode 29 A cassette file starts with a 20 second mark tone This tone is followed by the file records with 128 data bytes each The final record is an End Of File record The cassette is a straight forward read write device There are no special functions other than those common to other CIO devices The cassette motor is controlled by one of the controller port control registers If bit 3 of PACTL D302 54018 is O then the cassette motor i
54. Atari System Reference Manual Atari System Reference manual Written by Bob DuHamel c 1987 Hypertext version constructed by Ivo van Poorten c 1994 Bob Duhamel 6915 Casselberry Way San Diego CA 92119 Atari is a registered trademark of Atari Corp This manual contains highly technical information Such information is provided for those who know how to use it To understand the advanced information you are expected to know 6502 assembly language If you are new to programming concentrate on the parts which discuss BASIC commands Addresses are usually given in both hexadecimal and decimal numbers The operating system equate names are given in capital letters with the address following in brackets The decimal address is in parenthsis within the brackets For example DOSVEC 000A 2 10 name hex dec The 2 after the hexadecimal number means that this address requires two bytes to hold its information Any address called a vector uses two bytes whether noted or not Control registers and some other bytes of memory are shown in the following format Register format 76543210 8421 NP Ss 0 Nu aor 8 The numbers on top are the bit numbers Bit 7 is the Most Significant Bit MSB and bit 0 is the Least Significant bit LSB The numbers on the bottom are the bit weights These are useful when changing memory with decimal numbers as you would in BASIC For example to set bit 4 of a register to 1
55. C the INPUT command is used BASIC INPUT command format INPUT channel string variable or INPUT channel arithmetic variable For example INPUT 1 INS The above commands will cause the data from the device to be put into the specified buffer INS in the BASIC example until an EOL is reached If the INPUT statement is used again without closing the channel the computer will get more data from the device until another EOL is read or the end of the file is reached The new data will write over the old data in the input string or buffer If an arithmetic variable is used only numbers can be input PRINT ICCOM 09 In assembly language the print command is identical to the input command The only difference is that the PUTREC code 09 is stored in ICCOM Of course the buffer bytes of the lOCB then specify the block of memory to be output from rather than input to With the print command EOLs within the string or buffer are ignored but an EOL is placed at the end of the data when sent to the device In BASIC the PRINT command is used like INPUT except you want to use a semicolon instead of a comma to separate parameters For example PRINT 1 OUT PRINT 1 HELLO If you use a comma ten space characters will be sent before the string If the print command is used again without closing the channel the new data will be appended to the end of the data previously sent Old data will not be written over GET IC
56. CAX1 ICAX1 for disk open PH 322 0 WRD AI D 1 open to read the directory instead of a file A 1 append data to the end of the file This gives the following extra ICAX1 options Disk specific ICAX1 options HEX DEC 06 6 open to read directory 09 9 output append to the end of an existing file READING THE DIRECTORY When the directory is read each file name is treated as if it were followed by an EOL A loop must be used to read all of the file names in the directory The last entry read is the free sector count After it is read another read operation will result in an End Of File error The disk drive has a number of device specific commands other than the regular ClO commands From BASIC the XIO command is used to access these commands The XIO command allows you to directly load the IOCBs from BASIC Each parameter of the XIO 19 command places values in certain bytes of an lOCB XIO command format XIO command channel auxl aux2 device file nam Note that the parameters resemble the BASIC OPEN command The BASIC OPEN command is identical to it s equivalent XIO command XIO commands specific to the disk drive RENAME XIO 20 32 DELETE XIO 21 33 LOCK XIO 23 35 UNLOCK XIO 24 36 POINT XIO 25 37 NOTE XIO 26 38 FORMAT XIO SFE 254 EXAMPLES XIO 33 1 0 0 D JUNK delete file named D JUNK XIO 32 1
57. COM 07 In BASIC this command inputs a single byte of data from the device EOLs are ignored In BASIC GET is used like INPUT except an arithmetic variable must be used For example GET 1 IN If the get command is used again the next byte from the device will be read If the end of a file is reached an error will occur There is no command in BASIC to input an entire file without stopping at each EOL If you wish to ignore EOLs while reading a file to a string you must use the GET command Each byte of data is then put into the string by the program 1 4 0 D TEST 60 REM GOES TO LINE 60 WHEN END OF FILE ERROR OCCURS 1 IN EN INS 1 CHRS IN 30 E 1 In assembly language the get command can be used to get any number of bytes from the device lt works just as INPUT does except EOLs are ignored ICCOM ICBAL ICBAH ICBLL IOCB get byte parameters get character single byte code same as in input 10 ICBAH Other than the ICCOM code GETCHR 07 this command is identical to the input command PUT ICCOM 0B In BASIC PUT is the opposite of GET It outputs a single byte from a variable to the device PUT is used the same as GET For example PUT 1 OUT In assembly language the command byte of the lOCB is loaded with the put character code PUTCHR 0B Otherwise the PUT command is identical to GET CLOSING A C
58. E CONVENTIONS DOS is unique among CIO handlers in that it requires an eight character file name to follow the device name This file name may be followed by a period and then a three character extender EXAMPLES D TEST D2 FIREMAN D VENTURE EXE D CHAPTER 001 The D2 is used for drive number two if present The file name must use upper case letters or numbers The first character must always be a letter WILD CARDS The characters and may be used as wild cards means any combination of characters and means any single character EXAMPLES D P any file beginning with P and without an extender D EXE any file with the extender EXE Dit any file D F REMAN one unknown character FIREMAN or FOREMAN will match Wild cards can only be used to load delete lock and unlock files When loading a file using wild cards only the first matching file will be loaded When renaming a file both the new and old names are expected after the device name EXAMPLE D OLDNAME BAS NEWNAME BAS 18 To format a disk only the device name D or Dn is needed USING DOS When a CIO channel is opened to the disk drive it must actually be opened to a specific file on the disk The device name in the open command must be followed by a file name When a channel is opened to the disk two special parameters may be used in I
59. EEN DRAW 18 SCREEN FILL 32 32 OPEN TO SCREEN BUT DON T ERASE 33 33 FORMAT DISK RESIDENT DISK HANDLER RDH 35 36 37 38 80 RDH PUT SECTOR 82 RDH GET SECTOR 114 183 184 185 186 187 188 189 190 191 192 193 194 195 196 1 97 198 199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0214 0215 0216 0217 0218 0219 0220 0221 0222 0223 0224 0225 0226 0227 0228 0229 0230 0231 0232 0233 0234 0235 0236 0237 0238 0239 0240 0241 0242 O O O O G O G O G O GO OGO OO O o DSTAT PSEC NOIRG CR i IOCBSZ MAXIOC IOCBF i LEDGE REDGE LINZBS i NGFLAG CASINI RAMLO TRAMSZ STDA WARMST BOOT DOSVEC DOSINI APPMHI POKMSK BRKKEY RTCLOK BUFADR ICCOMT DSKF DS PTIMOT AB PBE 53 83 57 87 80 128 9B 155 10 16 80 128 SFF 255 02 2 27 39 OS VARIABLES PAGE 0 00 0 00 0 01 al 02 2 04 4 06 6 07 7 08 8 09 9 SOA 10 0C 12 SOE 14 10 16 11 17 12 18 15 21 17 23 18 24 1A 26 1C 28 1C 28 1D 29 1D 29 1E 30 S1E 30 1F 31 S1F 31 20 32 20 32 21 33 22 34 23 35 24 36 25 37 26 38 27 39 28 40 29 41 2A 42 2B 43 2C 44 2E 46 2F 47 RDH GET STA RDH PUT SEC US OR AND VE
60. HANNEL Closing a channel frees it for use by another device or for changing parameters In assembly language the close code is put into the command byte of the IOCB then the CIOV call is made IOCB close command CLOSE 0C LDX IOCB1 DA CLOSE STA ICCOM X JSR CIOV In BASIC use the CLOSE command followed by the channel number CLOSE 1 With the disk drive the file name is not put into the directory until the channel is closed 11 THE DEVICE TABLE CIO uses a jump table located at 031A 794 When a CIO call is made CIO searches the table for the one byte device name The two bytes following the device name contain the address of the device handler s vector table CIO searches the device table from the end 033D 829 to the beginning This way if a custom handler has ben substituted for a resident handler the custom handler will be found first custom handlers cannot be inserted directly in the place of resident handlers in the device table Each handler has its own vector table This vector table is 16 bytes long The two byte vectors point to the various handler routines The vectors are stored in the vector table in the following order Handler vector table order open close get byte put byte get stat special JMP init code 3 bytes The open routine should validate the ICAX parameters and check for illegal commands The close routine should send any remaining data in the buffer
61. ION BYTI TWO SPARE ES CIO US El IOCB NUMBER 16 CHARACTE ER POINTER El ka 11 E FOR CURRENT OP ERATION 5 0243 0244 0245 0246 0247 0248 0249 0250 0251 0252 0253 0254 0255 0256 0257 0258 0259 0260 0261 0262 0263 0264 0265 0266 0267 0268 0269 0270 0271 0272 STATUS CHKSUM BUFRLO BUFRHI BFENLO BFENHI CRETRY LTEMP DRETRY BUFRFL RECVDN XMTDON CHKSNT NOCKSM BPTR ELG 30 31 32 33 34 35 36 36 37 38 39 S3A S3B 3C 3D ETYPE 3E FEOF FREQ i SOUNDR CRITIC FMSZPG CKEY ZCHAIN CASSBT DSTAT 7 ATRACT DRKMSK COLRSH GRAPHICS 0273 0274 0275 0276 0277 0278 0279 0280 0281 0282 0283 0284 0285 0286 0287 0288 0289 0290 0291 0292 0293 0294 ONLY 0295 0296 0297 0298 0299 0300 i TMPCHR HOLD1 LMARGN RMARGN ROWCRS COLCRS DINDEX SAVMSC LDROW LDCOL LDCHR LDADR EWROW EF A s YUZEHZOOOO Q O SAVADR RAMTOP BUFCNT BUFSTR BITMSK SHFAMT ROWAC COLAC 3F 40 41 42 43 S4A S4A S4B S4C 4 4 AU 50 51 52 53 54 55 57 58 S5A S5B S5D S5E 60 60 61 62 63 66 66 68 S6A S6B S6C S6E S6F 70 72 48 49 50 51 52 53 54 54 59 56 57 58 59 60 61 62 63 64 65 66 67 74 74 75 76 77 78
62. K INITI 800 XL AL T IMER VALUE ADD OPTI ITION ON JUM COR PERS RECTION CASSE FEF MODE W HEN SE FINAL VAL UE TI M PRIN SERIAL I ERS 1 amp 2 DE TER TI OUT FLAG E OS PO NDLE TACK RARY DATA OR BA OUT PORT TERMINE BAUD UD RATE CORRECTION STATU POINTE R SAVE S HO DER R ADDRESS D W POWE POWE I SI HA MAXIMU X X X POWE HANDLER DDR R UP RE R UP RE R UP RE naa DP OTHER IOCB s PRINT 800 XL ER B UFFER 21 112 BYTES 40 BYTES SPARE BYTE S SCRE EN EDI 120 TOR E 38 BYTES ESS INDE X 0539 054 054 054 054 054 054 054 054 054 054 0550 0551 0552 0553 0554 0555 0556 0557 0558 0559 0560 0561 0562 AANA OU BWNE O o 0563 0564 0565 0566 0567 0568 0569 0570 0571 0572 0573 0574 0575 0576 0577 0578 0579 0580 0581 0582 0583 0584 0585 0586 0587 0588 0589 0590 0591 0592 0593 0594 0595 0596 0597
63. L 2K FREE RAM IF NO CARTRIDG F c800 51200 XL START OF OS RO CHORG2 CC00 52224 XL INTERNATIONAL CHARACTER SE 121 0598 0599 0600 HARDWARE REGISTERS 0601 0602 0603 SEE REGISTER LIST FOR MORE INFORMATION 0604 0605 0606 HPOSPO D000 53248 0607 MOPF D000 53248 0608 SIZEPO D008 53256 0609 MOPL SD008 53256 0610 SIZE D00C 53260 0611 GRAFPO DOOD 53261 0612 GRAF D011 53265 0613 COLPMO D012 53266 0614 COLPFO D016 53270 0615 PRIOR D01B 53275 0616 GTIAR D01B 53275 0617 VDELAY DO1C 53276 0618 GRACTL D01D 53277 0619 HITCLR DO1E 53278 0620 CONSOL DO1F 53279 0621 AUDF1 D200 53760 0622 AUDC1 D201 53761 0623 AUDCTL D208 53768 0624 RANDOM D20A 53770 0625 IRQEN SD20E 53774 0626 SKCTL D20F 53775 0627 PORTA D300 54016 0628 PORTB D301 54017 0629 PACTL D302 54018 0630 PBCTL D303 54019 0631 DMACLT D400 54272 0632 DLISTL D402 54274 0633 HSCROL D404 54276 0634 VSCROL D405 54277 0635 CHBASE D409 54281 0636 WSYNC D40A 54282 0637 VCOUNT D40B 54283 0638 NMIEN SD40E 54286 0639 0640 FLOATING POINT MATH ROUTINES 0641 0642 AFP SD800 55296 0643 FASC SD8E6 55526 0644 IFP D9IAA 55722 0645 FPI SD9D2 55762 0646 ZFRO SDA44 55876 0647 ZF1 SDA46 55878 0648 FSUB SDA60 5
64. OS files When the computer is first turned on it will attempt to read a program starting at sector one in disk drive one The exceptions are if a cartridge prevents the disk boot process or the START key is pressed The program is expected to use all 128 bytes of each sector FORMAT OF A DISK BOOTED PROGRAM A disk booted program begins at sector one on the disk and continues in sequence The first six bytes of the first sector contain program information The rest of the bytes contain the program itself Disk boot program header lst byte 00 flags stored in DFLAGS 0240 Sxx number of sectors used by program Sxx address to start load Sxx 64 xx initialization address 6th byte Sxx 7th byte xx start of program The flags byte is usually unused and should be zero The load address is stored in BOOTAD 0242 2 578 The initialization address is stored in DOSINI 000C 2 12 After the program is completely loaded the computer will JSR to the address stored in DOSINI for initialization It will then jump to the address stored in DOSVEC to run the program The initialization part of the program should set the bottom of free RAM pointer MEMLO 02E7 2 743 to point to the end of the program 1 This will protect the program from the computer and other programs The top of user RAM pointer APPMHI 000E 2 14 is also usually set to point to the same address This will protect the program from the video hardwa
65. RIFY NO GAP CASSE TTE CARRIAGE RE URN IOCB SIZE MAX IOCB IOCB FREE LO DEFAUL EET CK SIZ E MARGIN DEFAULT RIGH 800 XL FOR OR RESERVE T MARGIN IGINAL D EBUGG ER D XL FOR POW ER UP SELF T POINTER FOR EMPORARY RAI EST DATA SUCCESSFU PROGRAM PROGRAM INIT DISPLAY LOW 1 B S ELE SIZI EST Fl A OOT FLAG RUN VECTOR IALIZATION IMIT IRQ ENABLE F AGS FLAG 3 BYTES SB FIRST INDIREC COMMAND DISK FILE BUE FOR VECTOR MANAGER FER ADDRESS DISK UTILITY POINTER DU POINTER P SYS EST R TIME OUT REGIST ER 800 PRINTE XL RESERVE D 00 PRINTE 1 RESERVE R BUFE D R BUFE ER SIZE 00 TE RESERVE ZERO PAGE 10 8 x 800 PRINTE XL RESERVE 8 XL PORARY REGIST D ER D CB par ANDLER INDE X NUMB ER DEVICE NUMBE COMMAND STATUS ID R BUFFER POIN ER LOW BYTE BUFFER POIN ER HIGH BYT El PUT ROUTINE POINTER LOW PUT ROUTINE POINTER HIGH BUFFER LENG H LOW AUXILIARY INFORMAT
66. RIZ 120 LRO 704 PL 559 EP0 53256 HPOSP0 53248 TL 559 RAM PEEK 106 16 BASE 54279 TL 53277 START PMRAM 256 PMO AU Q Uv EM SE REGISTERS SDMCTL 62 INES 2 THEN POKE SDMCTL 46 SIZEPO 1 j E HPOSPO HORIZ PCOLRO 88 PMBASE PMRA GRACTL 3 DRAW PLAYER PMSTART VERT 60 PMSTART VERT 1 66 PMSTART VERT 2 165 85 340 POKE PMSTART VERT 3 129 350 POKE PMSTART VERT 4 195 360 POKE PMSTART VERT 5 189 370 POKE PMSTART VERT 6 66 380 POKE PMSTART VERT 7 60 The above program will draw a happy face in about the middle of the screen using player 0 To move the player horizontally poke a different number into HPOSPO To draw the player in a different vertical position change VERT To use a different player or missile use the memory maps above to find the starting address of the player you want to use For example to use player 1 change line 40 to PM1 1280 Then change line 130 to PMSTART PMRAM 256 PM1 The variable LINES determines the vertical resolution The number poked into SIZEPO determines the width P M PRIORITY The priorities of players missiles and non P M graphics can be controlled by the PRIOR register D10B 53275 and its shadow register GPRIOR 26F 623 Objects with higher priority will appear to move in front of lower p
67. USED EDITRV E400 58368 EDITOR SCRENV E410 58384 SCREE KEYBDV E420 58400 KEYBOARD PRINTV E430 58416 PRINTER 123 s 1 Go to appendix A Go to appendix C APPENDIX C Memory Use Page 0 00 7F Operating system zero page The entire first half of page zero is reserved for the operating system 80 FF Free zero page The top half of page zero is free if BASIC is disabled BASIC uses all but CB D1 The floating point math routines use D4 FF If the floating point arithmetic package is not used this memory is free Page 1 100 1FF This is the 6502 stack The stack pointer initialized to 1FF and moves downward as the stack is filled Pages 2 5 200 47F This area is used for operating system database variables Parts which are not used in some particular programs such as the cassette buffer or printer buffer may then be used for other purposes See the O S equate listing for these locations 480 57D 480 6F F if no floating point This is called the user work space It is free to be used by programs If the floating point arithmetic package is not used the user work space extends to 6FF This area is used by BASIC 57E 5FF
68. YTHI 0309 777 Number of bytes to be transferred set by handler or program This parameter is not required if the DSTATS specifies no data transfer DAUX1 030A 778 DAUX2 030B 779 These parameters are sent to the device as part of the command frame USING THE SIO INTERFACE All commands on the serial bus must originate from the computer The peripherals will present data on the bus only when commanded to do so Any operation on the serial bus begins with a five byte command frame While the command frame is being sent the command line of the serial connector is 0 Command frame format 69 Sxx DDEVIC xx DCOMND Sxx DAUX1 Sxx DAUX2 Sxx checksum The first four bytes of the command frame come from the device control block the checksum is the sum of the other four bytes with the carry added back after each addition If both R and W of the DSTATS are 0 no data is sent to or expected from the peripheral after a command frame is sent However the device is usually expected to send an ACK byte 41 after the command frame is sent If the command frame is invalid an NAK byte 4E should be sent If the operation is output W 1 the computer will send a data frame after it receives the ACK of the command frame It then expects an ACK after the data frame is sent If the operation is an input R 1 the computer expects a data frame from the peripheral after the ACK With either input or output a com
69. a Ga Ge EG nppprprrrrre DF3 D204 53764 Audio frequency 3 DC3 D205 53765 audio control 3 DF4 D206 53766 Audio frequency 4 DC4 D207 53767 audio control 4 DCTL D208 53768 general audio control IMER D209 53769 audio timer reset Go to chapter 16 Go to chapter 18 CHAPTER 18 The joystick ports The joystick ports are the I O ports of the PIA chip This means that they are bidirectional capable of output as well as input The joystick ports are usually set up for input To read them simply read the port registers PORTA D300 53016 will read joystick ports 1 and 2 PORTB D301 5401 7 will read joystick ports 3 and 4 Joystick ports 3 and 4 are used for memory control on the XL XE models and don t have external connectors Each bit of each port can be configured independently for input or output To reconfigure a port the port control registers PACTL and PBCTL D302 54018 and D303 54019 are used The port control registers also control some lines on the serial I O connector The port control registers TG oF A 432 10 PACTL or at e MA dE PBCTL Tro 3 108 42 1 24256 8 bits PACTL 93 Peripheral A interrupt status Set by peripheral interrupt reset by reading PORTA 3 Cassette motor control 0 on 1 off 2 0 PORTA is now port A direction control Writing to PORTA will now set bits for inpu
70. ad from the joystick trigger registers TRIGO TRIG3 D010 D013 53264 53267 These register have shadow registers STRIGO STRIG3 0284 0287 644 647 If these registers read zero the associated triggers are pressed The paddle triggers may be read from their shadow registers also They are PTRIGO PTRIG 7 027C 0283 236 643 THE GAME PADDLE REGISTERS Although the game paddles are plugged into the joystick ports they are not read from the port registers The game paddles are read by first writing any number to the start pot scan register POTGO D20B 53771 This turns off the capacitor dump transistors and allows the pot reading capacitors to begin charging It also sets the TV scan line counter to zero As each capacitor crosses a certain trigger voltage the number of TV lines scanned is put in the respective pot value register When the scan counter reaches 228 the capacitor dump transistors are turned on and the number 228 is put into any pot value registers which are still empty Before reading the pot value registers ALLPOT D208 53768 should be checked In this register each bit corresponds to the validity of a pot value register If a bit is zero its associated pot value register is valid If bit 2 of SKCTL D20F 53775 is 1 the pots go into the fast scan mode In this mode the paddles are read in only 2 TV scan lines They can also be read without regard to POTGO or ALLPOT
71. al B interrupt enable WSYNC SD40A 54282 wait for horizontal sync NMIE SD40E 54286 NMI enable NMIST SD40F 54287 NMI status Go to chapter 9 Go to chapter 11 CHAPTER 11 The Floating Point arithmethic Package The routines which do floating point arithmetic are a part of the operating system ROM The Atari computer uses the 6502 s decimal math mode This mode uses numbers represented in packed Binary Coded Decimal BCD This means that each byte of a floating point number holds two decimal digits The actual method of representing a full number is complicated and probably not very important to a programmer However for those with the knowledge to use it the format is given below Floating point number representation byte 0 XX xcess 64 exponent sign xx xx XX gt 10 BCD digits 57 xx byte 7 xx The decimal point is shifted to left of the MSD and the exponent is adjusted accordingly Therefore the decimal point doesn t need to be represented For programming purposes floating point numbers can be in ASCII code It takes up to 14 bytes to store a floating point number in this manner The floating point package has a routine to convert numbers between ASCII and floating point USE OF THE FLOATING POINT PACKAGE The floating point package has several routines to convert between ASCII and FP and to do the arithmetic functions These are the important data base variables Floating p
72. anguage the color is determined by the data sent to the screen See the above section on graphics modes for color information In BASIC the PLOT command is used to put data on the screen The PLOT command is used as follows The BASIC PLOT command PLOT x y x and y are the horizontal and vertical coordinates for the plotted point In modes 3 through 11 a single point will be plotted In modes 1 and 2 a text character will be printed on the screen by the PLOT command The PRINT and PUT commands can also be used in basic What appears on the screen depends on the graphics mode In modes 1 and 2 the ATASCII characters sent to the screen will be printed just as in mode 0 See the paragraph on modes 1 and 2 above for more information In the other modes what appears depends on how the ANTIC chip interprets the data bytes sent to the screen For example in mode 8 even numbered characters will be single pixels in color 1 Odd numbered characters will be in color 0 background There are two special commands for the screen handler DRAW and FILL DRAW ICCOM 11 17 The draw command works exactly like the plot command except a straight line is drawn from the previous pixel to the new one In BASIC it is used in the following format the BASIC DRAW command DRAWTO x y FILL ICCOM 12 18 Fill works like draw except the area to the right of the drawn line will be filled with the color in 43 FILDAT 02FD 765 The fill com
73. are from BFFA to BFFF In cartridge B they are from 9FFA to 9FFF last six bytes of a cartridge SOFFA or SBFFA XX start address 00 XX flag byte XX init address SOFFF or SBFFF XX Flag byte bit 0 1 allow disk boot bit 2 0 do not start cartridge after init DILE Y 1 cartridge takes control before OS is initialized The initialization process for the cartridge should be similar to that for disk and cassette A minimum of an RTS instruction is required The third byte of the cartridge tailer is used by the OS to check for the presence of a cartridge This byte must be zero A 16K cartridge will use both cartridge areas and the cartridge B tailer area can be used for program code THE CARTRIDGE HARDWARE Most cartridges consist of two ROM chips on a single circuit board Moreover both chip sockets have identical pin assignments In other words the chips can be switched to opposite sockets and the cartridge will still work The difference is in the chips themselves On one chip the A12 pin acts as an active low chip select On the other the A12 pin acts as an active high chip select Therefore the state of the A12 pin selects between the two chips Cartridge slot pin assignments 66 BACK 111111 543210987654321 SRPNMLKJHFEDCBA FRONT 1 1 16K A A13 16K only 2 A3 B GND 3 A2 Cc A4 4 Al D A5 5 AO E A6 6 D4 F A7 7 D5 H A8 8 D8 J A9 9 D1 K A12 CS CS 10 DO L D3 11 D6 __ D7 1
74. art code is executed NON MASKABLE INTERRUPTS NMI NMI interrupts are generated by the following conditions 1 Display list interrupt generated by the ANTIC chip 2 TV vertical blank interrupt generated by the ANTIC chip 3 SYSTEM RESET key 400 800 When an NMI interrupt occurs the hardware register NMIST D40F is examined to determine what type of interrupt occurred The computer is then directed through the proper ram vector to service the interrupt DISPLAY LIST INTERRUPTS DLIs The computer makes no use of DLIs The ram vector points to an RTI instruction VERTICAL BLANK INTERRUPTS VBIs There are two stages to the VBI service routine The second stage is only done if a critical function was not interrupted Stage 1 VBI The real time clock RTCLOK 0012 0014 is incremented The attract mode variables are processed System timer 1 is decremented If it goes to zero the computer JSRs through system time out vector 1 Stage 2 VBI The hardware registers are loaded with the data in their shadow registers System timer 2 is decremented If it goes to zero the computer JSRs through the system 53 time out vector 2 System timers 3 4 and 5 are decremented If a timer goes to zero the computer sets system timer flags 3 4 and or 5 If auto repeat is active the auto repeat process is done The keyboard debounce timer is decremented if not 0 Information at the controller port register
75. bles as a 50mA 5V peripharal power supply and a computer ready signal Useful database variables and OS equates SIOV E459 58457 serial port handler entry DDEVIC 0300 768 device ID DUNIT 0301 769 device number DCOMND 0302 770 command byte DSTATS 0303 771 status byte DBUFLO 0304 772 data buffer pointer 71 DBUFHI 0305 773 DTIMLO 0306 774 timout value DBYTLO 0308 776 number of bytes to transfer DBYTHI 0309 777 DAUX1 030A 778 sent to device DAUX2 030B 779 sent to device Go to chapter 12 Go to chapter 14 CHAPTER 14 The hardware chips The previous chapters described the operating system of the computer The following chapters will examine the hardware which supports the 6502 and the hardware s associated software THE GTIA CHIP The GTIA George s Television Interface Adapter is the main video circuit in the computer It controls the following functions GTIA functions Priority of overlapping objects Color and brightness including information from the antic chip Player missile control console switches and game control triggers THE ANTIC CHIP The main job of the ANTIC chip is interpreting the display buffer for the GTIA chip The ANTIC chip is somewhat of a processor in it s own right The program which runs it is called the display list and usually resides just before the display buffer in memory The ANTIC chip o
76. d code start timer random number generator reset serial port status start pot scan sequence serial port output serial port input interrupt request enable IRQ IRQ status serial port control serial port status p m priority and GTIA mode port A port B port A control port B control Direct Memory access control DMA character control 109 Ur D204 Ur D204 Ur D205 Ur D205 Ur D206 Ur D206 Ur D207 Ur D207 Ur D208 Ur D208 Ur D209 Ur D209 Ur D20A Ur D20A Ur D20B D20D D20D D201 za D20 ti Ur D20F Ur D20F Ur D21B Ur D300 D301 D302 D303 D400 D401 53764 53764 53765 53765 53766 53766 53767 53767 53768 53768 53769 53769 53770 93770 53771 53773 53774 53774 53774 93779 53775 532779 54016 54017 54018 54019 54272 54273 PADDL4 PADDL5 PADDL6 PADDL7 CH POKMSK SSKCTL GPRIOR s1 s1 s1 s1 PICKO PICK1 TICK2 ELERS SDMCTL CHART 0274 0275 0276 0277 02FC 0010 0232 026F 0278 0279 027A 027B 022F 02F3 628 629 630 631 764 16 563 623 632 633 634 635 559 799 DLISTL display list pointer low byte D402 54274 SDLSTL 0
77. ded to the mode number the screen will not clear when the channel opens If you want to use a channel other than 6 you will have to use the open command lt is used in the following format screen open without GRAPHICS command OPEN channel direction special mode S For example OPEN 1 8 7 S This will open channel 1 to a mode 7 screen for output only For use of special parameters see ICAX1 above USING AN OPEN CHANNEL TO THE SCREEN Once a channel is opened to the screen it is used like any other input or output device In other words data is placed on the screen by the PRINT and PUT commands Data is retrieved from the screen with the INPUT and GET commands The part of the screen which the data will be put in or taken from is determined by the X Y coordinants in the database variables COLCRS 0055 2 85 and ROWCRS 0054 84 What appears on the screen depends on what graphics mode the computer is in Before sending data to the screen in BASIC a color register must be assigned to the data Once a point is plotted on the screen it s color will be determined by the color register it was assigned to To assign a color to a ploted point the COLOR command us used as follows COLOR command format COLOR register 42 For example COLOR 1 After using the above command all points plotted will be controlled by color register 1 To change color registers use the COLOR command again In assembly l
78. does not use the ATASCII code A special code needed by the ANTIC chip is used DISPLAY CODE ATASCII CODE CONVERSION ATASCII display 00 1F 0 31 20 5F 32 95 60 7F 96 127 40 5F 64 95 00 3F 0 63 unchanged The codes for inverse video the above codes with bit 7 set 1 or the above codes 128 in decimal are treated likewise When you first turn on the computer BASIC opens channel 0 to the screen editor E The screen editor uses both the keyboard handler and the screen handler in mode 0 to display characters when they are typed in TEXT MODES 1 AND 2 Graphics modes 1 and 2 offer a split screen configuration if desired The split screen has four lines of mode 0 at the bottom of the screen In mode 1 the screen holds 20 characters horizontally and 24 characters vertically In mode 2 the characters are twice as tall so the screen holds 12 vertically In BASIC characters are sent to the screen with the PRINT command Since BASIC uses channel 6 for graphics you must specify channel 6 in the command For example 2 46 HELLO If you use a comma in place of the semicolon ten spaces will print before the HELLO You can also use the PLOT and DRAWTO commands In this case the COLOR command determines the character as well as the color to be displayed Data passes through CIO in the following form 76543210 PC D C determines the color 3
79. e MULTIPLICATION Multiplies FRO by FR1 with the result in FRO FMUL DADB JSR FMUL BCS out of range 59 DIVISION Divides FRO by FR1 with result in FRO FDIV DB28 JSR FDIV BCS out of range or divisor is 0 LOGARITHMS Puts logarithm of FRO in FRO LOG DECD LOG10 DED1 JSR LOG for natural log or JSR LOG10 for base 10 log BCS negative number or overflow EXPONENTIATION Put exponentiation of FRO in FRO EXP DDCO EXP10 DDCC JSR EXP for e Z or JSR EXP10 for 10 Z POLYNOMIAL EVALUATION Puts the result of an n degree polynomial evaluation of FRO in FRO PLYEVL DD40 LDX LSB of pointer to list of floating point coefficients ordered high to low LDY MSB of above LDA number of coefficients in list JSR PLYEVL BCS overflow CLEAR FRO 60 Sets FRO to all zeroes ZFRO DA44 JSR ZFRO CLEAR ZERO PAGE FLOATING POINT NUMBER Clears user floating point number in page zero ZF1 DA46 LDX address of zero page FP buffer JSR ZF1 LOAD FRO WITH FLOATING POINT NUMBER Loads FRO with user FP number in buffer pointed to by 6502 X and Y registers or by FLPTR After either operation below FLPTR will point to the user FP buffer FLDOR DD89 LDX Isb of pointer LDY msb JSR FLDOR or FLDOP DD8D FLPTR address of FP number JSR FLDOP LOAD FR1 WITH FLOATING POINT NUMBER Loads FR1 with user FP number in buffer pointed to by 6502 X and Y registers or by FLPTR After either operatio
80. e offset beyond the left edge of the screen by 16 color clocks 32 Graphics 8 pixels When HSCROL 15 the graphics line is shifted one color clock 2 Graphics 8 pixels to the left of the screen The big difference is that the memory scan counter gets messed up This means that you must use a reload memory scan counter command for each line of graphics This is a major modification of the display list It will require you to move and build the list yourself The advantage of this is that you can have a scrolling window in a large graphics map The technique is to move the window by reloading the memory scan counter then fine scrolling to the invisible bytes beyond the edges of the screen useful data base variables and OS equates SAVMSC 0058 2 88 pointer to current screen for CIO commands RAMTOP 006A 106 start of ROM pointer MSB only VDSLST 0200 2 512 DLI vector RAMSIZ 02E4 740 permanent start of ROM pointer MSB only DLISTL D402 DLISTH D403 E high byte 54274 display list pointer low byte HSCROL D404 54276 horizontal scroll register VSCROL D405 54277 vertical scroll register NMIEN SD40E 54286 NMI enable DLIs Shadow registers SDLSTL 0230 560 DLISTL SDLSTH 0231 DLISTH Go to chapter 14 Go to chapter 16 CHAPTER 16 81 Player and Missile PM Graphics Players and missiles called sprites on some comput
81. e accepted 30 unless the key debounce timer KEYDEL 02F1 753 is 0 When CIO is told to do an input operation from the keyboard CH is checked to see if a key has been pressed If CIO finds FF 255 in CH it waits until a key is pressed If CH is not FF a key has been pressed and the ATASCII code for that key is taken from ATACHR CH is then set to FF The data in CH is in the following format Key code format 76543210 C S key code C 1 S 1 CTRL key is pressed SHIFT key is pressed Anytime a key is pressed CH is loaded with the key code CH will hold the code until the computer is commanded to read the keyboard Sometimes the computer will read a key which was pressed long ago If you want to prevent this load CH with FF before reading the keyboard In BASIC use POKE 764 255 This will clear out any old key pressings Special function keys CTRL 1 screen output start stop CTRL 2 BELL CTRL 3 Generates End Of File status J or inverse video toggle CAPS LOWER sets lower cas CTRL CAPS sets CTRL lock SHIFT CAPS sets caps lock KEYBOARD REPEAT DELAY AND RATE CONTROL On the XL and XE KRPDEL 02D9 729 determines the delay before the key repeat begins The value of this byte is the number of vertical blanks 1 60th second each to delay KEYREP 02DA 730 determines the repeat rate in vertical blanks 31 KEYBOARD CLICK The keyboard c
82. e boot request flag CKEY 004A is set 12 The CIO device table is initialized 13 If a cartridge is present it is initialized 14 Channel 0 is opened to the screen editor The top of free RAM pointer MEMTOP 02E5 is set to point below the screen region The computer then waits for the screen to be established before continuing 15 If the cassette boot flag is set the cassette is booted 16 If there is no cartridge present or a cartridge doesn t prevent it the disk is booted 17 The cold start flag is reset 18 If there is a cartridge present the computer jumps to the cartridge s run vector 19 If there is no cartridge present the computer jumps through the vector DOSVEC 000A 10 DOSVEC will point to either a booted program the memo pad routine 400 800 or the logo display routine XL XE WARM START 1 The warm start flag is set to 7F true 2 cold start steps 2 4 are executed 3 RAM is cleared from 0010 007F and 0200 03FF 4 Cold start steps 7 14 are executed 5 If cassette booted software is present the computer JSRs through CASINI 0002 6 If disk booted software is present the computer JSRs through DOSINI 000C 12 52 The difference between cold start and warm start is the condition of the warm start flag WARMST 0008 If this flag is O a complete cold start is executed If the flag is anything other than 0 then only the warm start part of the warm start cold st
83. e bug in the operating system in XL and XE models This is a mishandling of the printer timeout The computer cannot tell if there is a printer attached or not This may have been fixed in the XE models However many programs some even formerly sold by Atari do not jump through published jump vectors when using the operating system These programs will not run on XL XE models Some of these programs are Atari Word Processor not Atariwriter and LUKs Letter Perfect and Data Perfect Since the operating system ROM can be switched to RAM a translator can be used to load the 800 operating system into an XL or XE model 130XE MEMORY MANAGEMENT The 130XE has an extra 64K bank of memory It is divided into four blocks of 16K each Each block can be switched to replace part of the main bank of RAM from 4000 16384 to 7FFF 32767 Furthermore it can be switched in such a way that only the 6502 or the ANTIC chip can see the extra memory Port B formerly the two extra joystick ports of the 400 800 is used to manage the memory Port B and memory management To a 4 322 10 PORTB TJUJAICIS S BIRI 16318421 426 aon 1 OS replaced by RAM 0 BASIC enabled bank select bits O CPU sees switched RAM at 4000 0 ANTIC sees switched RAM unused 0 self test HG P Ow Bits 2 and 3 of PORTB select which block of the extra bank of memory is switched in Bank select bits bits block 2 3 address 0 0 0000 S3FFF o
84. em Attempting to rename or delete one of them will rename or delete both The only way to fix a duplicate file name is with a sector editor or other special utility F LOCK FILE A locked file cannot be written to renamed or deleted To lock a file type F RETURN You will get the prompt WHAT FILE TO LOCK Type the file name you want to lock Wild cards will cause all matching files to be locked G UNLOCK FILE Used the same as lock H WRITE DOS FILES This option will write the DOS SYS and DUP SYS files to a formatted disk When you type H RETURN you will receive the prompt DRIVE TO WRITE DOS FILES TO Type the number of the drive If the drive contains a formatted disk the dos files will be written to it 24 I FORMAT DISK This option formats a new disk or erases a disk with files on it Typing I RETURN will get you the prompt WHICH DRIVE TO FORMAT Be sure you have the correct disk in the proper drive then type the drive number It is impossible to recover files on a disk formatted by accident While the disk is being formatted the drive will check to be sure the disk is formatted correctly If not the drive attempt to format the disk again If the disk is defective the drive will not finish the formatting process J DUPLICATE DISK This option will copy an entire disk except for sectors listed as free in the VTOC Some programs are copy proofed by changing the VTOC to show tha
85. ers are movable objects which are independent of the normal graphics Player and missile graphics are fairly straight forward Once the computer is set up for PM graphics five 8 pixel wide columns can be displayed on the screen The horizontal resolution width of each pixel and the vertical resolution number of scan lines per pixel are variable The horizontal position of each column is determined by it s horizontal position register Each column is simply a representation of a bit map in a certain block of memory If you want to draw an object on the screen you simply put a bit map representing it in the proper memory block The vertical position of an object is determined by the location of it s bit map in memory For example if you want to draw a happy face in the middle of the screen you put a happy face bit map in the middle of one of the memory blocks controlling one of the columns One column player displayed on the screen AR AA first byte of a block visible area object bit map Sees oa last byte of a block Horizontal positions 00 30 SCE SFF 0 48 206 255 l Left edge right edge 82 Far left far right To move the happy face vertically you would move the entire bit map in memory To move the happy face horizontally you change the number in the horizontal position register for the proper player One of the players can be and o
86. f the screens are in the same graphics mode and you want to change which one to do CIO commands to Change the CIO screen pointer SAVMSC 0058 2 88 This way you can display one screen while drawing on the other If you want to do CIO commands to screens of different graphics modes you will have the move RAMTOP and do a graphics call to change screens If your manipulation of RAMTOP causes the display data buffer to cross a 4K boundary the screen may be scrambled 79 DISPLAY LIST INTERRUPTS DLIs are not used by the operating system However other programs can initiate and use them Use the following steps to set up display list interrupts Setting up DLIs e Set bit 7 of the display list instruction for the line before you want the interrupt to occur The interrupt routine should set WSYNC and wait for the next line to execute e Set bit 7 of NMIEN D40E 54286 to enable DLIs e Set the DLI routine vector VDSLST 0200 2 512 to point to your machine language DLI routine e Your DLI routine should set WSYNC D40A 54282 STA WSYNC will do THis will cause the 6502 to wait for the next horizontal sync This will keep the DLI routine from changing something in the middle of a T V line e The DLI routine must end with an RTI instruction SCROLLING Scrolling is controlled by a combination of scroll position registers and changing the memory scan counter Basically course scrolling is done by reloading the memo
87. ften is split into four columns of two pixels wide each These columns are then called missiles In this case each missile has it s own horizontal position register SETTING UP PM GRAPHICS PM graphics are enabled by the direct memory access control register DMACTL D400 54272 The program using PM graphics will usually use the shadow register SDMCTL 022F 559 DMACTL SDMCTL 76543210 10 10 control bits al ll enable display list reading one line player resolution two line player resolution enable four players enable fifth player or missiles no background narrow background 128 color clocks 1 color clock equals 2 GRAPHICS 8 pixels normal background 160 color clocks wide background 192 color clocks od o ON W Normally bits 5 and 1 are set to 1 Bits 4 3 and 2 are used to enable players and or missiles accordingly Once DMACTL is set up for the type of PM graphics to enable the graphics control register GRACTL D01D 53277 is used to actually enable the PM graphics GRACTL hy 6 Ode 32 LO not used 83 2 1 latch paddle triggers 1 1 enable four players 0 1 enable fifth player or missiles If only DMACTL is set up the ANTIC chip will access memory for PM graphics but will not display them Next the memory area used for the PM bit maps must be set This block must start on a 2K 8 page boundary if single line resolution is used
88. g address of text window data buffer permanent end of RAM 1 MSB only cursor inhibit 1 no cursor color data for fill if gt 0 screen control codes are displayed as ATASCII characters EOL is uneffected gt 0 stop screen print actual color registers loaded from shadow registers during vertical blank 46 COLPF1 D017 53271 COLPF2 D018 53272 COLPF3 D019 53273 COLBK D020 53274 PCOLRO 02C0 704 PCOLR1 02C1 705 PCOLR2 02C2 706 PCOLR3 02C3 707 COLORO 02C4 708 COLOR1 02C5 709 COLOR2 02C6 710 COLOR3 02C7 711 COLOR4 02C8 712 Go to chapter 7 Go to chapter 9 CHAPTER 9 The resident disk handler see for OS O CO 2520 ES 5 CO CO OO CO SEO Li di an Li Li Li Li Li Li above use hadow registers PMO PM1 PM2 PM3 PFO PF1 PF2 PF 3 BK The resident disk handler is separate from DOS and is part of the permanent operating system ROM The disk handler does not use CIO The resident disk handler works with one sector at a time It is used by setting the drive number sector number and operation code in the device control block The program then jumps JSR to the handler entry vector DSKINV E453 58451 Device control block DD EVIC 0300 768 Serial bus I D Set by handler DUNIT 0301 769 Drive number DCOMND 0302 770 Command byte for resident disk handler 47 DSTATS 030
89. he display buffer in the following format 76543210 I Data I 1 displays character in inverse video Bits O through 6 select one of the 128 characters in the ATASCII set If bit seven 1 the character is displayed in inverse video Converting the above byte to decimal will give the BASIC ASC x equivalent The characters displayed in the text modes are determined by tHE ATASCII character set This is a bit by bit representation of how the characters appear on the screen The character set starts E000 57344 in the operating system ROM From there for 1K of memory each eight bytes holds a bit map of a particular character Below is how the letter A is stored in the character set Letter A as represented in the C set 76543210 E208 00000000 00011000 noe OP 0r a AT 30 0 E A o 1 0 0 tO KX a OI 0 0 10 ON Ka E o 1 Pl 10 q ARAS A o 1 0 0 10 ery kK SE20F 0000000 0 XL and XE models have an international character set starting at CC00 55224 In this character set the graphics characters are replaced by international characters Custom characters sets may be loaded at any free address which is a multiple of 1 024 0400 or 1K The database variable CHBAS 02F4 756 stores the most significant byte MSB of the address of the active C set Since the LSB of the C set address is always 00 no LSB is needed to find it 36 The data stored in the display buffer
90. hich of the four color registers their pixel is assigned to display buffer byte for mode 3 76543210 DI IDIDIDI Pl P2 P3 P4 Pixel color register assignments D 00 COLBK COLOR4 01 COLPF0 COLORO 10 COLPF1 COLOR1 EL COLPF2 COLOR2 Mode 4 uses a screen of 80 columns by 48 rows Each pixel is half the size of those in mode 3 Mode 4 requires 537 bytes of RAM where each byte controls 8 pixels This mode is very similar to mode 8 except there are fewer but larger pixels Mode 5 uses a screen of 80 columns by 48 rows The pixels are the same size as in mode 4 Mode 5 requires 1 017 bytes of RAM where each byte controls 4 pixels in the same manner as in mode 3 Mode 6 uses a screen of 160 columns by 96 rows It requires 2 025 bytes of RAM where 39 each byte controls 8 pixels as in mode 4 Mode 7 uses a screen of 160 columns by 96 rows It requires 3 945 bytes of RAM where each byte controls 4 pixels as in modes 3 and 5 Modes 8 through 11 and 15 on XL and XE models each require 7 900 bytes of RAM and are very similar in display set up The main differences between these modes is the interpretation of data in the display buffer Mode 15 sometimes called mode 7 5 uses a screen of 160 columns by 192 rows Each byte controls 4 pixels as in mode 7 The main difference between mode 15 and its related modes is bit O of each instruction byte in the display list the program which the ANTIC chip uses If this bit
91. intervenes Only one color can be displayed at a time 77 DISPLAY LIST EXAMPLES When CIO opens a channel to the screen it sets up the proper display list for the ANTIC chip The following are the things CIO must handle when setting up the display list Display list duties as used by CIO display a certain number of blank lines at the top of the screen Load the memory scan counter with the address of the display data buffer Display the required number of lines in the required ANTIC mode Set up a jump instruction if the display list crosses a 1K memory boundary Set up a reload memory scan counter instruction if the display data buffer crosses a 4K memory boundary CIO assumes that the display data buffer will butt against an 8K memory boundary If a program causes the display buffer to cross a 4K boundary by changing RAMTOP 006A 106 to point to an address which is not at an 8K boundary the screen will be scrambled This is not usually a problem if the graphics mode doesn t require a large block of memory SAMPLE DISPLAY LIST Below is an example of a Graphics 0 display list as CIO would set it up Display list for Graphics 0 assuming BASIC starts at A000 address instruction explanation Dec Hex 9C20 112 70 N 112 70 gt 24 blank lines 8 each command 112 70 66 42 load memory scan counter with 9C24 64 40 __ next two bytes and display one line 156 soc of ANTIC 2 characters 2 02
92. ion light pen vertical position game paddle 0 game paddle 1 game paddle 2 game paddle 3 game paddle 4 game paddle 5 game paddle 6 game paddle 7 color brightness color brightness color brightness color brightness interrupt request player missile player missile player missile player missile enable IRQ display list pointer high byte display list pointer low byte Direct Memory access control serial port control port A port B joystick trigger joystick trigger joystick trigger joystick trigger 111 DMA Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur Ur D019 D21B D40C D40D D200 D201 D202 D203 D204 D205 D206 D207 D012 D013 D014 D015 D201 za D403 D402 D400 D20F D300 D301 D010 D011 D012 D013 53273 53275 54284 54285 53760 53761 53762 53763 53764 53765 53766 53767 53266 53267 53268 53269 53774 54275 54274 54272 53775 54016 54017 53264 53265 53266 53267 COLOR3 GPRIOR PENH iPENV PADDLO PADDL1 PADDL2 PADDL3 PADDL4 PADDL5 PADDL6 PADDL7 PCOLRO PCOLR1 PCOLR2 PCOLR3 POKMSK SDLSTH SDLSTL SDMCTL SSKCTL STICKO STICK1 STICK2 STICK3 STRIGO STRIG1 STRIG2 STRIG3 02C7
93. is controlled by a 16 byte block of memory called an Input Output Control Block or IOCB The channels are used by putting the proper numbers in the proper IOCB bytes then jumping to the CIO routine In BASIC complete I O operations can be as easy as typing a command such as LPRINT In this case BASIC does all the work for you THE CIO CHANNELS There are eight CIO channels numbered from 0 to 7 In BASIC some channels are reserved for BASIC s use BASIC CIO channel assignments Channel 0 Permanently assigned to the screen editor Used for graphics commands 7 Used for the Cassette disk and printer Channels 6 and 7 are free to use when they are not being used by BASIC With machine language all of the channels are available to the programmer THE IOCB STRUCTURE The IOCB for channel zero starts at address 0340 decimal 832 This is the only address you need to know Indexing from this address is used to find all of the other bytes Below are the names and uses of the lOCB bytes IOCB bytes and uses ADDRESS NAME EXPLANATION 0340 ICHID handler Identifier 0341 ICDNO device number disk 0342 ICCOM command 0343 ICSTA status 0344 ICBAL buffer address low byte 0345 ICBAH buffer address high byte 0346 ICPTL address of put byte 0347 ICPTH routine used by BASIC 0348 ICBLL buffer length low byte 0349 ICBLH buffer length high byte 034A ICAX1 auxiliary information 034B ICAX2
94. ives the serial port status The register is then called SKSTAT Serial port status register 97 76543210 bits used reads 1 serial input shift register busy last key is still pressed shift key pressed direct from serial input port keyboard over run serial data input over run serial data input frame error o How tot dot wot YHA OB WNEF CO FO OG OOO 5 The serial port status is latched and must be reset by writing any number to its reset register SKRES D20A 53770 SERIAL PORT INPUT AND OUTPUT DATA When a full byte of serial input data has been received it is read from the serial input data register SERIN D20D 53773 Serial output data is written to the same register which is then called the serial output data register SEROUT This register is usually written to in response to a serial output data interrupt bit 4 of IRQST HARDWARE CHIP MEMORY ALLOCATION The addresses for the hardware chips are not completely decoded For example the PIA needs only four bytes of memory but is active from D300 D3FF Enough room for 64 PIA chips A second pair of parallel ports could be added by accessing the address bus and further decoding the address for a second PIA This would also require a small modification of the computer s circuit board to disable the original PIA when the new one is active Similarly there is room for 15 more POKEY or ANTIC chips and 7 gtia chips should you ever need them
95. lay buffer as a bit map to be displayed A command to display in mode 8 will cause the ANTIC chip to read the next 10 bytes in the display buffer Each pair of bits will control one pixel as in mode 4 However the pixels are blocks the same size as a Graphics 0 ANTIC 2 characters ANTIC MODE 9 Graphics 4 This is similar to ANTIC mode 8 except each byte controls 8 pixels instead of 4 and only one color can be displayed at a time The pixels are also half the size of those in ANTIC mode 8 ANTIC MODE A Graphics 5 This mode uses 20 bytes per line command As in ANTIC mode 8 each pair of bits controls one pixel The result is that the pixels are the same size as in ANTIC mode 9 but four colors can be displayed at once ANTIC MODE B Graphics 6 As in mode A there are 8 pixels per byte and only one color The pixels are half the size as in mode A ANTIC MODE C Like mode B except the pixels are half as tall only one T V line ANTIC MODE D Graphics 7 40 Bytes per line each byte controls 4 pixels The pixels are 1 4 as large as in ANTIC mode 8 Graphics 3 ANTIC MODE E Graphics 15 on XL and XE Like mode D except the pixels are half as tall one T V line Antic mode E is sometimes called Graphics 7 5 ANTIC mode F Graphics 8 9 10 and 11 This is the highest resolution mode Pixels are 1 8 the size of ANTIC mode 8 or mode 2 characters It uses 40 bytes per line each byte controlling 8 pixels unless the GTIA chip
96. lick of the XL XE is heard through the TV speaker The click may be turned off by putting FF in NOCLIK 02DB 731 NON HANDLER NON CIO KEYS The OPTION SELECT and START keys are read from the console switch register CONSOL D01F 53279 CONSOL non n lao UAH 0 0 0 C The console switch register Be E ES E Y 10 J0 JO IO SP OP SE ST This bit always reads 0 8 4 2 1 START SELECT OPTION onsole speaker set to 1 during vertical blank toggleing this bit operates the speaker which is heard through the TV on XL XE models The HELP key on XL and XE models is read from HELPFG 02DC 732 This address is latched and must be reset to zero after being read HELPFG un bh bh The HELP key register 76543210 CSOHOOO HI 6318421 42 6 o NR HELP bits 0 and 4 SHIFT CONTROL Useful database variables and OS equates A EYDEF 0079 2 121 key code coversion table vector XL XE RPDEL 02D9 729 delay before key repeat XL XE EYREP 02DA 730 key repeat rate XL XE NOCLIK 02DB 731 SFF turns off key click XL XE HELPFG 02DC 732 HELP key XL XE ATACHR 02FB 763 ATASCIT Code for last key CH SO2FC 764 keycode SFF if no key has been pressed BRKKEY 0011 17 break key flag 0 break key pressed SRTIMR 022B 555 Ke
97. lock out line but it is not used by any present devices The clock in line is available for synchronous transfer but is not used by the OS The signal on the clock out line goes high at the leading edge of each bit and goes low in the middle of each bit One byte of SIO data clock 0 1 0 1 1 0 0 1 data l start bit stop bit The SIO interface is used much like the resident disk handler In fact it uses the same device control block as the resident disk handler After the control block parameters are set a JSR is made to the SIO entry vector SIOV at 459 58457 Device control block for SIO DDEVIC 0300 768 Serial bus I D Set by handler or program DUNIT 0301 769 Device number if more than one DCOMND 0302 770 Device command byte DSTATS 0303 771 68 Before the SIO call this byte tells whether the operation is read write or that there is no data transfer associated with the command After the call this byte will hold the status error no error code of the operation DSTATS format before command 76543210 W R not used If both W and R are O there is no data transfer DBUFLO 0304 772 DBUFHI 0305 773 Points to the data buffer for either input or output DTIMLO 0306 774 Timeout value response time limit in 64 60ths of a second to be set by handler or program DBYTLO 0308 776 DB
98. mand expects to find a boundary to the right If no boundary is found the entire horizontal screen between the ends of the line is filled To use the fill command in BASIC the XIO command must be used in the following format POSITION x y XIO 18 6 0 0 E Note that the cursor is first moved by the POSITION command Below is an example of how to prepare for and use the fill command using the fill command 2nd DRAWTO DRAWTO here fill to here PLOT here This will draw and fill a box on the screen THE COLOR REGISTERS There are nine bytes of memory which control the colors on the screen These bytes are called color registers The color registers have the following names and relationships Color registers and relationships Register Register modes name address 0 amp 8 18 2 3 077 486 9 amp 11 10 HEX decimal COLOR numbers PCOLRO 02C0 704 0 PCOLR1 02C1 OD 1 PCOLR2 02C2 706 2 PCOLR3 02C3 707 3 COLORO 02C4 708 0 63 1 1 4 COLOR1 02C5 709 T e255 64 S127 2 44 COLOR2 02C6 710 0 128 191 3 COLOR3 02C7 711 192 255 COLOR4 02C8 JEZ border backgnd 0 backgnd backgnd The color numbers are in decimal These are actually shadow registers See the O S equates below for relationships In modes 0 3 the COLOR number actually determines the character printed The register to which a pixel character is assigned to is determined by the data byte sent to the screen th
99. n below FLPTR will point to the user FP buffer FLD1R DD98 LDX Isb of pointer LDY msb JSR FLD1R 61 or FLD1P DD9C FLPTR address of FP number JSR FLD1P STORE FRO IN USER BUFFER stores the contents of FRO in user FP buffer pointed to by 6502 X and Y registers or by FLPTR After either operation below FLPTR will point to the user FP buffer FSTOR DDA7 LDX Isb of pointer LDY msb JSR FSTOR or FSTOP DDAB FLPTR address of FP number JSR FSTOP MOVE FRO TO FR1 Moves the contents of FRO to FR1 FMOVE DDB6 JSR FMOVE The usual use sequence of the floating point package might be to load FRO and FR1 with FP numbes from user specified buffers do the math then store FRO in a user buffer An alternative might be to convert an ASCII representation to FP the result is automatically in FRO 62 move FRO to FR1 Convert the second ASCII number Do the math Convert FRO back to ASCII Store the number back into a user buffer The floating point package uses the following blocks of RAM RAM used by floating point package 00D4 SOOFF SO57E 05FF If the floating point package is not used the above ram is free Useful data FRO 00D4 6 212 FR1 00E0 6 224 CIX 00F2 242 INBUFF 00F3 2 243 FLPTR 00FC 2 252 LBUFF 0580 1408 AFP D800 55296 FASC D8E6 55526 IFP SD9AA 55722 FPI D9D2 55762 ZERO DA44 55876 ZF1 DA46 55878 FSUB DA60 55904 FADD
100. ns with other objects Each player has two registers assigned to it one to detect collisions with other players and one to detect collisions with plotted objects Likewise each missile has two registers one to detect collisions with players and one to detect collisions with plotted objects Careful use of these 16 registers can detect any type of collision Each register uses only the lower 4 bits The bits which equal 1 tell what the associated object has collided with For example to detect collisions of player 1 to other players 87 examine P1PL D00D 53261 P1PL player 1 to player collisions T 6 5 4 3 2 1 0 P1PL unused 8421 collision with player 3 collision with player 2 invalid collision with player 0 OrRNW PRR ETC When looking for collisions with plotted objects the bit number tells what color register is assigned to the object the collision was with For example to detect collisions between player 1 and plotted objects officially called the play field P1PF D005 53253 is used P1PF player 1 to ploted object collisions 76543210 P1PF unused 8 Are 2 1 3 1 collision with COLOR3 2 1 y COLOR2 1 1 m COLOR1 0 1 Y COLORO Etc Once a collision occurs it remains indicated in its collision register To clear out all collision registers write anything to HITCLR D01E 53278 STA HITCLR or POKE 53278 0 will do Useful database variables
101. occupied Bytes 3 and 4 of the VTOC tell how many sectors are available Starting at byte 10 is the Volume Bit Map Each byte in the VBM tells the status of eight sectors If a bit is a 1 the sector is available If a bit is a O the sector is occupied Sectors 361 through 368 contain the disk directory Each directory sector holds eight file names The first byte of a file name is called the flag byte It tells the status of that file Directory flag byte FT 3432 1 0 flag byte Bits 7 1 file deleted 6 1 file in use 5 1 file locked 0 1 open for output The next two bytes tell how many sectors are in the file The two bytes after them tell the starting sector of the file The last 11 bytes contain the file name Sector 720 cannot be accessed with DOS 2 0 The boot record VTOC directory and sector 720 use 13 sectors This leaves 707 sectors for storing files with DOS 2 0 Each file sector has 125 bytes of data The last three bytes tell how many bytes of the sector are used what directory entry the sector belongs to and which sector is next in the file File sector structure T 6 SA 32k 0 data byte 0 bytes byte 124 15 Dir No hi byte 125 forward pointer byte 126 S byte count byte 127 high 2 bits of forward pointer Short sector flag 1 short sector End Of File If the directory number does not match the order of the file name in the directory an erro
102. oint data base variables FRO S00D4 6 6 byte buffer for floating point number FR1 SOOEO 6 6 byte buffer for floating point number CIX S00F2 242 index for INBUFF address INBUFF 00F3 2 243 2 byte pointer to ASCII floating point number FLPTR SOOFC 2 252 2 byte pointer to user buffer for floating point number LBUFF 0580 1408 result buffer for FASC routine MAKING THE CALL To do a floating point function first set the proper pointers and JSR to the operation entry point Below is a list of the entry points and parameters ASCII to floating point Converts ASCII representation pointed to by INBUFF to FP in FRO AFP D800 INBUFF address of ASCII number CIX buffer offset if any JSR AFP FLOATING POINT TO ASCII 58 Converts floating Point number in FRO to ASCII The result will be in LBUFF INBUFF will point to the ASCII number which will have the bit 7 of the last byte set to 1 FASC D8E6 JSR FASC INTEGER TO FLOATING POINT CONVERSION Converts a 2 byte unsigned integer 0 to 65535 in FRO to floating point in FRO IFP D9AA JSR IFP FLOATING POINT TO INTEGER CONVERSION Converts floating point number in FRO to 2 byte integer in FRO FPI D9D2 JSR FPI BCS overflow ADDITION Adds floating point numbers in FRO and FR1 with result in FRO FADD DA66 JSR FADD BCS out of range SUBTRACTION subtracts FR1 from FRO with the result in FRO FSUB DA60 JSR FSUB BCS out of rang
103. perates independent of the 6502 It operates by direct memory access 72 DMA The ANTIC chip gives a HALT signal the 6502 causing the 6502 to give up control of the address bus The ANTIC chip can then read any data it needs to from memory ANTIC chip functions DMA Direct Memory Access control NMI Non Maskable Interrupt control LIGHT PEN READING WSYNC wait for horizontal sync THE POKEY CHIP The most important jobs of the POKEY chip are reading the keyboard and operating the serial port It also has the following functions POKEY chip functions Keyboard reading Serial port Pot game paddles reading Sound generation System timers IRQ maskable interrupt control Random number generator THE PIA CHIP The PIA Parallel Interface Adapter is a commonly used I O chip It consists of two 8 bit parallel ports with hand shaking lines In the Atari it has the following functions e Game controller port control bi directional e Peripheral control and interrupt lines Registers in the hardware chips are treated as memory addresses Many of the registers are write only These registers cannot be read from after they are written to Other registers control one function when written to and give the status of an entirely different function when read from Still other registers are strobes Any command which causes the address of one of these registers to appear on the address bus will cause their functions
104. plete code 43 should be sent to the computer when the operation is finished The complete code would follow the ACK of the data frame with an output operation If the operation is not completed for some reason the peripheral should send an error code 45 instead of complete SIO data frame byte 1 xx gt data bytes byte n Sxx byte n l Sxx checksum SIO commands EAD 52 RITE 57 TATUS 53 UT 50 ORMAT 21 OWNLOAD 20 EADADDR 54 EAD SPIN 51 OTOR ON 55 ERIFY SECTOR 56 lt ZVVS Present SIO device I D s DISK 31 34 D1 D4 PRINTER 40 70 RS 232 C 50 53 R1 R4 THE SERIAL CONNECTOR The serial connectors on the computer and all peripherials are identical Nearly all peripherials have two serial connectors Either connector may be used for any connection The serial bus is designed so that peripherials can be daisy chained together The following is a diagram of the serial connector The serial connector pin out 00 0 DO ON 0 00000 0 eo go Ak loa 1 clock in to computer 2 clock out 3 data in 4 GND 5 data out 6 GND 7 command active low 8 cassette motor control 9 proceed active low 10 5V ready 11 audio in 12 12v 400 800 13 interrupt active low Proceed goes to pin 40 CA1 of the PIA It is not used by present peripherials Interrupt goes to pin 18 CB1 of the PIA It is not used by present peripherials Pin 10 dou
105. r 167 file number mismatch will occur As a file is written to an empty disk it is put in consecutive sectors 125 bytes at a time After the file is written the VTOC and directory are updated When new files are written they also use consecutive sectors When a file is deleted the status bit of the directory is changed to show that the file has been deleted DOS then tracks the file sector by sector to find what sectors are used Finally the VTOC is updated to show that the deleted file s sectors are available for new files The file is not erased from the disk only the VTOC and directory are changed When a file is deleted an island of free sectors may be left on the disk When a new file is then written to the disk it will first use these new free sectors When the island is used up DOS will skip over the occupied sectors to the next free sector This is the reason for the sector link A file can end up with it s sectors scattered all over a disk It can be complicated but it s efficient DISK FILE STRUCTURE The first few bytes of a file may tell DOS or another program what kind of file it is These information bytes are called a header A text file is any file which has no header A listed BASIC program is a type of text file A letter from a word processor is another A binary load file is a file intended to load to a specific address in memory The first two bytes of a binary load file are decimal 255 The next two byte
106. r up The device name must usually be followed by a colon With the disk drive a file name is expected after the device name The screen handler is used for graphics The screen editor uses both the keyboard handler and the screen handler to work between the keyboard and screen USING AN OPEN CHANNEL Once a channel is opened to a device you have several options INPUT ICCOM 05 The computer reads data from the device until a carriage return is read decimal number 155 hex 9B or the end of the file EOF is reached A carriage return is also known as an End Of Line or EOL The IOCB input parameters are IOCB input parameters ICCOM get record code ICBAL address of buffer to ICBAH store the data in ICBLL length of the data ICALH buffer The following routine demonstrates the input command in assembly language Some of the equates are in the channel openning example above Input routine GETREC 05 BUFF address to store data at BUFLEN number of bytes available at storage address LDX IOCB1 DA GETREC STA ICCOM X DA lt BUFF TA ICBAL X DA gt BUFF TA ICBAH X DA lt BUFLEN TA ICBLL X DA gt BUFLEN ICBLH X SR CIOV PL OK2 P ERROR GWHOHEHEHNE NE gt OK2 continues if no errors If the data retrieved is shorter than the prepared buffer the number of bytes actually read will be put into ICBLL and ICBLH In BASI
107. re It must also set DOSVEC 000A 2 10 to actually point to the run address of the program The initialization should of course end with and RTS With DOSINI and DOSVEC properly set the program will restart up pressing the SYSTEM RESET key Rmember that the load address of the program should be six bytes before where you want the program to reside in memory The six byte header will load at the specified start address followed by the program CASSETTE BOOTED SOFTWARE The cassette boot process is nearly identical to the disk boot process The processes are so similar that cassette boot programs can usually be transferred directly to disk and vice versa The two differences are The cassette is booted instead of the disk if the START key is pressed when the power is turned on A bug in early operating systems requires the booted program to turn off the cassette motor with the following command LDA 3C STA PACTL D302 65 CARTRIDGE BOOTED SOFTWARE The Atari 800 has two cartridge slots All other models have only one The second cartridge slot slot B on the 800 resides from 8000 to 9FFF The first slot slot A resides from A000 to BFFF If a cartridge is inserted in a slot it will disable any RAM in the same area Slot A which is present in all models can reside at the entire 16K used by both cartridges in the 800 8000 to BFFF Cartridges use the last six bytes for boot information In cartridge A these bytes
108. red If a key is not pressed for more than 9 minutes the computer will enter the attract mode This mode is used to prevent burning of the TV phosphors by lowering the brightness and constantly changing the colors The attract mode timer ATRACT 004D 77 is set to 254 FE when the the attract mode is entered To force the computer out of the attract mode poke a number less than 127 into ATRACT Useful APPMHI ATRACT LMARGN RMARGN ROWCRS COLCRS DINDEX SAVMSC LDROW DCOL LDCHR LDADR n OoooOo x x x UO STL ROW COL SC RAMSIZ CRSINH FILDAT DSPFLG SSFLAG COLPMO COLPM1 COLPM2 COLPM3 COLPFO database variables and OS equates SOOOE 2 004D 0052 0053 0054 0055 2 0057 0058 2 SOO5A 005B 2 005D S005E 2 S006A 0230 2 0290 0291 2 0294 2 02E4 S02F0 S02FD SO2FE S02FF D012 D013 D014 D015 D016 WO OO CO 00 00 CO 00 00 TF PBPwWrRPoOAMANTIUOABWN AB o 53266 53267 53268 53269 53270 lower limit for screen region attract mode timer and flag left margin right margin horizontal cursor position vertical cursor position current graphics mode starting address of display buffer previous cursor position haracter currently at the text cursor emory address of cursor hadow register of display list address ext window cursor position m end of RAM 1 MSB only s t startin
109. reen The value is moved to SDMCTL whenever a key is pressed It is used to restore the display if DMA is disabled PUPBT 033D 3 829 831 is used to test memory integrity when RESET is pressed If these bytes are not 5C 93 and 25 the computer will do a cold start when RESET is pressed The self test ROM is from D000 to D7FF the same addresses as the hardware registers This part of the operating system ROM is disabled when not used When The computer is put into the self test mode This part of ROM is copied to 5000 to 57FF and run from there GINTLK 03FA 1018 is a logical 1 if a cartridge is installed built in BASIC is considered a cartridge BASIC can be disabled by poking 1018 with a non zero number If RESET is then pressed the computer will attempt to load the DUP SYS file and basic will be completely disabled Go to chapter 19 Go to appendix A 102 Appendix A Hardware Registers Register Shadow Name Description Address Name Address ALLPOT game paddle ready indicators D208 53768 AUDC1 Audio channel 1 control D201 53761 AUDC2 Audio channel 2 control D203 53763 AUDC3 Audio channel 3 control D205 53765 AUDC4 Audio channel 1 control D207 53767 AUDCTL general audio control D208 53768 AUDF1 Audio frequency 1 control D200 53760 AUDF2 Audio frequency 2 control D202 53762 AUDF3 Audio frequency 3 control D204 53764 AUDF4 Audio frequency
110. riority objects The format of PRIOR is as follows PRIOR bit assignment 76 35 4302 1 0 Bits 7 6 Control the GTIA graphics modes 00 normal 01 mode 9 10 mode 10 11 mode 11 5 1 multiple color player enable Permits overlapping of players 0 and 1 or 2 and 3 with a third color in the overlapped region 4 1 fifth player enable All missiles will assume the color controlled by COLOR3 2C7 711 missiles are positioned together to make the fifth player 86 3 0 Controls the priorities of players missiles and other graphics Objects with higher priority will appear to move in front of those with lower priority The following chart may need some clarification In the chart PMO player 0 and missile 0 CO COLORO plotted graphics controlled by color register 0 in the SETCOLOR command P5 all four missiles when combined into one player BAK the background known as COLOR4 or color register 4 in the SETCOLOR command Ete Bits 0 3 of PRIOR and P M priorities Bit 3 1 2 1 1 1 0 1 co CO PMO PMO highest cl Edi PM1 PM1 priority PMO C2 co PM2 PM1 C3 P5 CL PM3 PM2 PMO C2 CO PM3 PM1 C3 P5 cl C2 PM2 PM2 C2 C3 P5 PM3 PM3 C3 P5 lowest BAK BAK BAK BAK priority Only one priority bit can be set at a time If more than one priority bit is 1 overlapping areas of conflicting priorities will turn black COLLISIONS Each player or missile has a register showing overlap collisio
111. rough CIO The data in the color registers in in the following format Color register data format 76543210 color bright color bright one of 16 possible colors one of 8 possible brightnesses even numbers 0 E In basic the COLOR command is used to assign color registers The corresponding registers depends on the graphics mode For example COLOR 0 is COLOR2 in mode 8 In most other modes COLOR 0 is COLOR4 See the above chart for the register relationships To change the contents of the color registers in BASIC the SETCOLOR command is used In all modes except mode 10 the SETCOLOR command refers to the registers COLORO to COLOR4 SETCOLOR register relationships SETCOLOR 0 COLPFO COLORO SETCOLOR 1 COLPF1 COLOR1 SETCOLOR 2 COLPF2 COLOR2 SETCOLOR 3 COLPF 3 COLOR3 SETCOLOR 4 COLBK COLOR4 The format for the SETCOLOR command is SETCOLOR command format SETCOLOR register hue brightness register 0 4 0 8 in mode 10 45 hue brightness 0 15 16 colors 0 16 even numbers only 8 brightnesses The following chart gives the colors represented by the hue number colors represented by hue numbers The attract mode 0 grey 8 1 gold 9 2 gold orange 10 3 red orange 11 4 orange 12 5 magenta 113 6 purple blue 14 7 blue 15 blue cyan blue green blue green green yellow green yellow yellow
112. run that cartridge or BASIC C COPY FILE This option will copy a file to another part of the same disk with a different file name or copy from one disk drive to another When you press C RETURN you will be given the prompt 22 COPY FROM TO Type the devices and file names separated by a comma EXAMPLES FOREMAN FIREMAN or D1 TEST D2 TEST The first example will copy to the same disk The second example will copy from disk drive one to disk drive two If you want to have the first file appended to the end of the second file type A after the file names EXAMPLE RUNMENU EXE AUTORUN SYS A If the files are binary load files this will cause both files to be saved as one file When the load command is used they will both be loaded and run D DELETE FILE S After pressing D RETURN you will get the prompt DELETE FILE SPEC After typing the file name you will be asked to confirm the file to delete DELETE FILE SPEC DELETE D1 JUNK ARE YOU SURE Press Y if the correct file is displayed If you use wild cards you will be asked to confirm each matching file E RENAME Upon typing E RETURN you will be given the prompt 23 RENAME GIVE OLD NAME NEW Type the file name you want to change and the new name separated by a comma EXAMPLE COLT HORSE WARNING Do not rename a file to a name which already exists on the disk You will end up with a duplicate file name and will not be able to access one of th
113. ry scan counter and fine scrolling is done by changing the scroll registers VERTICAL SCROLLING Vertical scrolling is very simple Follow the steps below to set up vertical scrolling of graphics Steps to use vertical scrolling e Set bit 4 of the first byte of the display list instruction for each line to be scrolled e Put the number of T V lines to offset the graphics vertically in the vertical scroll register VSCROL D405 54277 e The vertical scroll register can offset the graphics upward by 0 7 T V lines in the 24 line graphics modes ANTIC modes 2 and 4 In 12 line graphics modes ANTIC modes 5 and 7 it can vertically offset the graphics by 0 15 T V lines To offset the graphics an 8th or 16th line the scroll register is reset to 0 and the memory scan counter is reloaded with the address of the next line of graphics in the display data buffer If the entire screen is being scrolled the load memory scan counter command near the beginning of the display list is changed to point to the address of the second line of graphics 80 HORIZONTAL SCROLLING Horizontal scrolling works much like vertical scrolling It is enabled by setting bit 5 of the instruction for each line to be scrolled The horizontal scroll register HSCROL D404 54276 sets the offset The small difference is that graphics are moved twice as far per change two graphics 8 pixels instead of one Also when HSCROL 0 the graphics ar
114. s an ATASCII character even if it is an editor control code CTRL 1 screen print start stop CTRL SED Go to chapter 6 Go to chapter 8 CHAPTER 8 The display handler S The display handler manages the computer s video display Although no data ever leaves the computer through it the display is treated like any other CIO device Data sent to the screen may be displayed as either characters or point by point graphics Although it is only visible in the 40 column text mode mode O there is a cursor on the screen in all of the text or graphics modes Whenever a character or graphics point is put on the screen the cursor moves just as in mode 0 The display is capable of both input and output Information can be put on the screen with any of the CIO output commands An input command will find whatever is on the screen at the position of the cursor When text or graphics is sent to the screen it is actually stored in an area of memory called the display buffer What you see on the screen is the computer s interpretation of the data stored there This will be explained further as each mode is covered DISPLAY HANDLER SPECIAL FUNCTIONS DRAW FILL SPECIAL ERROR STATUSES 84 8D 91 93 Invalid special command 141 Cursor out of range Nonexistant screen mode Insufficient ram for screen mode 35 TEXT MODE 0 In graphics mode 0 data passes through CIO and is stored in t
115. s hold the address at which the file is to load The last two header bytes tell the ending address for the file If the file is a program and is to run automatically the initialization and run address are appended to the end of the file binary load file header 16 Decimal Hexadecimal 255 identifier FF 255 FF 0 start 00 7 07 15 end FF 8 08 The above file would load at address 0700 1792 decimal and end at address 08FF 2063 If a binary load file has initialization and run address appended to it they take on the following format init and run tailer CHR Decimal Hexadecimal init address format b 226 identifier E2 2 02 c 2277 E3 2 02 n address nn n nn run address format diamond 224 identifier EOQ 2 02 a 225 El 2 02 n address nn n nn inverse video A program which doesn t need special initialization can be run at the init address Otherwise an RTS instruction is expected at the end of the initialization section The computer will then jump to the run address if specified 17 INSIDE THE COMPUTER DOS uses the computer s CIO utility When a DOS disk is booted a non resident handler is loaded into memory A new handler name D is then added to the handler table When ClO is called with a device name of D or Dn CIO will search the handler table for that device name If the D is found the next two bytes in the table point to the DOS entry address DOS FILE NAM
116. s in the block of memory used to store the input or output data See ICBAL and ICBAH If the amount of data read during an input operation is less than the length of the buffer the number of bytes actually read will be put in ICBLL and ICBLH by CIO ICAX1 through ICAX6 The auxiliary information bytes are used to give CIO or the device any special information needed OPENNING A CIO CHANNEL Before using a CIO channel it must be assigned to an I O device In machine language you start by putting the channel number in the four high bits of the 6502 X register X 30 for channel three Next you place the necessary codes parameters into IOCB 0 indexed by X The X register will cause the numbers to be offset in memory by 16 times the channel number This puts the numbers into the correct lOCB instead of lOCB 0 Below are the parameters used to open a channel Channel open parameters ICCOM open code ICBAL address of device name ICBAH in memory ICAX1 direction code ICAX2 Zero The direction code byte in ICAX1 takes on the following format ICAX1 format for opening a channel T2609 Ae BZ TQ ICAX1 WR 8421 wW 1 open for output write R 1 open for input read ICAX1 may have the following data CIO direction codes HEX DEC operation 04 4 input 08 8 output SOC 12 input and output cannot change the length of a disk file ICBAL and ICBAH point to the device name stored in memory The
117. s is read processed and placed in the proper shadow registers SYSTEM RESET INTERRUPT If a SYSTEM RESET interrupt is generated on the 400 800 the computer jumps to the warm start routine INTERRUPT REQUESTS maskable interrupts IRQs When an IRQ interrupt occurs the hardware register IRQST D20E the PIA status registers PACTL D302 and PBCTL D303 are examined to determine what caused the interrupt For each interrupt the 6502 accumulator is pushed to the stack The computer is then directed to the proper ram vector to service the interrupt SOFTWARE INTERRUPT BRK instruction The operating system doesn t use software interrupts The software interrupt vector points to a PLA followed by an RTI Interrupt vectors Label address type function VDSLST 0200 NMI DLI Points to an RTI VVBLKI 0222 NMI stage 1 VBI VVBLKD 0224 NMI return from interrupt routine CDTMA1 0226 NMI time out 1 used by SIO CDTMA2 0228 NMI time out 2 not used by OS VPRCED 0202 IRQ not used points to PLA RTI VINTER 0204 IRQ not used PLA RTI VKEYBD 0208 IRQ keyboard interrupt VSERIN 020A IRQ used by Serial I O routine 54 VSEROR 020C IRQ VSEROC 020E IRQ VTIMR1 0210 IRQ VTIMR2 0212 IRQ VTIMR4 0214 IRQ VIMIRQ 0216 IRQ VBREAK 0206 BRK SYSTEM TIMERS used by SIO used by SIO not used by OS PLA RT H not used by OS PLA RTI main IRQ code unused by OS PLA RTI
118. s on The following BASIC commands will turn the cassette motor on and off Cassette motor control POKI POKI 54018 PEEK 54018 8 motor on 54018 PEEK 54018 8 motor off ry ry Useful data base variables and OS equates PACTL D302 54018 port A control register bit 4 controls cassette motor CHAPTER 5 The keyboard handler K The keyboard is a read only device and therefore the keyboard handler has no output functions The keyboard handler reads the keys as ATASCII codes Each key is represented by one byte of data Therefore each time a key is pressed the data is treated as a byte of data just as data from any other device is The only difference is that the computer must wait for the operator to press the keys as it reads the data Whenever a key is pressed an IRQ interrupt is generated by the keyboard reading hardware The internal code not ATASCII for the key just pressed is then stored in CH 02FC 764 The code is then compared with the prior key code in CH1 02F2 754 If the code in CH1 is different from the code in CH the key is accepted The code is then converted to ATASCII and placed in the database variable ATACHR 02FB 763 On XL and XE models KEYDEF 0079 2 121 points to the key code to ATASCII conversion table This address is used by the the screen handler in 400 800 models If the code in CH1 is the same as the code in CH the new key code will not b
119. slot of the 800 This is also where 16K cartridges begin If there is no cartridge here it is ram A000 40960 This is the beginning of the left cartridge of the 800 or the only cartridge slot on all other 125 models This is where the BASIC ROM resides in the XL XE models This area is RAM is there is no cartridge or BASIC is disabled on XL XE models above the cartridges C000 CFFF 49152 53247 This area is empty on the 800 Sometimes special ROM chips such as Omnimon are wired in here On the XL XE models C000 C7FF is free ram if there are no cartridges On XL XE models the O S ROM starts at C800 D000 D7FF 53248 57373 This area is taken up by the hardware chips The chips actually take only a fraction of this space If these addresses are further decoded there is space for many many more hardware chips For example The PIA chip uses 256 bytes of memory but needs only 4 bytes There is room for 64 PIA chips in this reserved memory E000 ESFF 57344 58367 This is the location of the ATASCII character set E400 FFF7 58368 65527 This is the operating system ROM FFF8 FFFF 65528 65535 These last 8 bytes contain the addresses of the interrupt vectors Upon power up the 6502 gets a reset pulse and looks up the reset routine here Go to appendix B 126
120. ssentially allows two channels with twice the range as each of the four normal channels This is called 16 bit sound 91 To calculate exact frequencies use the following formulas The exact clock frequencies are also given if more accuracy is needed The clock frequencies are acquired by dividing the signal from the TV color burst crystal This crystal has a frequency of 3 579545 MHz Clock frequencies 1 7897725 MHz color burst 2 63 920446 Khz color burst 56 15 699759 KHz color burst 228 Formulas For 1 79 MHz clock clock 2 AUDEN 7 2 AUDFn 4 16 bit 8 bit AUDFn is the number in the audio frequency register For 16 KHz and 64 KHz clock 2 AUDFn 1 AUDIO TIMER INTERRUPTS When the audio timers count down to zero they generate IRQ interrupts if enabled The timers can be reset by writing any number to STIMER D209 53769 THE CONSOLE SPEAKER The console speaker is where key clicks and the cassette signals come from On XL and XE models this speaker is heard through the TV speaker It is operated by toggling bit 3 of CONSOL D01F 53279 This bit always reads O but it is actually set to 1 during vertical blank 92 Useful data base variables and OS equates CONSOL DO1F 53279 bit 3 controls console speaker UDF1 D200 53760 Audio frequency 1 DCL D201 53761 audio control 1 DF2 D202 53762 Audio frequency 2 DC2 D203 53763 audio control 2 H
121. t or output 0 sets bit for input 1 sets bit for output 1 PORTA operational 1 1 peripheral A interrupt enabled PBCTL 7 Peripheral B interrupt status Set by peripheral interrupt reset by reading PORTB 3 Serial connector command line 2 0 PORTB is now port B direction control Writing to PORTB will now set bits for input or output 0 sets bit for input 1 sets bit for output 1 PORTB operational 1 1 peripheral B interrupt enabled The electronic configuration of the controller ports is as follows NOL 2 SoR Mt L 4 5 67 R Mt L O through 7 are the binary data bits for port A or port B and are 5 volts and ground respectively R and L are the left and right game paddles t is the joystick trigger line The data bits in the joystick ports are used as follows for the joysticks and game paddles The joysticks and the port registers Tra 43 02 10 PORTA U D L R U D L RI 16318421 242 6 8 paddle triggers 37 2 10 94 PORTB 400 800 IUIDILIRIUIDILIRI only paddle triggers 7 6 5 4 U up D down L left R right The joysticks may be read either directly from the port registers or from the joystick shadow registers During vertical blank the data in the port registers is separated and put into the shadow registers These registers are STICKO 0278 632 STICK1 0279 633 STICK2 027A 634 and STICK3 027B 635 The triggers may be re
122. t some occupied sectors are empty For such disks a program which copies the entire disk is needed When you press J RETURN you will be given the prompt DUP DISK SOURCE DEST DRIVES If you are using only one disk drive type 1 1 If you have only one drive you will be told when to swap disks K BINARY SAVE This option saves a block of memory as a binary load file When you type K RETURN you will be given the prompt SAVE GIVE FILE START END INIT RUN Type the desired file name and a comma Now type the start and end addresses of the memory block to be saved in hexadecimal numbers separated by commas If the file is a program which is to automatically run when loaded give the initialization address if needed then the run address EXAMPLE CHASE EXE 0700 09FF 0700 25 This will save the block of memory from address 0700 to O9FF The program is not initialized before running so there is no address typed after the third comma When the program is loaded the computer will jump to address 0700 as specified in the last parameter to run the program L BINARY LOAD To load a binary file type L RETURN You will get the Prompt LOAD FROM WHAT FILE Type the file name and the file will be loaded If wild cards are used only the first matching file will be loaded M RUN AT ADDRESS Typing M RETURN will get the prompt RUN FROM WHAT ADDRESS Type the hexadecimal address of the program you want to run
123. the ANTIC chip is set up for the proper graphics mode The top of free memory pointer MEMTOP 02E5 2 741 is set to point to the last free byte before the display list Before opening a channel to the screen handler the pointer to the highest memory address needed by the program APPMHI 000E 2 14 should be properly set This will prevent the screen handler from erasing part of the program when it sets up the screen data region When the channel is opened two special options can be sent with the direction parameter ICAX1 ICAX1 for screen open EO 5 A S210 C SWR 16318421 2426 8 C 1 don t clear the screen S 1 split screen R 1 input W 1 output Before the open command the graphics mode number is placed into ICAX2 ICAX2 for screen open L658 A 3 2 10 mode mode 00 through 0B 0 11 0 15 on XL XE To open a channel to the screen in BASIC use the GRAPHICS command BASIC screen open format GRAPHICS mode 41 For Example GRAPHICS 8 This will set up a mode 8 graphics screen and open channel 6 to it If the graphics mode is 1 8 a split screen will be set up For example GRAPHICS 8 will set up a mode 8 screen with a four line text window at the bottom If 16 is added to the mode number a full screen will be set up For example GRAPHICS 8 16 or GRAPHICS 24 will set up a mode 8 screen with no text window a full 192 pixels high If the number 32 is ad
124. the OPEN command use XTO 3 1 4 0 K Note that the above command is identical to the OPEN command except XIO 3 is used instead of OPEN Also note that 03 is the IOCB open code for ICCOM DOSINI BRKKEY ICHID ICDNO ICCO ICSTA ICBAL ICBAH ICPTL ICPTH ICBLL ICBLH ICAX1 ICAX2 HATABS CIOV Useful database variables and OS equates SO00C 2 12 initialization vector 0011 17 break key flag 0340 832 start of IOCBs 0341 833 0342 834 0343 835 0344 836 0345 837 0346 838 0347 839 0348 840 0349 841 034A 842 034B 843 031A 16 794 device handler tabl SE456 58454 CIO entry vector Go to Table of contents Go to chapter 2 13 CHAPTER 2 The Disk operating System D The disk operating system program DOS is also called the file management system FMS DOS is not a permanent part of the computer it is loaded in upon power up if a disk drive is attached to the computer When the computer is turned on one of the first things it does is send a request to the disk drive to load DOS into the computer This startup operation is called booting The word boot is short for bootstrapping the start up process of early computers The term comes from lifting one s self by one s boot straps Anytime the disk boots the computer tries to read a program starting at sector 1 and continuing in sequence If the disk has DOS on it
125. tion l position l position l position l position l position 1 scroll of of of of of of of of display list pointer low byte missile 0 missile 1 missile 2 missile 3 player 0 player 1 player 2 player 3 request enable IRQ IRQ status keyboard code missile missile missile missile missile missile missile missile 0 to graphics collisions player collisions graphics collisions player collisions graphics collisions player collisions graphics collisions player collisions 104 DMA D403 D402 D400 DO1D DO11 DOOD DOOF DO10 D004 D005 D006 D007 D000 D001 D002 D003 D404 D20E D20E D209 D000 D008 D001 D009 D002 DOOA D003 DOOB 54275 SDI 54274 54272 SDMCT 53277 53265 53261 53262 53263 53264 54278 53252 53253 53254 53255 53248 53249 53250 53251 54276 53774 53774 53769 53248 53256 53249 53257 53250 53258 53251 53259 SD LST STL H 0231 561 0230 560 L 022F 559 POKMSK 0010 16 CH 02FC 764 NMIE NMIRES NMIST PO PO Pil Pl P2 P2 P3 B3 PF PL PF PL PF PL PF PL PACTL PAL PB PE PE PO PO PO PO PO PO PO PO POT PO PO CLT NH NV BASE
126. to be performed The write only registers have shadow registers in RAM Data to be put in the registers is usually put into the shadow registers The data in the shadow registers is automatically moved to the operating registers during vertical blank 73 For register use and address see the previous chaptes on the associated functions Go to chapter 13 Go to chapter 15 CHAPTER 15 Display Lists some of this file was lost chip also has a memory scan counter This register scans the display buffer for data to be interpreted and displayed Once loaded the memory scan counter s 4 most significant bits are fixed The result is that the memory scan counter cannot cross a 4K memory boundary i e AFFF to B000 without being reloaded DISPLAY LIST INSTRUCTIONS There are three basic instructions in the display list The type of instruction is determined by bits 0 1 2 and 3 of an instruction byte The other four bits give auxilliary parameters for the instruction Bit 7 always enables a display list interrupts DLIs Display list instruction format Toe 5 4 Be 2 TQ I n n n O 0 0 0 0 display blank lines 0 7 number of blank lines 1 8 76543210 pI w 0 0 0 1 74 ju ju o 76 DA l 1 jump 3 byte instruction mp and display one blank line mp and wait for vertical blank 3 2 30 0 IIIRIHIV M MIMIM Ll
127. to operate the RS 232 ports on the 850 interface If you don t want this program to automatically load when you boot with the master disk rename the file to RS232 27 SPECIAL DOS INFORMATION When DOS is in memory changes can be made to the DOS program These changes can be made by poking the changes into memory If you want to make the changes permanent you can type DOS RETURN to load the utilities From the utilities menu you can use the write DOS files option to save the changes on disk Some of the useful changes you can make follow POKE 1913 80 This turns off the write verify and speeds up disk writing POKE 1913 87 This turns write verify on POKE 5903 42 POKE 5904 46 POKE 5905 82 POKE 5906 85 POKE 5907 78 POKE 5908 155 This causes any binary file with the extender RUN to be loaded automatically when the computer is turned on POKE 5903 65 POKE 5904 85 POKE 5905 84 POKE 5906 79 POKE 5907 82 POKE 5908 85 This returns the DOS to normal Automatically loading files named AUTORUN SYS DOS 2 0 DOS 2 5 POKE 3772 255 POKE 3818 64 POKE 3774 64 POKE 38227123 POKE 3778 123 This will cause DOS to accept lower case as well as upper case letters in file names It will also now accept and _ POKE 3772 223 POKE 3818 65 POKE 3774 65 POKE 3822791 POKE 3778 91 28 This will change DOS back to normal accepting only upper case letters and numbers Go to chapter 2 Go to chapter 4 CH
128. to the device mark the End Of File and update any directories etc The get byte routine should get a byte from the device or the handler buffer and put it in the 6502 A register Handlers with long timouts must monitor the break key flag and put a 80 in the 6502 Y register if the BREAK key is pressed The put byte routine should send the byte in the 6502 A register to the device or handler buffer If the buffer fills it should be sent to the device BASIC can call the put byte routine without using CIO The get status routine may get 4 bytes of status information from the device and put them in DVSTAT 02EA to DVSTAT 3 For special commands the handler must examine the command byte and find the proper routine entry point In all cases the status error code of the operation should be put in the 6502 Y register To be compatible with all versions of the operating system the handler must redirect DOSINI 000C 2 12 for initialization upon reset This initialization must restore the vectors in the handler vector table and jump to the origional DOSINI vector 12 SPECIAL COMMANDS Some devices have special CIO commands These are known as device specific commands In assembly language these commands are executed just as any other CIO command is In BASIC the XIO command is used An example of the XIO command is XIO command code channel auxl aux2 device file nam To open a channel with the XIO command instead of
129. y delay and repeat timer SHFLOK 02BE 702 SHIFT CTRL lock flag 00 lower case 40 64 upper case lock 80 128 CTRL lock INVFLG 02B6 694 inverse video flag non zero invers CONSOL DO1F 53279 start select and option keys IRQEN SD20E 53774 IRQ interrupt enable bit 7 enables BREAK bit 6 enables other keys shadow registers POKMSK 0010 16 IROEN shadow Go to chapter 4 Go to chapter 6 CHAPTER 6 The printer handler P The printer is a write only device so the printer handler has no input functions The printer handler has no special functions other than the CIO functions common to all other devices Although many printers have special functions the printer handler has no control over them See your printer manual for information on special functions Go to chapter 5 Go to chapter 7 CHAPTER 7 33 The screen editor E The screen editor uses both the keyboard handler and the screen handler to provide interactive control of the computer In fact the keyboard handler the screen handler and the screen editor are contained in a single section of code and are therefore very closely related The editor works with one line of characters at a time The lines it works with are called logical lines and are up to three screen lines long The screen editor inputs data from the keyboard and then prints the data on the screen When the RETURN key is pressed the editor inputs
Download Pdf Manuals
Related Search
Related Contents
Smeg FPD34RD-1 Samsung BD-P1400P User Manual SX-KN2400 SX-KN2600 - Support User N otes - Mettler Toledo Baumatic BDWI640 Technical Drawing HP 600 LV970UT notebook Perle Systems 5500316-13 User's Manual Fiche de référence de génistéine plus Service Manual for G-Carriage Copyright © All rights reserved.
Failed to retrieve file