MICRO ISSUE 41 / OCTOBER 1981 / PAGE 15

From Here to Atari


James Capparell
297 Missouri
San Francisco, California 94107

My purpose in writing this column is to give potential microcomputer users enough information on the Atari 800 to provide a basis of comparison to other micros. I want to point out the features that convinced me that the 800 is perhaps the most-for-your-money machine on the market. I also think it is the best graphics machine in its price range. The smaller 400 unit, while possessing a difficult (for touch typists) keyboard, has so many of its bigger brother’s features that I feel it may be the single best buy in the entire computer industry.

The following will apply to both 400 and 800 units unless noted.

When you look closely at this equipment, you’ll notice that the design engineers went to considerable effort to put together a system that is sophisticated and versatile, yet easy to use for the novice. This system is modular and therefore easily expandable. The designers even built the TV modulator into the chassis. This device allows you to connect your television to your computer. Many manufacturers force you to pay extra for the modulator even though it’s absolutely essential for proper connection to your home television.

A second video output is available (800 only), allowing the connection of another monitor. This second port provides composite color/luminance and therefore a generally better picture. The two pictures are handy in teacher/student situations or any place where two pictures are better than one.

While on the topic of video, Atari puts out a clean NTSC (National Television Systems Committee) standard video signal suitable for home video taping. This is accomplished via the DIN plug (800 only) on the side of the console. Other machines need special adapter boards to do the same thing.

Atari was one of the first companies to pass FCC RFI emission standards. You can safely use this machine at home and not fear your neighbor’s wrath when he can’t watch his favorite television show due to interference from your computer. Many manufacturers had to redesign equipment to meet these stringent requirements, at an added cost to buyers. Again, Atari engineers demonstrated their design foresight.

Another video feature not readily apparent to the casual observer is the allowance for misaligned televisions. By including a border around the displayable screen image, Atari engineers have assured us that when we use VisiCalc the numbers won’t disappear into the invisible portion of the screen. This border is under programmer control.

One last design feature that even many Atari owners don’t yet appreciate is something euphemistically called ATTRACT MODE. This is that strange habit that causes the Atari to begin to rotate through all of its colors when no one has pressed on the keyboard in the previous nine minutes. This feature was included to prevent any one phospher from burning out.

I can’t speak about this equipment without mentioning graphics. The incredible features are due to a trio of large-scale integrated circuits designed specifically by and for Atari. These chips make twenty different graphics/text combinations available (depending on memory available). The high-resolution mode is 320 horizontal dots by 192 vertical lines. Actually, there is a way to get more than this (recall the border), but I’ll leave this technique for a future column.

There are two channels of DMA (direct memory access) video available. There are 128 color luminance combinations and all may be on the screen at one time. To be fair, there are constraints when using so many colors and the techniques will probably only be used by intermediate to advanced programmers. Also available are priority and collision registers that allow advanced animation techniques to be used.

The character set can be completely redefined by the user. This will allow creation of such things as foreign alphabets or special mathematics characters. Available to advanced users is hardware-controlled smooth scrolling in any direction, display list-driven playfield graphics, display list interrupts — all advanced techniques suitable for future columns.

Standard on these machines is a set of parallel ports usually referred to as the front jacks. These are ports A and B of a 6820 PIA. They allow the connection of a variety of input devices. Light pen, barcode reader, graphics tablets, and printers all have been implemented using these jacks. Also, the standard joystick and paddle controller plug in here. In addition, there is a serial port included to which a printer, disk, cassette, and modem may be added. To include all these peripherals, you must purchase an I/O expansion unit.

The console comes complete with an upper/lower case keyboard with a feel that touch typists seem to like. (Note that the 400 has a flat keyboard more appropriate for youngsters.) With this keyboard is an easy-to-use screen-oriented editor with full cursor control. This makes BASIC, assembler, FORTH, Pascal or Pilot easy to enter and correct. The 400 and 800 units also have four voices, or channels of sound, available. This allows you to play four-part harmony, or to include special sound effects in your latest program. The sound feature is readily available in BASIC. I’ve heard everything from Beethoven’s Fifth to the latest in phaser sounds on my machine.

In conclusion, I’d recommend the Atari 800 to anyone really serious about using state-of-the-art graphics. This includes all game players, as well as experimenter/hacker types. Also, those of you interested in experimenting with video taping must consider this machine. For potential users looking for business software, I’ve seen and heard of some excellent packages to be released soon. These include a full general ledger system, word processor and data base system for starters. I would not hesitate to suggest this equipment to those of you who would like to have a very flexible tool without becoming professional computer programmers. From the standpoint of ease-of-use, its modular design, and of course its state-of-the-art components, it’s a machine you can live with.

The 400, since it has almost as much capability as its bigger brother, must be seriously considered, and in fact may be the only machine to consider in the under $500 price range. If you are not sure about your needs and don’t want to spend much, yet still want all the frills that the rest of us have come to expect, the 400 is perfect.

I hope I’ve managed to convey the excellent combination of features and price. More of us are discovering this and my intent here is to raise issues of comparison. Now, when your friendly dealer attempts to sway you to purchase some other equipment you will be able to do some intelligent comparison shopping. (Please see summary table for these features, as well as a few additional ones.)

I intend to be doing a regular column for MICRO. Some of these advanced features will make excellent articles. I welcome suggestions and questions.

Summary Table: Atari Features

  1. Full screen editor
  2. Full upper/lower case typewriter-like keyboard
  3. Full cursor control: up, down, left, right
  4. Complete RFI shielding
  5. Built-in TV modulator
  6. NTSC standard signal, suitable for video taping
  7. Second video output (available on the 800)
  8. Protection against phospher burn on home TVs
  9. 128 color/luminance combinations available
  10. Twenty different graphics/text combinations available
  11. Maximum resolution of 320 × 192
  12. Two DMA video channels available
  13. Capability of placing eight small objects on screen all with independent color, position, and priority control registers (known as player/missiles)
  14. Hardware-controlled smooth scrolling
  15. Built-in real time clock and four additional counters
  16. Display is list-driven, bit-mapped video (known as playfield graphics)
  17. Interrupt-driven system with many hooks available to programmer (e.g. vertical, blank, or scan line interrupts are accessible)
  18. Four channels of sound are standard with frequency, volume, and distortion control in BASIC. Envelope shaping is possible from machine level code
  19. The separate voice channel available on cassette recorder is suitable for educational purposes
  20. Parallel port built in
  21. Serial port built in

MICRO ISSUE 42 / NOVEMBER 1981 / PAGE 37

From Here to Atari


James Capparell
297 Missouri Street
San Francisco. California 94107

What better place to discuss Atari features than in an issue devoted to games? Actually, I’m hesitant to draw the Atari-games parallel. The point that it is a premiere graphics machine has clouded the fact that it is a flexible, easy-to-use computer system with features and capability appealing to a diverse user group. And, the Atari has an installed user base estimated over 50,000.

Why do I believe that this equipment is ahead of its competitors? I feel its strongest features, relative to game programming, are sixteen graphics modes (high resolution 320 × 192), two direct memory access (DMA) video channels (sort of a simplified multiprocessing system), display list controlled memory mapped graphics, redefinable character sets, hooks for vertical blank interrupts and scan line interrupts, and of course four channels of sound (silent games are dull).

Mastering these features takes some time. Currently there are two essential manuals available from Atari: The Operating Systems User Guide and Hardware Manual #CO16555. The cost for both is thirty dollars and worth every penny.

This month I would like to discuss one feature of the display list, smooth scrolling of the screen image. The Atari maps its memory to video via a LSI chip called ANTIC. This chip is a dedicated processor with its own instruction set. These instructions make up what is called a display list. The display list controls the graphics mode which will be displayed on the screen. Recall that there are sixteen modes, each specifying memory use, resolution and color. The display list tells ANTIC what part of the 6502 memory space to display, what mode to display, whether an interrupt should be generated, and whether horizontal and/or vertical scrolling should be enabled. It is this last feature which will be demonstrated.

There are two methods which can be used to scroll the image. The first is direct and easy to comprehend. The display list has, as part of its instructions, a feature called Load Memory Scan (LMS). This operator is three bytes long. The last two bytes are the address (low-high bytes, 6502 style) of the start of display memory. As a result, the entire address space is available for display under program control. This gives the observer a ‘window’ into memory. Scrolling windows are created by simply changing the two address bytes of the LMS. In other words, it is not data being moved through memory, but a window moving across the data residing in memory which causes the image to scroll.

Program 1 should give a good idea of ‘coarse’ vertical scrolling. I call it coarse since the image moves a full character space at a time. Lines 170 and 180 are really doing all the dirty work. The new display address is being inserted into the display list at this point after appropriate incrementing or decrementing of the address bytes. I’ve chosen to vertically scroll the entire image but it is an easy matter to set up a scrolling window within a background display. In fact, program 2 does just that, only in the horizontal direction.

I’ve also mixed two modes on the screen. The only complication here is the need to have more than one LMS instruction. The second LMS restores the pointer to memory prior to the horizontal intrusion. There is nothing to stop you from placing an LMS instruction on every mode line; each could be scrolling in independent directions.

Program 3 is meant to demonstrate the second scrolling method, smooth or fine scrolling. This is accomplished with the help of hardware scrolling registers, one for horizontal and another for vertical direction. When the appropriate bits are set in a display list instruction, the values in each of these registers control the amount of scan lines vertically or color clocks horizontally that each line will be displaced. The limitation here is the amount of fine scrolling allowed. A line can be moved eight full color clocks horizontally and 16 scan lines vertically. When this amount is scrolled, the LMS address bytes must be incremented or decremented and the whole process must be started again. In this way smooth scrolling can be maintained.

The previously mentioned manuals are a necessity for commercial programmers. This machine has been completely disclosed and it’s up to us to begin using these features.

Currently three games make full use of Atari graphics. They are Missile Command by Atari Inc., Jawbreaker by On-Line Systems, and Dodgeracer by Synapse Software. These three games use the graphics capability of this equipment and approach arcade level polish and style. Synapse also produces Filemanager 800, a database management package that’s so easy to use and makes such excellent use of mixed mode displays that it’s going to become a standard for emulation.

One other program that I must mention is Eastern Front, available from Atari Program Exchange (APX). This is a strategy war game that makes excellent use of smooth scroll technique. This game is a virtuoso performance of programming skill and probably exercises the internal features of the Atari more than any other product on the market.

I hope your curiosity has been stimulated. These techniques are just the beginning; I intend to offer more ideas and help over the coming months.

Listing 1
10 REM ** PROG1 ** COARSE VERTICAL SCROLLING DEMO
15 REM PRESS UP/DOWN ARROWS TO MOVE DISPLAY THRU MEMORY
20 DLIST=PEEK(560)+PEEK(561)*256:REM GET START OF DISPLAY LIST
30 LMSL=DLIST+4:REM POINTER TO DISPLAY MEMORY
40 LMSH=DLIST+5
50 DISPLAYL=0:DISPLAYH=0:REM INITIALIZE ADDRESS OF DISPLAY MEMORY
55 REM READ KEYBOARD
60 IF PEEK(764)=255 THEN GOTO 60:REM WAIT FOR KEY
70 IF PEEK(764)=14 THEN POKE 764,255:GOTO 110:REM UP ARROW?
80 IF PEEK(764)=15 THEN POKE 764,255:GOTO 140:REM DOWN ARROW?
90 GOTO 60
100 REM MOVE DISPLAY WINDOW INTO LOWER MEMORY
110 DISPLAYL=DISPLAYL-40
120 IF DISPLAYL>=0 THEN GOTO 170:REM CAN'T DISPLAY NEGATIVE MEMORY
122 DISPLAYH=DISPLAYH-1:DISPLAYL=0
124 IF DISPLAYH<0 THEN DISPLAYH=0
126 GOTO 170
130 REM MOVE DISPLAY WINDOW INTO HIGHER MEMORY
140 DISPLAYL=DISPLAYL+40
150 IF DISPLAYL>240 THEN DISPLAYH=DISPLAYH+1:DISPLAYL=0
160 REM CHANGE DISPLAY MEMORY POINTER
170 POKE LMSL,DISPLAYL:REM PUT NEW DIPLAY ADDR IN DISPLAY LIST
180 POKE LMSH,DISPLAYH
200 GOTO 60:REM GO WAIT FOR KEYBOARD ENTRY
Listing 2
10 REM ** PROG2 ** COARSE HORIZONTAL SCROLLING DEMO
20 REM USE LEFT AND RIGHT POINTING ARROWS TO CONTROL SCROLL DIRECTION
25 LIST
30 DLST=PEEK(561)*256+PEEK(560)
35 DMEM=PEEK(DLST+4)+PEEK(DLST+5)*256
40 SKIPH=INT((DMEM+280)/256):SKIPL=DMEM+280-SKIPH*256
45 POKE DLST+15,66:POKE DLST+16,SKIPL:POKE DLST+17,SKIPH
50 ADDRL=DLST+13:ADDRH=DLST+14:VALL=0:VALH=3
55 POKE DLST+12,71:POKE ADDRL,VALL:POKE ADDRH,VALH
60 IF PEEK(764)=255 THEN GOTO 60:REM SCAN KB
65 IF PEEK(764)=7 THEN POKE 764,255:GOTO 100:REM RIGHT ARROW?
70 IF PEEK(764)=6 THEN POKE 764,255:GOTO 140:REM LEFT ARROW?
80 GOTO 50:REM ONLY ARROWS ARE LEGAL RESPONSE
90 REM SCROLL RIGHT
100 VALL=PEEK(DLST+13)+1:REM MOVE DISPLAY TO LEFT
110 IF VALL>255 THEN VALL=0:VALH=VALH+1
120 GOTO 55
130 REM SCROLL LEFT
140 VALL=PEEK(DLST+13)-1:REM MOVE DISPLAY TO RIGHT
150 IF VALL<0 THEN VALL=0:VALH=VALH-1
160 IF VALH<0 THEN VALH=0
170 GOTO 55
Listing 3
10 REM ** PROG3 ** FINE SCROLLING HORIZONTALLY AND VERICALLY
20 DLST=PEEK(560)+256*PEEK(561)
25 DMEM=PEEK(DLST+4)+PEEK(DLST+5)*256
30 SKIPH=INT((DMEM*280)/256):SKIPL=DMEM+280-SKIPH*256
35 VALL=0:VALH=2
40 POKE DLST+12,119:POKE DLST+13,VALL:POKE DLST+14,VALM
45 POKE DLST+15,66:POKE DLST+16,SKIPL:POKE DLST+17,SKIPH
50 IF PEEK(764)=255 THEN GOTO 50:REM SCAN KEYBOARD
55 IF PEEK(764)=14 THEN POKE 764,255:GOTO 200:REM UP ARROW?
60 IF PEEK(764)=15 THEN POKE 764,255:GOTO 250:REM DOWN ARROW?
65 IF PEEK(764)=6 THEN GOTO 300:REM LEFT ARROW?
70 IF PEEK(764)=7 THEN GOTO 350:REM RIGHT ARROW?
75 GOTO 50:REM IGNORE OTHER RESPONSES
200 Y=Y+1:IF Y<16 THEN GOTO 500
210 Y=0
215 VALL=VALL+40
220 IF VALL>240 THEN VALL=0:VALH=VALH+1
230 GOTO 450
250 Y=Y-1
255 IF Y>-1 THEN GOTO 500
260 Y=15
265 VALL=VALL-40
280 GOTO 445
300 X=X-1:IF X>-1 THEN GOTO 505
305 X=15
310 VALL=PEEK(DLST+13)+2
325 GOTO 445
350 X=X+1:IF X<16 THEN GOTO 505
355 X=0
360 VALL=PEEK(DLST+13)+2
440 IF VALL<0 THEN VALL=0:VALH=VALH-1
445 IF VALH<0 THEN VALH=0
450 POKE DLST+12,119:POKE DLST+13,VALL:POKE DLST+14,VALH
500 POKE 54277,Y:REM VERTICAL SCROLL REGISTER
505 POKE 54276,X:REM HORIZONTAL SCROLL REGISTER
510 GOTO 50

MICRO ISSUE 43 / DECEMBER 1981 / PAGE 43

From Here to Atari


James Capparell
297 Missouri
San Francisco, California 94107

Last month I showed you how to use the Load Memory Scan (LMS) instruction of the display list to effect a scrolling screen. Recall that the display list is the set of instructions used to control an LSI chip called ANTIC. ANTIC, a dumb microprocessor, functions as a graphics controller. Its principle functions are to specify the location in memory to be displayed, the mode of display (14 graphics/text modes with differing resolutions to choose from), horizontal/vertical scroll enable (discussed last month) and display list instruction interrupt enable.

This month I’ve included an ANTIC disassembler. This program requires you to enter a BASIC graphics mode numbered 0–8, and will then locate the associated display list and decode the instructions. Note that this program prints the ANTIC display modes numbered 2–15. Use the program and the ANTIC/BASIC correspondences will become apparent. (See program 1.) I also want to take you on a short trip into the world of basic raster scan graphics, Atari style, and then provide a quick lesson in the use of display list interrupts.

The normal NTSC raster television is made up of 625 interlaced scan lines. These scan lines are the horizontal lines appearing in the picture tube phospher when energized by the electron beam as it sweeps left to right, top to bottom, across your screen. Interlacing occurs in normal television to eliminate flicker. It simply means that all even scan line rows are ‘painted’ in one frame, and all odd lines in the next. The frame refresh rate is 60 Hz.

Each Atari frame image contains 262 scan lines with no interlacing. Every frame is the duplicate of the prior one unless there is programmer intervention. The image is repainted 60 times per second, and the electron beam is turned off at the end of every scan line. At that time it is returned to the left edge of the screen to start the next line trace. This is called horizontal blank time.

The beam is also turned off after every frame so that it may return to top left corner of the screen, called vertical blank time. These two time periods are very important to the would-be animator. It is crucial to understand how much time is available and how to enter code such that it will be executed at the appropriate moment.

The 6502 microchip in the Atari cycles at 1.79 megahertz, almost twice as fast as the normal 6502. This cycle rate was chosen so that two color clock widths on a scan line equal one machine cycle. There are 228 color clocks on every scan line, and the maximum displayable width of any scan line is 176 color clocks, called ‘wide playfield’ in the Atari literature. The maximum resolution is ½ color clock, and therefore Atari can display up to 352 picture elements (pixels) horizontally. The maximum vertical resolution, in scan line units is 240. Effectively, Atari has a high-resolution mode of 352 × 240.

It’s important to realize that there are physical limitations to this size display. Depending on your television’s adjustment, some of the displayed image may appear on the curved edge of the picture tube. This overlap is called overscan. While overscan is not important in normal television viewing, it is crucial when your word processor is printing what you can’t see.

Atari, in its Operating System (O.S.), used a more conservative screen size of 320 (160 clocks) horizontally by 192 scan lines vertically. This width screen is called normal playfield in the documentation. In this way Atari defeated normal overscan and assured us of seeing an entire image. There is a narrow playfield width as well, 256 pixels (128 clocks wide). These dimensions and timing are important since what is not used at display time is left over and available at interrupt time. (See table 1 for timing.)

It is relatively simple to change between screen widths. Location $22F controls playfield width. Called SDMCTL in the documentation, it is initialized to $22. Writing a $23 will change the screen dimension to wide, and writing $21 will reduce the screen to narrow. SDMCTL is the O.S. shadow for a hardware register in the ANTIC chip at $D400, called DMACTL.

Since many of these hardware locations are write only, the O.S. keeps copies, called shadows, in RAM. Shadow registers update the associated hardware at Vertical Blank Interrupt time. Remember to use the shadows to effect a permanent change to the entire frame. The exception occurs when using a display list interrupt. These interrupts can occur, under programmer control, on any scan line of every frame. To effect an immediate change at scan line interrupt, you must write directly to the hardware register.

To use the Display List Interrupt (DLI), a number of things must be accomplished. First, write the DLI service routine. The important thing to remember here is to save and restore any registers needed by the routine. Then find a free place in memory for this routine. (As you know, Atari has reserved page six, decimal 1536, just for users.) Next, update the vector at $200 and $201 to point to start of the routine. Now change the appropriate display list instruction to cause an interrupt (accomplished by turning on bit 7 of the instruction). Finally, enable DLIs by setting bit seven of hardware register $D40E, called NMIEN (Non-Maskable Interrupt enable). See program 2 for a simple example.

Also remember to set the interrupt in the mode line prior to the location where you would have the changes occur. Then write to a location called WSYNC $D40A. This will cause any changes to be delayed to the start of the next scan line and, therefore, allow a smooth synchronized transition.

DLIs can be used for everything from putting many colors on the screen, to changing among a number of character sets, to moving player/missiles around. To get the most from Atari, experiment with this concept.

Table 1: Timing

1.79 MHZ machine cycle
262 scan lines per frame
228 color clocks per scan line
60 frames per second refresh rate

1.79/60 = 29868 machine cycles per frame
29868/262 =114 machine cycles per scan line
228/114 = 2 color clocks per machine cycle

Vertical Blank Time
262 scan lines − 192 displayed scan line = 70
70 × 114 cycles/line = 7980 cycles available*

Horizontal Blank Time
Wide Playfield
228 clocks − 192 clocks = 36 clocks
36/2 = 18 machine cycles

Normal Playfield
228 clocks − 160 clocks = 68 clocks
68/2 = 34 machine cycles

Narrow Playfield
228 clocks − 128 clocks = 100 clocks
100/2 = 50 machine cycles

* All graphics are cycle-stealing Direct Memory Access (DMA). Depending on graphics mode and memory refresh, this value will be less.

Listing 1
10 REM *** PROG1 ***
20 REM MEMORY AND DISPLAY LIST VARIES WITH GRAPHICS MODE
30 REM DUMP AND DISASSEMBLE DISPLAY LIST
40 REM
100 ? " INPUT GRAPHICS MODE ";:INPUT MODE
105 GRAPHICS MODE
110 LST=PEEK(560)+PEEK(561)*256;REM FIND START OF DISPLAY LIST
120 MEMRY=PEEK(LST+4)+PEEK(LST+5)*256:REM FIND START OF DISPLAY MEM.
130 RAMTOP=PEEK(106)*256:REM NUMBER OF PAGES IN MEM DEFINED AT POWER ON
140 REM LIST
150 LPRINT " OS GRAPHICS MODE ";MODE
160 LPRINT " RAM AVAILABLE AT POWER ON ";RAMTOP
170 LPRINT " START OF DISPLAY LIST ";LST
180 LPRINT " START OF DISPLAY MEMORY ";MEMRY
190 REM DUMP DISPLAY LIST WITH DISASSEMBLY OF INSTRUCTIONS
195 LMS=64:INT=128:HSCRL=16:VSCRL=32:JVB=65:JMP=1
200 FOR I=LST TO MEMRY-1
205 LPRINT I;" ";PEEK(I)
210 INST=PEEK(I):REM DISPLAY LIST VALUE
215 IF INST>=128 THEN GOSUB 1100:GOTO 400
220 GOSUB 1140
400 NEXT I
410 STOP
1100 INST=INST-INT:REM get rid of interrupt bit
1105 LPRINT " INSTRUCTION INTERRUPT ENABLE "
1140 GOSUB 2000:REM FIND JUMPS AND BLANKS
1150 IF INST=0 THEN RETURN
1160 GOSUB 1400:REM GO FIND LMS
1170 GOSUB 1500:REM GO FIND VSCROL
1180 GOSUB 1600:REM GO FIND HORIZONTAL SCROLL
1190 GOSUB 1700:REM TRANSLATE ANTIC MODE TO OS GRAPHICS MODE
1200 RETURN
1400 IF INST<66 THEN RETURN :REM NO LMS
1405 LPRINT " LOAD MEM SCAN FROM ";PEEK(I+1)+PEEK(I+2)*256
1410 INST=INST-LMS:REM GET RID OF LMS BIT.
1420 I=I+2:REM INCREMENT LOOP AROUND ADDRESS BYTES
1430 RETURN
1500 IF INST<34 THEN RETURN :REM NO VSCROL ENABLE
1510 INST=INST-VSCRL:REM GET RID OF VSCROLL BIT
1520 LPRINT " VERTICAL SCROLL ENABLED "
1530 RETURN
1600 IF INST<18 THEN RETURN :REM NO HSCROLL ENABLE
1610 INST=INST-HSCRL:REM GET RID OF HORIZONTAL SCROLL BIT
1620 LPRINT " HORIZONTAL SCROLL ENABLED "
1630 RETURN
1700 LPRINT " ANTIC DISPLAY MODE ";INST
1750 RETURN
2000 IF INST=0 OR INST=16 OR INST=32 OR INST=48 OR INST=64 OR INST=80 OR INST=96 OR INST=112 THEN GOSUB 2100
2010 IF INST=1 THEN GOSUB 2200
2020 IF INST=65 THEN GOSUB 2300
2030 RETURN
2100 LPRINT " BLANK ";INT(INST/16)+1;" LINES"
2110 INST=0:RETURN 
2120 REM
2200 LPRINT " JUMP INSTRUCTION TO ";PEEK(I+1)+PEEK(I+2)*256
2210 I=I+2:REM INCREMENT AROUND ADDRESS BYTES
2215 INST=INST-JMP:RETURN 
2220 REM
2300 LPRINT " JUMP & WAIT FOR VERTICAL BLANK TO ";PEEK(I+1)+PEEK(I+2)*256
2310 I=I+2:REM INCREMENT AROUND ADDRESS BYTES
2315 INST=INST-JVB:RETURN 
Listing 2
10 REM *** PROGRAM 2 ***
20 REM THIS WILL CREATE A DISPLAY LIST WITH DLI ENABLED
30 REM THE SCREEN WIDTH IS NARROWED AT DLI TIME AS WELL
40 REM
45 GRAPHICS 0:SETCOLOR 4,4,9:REM SET BORDER COLOR
50 DLST=PEEK(560)+PEEK(561)*256:REM FIND START OF DISPLAY LIST
60 POKE DLST+14,PEEK(DLST+14)+128:REM TURN ON INTERRUPT BIT 7
70 FOR L=0 TO 29:REM POKE DLI SERVICE ROUTINE INTO PAGE 6
80 READ INSTRCT:POKE 1536+L,INSTRCT
90 NEXT L
100 DATA 72,138,72,169,40,162,48,141,10,212,141,23,208
110 DATA 142,24,208,169,33,141,0,212,162,140,142,26,208,104,170,104,64
120 POKE 512,0:POKE 513,6:REM POINT TO DLI INTERRUPT SERVICE ROUTINE
130 POKE 54286,192:REM ENABLE DLI
140 LIST
150 REM *** DLI SERVICE ROUTINE ***
152 REM PHA SAVE REGISTERS
154 REM TXA
156 REM PHA
158 REM LDA #$28 CHARACTER LUMINENCE
160 REM LDX #$30 BACKGROUND COLOR
162 REM STA $D40A WAIT FOR HORIZONTAL SYNCH
164 REM STA $D017 PLAYFIELD 1
166 REM STX $D018 PLAYFIELD 2
168 REM LDA #21  NARROW PLAYFIELD
170 REM STA $D400 DMACTL ENABLE NARROW WIDTH
172 REM LDX #$8C BORDER COLOR
174 REM STX $D01A COLBK
176 REM PLA     RESTORE REGISTERS
178 REM TAX
180 REM PLA
182 REM RTI     RETURN FROM INTERRUPT

MICRO ISSUE 44 / JANUARY 1982 / PAGE 55

From Here to Atari


Jim Capparell
297 Missouri
San Francisco, California 94107

This month I’m going to talk about the vertical blank (Vblank) interrupt. I will give you a working definition of what an interrupt is, then discuss how Vblank fits into the overall interrupt structure, what is accomplished in this time period, and how programmers may access this interrupt for their own use. I will also provide a simple program to illustrate the use of Vblank vectors and how to insert code at VVBLKD.

Recall last month, in my discussion of raster scan graphics, that the term vertical blank is given to that time period when the electron beam is turned off and returned to the upper left corner of the video screen, ready to start tracing a new frame. The number of machine cycles available at Vblank is some fraction of 29868 machine cycles that are needed to trace one entire television frame. In the normal graphics (text screen), approximately 7980 machine cycles are left over at Vblank to be shared by the Operating System Vblank interrupt service routine (ISR) and any programmer supplied code. The term interrupt applies to any signal, originating from hardware or software, which serves to suspend normal mainline program flow.

When an interrupting event occurs, the program counter (PC) and processor status registers are automatically saved on the system stack. The processor then executes special code referred to as an interrupt service routine (ISR). The address of the ISR is found in a memory location reserved for this purpose, called an interrupt vector. When the ISR is finished, the values of the PC and status registers are retrieved from the stack and processing of the suspended program is resumed as if nothing had intervened. This all happens at machine speed — in hundreds of microseconds.

The vertical blank interrupt is an essential part of the Atari operating system and appears as a non-maskable interrupt (NMI) to the system. The NMI is only one of three possible interrupts that the Atari can process. These three, chip reset, NMI, and IRQ, are analyzed further by interrupt service software. Whenever an NMI or an IRQ signal occurs, the appropriate service routine is executed. These service routines interrogate a status register to isolate the interrupting source. See table 1 for a breakdown of vectors and contents for each type of interrupt.

It’s apparent from table 1 that all NMI interrupts are vectored through location $FFFA to the NMI interrupt service routine (ISR) starting at address $E7B4. Since there are three possible causes of an NMI, the ISR must determine the source of the interrupt by interrogating an NMI status register at address $D40F. This location, called NMIST in the documentation, has bit 7 set when a DLI occurs, bit 6 set when a Vblank occurs, and bit 5 set when the system reset button has been pressed. If neither a DLI nor a system reset caused the NMI, then a Vblank interrupt is assumed by the ISR and the processor jumps to the address contained in the vector at $0222.

There are actually two vectors used by Vblank through which a programmer may introduce additional or replacement code. One vector, referred to as vertical blank immediate vector VVBLKI, is at address $0222. This vector normally contains the address $E7D1, the start of the system Stage 1 Vblank ISR. Should it be necessary to either replace system functions or simply perform operations prior to the system code, then you would use this vector. The other vector location, called vertical blank deferred VVBLKD, is at address $0224. This vector normally contains the address $E93E, which is the start of code for the system return from interrupt. The contents of $0224 would be changed to point to new code when your operation was needed after system housekeeping was accomplished.

The Vblank process is actually divided into two stages. Whenever a Vblank NMI occurs, the following events always happen:

  1. Processor registers A, X, and Y are pushed on stack.
  2. Interrupt request is cleared by writing zero to $D40F.
  3. Jump through VVBLKI normally pointing to Stage 1 Vblank.

When Stage 1 processing is executed, it increments the three-byte counter called RTCLOK at addresses $12, $13, and $14. Location $12 is the most significant byte. This counter wraps to zero after approximately 77 hours and then continues counting. The attract mode is also processed at Stage 1; that is the process which causes the colors on your screen to start shifting if no key has been pressed on the keyboard in the previous nine minutes.

Additionally, system timer 1 at locations $218 and $219 is decremented if it is non-zero. When the counter goes to zero, an indirect JSR is performed via a vector at addresses $226 and $227. Note that an indirect JSR is performed by copying the address from the vector to the stack and executing an RTS instruction.

At this point a test is made to determine if a time-critical section of code was interrupted. If either the I bit in the processor status register or the critical flag at address $42 are set, then the interrupted code is assumed to be time-critical. When this occurs, the registers are restored and an RTI instruction is executed.

The critical flag can be set by a Serial I/O in progress. If no time constraints are present, then Stage 2 processing is begun. It is in this section of code that IRQ interrupts are enabled, keyboard auto repeat logic is processed, keyboard debounce is performed, and system timers 2, 3, 4, and 5 are processed. In addition, the color data for playfield and player/missiles are updated. This color data and other RAM locations, called shadow registers, are copied into their associated hardware locations. Stage 2 also reads the game controller data from Jacks 1, 2, 3, and 4 into RAM memory.

To insert code either at VVBLKI or VVBLKD, the address where the new code resides must be placed into the appropriate vector. A system routine is provided at $E45C. This routine insures that both bytes of the vector will be updated while Vblank is enabled. A vertical blank can be processed during a call to this routine. The routine is called SETVBV in the documentation and the calling sequence is:

reg A (update indicator)
        = 1-5 then update timers 1-5
        = 6 for immediate Vblank vector VVBLKI
        = 7 for deferred Vblank vector VVBLKD

reg X   = Most Significant Byte of vector address

reg Y   = Least Significant Byte of vector address

JSR SETVBV Jump to subroutine
      The A, X, and Y registers may be altered.
      The display list interrupt will always be enabled on return.

A knowledge of processing interrupts and inserting code at interrupt vectors is essential to get the most from the Atari. With this example you should have enough information to experiment with the Vblank vectors. Interrupt-driven sound control, page flipping, animation techniques, greater color control, and many other procedures are possible.

Table 1
INTERRUPT    VECTOR    ISR LOCATION

CHIP RESET   FFFC      E477
NMI          FFFA      E7B4
    Display list   Jump through     0200
    Vertical Blank                  0222 and 0224
    S/Reset key                     E474
IRQ          FFFE      E6F3
    Serial bus output reads jump through          020C
    Serial bus output complete                    020A
    Serial bus input ready                        020E
   *Serial bus proceed line                       0202
   *Serial bus interrupt line                     0204
   *Pokey timer 1                                 0210
   *Pokey timer 2                                 0212
   *Pokey timer 4(Bug in O.S. timer 4)            0214
    Keyboard key scan                             0208
    Break key                                     ????
   *6502 break instruction                        0206

* These vectors are unused by the O.S. and are initialized to
point to an RTI instruction.
Listing 1
            10 ; **  PROGRAM EXAMPLE 1 **
            20 ;PROGRAM SETS UP A VVBLKD ISR
            30 ;
            40 ; SET UP NEW VECTOR WITH A BASIC USR CALL A=USR(1536)
            50 ; NEED TO DO THIS WHENEVER SYSTEM IS RESET.
0000        60          *=   $600      PUT IN PAGE 6 DECIMAL 1536
0600 68     70          PLA            NULL VALUE FROM BASIC
0401 A907   80          LDA  #7        INDICATOR FOR VVBLKD
0603 A206   90          LDX  #06       HIGH BYTE FOR VECTOR ADDR
0605 A040   0100        LDY  #$40      LOW BYTE FOR VECTOR ADDR
0607 205CE1 0110        JSR  $E45C        SET UP DEFERRED VECTOR
060A 60     0120        RTS            RETURN TO BASIC
            0130 ; **  **  **  **
            0140 ; ROUTINE AT DECIMAL 1600 IS DESIGNED TO WASTE TIME.
            0150 ; PUT A NUMBER FROM 1 - 5 IN DECIMAL 1568.
            0160 ; USE POKE 1568,N
            0170 ; THIS IS THE ISR WHICH SIMPLY WASTES TIME.
060B        0180        *=   $640
0640 A600   0190        LDX  0          INIT COUNTERS
0642 A400   0200        LDY  0
0644 E8     0210 LOOP1  INX            INCR COUNT
0645 EC2006 0220        CPX  $620       DELAY VALUE
0648 F003   0230        BEQ  LOOP2
064A 18     0240        CLC             FORCE BRANCH
061B 90F7   0250        BCC  LOOP1
061D C8     0260 LOOP2  INY
061E CC2006 0270        CPY  $620       DELAY VALUE
0651 F003   0280        BEQ  EXIT       DONE ?
0653 18     0290        CLC             NO-FORCE BRANCH
0654 90EE   0300        BCC  LOOP1
0656 4C3EE9 0310 EXIT   JMP  $E93E     TAKE NORMAL VBLANK EXIT

MICRO ISSUE 45 / FEBRUARY 1982 / PAGE 79

From Here to Atari


Jim Capparell
297 Missouri St.
San Francisco, California 94107

This month we will look at the DOS II file structure and the floppy disk system. We shall investigate what the I FORMAT option of the DOS II menu docs and look at the physical characteristics of a mini-floppy.

Included are two programs which print out the directory files of a disk. Program 1 is written in BASIC and provides the ability to list the disk directory without having to access the DOS menu first. Program 2 also lists a disk’s directory, and its distinction is the use of the FORTH language. (This FORTH is from Quality Software.)

A floppy disk is nothing but flexible mylar coated with a substance that will hold a magnetic charge. The floppy itself is protected by an envelope whose interior is designed to clean the disk surface as it spins. A slot is cut in the envelope allowing the read/write head access to the magnetic surface. The other two noticeable physical characteristics of the disk envelope are the write protect notch on the left edge and the index hole near the hub.

When the write protect notch is covered, the disk hardware is prevented from writing data to disk, affording some protection from inadvertent erasure. The index hole is used by the hardware to find the start of the first sector on a track (not used by Atari).

The format of Atari disks is known as soft sectored. Software provides the sector marks rather than the index holes. This formatting is performed whenever the I option of the DOS II menu is selected. At format time the disk surface is divided into 18 pie-shaped wedges. The beginning of every wedge has a preamble or header written which identifies the particular sector by number. This header is followed by the actual data, which is then followed by a gap.

In addition to the sector division, each disk is also arranged in 40 concentric circles known as tracks. It is upon these tracks that data is recorded within a sector. As noted, every track is divided into 18 sectors. Refer to table 1 and table 2 for further information.

The formatting process (1) lays out sector arrangement by number on 40 tracks; (2) writes Atari DOS file structure on disk; (3) initializes every sector of disk to zero.

The Atari DOS expects certain information at specific sector positions on the disk surface. It is this information which allows the File Management System to recover a file by name. The sectoring is performed by a ROM in the disk drive upon command from the File Management System (FMS), This sectoring arrangement is a rather arbitrary decision. The hardware doesn’t care where the sectors are put on the disk, as long as 18 exist on each track, and each sector has its preamble or header, identifying itself by number.

Drives purchased prior to fall 1981 wrote the sectors sequentially (i.e., 1, 2, 3, 4...). This method wastes time. For example, suppose sector 1 were to be read and then a small amount of processing were done prior to sector 2 being read. By the time the CPU were ready, sector 2 would have rotated past the read/write head, forcing the system to wait another revolution to read it. This is easily corrected by ordering or interleaving the sectors differently. This, in fact, is what the new drives do, and as a result save about 30% on file load time. Those of us with the old drives probably will be able to purchase the new ROMs as a retrofit by the time you read this.

When the formatting process is complete, 719 sectors have been initialized and allocated as follows:

Sector 1–3
boot record
Sector 4–359
user data
Sector 360
Volume Table of Contents (VTOC)
Sector 361–368
file directory
Sector 369–719
user data

Sector 360, the VTOC byte allocation is as follows:

Byte 0
directory type set to 0
Byte 1–2
maximum sector number (low, high byte)
Byte 3–4
number of sectors available (low, high byte)
Byte 5–9
unused
Byte 10–99
bit map, one bit per sector, bit set when sector in use
   7                           0
 ┌───┬───┬───┬───┬───┬───┬───┬───┐
 │   │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │
 └───┴───┴───┴───┴───┴───┴───┴───┘
Byte 10 of VTOC
 ┌───┬───┬───┬───────────────────┐
 │ 8 │ 9 │ 10│                   │
 └───┴───┴───┴───────────────────┘
Byte 11 of VTOC

Sectors 361 through 368 are reserved for the file directory. Each directory entry is 16 bytes long, and allocated as follows:

Byte 0
flag byte $40 = in use, $60 = file locked, $80 = file deleted
Byte 1–2
total sectors in file (low, high byte)
Byte 3–4
starting sector of file (low, high byte)
Byte 5–12
file name (eight characters)
Byte 13–15
file name extension (three characters)

The last important piece of information is the layout of a sector in a user file.

Byte 0–124
user data/program
Byte 125
bits 2–7 file #
bits 0–1 are high bits of next byte
Byte 126
forward pointer (10 bits including bits 0 and 1 from byte 125)
Byte 127
bits 0–7 byte count used in sector

The file number is used to verify file integrity and contains the value of the directory position of that file. The forward pointer contains the disk sector number’s 10-bit value of the next sector in the file. The pointer is equal to zero in the last sector of the file, and the byte count is the number of data bytes in the sector.

We’ll continue our discussion of DOS II file structure and the floppy disk system again next month.

Program 1
10 REM *** ***
20 REM USE THIS PROGRAM TO RETRIEVE A DIRECTORY LISTING
25 REM WITHOUT EXITING TO DOS MENU
30 REM INCLUDE AS A SUBROUTINE AT START OF EVERY EDITING SESSION
100 GOSUB 30010
120 STOP
30010 DIM FILENAME$(48)
30020 OPEN #1,6,0,"D:*.*":REM OPEN DIRECTORY FILE
30030 TRAP 30100
30040 INPUT #1,FILENAME$
30050 ? FILENAME$
30060 GOTO 30040
30100 CLOSE #1
30110 RETURN
Program 2
SCR # 101
0 (TYPE LST TO LIST FILENAMES)
1 :SPC SPACES ;
2 :DIR (DIR ENTRY - POS BUFADR)
3  1 - 8 /MOD 301 + BLOCK;
4 :HEAD CR."TOTAL" 2 SPC
5  ."START" 2 SPC ."FILENAME"
6  CR ."SECT" 3 BPC ."SECT" 3
7  SPC CR CR;
8
9 :DIRNAM ( ADR - ..) DUP 16 +
10  SWAP 5 + DO I Ce EMIT LOOP ;
11 :GETLST DIR SWAP DROP HEAD DUP
12  128 + SWAP DO I 1+ @ . 4 SPC
13  I 3 + @ . 4 SPC I DIRNAM CR
14  16 +LOOP;
15 :LST 64 1 DO I GETLST 8 +LOOP;
Table 1
810 disk drive
18 sectors/track
40 tracks/disk
720 sectors/disk (40 × 18)
128 bytes/sector
92160 bytes/disk surface *

* This is nominal total. When using DOS II files it must be reduced by 13 sectors used in DOS file structure (see table 2) and by an additional three bytes for each of remaining 707 sectors (file number, forward pointer, byte count).

13 × 128 = 1664
3 × 707 = 2121
Total = 3785

Total capacity when using DOS II format is 92160 − 3785 = 88375 bytes/disk.

Table 2
DOS II sector allocation
3 sectors used for boot
1 sector used for VTOC
8 sectors used for file directory
1 sector unused due to numbering discrepancy between FMS and disk controller
13 sectors total

MICRO ISSUE 46 / MARCH 1982 / PAGE 32

From Here to Atari


By James Capparell

More on the Disk

Last month we looked at the floppy disk and the structure that constitutes DOS II. This month I will discuss one problem that plagues some early disk drives and describe an inexpensive remedy. I will also include an assembly language program that lists disk directory files.

Disk drives purchased prior to fall 1981 are susceptible to a few problems — including frequent errors 144 and 138. These errors are due in part to the use of the Western Digital disk controller chip, 1771. This chip, when used without a Western Digital Data Separator (D.S.) independent of the chip, provides marginal performance.

The D.S. functions to separate clock pulses from data pulses. As a drive is used, mechanical parts begin to wear, heads get out of alignment, speed varies, and errors occur, especially on the inside tracks, sector 600 and above. Recently added programs will not reload without generating the 144 error. Atari has corrected this problem in drives that were shipped after fall ’81. Built into the new drives are the necessary D.S. as well as power supply improvements and the new ROM formatter (discussed last month). You can determine that a drive is new by looking for the circular stickers with DS and C printed on them. There has been some indication that there will be a retrofit available to those with old drives.

Another solution is available — the Data Separator board from the Percom Company. Initially this board was designed for Radio Shack disk drives suffering from the same problems due to use of the same 1771 chip. The board is available for $30 from the Percom Company, 211 N. Kirby, Garland, Texas 75042. It is relatively easy to install if you are familiar with a soldering iron and are not afraid of integrated circuits. Since tinkering with your drives will void your three-month warranty, I’d advise you to wait three months after purchase before trying this procedure.

At the top corners of your disk drive you will locate the Phillips-head screws. Pry off the concealing tabs, loosen the screws, and lift off the plastic top. As you view your drive from the front and top you will see a long board on your left. It is mounted vertically and there is a sheet-metal box covering part of the circuitry. The 1771 chip is socketed under this metal box along with some other chips such as the ROM formatter. (The metal box is included for RFI shielding.)

Carefully disassemble the board from the motherboard, which lies flat to the rear of the drive. Mark all wires as you unplug them. Pay attention to the front-rear, and top-bottom orientation of plugs to be assured of correct reassembly. After the long board is unplugged from the motherboard and the metal box has been pried loose, locate the 40-pin integrated circuit marked 1771.

Now find the crystal which sits about two inches forward of the 1771. This crystal must be moved to make room for the Percom D.S. Unsolder the crystal and solder on longer leads. Return the crystal to its original location, but this time bend it forward. (The longer leads should allow this.) Carefully pry the 1771 out of its socket and insert it into the Percom D.S. circuit board in the orientation described in the board’s instructions. Make sure every chip is properly seated again.

Following Percom’s instructions, insert the new circuit board in place of the 1771. This board can really only be inserted logically in one direction, extending toward the front of the drive covering the crystal. Reassemble all boards and loose wires, taking care that orientations are correct. The metal box will not fit in its original location without cutting a notch for the newly moved crystal.

I recommend testing the disk before putting the cover on. You may need to reseat the chips again; I played with mine a couple of times before everything worked. Prior to installing this board I could not consistently read any sectors above about 600, the inner tracks. After installation everything worked like new.

Product Reviews

I have received the following products for review. They will be handled in more detail in MICRO’s new “Reviews in Brief” department, which will begin in April.

Eastern House Software
3239 Linda Drive
Winston-Salem, NC 27106
  1. Macro Assembler
  2. Monkey Wrench utility ROM used in right-hand cartridge with BASIC
LJK Enterprises, Inc.
P.O. Box 10827
St. Louis, MO 63129
  1. Letter Perfect word processor
Optimized System Software, Inc.
10379 C Lansdale Ave.
Cupertino, CA 95014
  1. BASIC A+ Enhanced BASIC
  2. OS/A+ Enhanced DOS

Please address all correspondence to the author at 297 Missouri, San Francisco, CA 94107.


10  .TITLE "GET DISC DIRECTORY"
20  .PAGE "DIR.ASM"
30 ;THIS PROGRAM ACCESSES THE DISC DIRECTORY
40 ;AND PRINTS IT TO SCREEN
50 ;IT RESIDES IN PAGE 6 TO MAKE IT AVAILABLE TO BASIC
60 ;USE L OPTION IN DOS MENU TO LOAD FILE
65 ;CALL FROM BASIC X=USR(1536)
70 ;
80 OPEN=$03 OPEN COMMAND
90 CLOSE=$0C CLOSE COMMAND
0100 GETREC=$05    GET RECORD COMMAND
0110 PUTREC=$09    PUT RECORD COMMAND
0120 IOCB0=$00 INDEX FOR IOCB 0 ASSIGNED TO E:
0130 IOCB5=$50 INDEX FOR IOCB 5 ASSIGNED TO DISC
0140 CIOV=$E456    CIO ENTRY VECTOR
0150 EOF=$88 END OF FILE STATUS VALUE
0160 ICHID=$340   HANDLER I.D. SET BY CIO
0170 ICDNO=ICHID+1  DEVICE # SET BY CIO
0180 ICCOM=ICDNO+1  COMMAND BYTE
0190 ICSTA=ICCOM+1  STATUS BYTE SET BY CIO
0200 ICBAL=ICSTA+1  BUFFR ADR LOW
0210 ICBAH=ICBAL+1  BUFFR ADR HI
0220 ICPTL=ICBAH+1
0230 ICPTH=ICPTL+1
0240 ICBLL=ICPTH+1  BUFFR LEN LO
0250 ICBLH=ICBLL+1  BUFFR LEN HI
0260 ICAX1=ICBLH+1  AUX1
0270 ICAX2=ICAX1+1  AUX2
0280 ;
0290 ;
0300  *=$0600    PAGE 6
0310  PLA   CLEAR NULL VAL FROM BASIC USR FUNCTION
0320  LDX #IOCB5
0330  LDA #OPEN          OPEN FILE OR DIRECTORY
0340  STA ICCOM,X        COMMAND BYTE
0350  LDA #NAME&$FF  SET UP BUFFER POINTER
0360  STA ICBAL,X        TO POINT TO DIR SEARCH
0370  LDA #NAME/256      COMMAND D:*.*
0380  STA ICBAH,X
0390  LDA #$06 SETUP FOR INPUT
0400  STA ICAX1,X
0410  LDA #0
0420  STA ICAX2,X
0430  JSR CIOV GO OPEN FILE
0440  BPL A05 EVERTHING OK
0450  BMI EXIT ERR ON OPEN FILE
0460 A05 LDA #GETREC
0470  STA ICCOM,X
0480  LDA #PUTREC
0490  STA ICCOM     SETUP IOCB 0
0500  LDA #$6E
0510  STA ICBAL,X   BUFFER LOW
0520  STA ICBAL
0530  LDA #$6
0540  STA ICBAH,X
0550  STA ICBAH
0560 A10 LDA #$14  SET MAX, RECORD SIZE
0570  STA ICBLL,X
0580  STA ICBLL
0590  LDA #0
0600  STA ICBLH,X
0610  STA ICBLH
0620  JSR CIOV      READ ONE DIR RECORD
0630  BMI A20       EITHER EOF OR ERROR
0640  LDX #0        SETUP IOCB 0
0650  JSR CIOV      GO WRITE RECORD TO E:
0660  LDX #$50      RESET IOCB TO 5
0670  BNE A10       GO GET NEXT RECORD
0680 A20 CPY #EOF  DONE?
0690  BNE EXIT      NO THIS WAS AN ERROR
0700  LDA #CLOSE    SHUTDOWN FILE
0710  STA ICCOM,X
0720  JMP CIOV      USE JMP HERE SO THAT RTS IN CIO
0730 ;        EILL RETURN TO BASIC
0740 EXIT RTS
0750 ;
0760 ;
0770 NAME .BYTE "D:*.*"
0780 .END

MICRO ISSUE 47 / APRIL 1982 / PAGE 105

From Here to Atari


By James Capparell

Character sets, display codes, ATASCII codes, and keyboard codes are the subject of this month’s column. This information will help you understand how a character appears on your T.V. screen. I will show you what the Atari character set is, where it resides in ROM, and how to access the character set. I’ll also describe the three codes used to refer to the character set. Program 1 will print the keyboard code, ASCII character, and display code tor any given key. Program 2 will show you how to place characters on a graphics 8 high-resolution screen. However, before we get that far we need to know what happens when a key is pressed on the keyboard.

When you press any key, an IRQ interrupt is generated. (For more on this, see my column in the January ’82 MICRO.) The vector for IRQ is at memory location $216, $217 called VIMIRQ in the documentation. This vector points to $E6F6, the entry point for the IRQ interrupt Service Routine (ISR). This service routine performs the following functions:

  1. Saves system registers.
  2. Determines cause of interrupt by polling status register bits. IRQEN at $D20E is interrogated for this purpose. See table 1 for IRQEN bit translations,
  3. Jumps through the appropriate vector to the ISR. The ISR performs the necessary housekeeping associated with the interrupting source.

For the sake of our discussion, assume a key has been pressed. This causes an IRQ. Once it has been established that it was a keyboard-caused IRQ, a jump is made through locations $208, $209 called VKEYBD, This location contains $FFBE, the start-of-keyboard service routine. This routine performs the following functions:

  1. Processes debounce. Bounce is associated with the mechanical vibration caused by key closure. This bounce can appear to the system as several keystrokes instead of just one, A software delay of 20 msec is sufficient to allow the vibration to dampen, A counter for this purpose is established at this point.
  2. Starts/Stops(cntrl-1) processing, SSFLAG at location $022F is set when the control and “1” keys are pressed simultaneously. This is the feature that allows you to start and stop listings or your favorite game.
  3. Saves the keyboard code in locations $2FC and $2F2, called CH and CH1, respectively. This code is to be differentiated from ATASCII or the display codes.
  4. Sets attract mode flag at location $4D. This prevents color rotation, which normally occurs after nine minutes of keyboard inactivity. If you choose to disenable color rotation, be aware that prolonged operation without rotation could damage your picture tube’s phosphor.
  5. Sets location $22B, called SRTTMR, to $30. This is the auto-repeat timer and is used by Stage 2 Vblank routines to auto-repeat any key that is held down longer than ½ second. Stage 2 Vblank processing also decrements the debounce counter and updates the auto-repeat timer every 1/60 second.

After a key has been processed through the keyboard interrupt routines and Vblank, the resident keyboard handler takes over. This handler is part of the versatile Central Input/Output CIO facility. Most of what goes on here is very involved and the interested reader is advised to go to the operating system listing to follow the flow. These listings are available from Atari (ask for manual CO16579). The one function that CIO performs that we need to understand is code translation.

If you read the manuals, you know there are many references to ATASCII code. Atari ASCII or ATASCII is Atari’s version of the American Standard Code for Information Interchange. ASCII is an Industry-standard description of how 26 letters of the alphabet, numbers, special punctuation, and some special characters can be represented in eight bits. Since there are 256 combinations available in eight bits, this leaves many combinations unused in the normal ASCII. The Atari, however, uses them all since it can display special graphics characters, inverted characters, and normal characters.

A universally accepted code — e.g. ASCII — is essential for devices to communicate properly with one another and with us. If the serial bit stream 01000001 is sent to any printer which recognizes ASCII, it will print the capital letter “A”. Look at Appendix C-1 in your BASIC reference manual to see the entire ATASCII code and characters.

ATASCII is included in our machines to be compatible with peripheral devices. The Atari display code for each character is different from ATASCII. The display code is used to access the actual data that forms a character. It is all this data that is collectively referred to as a character set. The entire character set is stored in ROM starting at page address $E0 (that’s 57344 decimal). This character set is simply a string of bytes describing the shapes of individual characters.

Each character requires eight bytes, and is formed in an 8 × 8 grid. See figure 1. In order to access the appropriate eight bytes it is necessary to know the display codes of the character set. Program 1 is designed to tell you what a given code is for any key pressed on the keyboard, and will also work for shifted or controlled keys. Once we have found the data for the character we want, we can use that data. Look at program 2 to see how we moved letters, byte-by-byte, and stacked these bytes one on the top of the other to display characters in graphics mode 8.

The data stored at any location within a character set is arbitrary. Suppose when we go look for the string of bytes that normally is an “A” some other data is stored there. It would only be possible for different data to be there if the character set had been moved to RAM. Atari gave us another pointer called CHBAS $D409. This location tells the O.S. where the first page of the character set data is. Normally residing in ROM, it can be moved to RAM. New data replaces old, and the pointer CHBASE can be changed to reflect the new location of the data. It is in this way that the letter “A” can be replaced by any pattern that will fit into the normal 8 × 8 grid. This process, known as redefining character sets, requires a few basic steps.

  1. The new characters must be designed. Recall that each character must fit into an 8 × 8 grid. Then these byte values must be moved to an appropriate place reserved in memory just for this purpose,
  2. ANTIC must be informed of where the redefined character set is in RAM. The character set must be on a 1K boundary, and CHBAS, location $2F4, must be changed to point to the page address of the new character set.

Using some of these ideas, you could change the delay before a key repeats, redefine the keys on the console, use the keyboard vector to trap certain keys and give them special meaning. Well, you get the idea — it’s completely flexible.

The author may be contacted at 297 Missouri St., San Francisco, CA 94107.

Figure 1
.  .  .  .  .  .  .  .  = $00
.  .  .  x  x  .  .  .  = $18
.  .  x  x  x  x  .  .  = $3C
.  x  x  .  .  x  x  .  = $66
.  x  x  .  .  x  x  .  = $66
.  x  x  x  x  x  x  .  = $7E
.  x  x  .  .  x  x  .  = $66
.  .  .  .  .  .  .  .  = $00
The hex values are those found in ROM locations 57608–57615. These are the stored values representing the letter A.

Table 1
Address $D20E, known as IRQEN (interrupt request enable), is interrogated whenever an IRQ interrupt occurs.

Bit 7 = Break key interrupt
Bit 6 = Other key interrupt
Bit 5 = Serial input data ready interrupt
Bit 4 = Serial output data needed
Bit 3 = Serial output transmission finished
Bit 2 = Timer 4 decremented to 0
Bit 1 = Timer 2 decremented to 0
Bit 0 = Timer 1 decremented to 0
Listing 1
5 REM ** PROGRAM 1 **
6 REM PRESS ON ANY KEY WAIT FOR A COUPLE OF SECONDS
7 REM THE KEYBOARD CODE, CHARACTER, AND THE CHARACTER'S
8 REM DISPLAY CODE ARE PRINTED
10 OFFSET=6
20 DMEM=PEEK(88)+PEEK(89)*256:REM FIND DISPLAY MEMORY
30 A=PEEK(764):IF A>99 THEN 0FFSET=7:IF A<10 THEN OFFSET=5
40 IF A<>255 THEN ? A;" ";CHR$(A);" ";:? PEEK(DMEM+OFFSET)
50 OFFSET=6
60 GOTO 20
Listing 2
5 REM ** PROGRAM 2 **
6 REM PUT TEXT OK A GRAPHICS g SCREEN
7 REM CHANGE X, Y SEE HHAT HAPPENS
10 DIM OUT$(15),CNVRT$(1)
15 OUT$="ATARI SO":REM MESSAGE
20 CHBAS=57344:REM START OF CHARACTER SET
22 5PACE=2
25 X=12;Y=85:REM HORZ. VERT, OFFSETS
30 GRAPHICS 3*32
35 DMEM=PEEK(88)+PEEK(89)*256:REM START OP DISPLAY MEMORY
40 DMEM2=DMEM+X+(Y*40);REM OFFSET TO SCREEN CENTER
45 FOR I=1 TO LEN(OUT$):REM MOVE MESSAGE
50 CNVRT$=OUT$(I,I):GOSUB LOOO
55 CHAR=CHBAS+X*8:REM GET CHARACTER DATA
to FOR BYTE=0 TO 7
t5 POKE DMEM2+BYTE*40,PEEK(CHAR+BYTE)
70 NEXT BYTE
75 DMEM2=DMEM2+SPACE
80 NEXT I
85 STOP
900 REM SUBROUTINE CONVERTS ATASCII INTO DISPLAY CODES
910 REM DISPLAY CODE USED AS INDEX INTO CHARACTER SET IN ROM
1000 X=ASC(CNVRT$)
1010 IF X>127 THEN X=X-128:REM ELIMINATE REVERSED CHAR.
1020 IF X>31 AND X<96 THEN X=X-32:RETURN
1030 IF X<32 THEN X=X+64
1040 RETURN

MICRO ISSUE 48 / MAY 1982 / PAGE 29

From Here to Atari


By James Capparell

Editor’s Note: This is the last “From Here to Atari” that will appear in MICRO. We thank Jim Capparell for his efforts and wish him success with his new Atari magazine, ANTIC. And we say to the Atari Community: send us your work! We are very interested in publishing Atari material.

The “front jacks” on the Atari 400 and 800 are used for everything from game controller ports to printer and graphics ports. To get the most out of them it is necessary to understand something about the hardware. This month, I’ll provide a description of the pin configuration of these jacks, the memory locations assigned to the jacks, and an example of how each pin may be individually configured as input or output.

The hardware controlling these jacks is a 6820 PIA (Peripheral Interface Adapter). This chip consists of two ports labeled “A” and “B”. Port A controls Jacks 1 and 2. Jacks 3 and 4 (on your right) are controlled by Port B. The jacks are numbered left to right as you face the console. There is a numbering discrepancy: BASIC numbers them to 3. The BASIC statement,

10 ? STICK(0),STICK(1),STICK(2),STICK(3)

will print the values read at Jack 1, Jack 2, Jack 3, and Jack 4.

Each port consists of three registers — the Control Register, the Data Direction Register (DDR), and the Data (buffer) Register (DR). The PIA is a 40-pin chip. Due to a limitation on available pins, the DDR and the DR share the same address. (See table 1.)

Bit 2 of the control registers determines whether the DDR or the DR is addressed. When set to 0, bit 2 addresses the DDR, but when set to 1 the DR is addressed. The data register simply holds data. When the jacks are configured as inport ports, the DR holds the data for the Atari to read. When the jacks are configured as output ports, the DR holds data to be written to an external device. The DDR determines for the PIA which lines are input and which are output.

To configure Jack 1 as input and Jack 2 as output, it is necessary to tell the PIA the direction for each of the eight bits in Port A. To accomplish this, perform the following steps:

  1. Set bit 2 of PACTL($D302) to 0. This allows us to address the DDR.
  2. Write 00001111 = 15 to address $D300 (note a 1 bit indicates the associated line is output).
  3. Set bit 2 of PACTL to 1. This restores address $D300 to the data register.

At this point, Jack 1 can be read normally with a STICK(0) statement. Jack 2 can’t be read since it is configured as an output jack. Try the following:

10 POKE 54018,0:REM Go talk to Data Direction Register
20 POKE 54016,15:REM Jack 1 is input, Jack 2 is output
30 POKE 54018,4:REM Reset to data register
40 REM connect joystick to Jacks 1 and 2
50 ? STICK(0),STICK(1):REM Print out values from Jacks 1 and 2
60 GOTO 50:REM Loop forever
70 REM Move Joysticks 1 and 2, only Joystick 1 will register a change.

Whenever your system is turned on all jacks are configured as input. That is, the operating system writes a 0 to the Data Direction Reigsters in Ports A and B. The values returned at these jacks are always a 1 when there is no input — logical 1 is false. This helps explain why a 15 is read even when there is no input from a joystick. Look at the diagram in figure 1 for correspondences between bits in DDR and bits in data buffer.

When a jack is configured to input and the following BASIC statement is executed:

10 ? STICK(0):GOTO 10

the following values will be printed as the joystick is manipulated:

1111 (15) = stick neutral
1110 (14) = forward
1101 (13) = backward
1011 (12) = left
0111 (11) = right

Combinations (diagonal)

1010 (10) = forward/left
1001 (9)  = backward/left
0101 (7)  = backward/right
0110 (6)  = forward/right

The pin configuration for each jack is as follows:


1 2 3 4 5
 6 7 8 9

Console (male)
Pin 1 = forward
Pin 2 = backward
Pin 3 = left
Pin 4 = right
Pin 5 = pot (paddle control)
Pin 6 = joystick trigger at $D010-$D013 (CTIA)
Pin 7 = +5V
Pin 8 = gnd
Pin 9 = pot (paddle control)

These front jacks are versatile and easy to use. I’ve connected a Hewlett Packard Bar code reader to my 800. Others have used them for graphics printer interface and 10-key pad for business use as well.

Table 1
I/O AddressO.S. Shadow Address
$D300 (54016)$278 (632)
Port A data register or data direction register when bit 2 of PACTL is 0. This address corresponds with Jack 1 and Jack 2. BASIC statements STICK(0) and STICK(1) read this port.
$D301 (54017)$279 (633)
Port B data register or data direction register when bit 2 of PBCTL is 0. This address corresponds with Jack 3 and Jack 4. BASIC statements STICK(2) and STICK(3) read this port.
$D302 (54018)$27A (634)
Port A control register. Insert a value of 4 (bit 2 = 1) and $D300 becomes the Data Register.
$D303 (54019)$27B (635)
Port B control register. Insert a value of 4 (bit 2 = 1) and $D301 becomes the Data Register.
The shadow registers are updated at Stage 2 of Vertical blank processing — no more frequently than every 1/60 second. If your program requires more accurate data, read the associated hardware registers at addresses $D300 and $D301.
          Joystick Data
 ┌───┬───┬───┬───┬───┬───┬───┬───┐
 │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │  When bit = 0 then switch pressed
 └───┴───┴───┴───┴───┴───┴───┴───┘       bit = 1 then switch not pressed

      Jack 2        Jack 1
     (stick 1)     (stick 0)
                                    Bit 0, 4= Forward
                                        1, 5= Backward
                                        2, 6= Left
                                        3, 7= Right
 ┌───┬───┬───┬───┬───┬───┬───┬───┐
 │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
 └───┴───┴───┴───┴───┴───┴───┴───┘
   Data Direction Register

MICRO ISSUE 54 / NOVEMBER 1982 / PAGE 103

From Here to Atari


By Paul Swanson

We are pleased to introduce our new Atari Column. Paul Swanson has published articles in several microcomputer magazines and has authored a book on disk techniques. He runs his own software consulting firm and markets a full-size keyboard for the Atari 400.

The Atari has two microprocessors instead of one, unlike what you would find in most systems. The main processor is the 6502. Atari, Inc., custom-made the second processor, ANTIC, which is used to control just the graphics screen. A few other custom chips in the Atari are not full microprocessors, but you can control them through the hardware registers.

Taking advantage of all the Atari’s special hardware can be quite complicated. Fortunately, because of the various graphics modes available, much of this hardware can be accessed through BASIC without knowing very much about the hardware itself.

You can write simple programs using the information in the BASIC Reference Manual supplied with the BASIC cartridge. More complex programs that take advantage of Atari’s special chips require more information. I will supply you with details of this special hardware in upcoming columns.

Each month’s column will focus on some feature of Atari’s hardware. I intend to take these topics from letters I receive, so if you have questions or need more information on a specific function, send me a letter at 97 Jackson St., Cambridge, MA 02140. (If you don’t want your name mentioned, be sure to note that in your letter. I will include excerpts from letters in my columns.)

In addition to answering questions concerning the Atari, this column will also contain information on new hardware and software from Atari and other manufacturers. Already available from second sources are memory boards for both the 800 and the 400. The 32K board (for both) has been available from several different companies for over a year now. There is also 48K on a single card that you can plug into your 400. I’ve heard of a 64K board but haven’t seen it yet. The Atari can’t address 64K directly because of the 16K reserved for the operating system ROM and the hardware registers. The 64K board is bank-selectable so it doesn’t exceed the 48K allowed. Available pseudo disks give you 128K of memory that you can access as if it were a disk.

Many new products have been announced for the Atari, and many are about to be announced. Much of the new software available is in response to Atari Inc.’s interest in home educational applications. My First Alphabet, by Fernando Herrera, is still one of the best educational software packages available for younger children. A new program called Master Type, from Lightning Software, makes an interesting spaceship game out of learning touch typing. If you want to learn how to type, you may want to get your local computer store to demonstrate this program for you. It is listed at $39.95, requires 32K and a disk drive, and keeps your interest with 17 levels of complexity. These two software packages, as well as the memory boards, are available at most computer stores that carry Atari.

This column, on occasion, will try to clarify conflicting rumors. For example, I have heard three or four people asking about the “special vector” you can use in the Atari to get rid of the key click. I can appreciate the need for eliminating that noise — it seems much louder when everyone else is asleep — but I disassembled part of the operating system looking for the keyboard click and found no place to POKE anything that would eliminate it. The part in question is in ROM and you can’t alter ROM with a POKE. It doesn’t check with any RAM locations before the JSR (Jump to SubRoutine) that produces the click. The only ways I can see to eliminate the click include physically disconnecting the keyboard speaker or writing your own keyboard handler. Even writing the keyboard handler would not eliminate the click under every possible condition; you have to initiate the handler every time one of a variety of different things happens.

Future columns may also include a listing of a short utility program (BASIC) that is in the public domain. No machine-readable copies will be available. If you really don’t want to type it in, check with your local user group to see if anyone already typed it in.

My December column will feature the Atari Regional Software Acquisition Centers; January will include available technical literature. December’s column will be of particular interest if you plan to market any of your Atari software. January’s topic covers places where you can find lists and explanations of all those special memory locations that you need to develop fancier software.


MICRO ISSUE 55 / DECEMBER 1982 / PAGE 32

From Here to Atari


By Paul S. Swanson

Atari News

I was pleased to see that Atari, Inc., recently established two regional software acquisition centers located in Cambridge, Massachusetts and London, England. The centers were set up to acquire software by contracting out for specific programs, or by buying software that has already been developed independently, more centers are planned for the future; I’ll let you know where they will be as soon as Atari annouces that information.

Technical Tidbits

Code conversion is required in two areas when you’re programming the Atari. The “normal” character code, called ATASCII, is a variation of ASCII. There are two other character codes used by the system. One is used to write characters to the screen. The screen handler does this conversion automatically when you PRINT to the screen, but if you use your own routines and put the characters directly on the screen with POKE or a similar method, you need to convert to this screen code.

The operating system manual includes a table that shows you the correspondence between ATASCII and the screen code (which they call the “Internal Code”). You can form a look-up table if you want by using a 256-byte string. Set it up so the value to POKE is the ASC( value of the byte in the string found at AVAL + 1, where AVAL is the ASC( value of the ATASCII character to be displayed.

An alternative approach, which consumes less memory than the lookup table, is using dependent IF statements. Using N as the ATASCII value to display:

FLAG=INT(N/128):N=N-FLAG+64:
IF N>95 THEN N=N-96:IF N>64
THEN N=N+32

After you execute that one line of code (it must be in one program line), POKE the screen location with N + FLAG. FLAG will equal 128 for inverse video characters and will equal zero for normal video characters in mode 0. There are two bits in modes 1 and 2 that determine the color, but the conversion routine in the above IF statements will interpret them both correctly.

The other code conversion would be for characters read from the keyboard. Several people have asked me how to eliminate the keyboard click. The only way to completely eliminate it would be to disconnect the keyboard speaker, but you can use another method if you write your programs to accommodate it. Instead of using INPUT and GET to obtain information from the keyboard, you can PEEK location 764. This location contains the keyboard code of the last key pressed on the keyboard. You must read this location, then POKE 764,255. If the location contains 255 you know that no key has been pressed since the last time you read it. The problem with this method is that the code you read is neither ATASCII nor the internal code. You can get the values of all of these codes by running the following program:

10 REM ** KEYBOARD CODES **
11 REM ** STOP BY PRESSING BREAK **
12 REM **
13 REM **
20 PRINT "PRESS KEY AND THIS PROGRAM"
30 PRINT "WILL DISPLAY THE"
40 PRINT "CORRESPONDING KEYBOARD CODE AS A DECIMAL VALUE:"
50 N=PEEK(764)
60 IF N=255 THEN 50
70 POKE 764,255
80 ? N;" ";
90 GOTO 50

If you use this program as a subroutine by itself, it will act as a GET statement. Putting the subroutine in a loop that stacks the codes in a string until it gets a RETURN code will act as an INPUT statement for alphanumeric input. For this, remember to display the characters on the screen and to make allowances for backspaces. Now your program will not produce a click with each keystroke.

The only other common code conversions required are for the graphics screens. Those are simpler than the other conversions. If you are using the standard screen set up by BASIC, it is much easier to use standard BASIC statements like PLOT and DRAWTO. If you want to set up a specific shape that would require a lot of DRAWTO commands for a relatively small area, you may want to use PRINT.

Although converting to exact byte values to POKE onto the screen is possible, PRINT allows you to address each individual pixel on the screen. You PRINT an alphanumeric string to the screen through channel six. In mode 3, POSITION the graphics cursor at the beginning of one of the lines in the image, then PRINT #6;"112233" for two pixels each of colors 1, 2, and 3. To print the background color, which will allow you to erase an image, use zero, four, or a space. In two-color modes, use only zero and one. This method will save you substantial conversion over PEEKing and POKEing and will, in some cases, run much faster than the equivalent PLOT and DRAWTO statements. You don’t need a COLOR statement for the PRINT method because you specify the color register directly, and there is an additional advantage to providing a version of the image right in the program (invaluable in debugging).

Next Month

My January column will introduce the Operating System and Hardware manuals and a few other sources of more technical information on the Atari. I plan to make the Technical Tidbits a regular feature, so send in your questions.


MICRO ISSUE 56 / JANUARY 1983 / PAGE 19

From Here to Atari


By Paul S. Swanson

This month’s column covers technical literature available for Atari computers. The term technical, of course, means different things depending on your programming level of expertise.

For non-programmers who want to learn, there is one general book on the market that provides a good introduction to programming. This book, Karel the Robot by Richard E. Pattis (Wiley, 1981), was intended as an introduction to Pascal, but is well written as an introduction to almost any computer language.

For those who already know something about programming and own an Atari computer and a BASIC Language Cartridge, there are two good sources. One is Atari BASIC by Albrecht, Finkel, and Brown (Wiley, 1979), which is written to teach you how to program in BASIC. The BASIC Reference Manual from Atari outlines the available BASIC commands and has some handy reference tables. One table, labeled “Memory Locations,” provides vectors, shadow locations, and hardware locations that you can PEEK or POKE for special actions. These two books come with the BASIC cartridge in a programmer’s kit from Atari.

Your next step in acquiring literature from Atari is a reference book called De Re Atari, which was written by several Atari staff members and is available at most computer stores that carry the Atari. In addition to the features I listed above, this book also explains how Atari BASIC uses memory, then does the same for the resident operating system and disk operating system. Other topics include vertical blank interrupts, cassette operations, television artifacts, and the GTIA chip (if you aren’t familiar with this chip you are in for a pleasant surprise).

In the middle of digesting De Re Atari, you will probably become interested in machine language. I know of no machine-language book available from Atari, but almost any book on the 6502 should work. I use Programming the 6502 by Rodnay Zaks (Sybex, 1978). Another is Lance Leventhal’s 6502 Assembly Language Programming, (Osborne/McGraw-Hill, 1979).

There are other books available for Atari computers at the level of De Re Atari. Your Atari Computer by Poole, McNiff, and Cook (Osborne/McGraw-Hill, 1982), is a good example. It covers certain features of the Atari and its peripherals in more depth and is therefore a good supplement to De Re Atari.

For even more advanced programmers, Atari publishes the Technical User Notes, a combination of the Operating System Manual and the Hardware Manual. These are strictly reference books — don’t look for long explanations. They are concise descriptions of all the different system features. BASIC, for example, is not even mentioned. The few examples are in machine language.

I have all the above-mentioned books within arm’s reach of my Atari computer, as well as a few reference books concerning integrated circuits (I also experiment with my own electronic circuitry). The Hardware Manual contains all the wiring diagrams of the Atari computer (both the 400 and the 800), invaluable for interfacing.

Talking to Other Computers

One question from a reader reminded me of a recent project I embarked upon. The question concerned moving data from an Apple to an Atari. I recently set up communication between my Atari and a 6502-based system I built from scratch. This allowed me to develop the 6502’s operating system using an assembler on the Atari. I communicated to and from the Atari through game controller ports 3 and 4. Using one plug connected at game controller 4, I set up a serial communication through half of one of the two PIA bytes. The PIA can be directly accessed and programmed through hardware registers. A register named PBCTL (for Port B control) at location $D303 (decimal 54019) allows you to set up game controller ports 3 and 4 as either input, output, or any combination on the eight joystick pins. From BASIC, POKE 54019,56, then POKE 54017 with a bit map of which pins you want as input and which you want as output. For input, use a zero bit; for output use a one. Next, POKE 54019,60. The joystick pins on game controllers 3 and 4 are now set up the way the bit map specified.

The eight joystick pins are the top pins on each game controller jack excluding the far right pin on each. The Port B byte includes the eight pins on jacks 3 and 4. The lowest order bit is the top leftmost pin on jack 3; the highest order bit is the fourth pin from the left on the top row of jack 4,

If you are working on transmitting data from the Apple to the Atari, I have another suggestion that will help things run faster. The Apple clock runs at 1 MHz, but the Atari clock runs at about 1.79 MHz; therefore, the Atari can process information about 75% faster than the Apple. If you have conversions, use the Atari. To get the full advantage of the Atari’s faster clock, write a zero to location $D40E and another zero to location $D400. Location $D400 enables and disables the different types of direct memory access available. Location $D40E enables and disables the non-maskable interrupts (except SYSTEM RESET). You will have no screen display after that. Write to $D40E first because $D400 is shadowed during the vertical blank interrupt. The zero in $D40E will stop the shadowing and allow access directly to the hardware register. It also allows an easier method for undoing all that disabling. When you have written those two zeros out, run the conversion routine. When the conversion is done, just write a $40 to location $D40E to reenable the vertical blank interrupt. The shadowing will re-enable the DMA by rewriting the original contents of location $D400.

In Conclusion

Future columns will be based on letters from readers. If you have any suggested topics or questions concerning the Atari, write me at 97 Jackson Street, Cambridge, MA 02140.


MICRO ISSUE 57 / FEBRUARY 1983 / PAGE 31

From Here to Atari


By Paul S. Swanson

Languages

The language C, offered in interpreter and compiler versions, was recently added to the list of languages available to Atari 400 and 800 systems. FORTH, PILOT, and several other high-level languages have been available for some time. But despite the large number of choices for languages, the most popular seem to be BASIC and assemblers.

There are several versions of BASIC and several assemblers. Of the assemblers, the original cartridge version from Atari can be implemented on even a 16K system, which is an advantage for those who have not expanded their systems to 48K. Atari also provides a macro assembler. I chose the Synassembler (Synapse Software), which assembles faster than the Atari cartridge and is less expensive.

Almost every Atari computer is purchased with a version of BASIC — usually the cartridge BASIC. There is also a form of Microsoft BASIC for those of you who want to, on your Atari, run software that was written for other computers. Because of the note and point style of random access used on the Atari, there is a big difference in the disk commands between the Atari version and the versions on the Apple, Radio Shack, and IBM computers.

Monarch Data Systems (P.O. Box 207, Cochituate, MA 01778) offers a BASIC compiler. Compiled programs can run 4 to 12 times faster than the interpretive code. Several restrictions limit the use of this compiler, but these are easily circumvented for most applications. For example, the compiler uses fixed point arithmetic instead of the slower floating point, so there are no trigonometric functions. There is also no RND( function supported, so you must use a PEEK(53770) and extract a random number by multiplying that result (a random number between 0 and 255), then dividing to get a number in the proper range. The LOAD and RUN statements are also not supported, so the program cannot chain to other programs. For more information on this compiler, contact Jeff Goldberg at Monarch Data Systems.

Hardware

Many letters from readers express an interest in the hardware and ask questions about the keyboard I was marketing. I recalled the keyboard because several manufacturers produce keyboards just like it, and they can produce them more cheaply than I can. However, I am writing an article describing how I built my keyboard (you can build one for under $20 plus a weekend of time instead of buying one for over $100).

Several questions have been asked about the controller jacks at the front of the Atari console. These jacks provide the simplest interfaces to any external device. They are connected to eight A/D (analog to digital) converters and a PIA (peripheral interface adapter). See the last page of your Atari hardware manual for a diagram of the pins and jacks. Port A controls the joystick pins of jacks 1 and 2 and Port B controls those on jacks 3 and 4. As you look at the computer from the front, the MSB is on your right and the LSB is on your left. To use them for input, you do not need special codes — just PEEK(54016) for Port A or PEEK(54017) for Port B.

To set up pins for output, you must write to the direction control register. An example of setting up Port B as an 8-pin output follows: (to use Port A instead, subtract one from the PEEK and POKE addresses)

100 POKE 54019,56
110 POKE 54017,255
120 POKE 54019,60

POKEing 54019 with a 56 tells the computer to take the next POKE to 54017 as a direction control code. This is a binary code with each bit corresponding to a pin on the jacks. If the corresponding bit is 1, the pin is defined as output and if it is a zero, the pin is set up as input.

Once you have completed that section of code, you may then POKE to 54017 whatever you want to send out. If you POKE there and then PEEK the same location, you will get back the code you sent, as if it were a RAM location. Therefore, if you set the low-order four bits as output and the upper four as input, you can send a code out then read the input combined with the code you sent. This makes scanning controllers simple to set up in the software. The value you read is what you sent plus 16 times the value that your device sends back.

The plugs for those jacks are not easy to obtain. You can get plugs that work from APX, but they cost almost $7 each (plus postage) and you must have a minimum order. Just check around in your area for a suitable store. My source is Eli Computers in Cambridge, MA.

A ground and +5 volts are available, also. For larger projects it is best to have an independent power supply for your device. According to Atari, you can draw as much as 300 mA from these pins (total — not per port), which should be enough to drive many smaller devices.

Thanks to Devin MacAndrew for calling my attention to an error in my November column. The 64K board I mentioned, according to the advertisement he sent me, is available from Mosaic (Mosaic Electronic Inc., P.O. Box 748, Oregon City, OR, 97045) and bank selects only above the 48K boundary, using a 4K address space not used by the hardware registers or operating system.

Future Columns

As many columns as possible will be based on mail I receive, so by all means, keep writing. Please mention specific applications and include a description of your hardware configuration. The next few columns will deal with various aspects of the hardware available on standard Atari computers.


MICRO ISSUE 58 / MARCH 1983 / PAGE 10

From Here to Atari


By Paul S. Swanson

The recently announced Atari 1200 computer should be available soon at a suggested retail price of $899.00. The significant differences between it and the 400 and 800 computers include 64K memory, more function keys, and changes in the operating system.

The operating system of the Atari 1200 supports four more graphics modes. These modes are instruction register modes 4, 5, C, and E. IR modes 4 and 5 are character graphics modes, which allow characters to be formed using bit pairs as color register references. IR mode 4 uses one scan line per character row and mode 5 uses two. Most of the reference materials I have claim that these are four-color modes, and it is true that you can have only four colors in each character on the screen, but they are actually five-color modes. The colors normally originate from registers 4 (background), 0, 1, and 2, but if you PRINT the character in inverse video the color that would have been from register 2 will be taken instead from register 3.

IR modes C and E are both map modes. Mode C is a two-color mode using 160 dots per line; each mode line is a single scan line. Mode E is like OS mode 7 (which is IR mode D) except it has twice the vertical resolution, using one scan line per mode line instead of two. These new modes can be declared with GRAPHICS statements from BASIC as modes 12 through 15.

There are only 14 modes available in the Atari hardware (GTIA modes are actually all versions of mode 8). The Atari 1200 operating system supports all but the IR mode 3, a special character mode that supports lowercase descenders. It has ten scan lines per character, allowing you to use all eight in the character set because the other two are automatically blanked. IR mode 3 is the only mode that I have not found any reason to implement and can’t recall seeing any programs that use it. If you want to implement IR mode 3 you need a complete custom character set. It is fairly simple to alter a mode display list to use IR mode 3.

The Atari 1200 has only two joystick ports, using the locations of PORTA (PORTB doesn’t exist). The new arrangement of the keyboard makes more sense. The BREAK key is no longer on the keyboard next to BACK S, which should eliminate unintentional BREAKS while you are trying to run your programs.

The new function keys, as well as most of the keys on the keyboard, are programmable. There are three 64-byte maps in memory that define the code for the key alone, SHIFT plus the key, and CTRL plus the key.

Like the Atari 400, the Atari 1200 has only one cartridge slot. Some third-party cartridges will not work on the 1200 because there is a slight difference in the physical dimensions of the slot, but the Atari cartridges will work fine.

Except for situations where the software calls for game controllers in ports 3 and 4 and for cartridges in the right slot, the 1200 should be fully upwards compatible as far as software. If you obeyed the restrictions outlined in the operating system manual instead of looking for ways to “cheat” in the operating system listing, your software should work on the 1200.

Restoring Registers

The vertical blank interrupt routine is in two parts. The first part updates system clocks and the second part shadows the hardware registers. The second part, referred to as the deferred vertical blank interrupt routine, is easily disabled — just POKE 66,1.

Some interesting effects can be produced by playing with this feature. For example, instead of watching a screen fill up as the program draws it, you can blank it out or put some other message on it, then POKE 66,0 and your completed screen instantly appears, fust follow these simple steps:

  1. POKE 66,1 to disable the deferred vertical blank interrupt routine.
  2. POKE 54272,0 to blank out the screen, or set up a display list and a screen somewhere in memory that is not used by the OS screen and POKE the display list pointers into 54274 (lo) and 54275 (hi). POKE color and other information directly into the hardware registers — not the shadow registers.
  3. Use the standard BASIC statements (or the shadow registers in machine language) to set up the next screen. Do not use hardware registers directly.
  4. POKE 66,0 and your new screen will immediately appear on the television.

Normally, you do not need to set the address for the Jump on Vertical Blank (JVB) instruction because the shadowing restarts the display list from the pointers in the shadow registers. If you disable the deferred VBI routine, you must supply the address or ANTIC will get lost in memory and not give you the interim display you set up.

If there are many computations and screen commands required to complete the final screen, you will probably want to supply the display list and screen so that there is an interim screen showing during the computations. Remember that DMA (Direct Memory Access) can steal up to 30% of your processing time. If you make the interim screen simple, you limit the DMA substantially. One or two lines of IR mode 6 or 7 (OS modes 1 and 2) instead of a full graphics or text screen will not steal many cycles from your computations.

There are other ways to shut off the vertical blanking. You can write directly to the hardware register NMIEN at 54286 (write a zero), but that stops the entire routine and the clocks will also stop. If you do this, write a 64 to 54286 to reenable the routine. Using location 66 (called CRITIC) does not stop the system clock.

What happens in the above procedure is that shadowing is temporarily suspended. This means that you can modify the normally shadowed hardware registers in any way you want to get any interim effect you need, then restore all of them to the values you set up for the next screen by a POKE 66,0. All of the hardware registers are updated during a vertical blank period, so the next television frame contains your new screen. You do need your own display list and screen area because your GRAPHICS, PLOT, DRAWTO, and PRINT statements will still change the memory area that the operating system “thinks” the screen occupies. SETCOLOR, as well as SOUND and a few other statements, write to shadow registers, so they simply set up the shadow registers for the new screen without affecting the current screen.

Compatibility Note

The Commodore 64 has several features that are similar to those found on the Atari. One external feature is the pair of control ports. The 64 has two jacks that are pin-compatibile with the Atari controller jacks, so any device set up for the Commodore 64 control ports will probably work without alteration on the Atari controller jacks. Commodore’s PORTA and PORTB are not the same as the Atari PORTA and PORTB, so you will have to reshuffle the software a little. I recently had my Atari computer “talking” to a Commodore 64 through these controller ports and the differences were mainly the method of setting up the ports for mixed input and output and the memory location of the ports themselves.

Next Month

In the interest of supporting the new operating system modes of the 1200 without abandoning the 400 and 800, I will review setting up character sets for IR modes 4 and 5. The information will be compatible with the Atari 400 and 800. If you want to implement it on the 1200, you can either do it the same way or take advantage of the OS support, which will simplify your program in a few places.


If you have any topics that you would like discussed in this column, write me at 97 Jackson Street, Cambridge, MA 02140.


MICRO ISSUE 59 / APRIL 1983 / PAGE 20

From Here to Atari


Paul S. Swanson

Clearing Up the Rumors

Many rumors are circulating about new products from Atari. I have seen the 1200 — it is not just a rumor. There are also indications that another computer will be announced sometime this summer. But the rumors concerning a 48K Atari 600 no longer look credible since Atari is more likely to bring out a more advanced product; a computer that is between the 400 and 800 is not a step forward. Any statements not officially announced by Atari are probably inaccurate. I’ll keep you up to date on significant official announcements.

Missing the Right Cartridge Slot?

I have received a few letters from Atari 400 owners concerned about the right cartridge slot on the Atari 800. Since the Atari’s newest computer, the 1200, has no right cartridge slot, and there is very little existing software that requires it, it is not likely that much future software will require it.

Another popular topic in letters is assembly language on the Atari. The Atari uses 6502 assembly language, the same used by Apple, Commodore, and others, so general 6502 books will be useful. A few topics concerning assembly language are specific to the Atari, so if your concerns deal with them, write a letter to me describing the specific application.

For example, one reader asked about creating a cassette bootable program. If you hold down the START button while you power up the computer, it will attempt to load and run a program from tape. The program on tape must be in machine language, which is where assemblers become important. Cassettes are a little more difficult to deal with than disks, primarily because there is no cassette operating system comparable to the disk operating time.

To create a cassette bootable program, you must under stand what the computer does when it reads such a file. The steps that the computer executes in reading the file are:

  1. The first record loads into the cassette buffer and the computer stores the first six bytes and saves them in various places. The first byte is not used. The second byte contains the number of records to load. Bytes 3 and 4 contain the address to start saving the program. The last two bytes are the initialization address.
  2. The first record (apparently including the first six bytes) is moved from the cassette buffer into the indicated start address, then the rest of the records are read and placed in sequential memory locations following the first record.
  3. The computer JSRs to the address of the byte immediately following the first six bytes (starting address plus six). You can use this to load more records into memory if you wish. Return by using an RTS command after clearing the carry (if there was no error), or setting the carry to indicate that there was an error during this routine.
  4. The computer next JSRs to your initialization address (indirectly through bytes 5 and 6). In this routine, do whatever initialization you want, then place your actual starting address in DOSVEC (at $000A). Use another RTS to end this routine.
  5. Finally, the computer JMPs indirectly through DOSVEC to begin your application. At any time during the execution of your application, SYSTEM RESET is pressed and steps 4 and 5 are repeated.

There is a small bug in Atari’s cassette boot routine. At the end of the routine that starts at the start address plus six (step 3), you must stop the cassette motor.

Back to Graphics

Last month I promised some information on using IR modes 4 and 5, which are the character graphics modes that will be available as OS modes 12 and 13 on the Atari 1200. You can, on the 400 and 800, use these two modes if you define your own display list and a custom character set. For hints on how to create a character set, refer to my article in the October 1982 (53:87) issue of MICRO.

There is an important difference in forming each of the characters. You must locate the set on a 1K boundary the same way I describe in the article. However, the formats for each character will be interpreted differently for IR modes 4 and 5. In these modes, the bytes in the set are interpreted as bit pairs, which refer to color registers. Zero refers to the background register, one refers to register zero, two to register one, and three to either register two or register three. In all, you can have up to five colors on the screen with up to four in each character. The reference to registers two or three depends on whether the character is printed in normal or inverse video.

Both of these modes support 40-character lines. Mode 4 uses one scan line per line of format, so it is easily implemented from an IR mode 2 (operating system mode 0) screen, allowing you to access it as if it were a text screen. Mode 5 uses two scan lines per line of format, making it equivalent in resolution to an OS mode 7 map mode screen. You can also modify a text screen for this one, too, but you have only half of the characters available on a full screen, so you must take this into account.

Mixing some IR mode 2 text lines with mode 5 is relatively easy. If you alter the display list to make some of the lines mode 5 and leave others in mode 2, you can PRINT to the screen as if it were the standard OS mode screen using BASIC. The drawback is that the text lines will use register 2 for the background color and the luminance of register 1 for the letters, so the screen will either have stripes where the text lines go or, if you set register 2 to black, the graphics will have only four colors instead of five, and only three can be used in each graphics character.

Some experimentation with these two modes will explain quite a bit about how they work. I have included a listing at the end of this column that should get you started.

Hardware

If you have a printer that works off the 850 interface, I have one note that may interest you, particularly if you write rather large programs. If the 850 is on when you start up the Atari, some memory is set aside to handle device R:. If you are not using the interface for anything except the printer, you do not need this device, nor do you need to have that extra memory subtracted from your program area. If the 850 is turned on only after the computer is turned on (i.e., the 850 is off when you turn the computer on), this memory is not set aside and device R: will not be available. Device P: is always enabled at power-up, so the printer will be available any time you have both the 850 and the printer turned on.

Reference Books

In a recent column (56:19), I reviewed some reference books that you may want next to your Atari to help with your programming. Since then I learned that Educational Software, Inc. (4565 Cherryvale Avenue, Soquel, CA 95073) publishes references for beginners or experts on the Atari computers, as well as software that will help your programming. Their Master Memory Map, for example, is a good roadmap of the hardware and shadow registers in the Atari.

A Closing Note on Character Graphics

When you are finished experimenting with modes 4 and 5, set up a standard text screen and POKE 64, 128, or 192 into location 623. This causes the character set to be interpreted in four-bit groups, effectively implementing a character graphics screen equivalent to OS modes 9, 10, and 11. Note that these are the GTIA modes, so this won’t work on the older Atari computers that have CTIA chips instead of the GTIA chips.

Send your letters to Mr. Swanson at 97 Jackson Street, Cambridge, MA 02140.

Here to Atari Listing

10 REM ....Character Graphics
20 REM Using IR mode 4
30 REM
40 REM ....Paul S. Swanson
50 REM
60 REM ****************************
70 REM **Place character set on****
80 REM **a 1K boundary*************
90 REM ****************************
100 DIM X$(1):A=ADR(X$):B=INT(A/1024+1)*1024:DIM F$(B-A-1),CSET$(1024)
110 CSET$="@"
120 CSET$(1024)="@"
130 CSET$(2)=CSET$
140 REM ***************************
150 REM **Use CTRL characters for**
160 REM **the redefined characters*
170 REM ***************************
180 RESTORE 1000
170 C=513
200 READ N
210 IF N=256 THEN 300
220 CSET$(C,C)=CHR$(N)
230 C=C+1
240 GOTO 200
250 REM ***************************
260 REM **Declare a GR.0 screen,***
270 REM **then redefine its********
280 REM **display list.************
290 REM ***************************
300 GRAPHICS 0
310 DL=PEEK(560)+PEEK(561)*256
320 POKE DL+3,68
330 I=DL+6
340 N=PEEK(I)
350 IF N=65 THEN 430
360 POKE I,4
370 I=I+1
380 GOTO 340
390 REM ***************************
400 REM **Use standard PRINTS******
410 REM **to display characters.***
420 REM ***************************
430 FOR I=0 TO 26
440 PRINT CHR$(I);
450 NEXT I
460 REM ***************************
470 REM **PRINT the inverse********
480 REM ***************************
490 PRINT : PRINT
500 FOR I=0 TO 26
510 PRINT CHR*(I+128);
520 NEXT I
530 REM ***************************
540 REM **Tell the Atari where to**
550 REM **find the new characters**
560 REM ***************************
570 POKE 756,B/256
580 GOTO 580
960 REM ***************************
970 REM **The custom characters****
980 REM **0ne DATA per character***
990 REM ***************************
1000 DATA 5,5,5,5,5,5,5,5
1010 DATA 90,90,90,90,90,90,90,90
1020 DATA 175,175,175,175,175,175,175,175
1030 DATA 250,250,250,250,250,250,250,250
1040 DATA 165,165,165,165,165,165,165,165
1050 DATA 80,80,80,80,80,80,80,80
1060 DATA 0,0,0,0,1,5,21,85
1070 DATA 0,0,0,1,5,21,85,86
1080 DATA 0,0,1,5,21,85,86,90
1090 DATA 0,1,5,21,85,86,90,106
1100 DATA 1,5,21,85,86,90,106,170
1110 DATA 5,21,85,86,90,106,170,171
1120 DATA 21,85,86,90,106,170,171,175
1130 DATA 85,86,90,106,170,171,175,191
1140 DATA 86,90,106,170,171,175,191,255
1150 DATA 90,106,170,171,175,191,255,252
1160 DATA 106,170,171,175,191,255,252,240
1170 DATA 170,171,175,191,255,252,240,192
1180 DATA 171,175,191,255,252,240,192,64
1190 DATA 175,191,255,252,240,192,64,0
1200 DATA 191,255,252,240,192,64,0,0
1210 DATA 255,252,240,192,64,0,0,0
1220 DATA 252,240,192,64,0,0,0,0
9999 DATA 256

MICRO ISSUE 60 / MAY 1983 / PAGE 16

From Here to Atari


Paul S. Swanson

This month’s column is based largely on a letter I received from Jose H. Nieto, a MICRO reader in Venezuela. His letter outlined a few questions that are commonly asked in reference to specific applications. His application included drawing geometric shapes.

Mr. Nieto’s first question was about monitors. When drawing shapes in mode 8, you will get color artifacts on any compatible monitor or television because of the mechanics of the signal, although some monitors will reduce the artifacts a bit. However, using the computer for plotting single points to define geometric shapes does not really require color in mode 8. This mode actually is a one-color mode, allowing two luminances. I would prefer to do such work with a good black and white or green phosphor monitor. The image is much clearer than that obtained by either a television or a color monitor.

The Atari 800 computer can be connected to almost any raster scan monitor that uses the same sync signals a television uses. The Atari 400 cannot be connected to a monitor; its only video output is combined with its only audio output and modulated for television use.

The second question in the letter deals with connecting an Atari 800 computer to a stereo amplifier. First, the sound output from the Atari is monaural. You can still use a stereo amplifier, but you will not get stereo sound. The jack on the side of the Atari 800 has connections for the monitor and the sound channel. This jack has five pins on it. The ground pin is the lowest pin on the jack (pin 2). This should be connected to the ground wire of anything you connect to this jack. The “live” connection for sound is pin 3, which is the top pin on the left side as you look at the jack. If you connect both audio input lines to this pin (the “live” from each channel) your stereo amplifier should work just fine. The proper place in your amplifier to connect the Atari output is the auxiliary input or the phonograph input (if there is no auxiliary input).

For color monitors, pin 4 is the proper place to connect the live video wire. Black and white does not require the color information and I have had better results connecting those monitors to pin 1, which is composite luminance. Pin 4 is composite video, which will carry the color burst required for color pictures, but not required for black and white.

Another question in Mr. Nieto’s letter refers to the use of a PRINT #6 command with a mode screen. This will normally leave inverse video spaces at the end of each line. If you want to access a mode screen with PRINT #6, don’t use a GRAPHICS 0 statement. Instead, declare the mode with the following statement:

OPEN #6,0,0,"E:"

The screen is opened with a GRAPHICS statement as the screen handler (device S:). Using the screen editor, device E:, will eliminate the white squares. The white squares you get when you use GRAPHICS statements with PRINT#6 is actually the cursor, unreversed after it is moved. Use the device E: and you won’t have to worry about it.

Since the white squares left behind are unreversed cursors, there is another simple solution to this. Turn off the cursor right after you declare GRAPHICS 0. This can be done by a POKE 752,1.

When you use GRAPHICS 0 and the POKE 752,1, you can use COLOR, PLOT, and DRAWTO with a mode screen. Try, for example, the following short program:

10 GRAPHICS 0
20 POKE 752,1
30 PRINT
40 COLOR ASC("A")
50 PLOT 0,0
60 DRAWTO 10,10

Lines 10 and 20 open the screen and shut off the cursor. Line 30 eliminates the single white square that would be left if the PLOT were to be executed without it. The COLOR in mode zero is the character to print. The PLOT and DRAWTO will set a diagonal line comprised of A’s on the screen. Eliminate line 30 to see the cursor that it eliminates. Change the COLOR statement for other characters. The control characters will print as characters in this method, so you can declare COLOR 28 in line 40 and get a line of up arrows. Even the ESC character works (COLOR 27). Only RETURN (COLOR 155) gives unusual results.

One last question concerns the graphics available on printers. There is no redefinable character set on the Atari 820 printer and I know of no graphics available on it either. The printer I use is an Epson MX-80 with Graftrax Plus. The character set on that printer is also not programmable, but you can address all of the dots on each line individually in its graphics modes. It is rather simple to write a screen dump program for the Epson, if you dump the screen sideways. If you have an Epson with any Graftrax option, read the graphics section of your Epson manual and you will see how this can be done.

Both of the 800 series Atari 40-column printers also have graphics capabilities. If you do not need the 80-column width, the suggested $299.00 retail price of these printers may be worth considering.

New Hardware

In other news, Atari has a few products to add to their computer line. In addition to the well-publicized 1200, Atari has a new Program Recorder, model number 1010, that is scheduled for first quarter (it should be available by the time you read this). The 1010 is like the 410 except it has a case design more similar to the new look of the Atari 1200. Also reported is that this new recorder has an improved mechanism. It will be in the same price range as the Atari 410.

In the second quarter, two new printers are scheduled. The Atari 1020 is listed as a 40-column color printer. It actually functions like a drum plotter with colored pens. It uses the 40-column sized paper and can be addressed as a printer. The characters printed to it are plotted in normal, compressed, or expanded mode, as controlled by the program. The suggested retail price for the 1020 is $299.00.

The Atari 1025 is a new 80-column printer that does not require the 850 interface. It reportedly does not have graphics capabilities. Suggested retail price for the 1025 is $549.00.

Write to Paul at 97 Jackson St., Cambridge, MA 02140.


MICRO ISSUE 61 / JUNE 1983 / PAGE 14

From Here to Atari


by Paul Swanson

Many companies supply products that can be attached to the Atari 400 and almost as many supply products for the Atari 800. Starting with this column, I will include a description of one of these products each month.

InHome B Key Keyboard

I recently installed an InHome keyboard in a customer’s Atari 400 computer. This keyboard replaces the membrane keyboard inside the case. The membrane keyboard is smaller than a standard keyboard but the InHome keys are placed at the standard distances from each other. In order to do this and still fit the new keyboard into the same space, a few of the keys at the ends of the rows were relocated to places on each side of the spacebar.

Specifically, there are five relocated keys: CNTL, TAB, CAPS/LOWR, BACK S, and ESC. A period of adjustment is required for touch typists who are very familiar with the layout of the Atari 400 and Atari 800 computer keyboards. The most annoying part of the adjustment is the relocation of the BACK S key. The BREAK key on the InHome keyboard occupies the spot formerly occupied by BACK S. I feel that this point is the keyboard’s major weakness; the BREAK and BACK S keys should be reversed.

Once you get past the adjustment period, the keyboard has obvious advantages. All of the keys, including SYSTEM RESET and the three function keys, are full stroke keys on this board. In addition, increasing the distance between the key centers to the standard distance of typewriters makes word processing and other text-oriented tasks even easier. All except one of the keys are labelled almost identically to the keys on the Atari 400 computer keyboard. The only one completely changed is the Atari key, which is now the InHome key.

Adding an InHome keyboard and a 48K memory board to an Atari 400 makes it almost equivalent to an Atari 800 at a savings of up to $200. You still don’t have a right cartridge slot, but that is starting to look like a vestigial organ of Atari 800 computers. Also missing is the circuit for attaching a monitor. For more information write to InHome Software Inc., 2485 Dunwin Dr., Mississauga, Ontario, Canada L5L 1T1.

On Map Modes

The new Atari 1200XL computer has two new map modes. One of them is mode 15 which is a four-color mode with 160 dots horizontally and 192 vertically. Trying a GRAPHICS 15 statement on an Atari 400 computer or an Atari 800 computer will produce an error 145 because the operating system does not support that mode. It is available on both of those computers, but you must supply your own display list or alter one supplied by the operating system.

Listing 1 alters the display list that results from a GRAPHICS 8 statement. The FOR/NEXT loop in lines 40 through 70 performs this alteration. Line 30 gets the location of the start of the display list first, then the FOR/NEXT loop investigates the list and makes the changes. The specific differences are two types of commands. A decimal 79 ($4F) loads the memory scan counter for the mode 8 screen. This gets changed to a decimal 78 ($4E) for a mode 15 screen. Decimal 15 ($0F) is a mode line command that displays one mode 8 line on the screen. The decimal 14 ($0E) causes a display of a mode 15 line instead.

The numbering of the commands and the modes can be a little confusing. There are two distinct numbering systems used. The modes declared in GRAPHICS statements are OS (operating system) modes and obey a numbering system quite different from the internal numbering system, referred to as the IR (internal register) mode. OS mode 8 is IR mode $F and OS mode 15 (Atari 1200XL computers only) is IR mode $E.

The FOR/NEXT loop occupying lines 80 through 150 draws three diagonal bars of color on the screen. The BASIC ? (PRINT) statement to a map mode screen is not documented at all as far as I have been able to determine. It interprets one screen dot per character in the string. If the screen is a two-color screen, as in this example, only the last bit is used in each character. Therefore, if the ATASCII value of the character is an odd number, the foreground color is used for the dot and the even numbers produce background colored dots. The ? #6 method is used in this example because DRAWTO cannot be restricted to only even numbered or only odd numbered columns.

The requirement for the even or odd numbered columns is due to the operating system “thinking” that it is maintaining a mode 8 screen. Altering the display list causes the screen image to be interpreted in bit pairs. Beginning on an even row, bit pairs of 01 (binary) result in a dot of the color in register 0, 10 to register 1, and 11 to register 2. Note that this follows the same scheme used in the BASIC COLOR statement numbering.

Listing 2 produces the same display on an Atari 1200XL computer as does Listing 1. Since the operating system “knows” that it is a four-color screen, the numbers 1, 2, and 3 are used instead of the pairs 01, 10, and 11. On four-color screens, each character in the string contributes the last two bits of its ATASCII value.

Listing 3 demonstrates the increased resolution between mode 7 and mode 15. This listing (and Listing 1) will work on the Atari 400 computer and the Atari 800 computer as well as on the Atari 1200XL computer. Lines 10 through 70 draw the three colored bars on a mode 7 screen. Lines 80 through 100 wait for the RETURN key. Lines 110 through 140 convert the display list to mode 15. The screen will shrink to one half height because mode 7 has only half the number of lines as a full mode 15 screen.

POKEY Times

I recently received a letter from Ian Chadwick, the Associate Editor of InfoAge and author of Mapping the Atari. He suggested that I include some information on the POKEY timers in my column. His observation that the Atari documentation does not adequately cover them has some merit.

There are three of these timers available for use. All of the times use the AUDF values for initialization, which are the same values used for sound channels 0 through 2. STIMR is another location actually used to start the counters. Each timer sets an interrupt when it counts down to zero.

A couple of peculiarities about the timers reveal some interesting insights into how they operate. They are enabled by setting the corresponding bit at location 16 (decimal) to one. Set timer 1 by POKE 16,193. Note that the keyboard, including the BREAK key, no longer functions. Press SYSTEM RESET to restore the keyboard. The reset puts the value 192 (decimal) back in location 16, disabling the interrupt.

POKEing 193 into location 16 enabled timer 1 when the AUDF value was zero. This causes a constant interrupt, leaving no processor time available and masking all other maskable interrupts. SYSTEM RESET is a non-maskable interrupt that can override the timer interrupt.

Now POKE 53760,10, which sets AUDF1 to 10, giving timer 1 some time when it is counting before it generates the interrupt. POKE 16,193 to enable the timer and hold down the space bar. Notice that the auto-repeat is irregular and slower and that the keyboard click changed its tune. If you POKE a number smaller than 10 into AUDF1, the auto-repeat will be even slower, the limit being a zero in AUDF1, which stops everything.

Although the examples are BASIC, the BASIC language cannot really function with these timers because interrupt routines cannot be written in BASIC. In machine language, an interrupt routine can handle the timer 1 interrupt very effectively. One of the best uses for the timer interrupts is to time two external events like pulses on the controller jack pins. Set AUDF1 to the interval you want to use to time the event first. Alter $0210 and $0211, which is the interrupt vector. Store your interrupt routine starting address here. Set up a flag and a counter in memory and set the flag to zero. Last, enable the interrupt.

The interrupt routine is in three sections, controlled by the value in the flag. When it is zero, just poll the first signal. If it is present, set the flag to one, store anything in location $D209 (this is STIMR — writing to this location initializes all timers to the AUDF value). Then zero your counter, PLA and RTI. Make sure that you pull A before any RTI and always restore X and Y and any other registers you affect or you will probably crash the system. If the flag is one, increment the counter and test the second signal. If it is present, set the flag to 2 before you restore the registers and RTI. If the flag is 2, just restore registers and RTI.

That sequence will time the duration between the two events polled in the units determined by the value in AUDF1. To start the sequence, just store a zero in the flag. Check for the flag equal to 2 for a completed timing sequence. When the flag equals 2, the counter value is valid. Note that the units are N/63921 seconds, where N is the AUDF1 value, so using 64 for AUDF1 produces units reasonably close to milliseconds. Altering AUDCTL can change the frequency used if this is an inconvenient unit — the default 64 KHz can be altered to about 15 KHz or about 1.79 MHz. The exact frequencies are 15.6999 KHz and 1.78979 MHz for these alternates.

Next Month

The 850 interface seems to be an interesting yet misunderstood device. July’s column will clear up questions you may have. Next month’s hardware product description will be of the new 80-column RGB interface recently announced by Austin Franklin Associates.

Send your letters to: Paul Swanson, 97 Jackson St., Cambridge MA 02140.


MICRO ISSUE 62 / JULY 1983 / PAGE 17

From Here to Atari


by Paul Swanson

Many readers have sent in questions concerning use of the Atari 850 interface. Larry L. Farmer in Dover, Delaware, asked about the bootable handler for the 850.

To use the 850 just for the printer is no problem — make sure it is off when you boot the computer and turn it on when you want to use the printer. Use the disk normally, as if the 850 weren’t there. There is no bootable handler required for using the printer through the 850.

If you want to use the other four ports on the 850, you do need a handler. The handler loader is in the AUTORUN.SYS file on your DOS disk. You do need the handler for modem programs, for example. Using Atari’s Telelink I requires that you have the 850 on when you boot the computer and it will load the handler. Don’t Ask Software’s TeleTari works the same way, except it uses the disk instead of a cartridge.

To use the AMODEM programs or other communication programs, or your own software to access devices through these ports, boot your computer with the DOS disk and make sure the 850 is on when you boot it. When it loads the handler you will hear a tone from the TV speaker a second or two in length. That is the handler loading from the interface.

The handler is located and booted from the interface. It controls device R (R1, R2, R3 and R4), which is usually an RS-232 port. The AUTORUN.SYS program simply triggers the loading. If you are not going to use the four ports on the 850, whether or not you are going to use the printer connected to the 850, make sure the 850 is off when you turn on the computer. If the 850 is on, even if the handler is not loaded, it will reserve some memory for a buffer. This memory is not used or needed if you don’t use those four ports.

Telecommunications

I recently received a review copy of TeleTari from Don’t Ask Computer Software (Los Angeles, California) and have been using it to play with the local billboards. TeleTari allows you to send and receive disk files, which makes it useful for uploading and downloading programs. It also has a very complete terminal configuration selection, allowing communication to anything your modem can handle.

It does live up to it’s “Friendly Terminal” slogan — every one of its functions is adequately documented and relatively easy to use. A few of the nicer features include a buffer that collects everything while you are on line and that can be reviewed on the screen at any time, easily printed, saved on disk or sent to any other peripheral you choose. Also, the buffer doesn’t disappear after you save it, so you can, for example, print it out, then save it to disk. You have to tell TeleTari when you want the buffer cleared. Suggested retail price for TeleTari is $39.95.

Atari 1025 Printer

If you are looking for a printer and don’t want to pay the extra money for the 850 interface, you will probably be looking at an Atari 1025. It handles full 9.5 × 11 inch forms, which usually come with perforations so that the sprocket holes rip off leaving you with 8.5 × 11 sheets. It uses fanfold paper only — no single sheets. Suggested retail price for this new printer is $595.

The 1025 has 80 columns per line but doesn’t require the 850 interface. It uses a typewriter spool-type ribbon. It prints at 16.5, 10 or 5 characters per inch and 6 or 8 lines per inch. It also has “European” characters.

The 1025 does not support graphics nor does it have proportional print. It is probably worth looking at because the 850 is not required, but if you already have an 850, you may want to look at some other printers. I’ll stick with my IDS IP-225 and Epson MX-80.

The Atari 1020 printer looks like it will be a little more interesting. It is a four-color “printer” (described like a drum plotter) using colored pens instead of the dot matrix impact printhead. It also connects directly to the serial bus, but uses roll paper only 4" wide. The 1020 suggested retail price is less than $300.

Interfacing Using Controller Jacks

One topic that keeps recurring is peripheral control through the joystick ports. The four jacks on the Atari 400 and 800 computers are full of places to hook up peripherals. I mentioned my IDS IP-225 printer, but since I have only one 850 interface, I have that printer hooked up through controller jacks 3 and 4 on my Atari 400. That particular printer requires only seven data bits. I use the eighth bit available in the jacks for the STROBE line to the printer and hook the printer’s ACK line to a joystick trigger input. If CIO makes you think of a bunch of spies, you may want to use PEEK and POKE from BASIC to control the printer. If it means the Central I/O utility, then you may want to write a handler for the printer.

My IDS uses a handler set in place by a BASIC program. The handler occupies the entire top half of page 6 (actually, 126 bytes) and handles OPEN, CLOSE, PUT and initialization, so the “P” device still refers to the controller jacks after you hit SYSTEM RESET. I am preparing an article on this interface to CIO. If I successfully complete it, you will see it here in MICRO. Otherwise, I will continue the description in future columns. I think such a topic is well worth discussing because you can use the same method for attaching almost any peripheral you want through the controller ports — parallel or serial — and have the handler control all handshaking and data transfers one byte at a time.

Promises, Promises

I know I promised a description of the new 80-column board from Austin Franklin Associates, Inc., in this month’s column and it is not here. There was a problem in the software at the last minute, which delayed the release beyond the deadline for the column. Look for you next month.

Send your letters to Paul Swanbon at 97 Jackson St., Cambridge, MA 02140.


MICRO ISSUE 63 / AUGUST 1983 / PAGE 14

From Here to Atari


by Paul Swanson

The Atari product line is undergoing several changes. It looks like there was truth to the rumor about cancelling the 400 and 800 computers. They are not on the most current price lists.

New Products

Through the end of 1983, many new products will become available from Atari. They include four new computers and many new peripherals.

The new computers are the Atari 600XL, 800XL, 1400XL, and 1450XLD. The 600XL will list at about $199. The prices on the other computers are “to be announced.” All of these new computers, supporting the fact that Atari does listen, have slots in the back exposing the system bus. The 600XL has 16K, expandable to 64K, and the others have 64K built in. Atari BASIC is a built-in feature of all of these systems — no cartridge required. They also support the international character set available on the 1200XL and are similarly styled. The 600XL and 800XL systems will be available in the third quarter of this year and the 1400XL and 1450XLD will be available in the last quarter of this year.

The 800XL looks like it is a 600XL with the extra memory included, but the 1400XL and 1450XLD have some interesting new features. Both have built-in modems and speech synthesizer. The 1450XLD also has a built-in 254 KB double-density, dual-sided disk drive.

New peripherals include the 1027 printer, which is a 5×7 dot matrix printer that prints at 20 cps and is designated letter quality. It will take single sheet or roll paper and features bi-directional printing and underlining. I haven’t seen the output yet, but Atari’s description is “prestige elite” fully formed characters, printed at 12 cpi, 80 characters per line, and I have heard comments indicating that the output really does look typed. The retail price is listed at $349.95.

The Atari 1050 disk drive is a 127 KB dual-density disk that is available now. It will retail at $449.95. However, you will require DOS 3.0 to enable the dual-density feature, and that will not be available until the third quarter.

A direct connect modem, cased in the “new look,” will also be available in the fourth quarter. This is the Atari 1030 and specs look very similar to the Atari 835 direct connect modem. It is still only 300 baud, but does not require the 850 interface.

Other new hardware items are a touch tablet (digitizer) for $79.95 (4th quarter), a 10-key numeric pad for $124.95 (available now), remote control joysticks that include two joystick transmitter units and one receive unit for $74.95 (4th quarter), the “Ultimate joystick” (no idea what this will be) available in the 4th quarter, and a Track Ball for $59.95 (also 4th quarter). The Track Ball is read like a joystick and programs set up for joystick input can use this with no changes. It looks like next Christmas will see an entirely reworked product line from Atari.

Atari is also working on a CP/M board for these new computers. That should be available in the fourth quarter at a price “to be announced.”

There is not too much available in terms of technical data beyond what I have mentioned, at least not at this writing. I will have more information on at least some of these products by next month.

80-Column Board

Austin Franklin Associates (43 Grove St. Ayer, Massachusetts) has a new 80-column monitor interface for Atari 800 computers. At this writing the board is not yet on the market. I have an early prototype here to examine and the software on it is incomplete. Therefore, a complete review is not possible, but I have tested enough of the board to describe it.

The hardware consists of a four-layer PC board to install in the last memory slot of the 800. To run the system with this card and 48K, you must use either a 16K and 32K combination of memory boards or one 48K board.

To make this board work, a cartridge for the right cartridge slot is also supplied. However, no computer memory is used for the right slot cartridge. Normally, when a cartridge is inserted in the right slot, memory addressing between 32K and 40K is disabled so that the cartridge may be mapped in. In this particular cartridge, the program contained on the cartridge is relocated and, for all practical purposes from an application program’s point of view, seems to disappear. It is therefore compatible with programs that require 40K to 48K of memory. This 80-column interface leaves the left cartridge slot open for BASIC, the Assembler/Editor, or any other Atari-compatible left cartridge.

The software on the right cartridge makes the board very easy to use. The board is enabled by opening the screen editor or declaring GRAPHICS 0. Selecting any other mode disables the board and switches to the normal monitor output from the computer so that the graphics will appear on the monitor. In your programs, PRINT to it as if it were the normal mode screen, but with 80 columns instead of 40. Keyboard selectable options allow a few more options not available in normal 40-column mode operation.

Output is in 16 colors, selectable for each character as it is written. There are also four attributes that can be applied to each character, which are underline, blink, half intensity, and inverse video. The full ATASCII 128-character set is available plus an extra 128 characters, accessible through a special function. These extra characters are the same as the VT-100 graphics characters at codes $80-$FF. These may also use the four attributes and 16 colors.

The hardware also includes a light pen input, which is a male connector functionally identical to the controller jacks on the front of the computer. A plug that fits the monitor output jack on the side of the Atari 800 is also supplied. This plug allows the use of the monitor when the 80-column mode is not in use.

The board is accessed by the computer directly through memory-mapped location. The effective transfer rate is well above 19,200 baud. The television goes blank during these transfers when the 80-column board takes over. This is because ANTIC must be shut off. If you store display lists and screens in memory, you can turn ANTIC back on and use the television for a second display. If you are not using the television, ANTIC and all of the DMA is disabled, so program will run 20–30% faster than when using the normal text screen.

The retail price for the 80-column board is $289.95. Some software support packages are being developed for it and I will mention them as they become available.

BASIC Compilers

A BASIC Compiler is a program that converts a BASIC program to a faster, machine-language version. There are three compilers available for Atari BASIC programs. None of them is completely compatible with all of the commands in Atari BASIC. I have two of the three — the DataSoft compiler and the Monarch Data Systems compiler (the ABC compiler). They are two very different compilers.

The DataSoft compiler requires much rearranging of the program before compilation. For example, all DATA statements must be listed as the last statements in the program, variables and expressions are not allowed in DIM, GOTO, GOSUB, and RESTORE statements, and there are different rules for FOR/NEXT statements (there may be only one NEXT statement for each FOR statement). The substring assignment is also not compatible with Atari BASIC.

The DataSoft compiler does give the choice of compiling for fixed or floating-point arithmetic and supports the appropriate functions in the floating-point mode (SIN, LOG, etc.). It also prints out an assembly-language listing of the compiled program during the four-pass compilation. I saw no way to alter and reassemble from this listing. In fact, the only uses I found for it are optimizing the BASIC code for shorter object files and decoding the run-time error messages (the compiler lists the error number and memory location instead of program line).

The Monarch compiler was much easier to use because almost all of the functions are implemented identically and no rearranging of statements was required. Just about the only thing required was to adjust the program to use integer arithmetic instead of floating point. The Monarch compiler uses 3-byte integer values (the DataSoft integer compile, for comparison, uses only 2-byte integers) for the variables and calculations. The RND function is not supported, so a PEEK(53770) to get a random number in the 0–255 range is needed in place of any RND functions in the program.

The Monarch compiler supports expressions in DIM, GOTO, GOSUB, and RESTORE statements; DATA statements follow the same rules as they do in Atari BASIC. Enor messages at run time state the error number and BASIC program line number.

Speed is an important factor with compilers and the DataSoft compiler does produce slightly faster programs. I have not run any speed tests, but the manufacturer’s claims of 5–20 times for DataSoft and 4–12 times for Monarch (times meaning number of times faster than the original BASIC program) seem to be true. However, in compilation, the one-pass process used in the Monarch compiler is much faster than the four-pass process used by DataSoft.

I compiled my word processor on the Monarch compiler and am very happy with the results. The word processor is written almost entirely in Atari BASIC (there is one small machine-language subroutine it puts in page 6). It required very little alteration for the compilation. Because of the difference in substring use, I couldn’t compile it with DataSoft’s compiler. I may rewrite parts of it later so that I can, just to compare the results.

In short, I found the Monarch compiler much more compatible with Atari BASIC and therefore much easier to use. The DataSoft compiler would be useful for BASIC programs written specifically with compilation in mind. The DataSoft compiler also has an advantage with programs that require the floating-point arithmetic, although much of it could be simulated in fixed-point on the Monarch compiler because of the large number of significant digits it supports.

I also compared the space required to store the results on diskette. The Monarch compiler produces longer files on very short programs, but on longer programs, the compiled version is usually smaller. The DataSoft compiler restricts the program size to 100 sectors and uses two intermediate files in the compilation. DataSoft claims that the finished object program requires about the same disk space as the original BASIC program, but I have found that it requires more. The Monarch compiler requires only the BASIC source program and a file for the completed object code.

The DataSoft compiler retails at $99.95 (9421 Winnetka Ave., Chatsworth, CA 91311; 800-423-5916) and the Monarch compiler retails at $69.95 (P.O. Box 207, Cochituate, MA 01778; 617-877-3457). The third compiler — not reviewed — is BASIC from Computer Alliance.

Missing: June Listings!

Editor’s note: The following listings were omitted from Paul’s June column. We apologize for the inconvenience.

Listing 1
10 GRAPHICS 8
30 DL=PEEK(560)+PEEK(561)*256
40 FOR I=DL TO DL+200
50 IF PEEK(I)=79 THEN POKE I,78:GOTO 70
60 IF PEEK(I)=15 THEN POKE I,14
70 NEXT I
80 FOR J=0 TO 95
110 POSITION J*2,J+50
120 ? #6;"0101010101010101010101010101010101010101";
130 ? #6;"1010101010101010101010101010101010101010";
140 ? #6;"1111111111111111111111111111111111111111"
150 NEXT J: STOP
Listing 2
10 GRAPHICS 15
20 FOR J=1 TO 79
30 POSITION J,J+40
40 ? #6;"11111111111111111111";
50 ? #6;"22222222222222222222";
60 ? #6;"33333333333333333333"
70 NEXT J
Listing 3
10 GRAPHICS 7
20 FOR J=1 TO 79
30 POSITION J,J+40
40 ? #6;"11111111111111111111";
50 ? #6;"22222222222222222222";
60 ? #6;"33333333333333333333"
70 NEXT J
80 DIM X$(1)
90 ? "PRESS RETURN";
100 INPUT X$
110 DL=PEEK(560)+PEEK(561)*256
120 FOR J=DL+6 TO DL+84
130 POKE J,14
140 NEXT J

MICRO ISSUE 64 / SEPTEMBER 1983 / PAGE 16

From Here to Atari


Paul S. Swanson

Entering a long listing from a magazine is not an easy task. I have entered many programs from magazines and spent hours trying to get all of the mistakes out of them. Being a programmer helps because I can follow the logic in the program (usually) and find errors that way.

Letters I have received indicate that other people have the same problem. Often the person typing is not a programmer, which compounds the problem. Unfortunately, there is no simple solution.

There are a few routes to persue. If you get an error running a program you typed from a magazine, the line giving the error may or may not be in error. The error may be caused by a line the computer encountered earlier. Look for other lines in the program that use the same variable(s). Be careful of lower-case L (l) and the number one (1) and upper-case O and the number zero (0).

Another route to persue is to contact other Atari owners that may have entered the program. Even if the other person couldn’t get it to work, comparing versions may correct the problems. Local Atari user groups are very good for this sort of collaboration.

If you have no modem on your Atari, find someone who does. A program like AMODEM (a public domain communications program) will allow an Atari with a modem to download programs from local bulletin board services, which are usually free. My last long program, which is the Mode 10 painter program (MICRO 62:66), was uploaded and is available on several bulletin board services in the Cambridge, MA, area, some of which were noted in the article (pg. 71). One of those bulletin boards does not exist anymore; the Cambridge AMIS board is no longer on line, so I uploaded the program to one called The Outpost at (617) 259-0181. MICRO has a bulletin board (still in the experimental stage) and programs in the magazine may be available in its download file. The number to call is (603) 883-1576. If all goes well, all of the listings in each issue of the magazine will spend a few months in MICRO’s download file. You will need a modem on your Atari and a program that will allow downloading to disk files, or a friend with that set up.

Logo

The Atari version of Logo is now available on a cartridge. This version has turtle graphics using the equivalent of GRAPHICS 7 in BASIC, which is the same as the turtle graphics implementation in Pilot. Atari Logo sports up to four turtles. It uses the players for turtles and supplies alterable shape tables for them. I have heard one complaint about Atari Logo; it was that the turtles do not always point exactly in the direction they are heading. I have found this to be true. It looks like the turtles point in as many as ten directions but the heading can be defined much finer than that. Therefore, the turtle always points within 36 degrees of its true heading.

The turtle positions use a 320 × 240 coordinate grid, which means the turtle can be placed finer than the pixel count (which is 160 × 96) can display. All 128 colors are available, four of which may be assigned to the screen. Color indirection can be used by drawing then changing the color. Everything drawn will change to the new color, similar to the way the BASIC SETCOLOR statement works.

Atari Logo supports two sound channels to generate tones. A tone may be generated with controls on frequency, duration, and decay. If a tone is sounded on one of the channels and a second tone is requested for the same channel, the computer will wait for the first tone to finish before beginning the second tone.

Since I program mostly in BASIC and assembly language, I found myself a little handicapped when approaching Logo. There are no line numbers in Logo, which means the familiar GOTO, GOSUB, and IF... THEN with a line number doesn’t exist. Instead, Logo is completely procedure-oriented, adding commands to the language by defining procedures. A procedure can also call itself, and this type of recursive programming opens up some interesting possibilities. I was unsuccessful at finding someone who could compare the Atari Logo to other versions on computers like the Apple. I will keep trying and, if successful, I will have such a comparison for next month.

Light Pens

If you built a light pen for your Atari using the instructions from “An Inexpensive Lightpen for the VIC-20, C-64, and Atari” by David Bryson (MICRO 61:82), then you were able to obtain a phototransister (which I haven’t) or you are having some problems with precision. The phototransister Bryson uses has a 2-microsecond response time; the only ones I have been able to find have response times of around 8 microseconds, which really is not fast enough for drawing on the screen.

The timing is most important in determining the horizontal position of the pen. The scan line on the television is made up of color clocks, which are the width of a mode 7 dot (or mode 15 dot on the 1200XL). There are 160 color clocks across the normal screen (the width of the blue area in the text mode). Therefore, one color clock occurs in about .25 microseconds. In other words, the response time of the phototransister specified by David Bryson is within four color clocks horizontally, and the response time of the more common 8-microsecond phototransister is within 16 color clocks. To combat the problem, I have developed a method for reading the pen. The method is not perfectly sound, but it usually works. Take multiple readings of the pen and use the lowest horizontal value after adjustments are made.

The vertical coordinate of the light pen is usually good the first time read. It denotes vertical position in units of two scan lines, so this number, obtained by a PEEK(565), will range from around 16 to around 111. The horizontal reading, which is a PEEK(564), has several complications. First, zero happens about two-thirds of the way across the screen. The left edge of the screen may be around 80 or 90. To reduce the horizontal reading, if the reading is below 40, add 228. Ignore readings, after this adjustment, that are below 80; these are false readings, indicating points that are not on the screen. Of the remaining readings, pick the lowest of 10 or 20 readings. This won’t be perfect, but it will be fairly close. The differences in television sets and computer signals will make the readings of the left and right hand edges vary a Little, but there will still be a count of 160 color clocks horrizontally.

In persuing the topic of light pens, I contacted General Electric and spoke to William Sahm, one of their application engineers. He gave me a circuit that helped enhance the response of a phototransister in this type of application. It required three resisters and a capacitor, all housed in the light pen itself. What it did was bias the transistor so that the range of light from the screen fell into the linear area of the transistor’s response curve, making it much more reliable. The parts required for this are a .01 microfarad disk capacitor, 100K, 33K, and 22K resistors. Wire it according to the schematic below, keeping all leads as short as practical and all close to the phototransister. Be careful when soldering to the phototransister because these devices are very sensitive to heat.

Schematic for Light Pen with blessing circuit. Keep all leads as short as possible to avoid external effects.

Also, a better response may be obtained using twisted or ribbon cable (instead of the specified shielded cable) to run the signal from the light pen to the computer. Although shielded cable does cut down on the radio emissions from the wire, it also introduces a lot of unwanted capacitance. I used a ribbon cable with the ground and switch return on one side and the signal, which is connected to pin 6, on the other side of the ribbon. This also cuts down on the capacitance by keeping the signal away from the ground wires. With the biasing circuit in the pen, there is no longer any need for the 100K resistor between the signal line and the +5-volt line. The ribbon cable, if that is used, should be set up in the order indicated on the schematic. Another possibility is to use a four-conductor ribbon, ordering the wires as the light pen (connected to pin 6), an unconnected wire, the switch return (connected to pin 1), then the ground wire. Keep all leads, including the length of cable between the computer and the light pen, as short as is practical. This will cut down on the capacitance as well as the resistances from the wire. Since the signals are radio frequency signals, it also cuts down on the possibility of interference with radios in the area by making the antenna a little shorter. Three feet should be adequate for the length of the wire between the plug and the light pen.

You may contact Paul at 97 Jackson St. Cambridge, MA 02140.


MICRO ISSUE 65 / OCTOBER 1983 / PAGE 14

From Here to Atari


Paul S. Swanson

Several inquiries came in concerning the listing for the Mode 10 Painter Program, Part I, appearing in the July issue of Micro. The listing was typeset, which is a difficult format to decipher into the proper keystrokes when translating the graphics characters onto the Atari computer. The screen format listing in September should help you find any bugs. To make your screen conform to the 40-column format of these listings, POKE 82,0 before entering the program. That will set your left margin at column zero and give you a full 40-column screen.

GTIA Modes

The painter program also inspired a few questions about the three GTIA modes. All three of the modes are variations of GRAPHICS 8 screens. The shadow of the hardware register PRIOR, which is located at (decimal) 623, contains two switches that control the four possible interpretations. Since GRAPHICS 8 and GRAPHICS 0 screens both use the same type of interpretation, this location can also be used to control a GRAPHICS 0 screen so that it can be used as a GTIA character graphics screen.

Specifically, the interpretation for the GTIA modes all use four bits, so each byte contains the information for two pixels. If GRAPHICS 9 is declared, or a POKE 623,64 is executed, each four bits will be interpreted as the luminance of the hue contained in color register four (SETCOLOR 4,H,0 where H is the background hue). The luminance should be set to zero. If it is not zero it will create some undesirable effects on the display and at least some of the selections of luminances will be lost.

GRAPHICS 11 is the inverse of GRAPHICS 9. This interpretation happens in response to either a GRAPHICS 11 statement or POKE 623,192. All 16 hues will appear at the luminance stored with SETCOLOR 4,0,L (L is the luminance). The luminance of the black background is always zero, independent of the luminance selected. Using a hue number other than zero alters the background color, but has an undesirable effect on the hues as setting the luminance has on the luminances of a GRAPHICS 9 screen.

GRAPHICS 10, which corresponds to a POKE 623, 128, is the only one that uses color registers other than register four. All nine color registers, which include the ones altered with SETCOLOR 0,... through SETCOLOR 4,... and the four used for the players and missiles (POKE 704,.. through POKE 707,..) are used on this screen. The allowed color values on the screen are zero through nine. The other seven are not practical to use, although they will produce colors. The screen background is taken from player zero’s color and can be set with a POKE 704,HUE*16+LUMINANCE. POKE 705 through 707 for the colors one through three. SETCOLOR 0,... through SETCOLOR 4,... control colors four through nine. Notice that although SETCOLOR 4,... sets the background color in most other modes, it is a foreground color in mode 10. Mode 10 is the only mode that uses location 704 for the background color. The colors set with SETCOLOR 0,... through SETCOLOR 4,... sue, in the same order, stored at locations 708 through 712, so POKE 704+COLORREG,HUE*16+LUMINANCE, where COLORREG is the color number to set, HUE is the hue (0 through 15) and LUMINANCE is the luminance value (even numbers in the range 0 to 15).

EREDIT

EREDIT, by EHR3, Inc., is a newly introduced editor that can be used to create and/or edit BASIC or assembly-language files. It will also save all of the changes made to the file and allow you to “back out” of changes you have made, all the way back to the original version if you wish. It uses the files on disk as BASIC LIST files, or the equivalent in assembly language (a TYPEd file from the Synassembler, for example).

All of the screen editing controls normally used when entering or editing a BASIC program are available in this editor (i.e., the four arrow keys, INSERT, DELETE, etc.). It is also possible to be editing one file and list another file on the screen. Combining this with the full screen editing allows you to take lines, with or without additional editing, directly from another file into the file you are editing.

EREDIT is controlled by 31 commands. Several of them are DOS commands, allowing operations like file delete, file copy, directory list, disk format, lock and unlock, to be performed without entering DOS. Several commands allow statements to be relocated in the program text and renumbering is available. There is also an overlay option that prevents you from redefining a line. This can be very valuable in preventing accidental deletions of lines in the program being edited. The COMPARE command allows line-by-line comparison between programs, noting every line that is different in comparing two files (including lines appearing in one file but not the other).

There is no BASIC syntax checking in EREDIT so it is possible to create and/or edit BASIC files only to find errors while ENTERing it into BASIC later. This is not too serious a drawback, since the corrections are easily done from BASIC at that point. The only other drawback I noted was the fact that there was no immediate mode capability, or anything equivalent. Generally, when I am writing or editing a program, I use the immediate mode to execute ASC( — CHR$( conversions or perform calculations.

The user manual is in the reference book style, listing all of the commands in alphabetical order with adequate descriptions of each. Also, if the EREDIT disk is in the disk drive, the command HELP followed by a command name will list a brief description of the identified command on the screen. In both the manual and on the screen, the defaults are listed with the descriptions.

In summary, EREDIT can be a valuable tool to use in the development of software in BASIC or assembly language. It is available at EHR3, Inc., 174 Summit Avenue, Summit, NJ 07901. Suggested retail price is $49.95. Inquiries are invited at that address by mail or by telephone at (201) 277-6785. It is compatible with the Atari 1200XL computer as well as the Atari 400 and 800 computers.

Next Month

I will review two software packages in next month’s column. One is XBASIC from SUPERware, a utility program that stays in memory when a BASIC program is being written and executed. It provides many interesting capabilities not available in the standard Atari BASIC relating to arrays, strings, player/missiles, and DOS. The other program is S.A.M. (Software Automatic Mouth) from Don’t Ask Software, which adds a sophisticated speech synthesizer to your Atari with no additional hardware. These topics will be presented along with a simple way to implement a display-list interrupt, which can be used to change character sets, colors, or the switches that control the GTIA interpretation so that a text window may be added to a GTIA screen.

You may contact Paul at 97 Jackson St., Cambridge, MA 02140.


MICRO ISSUE 66 / NOVEMBER 1983 / PAGE 76

From Here to Atari


Paul S. Swanson

This marks the beginning of my second year of writing this column for MICRO Magazine. Response has been good so far, but I am always looking for reader feedback. Mail is the only way to assure that this column continues to reflect its readers’ interests.

XBASIC and SAM

XBASIC is a series of utilities for BASIC programming. Most of the complaints I have heard concerning Atari BASIC stem from the fact that it doesn’t support string arrays. XBASIC not only allows you to use string arrays, but it also allows you to use the space reserved by a string as an integer array. These are only two of the many programming aids offered by this utility package.

The code that implements these functions is booted from disk and resides in memory all of the time the BASIC program is being written and while it is running. A special SAVE command puts this code, as well as the BASIC program, on disk for you. There are a few simple lines of BASIC code, supplied on the disk with the utilities, that are used to enable XBASIC.

Included among the utilities offered by XBASIC are enhanced I/O functions (GET and PUT characters, screen save/load, move screen, move memory, fill memory, double peek, etc.), timer functions, string functions (arrays, searches, get and put, integer array in string), enhanced SOUND controls, disk-directory listing without leaving BASIC, player-missile movements, and additional graphics modes. It also adds seven error messages to the list of BASIC errors to help in the use of the utilities.

XBASIC may be just the thing for the many BASIC people who have a fear of machine language. It is a useful addition to Atari BASIC and will handle a lot of the functions that I normally attribute to machine-language subroutines. In fact, it is a series of machine-language subroutines, all accessed with various USR( calls. XBASIC is available from SUPERware, 2028 Kingshouse Rd., Silver Spring, MD 20904. It is supplied with a user manual written in a reference-type format and resides on a disk along with BASIC programs that contain examples of using the utilities.

SAM (Software Automatic Mouth) is a very different utility. Also available on other computers including Apple and, in the near future, the Commodore 64, SAM sets up the computer to speak. No additional hardware is required for the Atari version. The voice is generated using the normal SOUND channels and is produced by the television speaker. As speech synthesizers go, SAM’s voice is not bad. I would rate it as one of the more intelligible ones; however, all speech synthesizers tend to sound Scottish to me.

SAM can be used in a number of ways and comes with some supportive BASIC routines on the disk. One of the routines has SAM recite stored text, which includes a passage from Shakespeare and one from the Gettysburg address. Another routine allows you to type in a phrase (in normal English text,) which is converted to the phonemes and recited by SAM. Also, you can control SAM directly (using phonemes) by implementing a USR call from BASIC, so you can add SAM’s voice to your own programs. SAM is also disk-based and is available from Don’t Ask Software, 2265 Westwood Blvd, Suite B-150, Los Angeles, CA 90064.

Display List Interrupts

These small machine-language routines can be written and implemented in a BASIC program very easily. The example does only one, very simple task, but the display-list interrupt can be used to alter any of the hardware registers at any point in the display.

The sample program sets up a display/list interrupt that changes the color of the screen to the blue used for the normal text background. The program goes on to alter the color in the screen background color register to black. The result is a screen that is black with a blue rectangle at the bottom. Text will print in both areas normally, unaffected by the change in color.

The display list interrupt is stored in page 6, which starts at location 1536. Converted to decimal, the interrupt routine is contained in line 90. It begins with a PHA (PusH A onto the stack), decimal 72, so that it can use the register without altering it as far as the interrupted program is concerned. Next, the accumulator is loaded with 148, which is the value for the color of the normal blue background. LDA, immediate, is a 2-byte command, which is 169 in decimal. The next command, a STA, which is a three byte command, is a little more involved than just storing the contents of the A register. It stores to a special hardware register called WSYNC, which is wired to stop the processing until the current scan line is completed. Because of that, the alterations take place while the beam forming the picture is turned off.

Once the preliminary work is complete, the STA (141,24,208) puts the contents of the A register in the hardware register corresponding to SETCOLOR 2,.... Then a PLA (decimal 104) restores the A register with the contents it had when the interrupt was called and the 64 is the return from the interrupt (RTI).

Now that the interrupt is in place, you must implement it, which requires three steps. The first step is to put the address of the routine in the display-list interrupt vector. Line 40 places 1536, which is $0600, into the proper locations. The next step defines where on the screen the interrupt will take place. This requires setting one bit in the display list. The location of the display list is at locations 560 and 561 and is read into the variable DL in line 50. Line 60 sets the highest order bit on the 12th screen line. The interrupt will start at the beginning of the last scan line of that line of characters on the screen.

Before the last step, which enables the display-list interrupt, the sample program changes the text background to black. The POKE following that writes to the non-maskable interrupt-enable register. The two highest order bits (decimal values 128 and 64) enable the display-list interrupt (value 128) and the vertical-blank interrupt (value 64). At that point in the program, the color changes will occur and the computer will be in the immediate mode. You can then enter from the keyboard other SETCOLOR 2,.... commands. The following immediate-mode statement produces an interesting effect: FOR I=0 TO 15:FOR J=0 TO 15 STEP .1:SETCOLOR 2,I,J:NEXT J:NEXT I To restore the screen to the normal colors without the interrupt, just press SYSTEM RESET. More can be added to the display-list interrupt, and this one will be used in later columns to show how various items are added.

Telecommunications

Using modems on personal computers is becoming popular. There are many bulletin board services across the country that allow access without charge as well as several that have rather low fees. On most of the free boards, if you have a modem set up on your computer and a terminal program running, you can access a message base, download programs that will run on your computer, play games, buy and sell used or new computer equipment and software, and even check out the local weather forecast. The message bases discuss almost anything that the callers have found of interest in the public messages and also support, through private messages or in a separate “E-Mail” section, messages to particular callers. Other than discussions of interesting topics, the message bases are also often used to request help on different computers.

These boards are often privately owned, operating out of someones home, although some are owned and operated by computer stores. Almost all of them operate at 300 baud, which is the cheapest modem on the market; many will also operate at 1200 baud, a rate that is becoming more and more popular.

If you do add telecommunications capability, I would like to hear from you. I operate a “side board” on the Outpost at 617-259-0181. It is called Atari World and supports all of the features outlined above.

Telecommunications is a very interesting function that can be added to your home computer. There is a wealth of public domain software, most of it in the games and utilities categories, that can be downloaded from the boards. The message bases, beyond providing entertainment by sporting the discussions (don’t hesitate to jump in the middle of one — you will almost always be welcomed either directly or by someone countering your point of view), also provide a place for you to ask for help with your personal computer. Just leave a message stating what computer model you have (and what peripherals are on it) and explain what the problem is. Chances are you will have a response within a day or two from someone who knows how to solve your problem. If you leave it on Atari World, I’ll probably answer it for you.

10 RESTORE :LOC=1536
20 READ N
30 IF N>256 THEN POKE LOC,N:LOC=LOC+1:GOTO 20
40 POKE 512,0:POKE 513,6
50 DL=PEEK(560)+PEEK(561)*256
60 POKE DL+16,PEEK(DL+16)+128
70 DATA 72,169,148,141,10,212,141,24,208,104,64,256
80 SETCOLOR 2,0,0:POKE 54286,192

MICRO ISSUE 67 / DECEMBER 1983 / PAGE 89

From Here to Atari


by Paul S. Swanson

The listings accompanying this column provide my Christmas greetings to you. The assembly code is for reference. The BASIC program contains the resulting machine language in the data statements. It is an example of using display list interrupts. Enter the BASIC listing to see a color display.

Several display list interrupts control the changing colors in the triangular “tree” in the display and two more are used to color the trunk and to change the text window background to black. Every line of the mode 5 triangle has an interrupt on it. The colors are rotated under the control of the BASIC program.

The BASIC program begins by drawing the tree using dots of random colors. The background color is the only one not used in that section. Later, the display list interrupt will constantly alter the contents of the referenced color registers. The trunk is drawn with the color from register 2, which is declared in BASIC with COLOR 3. This is the same color register used for the text background.

Establishing the points for the interrupts is done in lines 120 through 160. First, DL is set equal to the location of the display list. Next, all of the bytes controlling lines 1 through 31 are altered. The 138 used is the code for GRAPHICS 5, which is 10, plus 128, which sets the display list interrupt enable bit. The tree occupies screen lines 1 through 30 and screen line 31 is the first line on the trunk. The line before the text window gets the last interrupt, which will be used to set the text background to black.

The display list interrupt is read into page six in lines 170 through 190. The vector is set up to point to the routine in line 200 and the first statement in line 210 enables the interrupt. Q is used to control the color base for the interrupt routine and A controls whether the message is “MERRY CHRISTMAS” or “HAPPY NEW YEAR.”

The BASIC loop that occupies lines 220 through 280 alters the color base and prints the messages. The interrupt is going constantly, so the BASIC program does not need to call anything. All that it changes is the contents of location 1664, which is used by the interrupt as the color base. The two phrases, controlled by A, are printed using the loop at lines 230 through 260. The FOR/NEXT loop within that loop controls the timing for printing the individual letters. Lines 270 and 280 dorm a delay at the end of each phrase, then set up A to point to the other phrase.

The assembler routine starts by saving the three registers on the stack. Since it is interrupting the program and it will use these three registers, they must be saved. Otherwise, the program that is interrupted will have the wrong values in the registers when the interrupt returns.

VCOUNT contains the number of the current screen scan line divided by two. This will serve to divide the interrupt into three parts. The triangle shape requires a color rotation, the trunk requires that register 2 be set to brown and the text window requires that register 2 be set to black. VCOUNT is 79 at the interrupt where the trunk color is to be selected, so it is compared to 79. If it is found to be 79, a branch is made to STUMP, where brown is stored in register 2. If it is found to be greater than 79, a branch is made to WINDOW, where register 2 is set to black.

If it is neither equal to nor greater than 79, the color rotation is performed. Since the interrupt happens during the last scan line of the previous mode line, a STA WSYNC, which stops the processor until the end of the current scan line, must be performed before the registers are changed. Preparation for this involves placing the proper colors into the 6502 registers.

The colors are based on whatever is in location 1664, which is controlled by the BASIC program. This is added to VCOUNT and placed in register Y. For register X, $15 is added to the color and $2A is added for register A.

The STA WSYNC is performed next, immediately followed by the three statements that place the colors in the registers. Although the timing is not critical in this program, because the colors affected are not near the left edge of the screen, the placing of the colors takes place totally within the horizontal blank period. The three store commands require 12 machine cycles and there are 26 in the horizontal blank period, although a few of these are stolen by DMA.

Since the color changes are not critical for the trunk and the text window, WSYNC is ignored and the colors are stored directly into the color registers. The $26 is equivalent to SETCOLOR 2,2,6, which is the brown used for the tree trunk. In WINDOW, the background is set to black and the text (register one) is set to a medium white.

The EXIT routine must restore the three registers in the reverse of the order in which they were stored on the stack. After restoring the three registers, the interrupt mask (processor I bit) is cleared and the return from the interrupt is performed. The processor I bit is set when the interrupt is called and leaving it set prevents other interrupts from altering the timing in this interrupt.

POKEY Timers

Another interesting set of interrupts are controlled by POKEY, which is the device responsible for the sounds and operation of the serial I/O bus. There are three POKEY timer interrupts available for general program use, referred to as POKEY timers 1, 2 and 4. These use the values in the AUDF registers, which are the same ones used for generation of sounds.

The advantage to the POKEY timers over the display list or vertical blank interrupts is that they are controlled through independent counters. Display list and vertical blank interrupts depend on the 60 Hz television frame rate and cycle at that frequency. The POKEY interrupts are completely controlled by frequencies which can be set by software.

To get an exact frequency with a POKEY timer is not that easy unless the frequency you want is an even multiple of the clock rates. There are three clock rates available, just as there are for the sound channels. In fact, they are the same sources. The “normal” frequency, which is the one selected when the system is booted, is 63.9210 KHz. This may be changed to count at 1.78979 MHz or 15.6999 KHz. When the interrupt routine is enabled properly, an interrupt happens each time the counter reaches zero. The frequency set for the clock rate can be used to calculate the frequency of the interrupt. The interrupt frequency is equal to: the clock frequency/(2 * (1 + number in the AUDF register)) POKE the value N into the register and the frequency of the interrupt is the frequency set (the 64 KHz or 15.7 KHz)/(2*(N1)). For 1.79 MHz, there is a slight modification of the formula. Divide the 1.79 MHz by two times the sum of N plus 4. If you are clocking two channels together, use 7 instead of the four. If you don’t know what that means, use 4.

When you use the timer interrupts, pay close attention to what is on the system stack. Before jumping through the timer interrupt vector, the operating system pushes the A register onto the stack. Before your routine starts, you should push the X and/or Y registers onto the stack if you intend to use them. Before you return from the interrupt, pull X and/or Y registers off the stack, then PLA and clear the interrupt with CLI. If all that was pushed onto the stack is not pulled off, or if more is pulled off than was put on, the system will crash or at least lock up as soon as you enable the interrupt.

The method for implementing the POKEY timers is stated inaccurately in the manuals. If you set it up the way the manual states, your system will lock up and you will have to press SYSTEM RESET to continue. Instead, first set up AUDCTL ($D208, or 53768) with zero for 64 KHz, one for 15 KHz or 96 for 1.79 MHz. Next, set the volume (AUDC1, 2 or 4 at $D201, $D202 or $D204 53761, 53762 or 53764). Now you can set up your software interrupt routine and change the interrupt vector to point to it. The three vectors are at $0210, $0212 and $0214 (528, 530 and 532). The above steps can be in any order. After all of them are completed, start the timer by POKE 53769,0 (actually, any number from 0 to 255 can be POKEd here and you will get the same effect). After all that is done (not before the POKE 53769, which is what the manual states), enable the timer interrupt.

Enabling the interrupt involves PEEK(16). Add 1, 2 or 4 to that value, which corresponds to the interrupt you are using, and POKE the number back into location 16 and also into location 53774. Once you do that, your interrupt will begin and an interrupt will be generated when the timer you set counts down to zero. As soon as the interrupt happens, the timer is automatically loaded with the value you origionally POKEd there, so the process repeats until you disable it.

Problems to Watch For

Problems associated with POKEY timer interrupts involve timing and other interrupts. DMA can alter, unpredictably, the amount of time between the interrupt and the first action taken by your interrupt routine, making the timing a little less precice. The average over several interrupts will be at your selected frequency, but the timing between two consecutive actions may be off by a few clock cycles if DMA is not disabled.

Other interrupts can also introduce problems. The major problem is the vertical blank interrupt. The only solution to this is to turn off the interrupt, and the display list interrupts if any are enabled, by POKEing a zero to location 559. Make sure you do all your SETCOLOR, GRAPHICS and other statements that depend on shadowing first or resort to using the hardware registers. That POKE also turns off the real time clock and keyboard auto-repeat.

Another interrupt source is the IRQ interrupts. These can be masked out by setting the corresponding bits in locations 16 and 53774 to zero, storing only the 1, 2 or 4 for the POKEY interrupt in those locations. Another possibility is to SEI at the beginning of the interrupt (don’t forget CLI at the end).

If you do not disable the keyboard, you may get some additional delays on some of the interrupts. The keyboard click uses the STA WSYNC command, which stops all processing, including interrupt servicing, until the end of the current television scan line is complete. Also, any other interrupt that leaves the processor “I” bit set will cause the processor to ignore the interrupt. Peripheral access may do this.

If you set up the POKEY timers to do something for you, you may have few, if any, problems with them. The problems mentioned above can be used as places to check if the timing is found to be innaccurate. If you set everything up the way I have described and the system locks up when you enable the interrupt, your machine language may have a fatal error. If you find no error, turn the computer off then on to reboot and try it again.

One undocumented note on the POKEY timers is that you can change the frequency between interrupts. If the calculations for the desired frequency are not exactly what you want, maintain a counter somewhere in memory. At the beginning of the routine, use STA to put the value into AUDF that BASIC placed there. Increment the counter and test it to see if it counted to where you want to make an adjustment. If it is there, store the adjustment frequency into AUDF and reset the counter to zero. The next interrupt will obey the new frequency, then put the old frequency back into AUDF. Remember that this is not documented, so it may not work on all Atari computers. Test it out before you depend on it.

Enabling the POKEY timer interrupts involves a lot of calculation. However, if they are properly enabled, very precise timing can be done with them. I am preparing a project using those timers and I will be writing an article describing it completely.

Next Month

I recently acquired an ATR8000, which is a device containing a Z80 processor, memory, a printer port, an RS-232-C port and disk controller logic so that you can hook up “bare” disk drives to your Atari. The ATR8000 offers CP/M compatibility and, when the CP/M option is not in use, the ATR8000 will act as a printer buffer. A functional description of the ATR 8000, along with pricing, will be featured in next month’s From Here to Atari.

You may contact Paul at 97 Jackson St., Cambridge, MA 02140.

Listing 1
               00005 * Listing 1
               00010 *
               00020 * DLI ROUTINE
               00030 *
               00040 * EQUATES
               00050 *
D40B:          00060 VCOUNT   .EQ $D40B * SCAN LINE COUNTER
DO16:          00070 COLOR0   .EQ $0016 * FOR SE.0,
D017:          00080 COLOR1   .EQ $D017 * FOR SE.1,
D018:          00090 COLOR2   .EQ $D018 * FOR SE.2,
D40A:          00100 WSYNC    .EQ $D40A * WAITS FOR HBLANK
               00110 *
               00120 * INTERRUPT ROUTINE
               00130 *
               00140          .OR $600 * FOR PAGE 6
0600: 4B       00150 DLIROUT  PHA * SAVE REGISTERS *
0601: 98       00160          TYA
0602: 4B       00170          PHA
0603: BA       00180          TXA
0604: 4B       00190          PHA
0605: AD 0B D4 00200          LDA VCOUNT * CHECK
0608: C9 4F    00210          CMP #79     * SCAN
060A: F0 1B    00220          BEQ STUMP    * LINE
060C: 10 21    00230          BPL WINDOW
060E: 18       00240          CLC
060F: 6D 80 06 00250          ADC 1664 * ADD COLORBASE
0612: A8       00260          TAY
0613: 69 15    00270          ADC #$15
0615: AA       002B0          TAX
0616: 69 2A    00290          ADC #$2A
0618: 8D 0A D4 00300          STA HSYNC * WAIT FOR BLANK
0616: 8D 1B D0 00310          STA COLOR2 * STORE COLORS
061E: 8C 16 D0 00320          STY COLOR0
0621: 8E 17 D0 00330          STX COLOR1
0624: 4C 39 06 00340          JMP EXIT
0627: A9 26    00350 STUMP    LDA #$26 * BROWN TRUNK
0629: 8D 18 DO 00360          STA COLOR2
062C: 4C 39 06 00370          JMP EXIT
062F: A9 00    00380 WINDOW   LDA #0 * BLACK BACKBROUND
0631: 8D 18 D0 00390          STA COLOR2
0634: A9 0A    00400          LDA #10 * WHITE LETTERS
0636: BD 17 D0 00410          STA COLOR1
0639: 68       00420 EXIT     PLA  * RESTORE REGISTERS
063A: AA       00430          TAX
063B: 6B       00440          PLA
063C: A8       00450          TAY
063D: 68       00460          PLA
063E: 58       00470          CLI  * CLEAR INTERRUPT
063F: 40       00480          RTI   * AND RETURN
Listing 2
5 REM *** Listing 2 - Christmas Greetings
6 REM *** Program by Paul S. Swanson
7 REM ***
10 GRAPHICS 5
20 FOR I=0 TO 30:REM * DRAW TREE *
30 FOR J=40-I/2 TO 40+I/2
40 COLOR INT(RND(0)*3+1)
50 PLOT J,I+1
60 NEXT J:NEXT I
70 COLOR 3
80 FOR I=36 TO 44:REM * DRAW TRUNK *
90 PLOT I,32
100 DRAWTO I,38
110 NEXT I
120 DL=PEEK(560)+PEEK(561)*256:REM * LOCATE DISPLAY LIST *
130 FOR I=DL+6 TO DL+36:REM * SET INTERRUPTS *
140 POKE I,138
150 NEXT I
160 POKE DL+44,138
170 LOC=1536: RESTORE :REM * READ DLI ROUTINE *
180 READ N
190 IF N<>256 THEN POKE LOC,N:LOC=LOC+1:GOTO 180
200 POKE 512,0:POKE 513,6:REM * ENABLE DLI *
210 POKE 54286,192:Q=255:A=0
220 RESTORE A+2000:? CHR$(125):REM * PRINT MESSAGE *
230 READ N:IF N=256 THEN 270
240 ? CHR$(N);" ";:POKE 1664,Q:Q=Q-1:IF Q<0 THEN Q=255:REM * Q CONTROLS COLORS *
250 FOR I=1 TO 50:NEXT I:REM * DELAY BETWEEN LETTERS *
260 GOTO 230
270 FOR I=1 TO 300:NEXT I:REM * DELAY BETWEEN MESSAGES *
280 A=1000-A:GOTO 220
999 REM * DLI ROUTINE IN DECIMAL *
1000 DATA 120,72,152,72,138,72,173,11,212,201,79,240,26,16,32,109,128,6,168,105
1010 DATA 21,170,105,42,141,10,212,141,24,208,140,22,208,142,23,208,76,57,6,169
1020 DATA 38,141,24,208,76,57,6,169,0,141,24,208,169,10,141,23,208,104,170,104,168,104,88,64,256
1999 REM * MESSAGE #1 *
2000 DATA 32,77,69,82,82,89,32,67,72,82,73,83,84,77,65,83,256
2999 REM * MESSAGE #2 *
3000 DATA 32,72,65,80,80,89,32,78,69,87,32,89,69,65,82,256

MICRO ISSUE 68 / JANUARY 1984 / PAGE 57

From Here to Atari


by Paul S. Swanson

The number of new peripherals you can add to your Atari computer has been steadily increasing. The ATR8000 is a device produced by SWP Microcomputer Products, Inc. that adds CP/M and a few other interesting capabilities. Another addition is a modem, which opens up a new direction to microcomputer users. In addition to the modems which can be attached to the Atari computers directly, any RS232C modem can be used either with the 850 interface module or under CP/M with the ATR8000.

The ATR8000

This peripheral is actually a computer on its own and can be used with or without an Atari computer attached. It does have the standard Atari serial bus connectors, but it can use any RS232C terminal instead of an Atari, connected through its modem port.

I have had an ATR8000 now for about a month and use it to connect three Radio Shack disks to my Atari computer. With such a setup, the drives can be used as Atari drives when not in CP/M mode, or as dual density CP/M drives in CP/M mode.

Using the ATR8000 as a peripheral to the Atari computer (i.e., not in CP/M mode) allows mixing the drives so that drive 1 may be connected to the disk port of the ATR8000 and may be a Radio Shack or other non-Atari drive and drive 2 may be an Atari 810 or 1050 connected along the serial I/O bus. In the CP/M mode, an Atari 810 or 1050 disk drive may not be used.

Two other devices that can be directly connected to the ATR8000 are parallel printers and RS232 devices, such as a serial printer or a modem. When the ATR8000 is not being used for CP/M, it will act as a printer buffer for the printer connected to it. A 64K ATR8000 provides a 48K printer buffer. This buffer will work for any printer attached to the parallel port on the ATR8000. It does not work for printers that are connected using the Atari serial I/O bus or 850 interface module.

A modem can also be connected to the ATR8000 using its serial port. The modem must be RS232 compatible and is controlled directly by the ATR8000. The modem connected in this fashion is not available to the Atari computer as device "R:", but may be used under CP/M. A modem connected to the 850 interface may be used by the Atari computer as device "R:" when not in CP/M mode. There are several different configurations allowed with the ATR8000, particularly if you also have an 850 interface.

There are also a few drawbacks to consider. The device does generate a large amount of television interference, particularly if you use a ribbon cable connector for the printer. It may even display an interference pattern on the television you use as a monitor for your Atari computer. A ferric core is supplied with the ATR8000 to suppress this interference (by wrapping the cable from the Atari to the television around it) on your monitor/television. Another problem is that you have to build cables. The pinouts are provided in the manual and the three ports on the ATR8000 are edge card connectors. The printer cable required the most work to assemble. The disk cable was relatively easy. The Radio Shack disk cables will work with no problem, even when using disks which are not Radio Shack disks. The only caution with using Radio Shack disk cables is that the drive selection is done in the cable, so you have to put the drives onto the cable in the correct order and the select on the disk drive must agree with the select on the cable connector.

The ATR8000 manual explains how to alter a Radio Shack drive to use it on the ATR8000. I ran into a slight problem with that, however, because the Radio Shack drives I have are not the same kind as the ones described. If you try this and find you have the older Radio Shack drives, all that is required is to sever the only jumper across the connector inside the drive. When you open the drive, which wire to cut will be obvious.

Since most “bare” disk drives will work with the ATR8000, including 8" drives with an alteration, it is tempting to get an ATR8000 and two drives from a surplus electronics store instead of two Atari drives if you are upgrading to a disk system. Careful shopping can result in drives for less than $150 each. The ATR8000 lists at $349.95 (16K without CP/M) or $499.95 (64K with CP/M), which adds up to $649.95 or $799.95 — less than the cost of the two Atari disk drives. You will still need the cable and a power supply for the disk drives, but if you do this, you will also have the printer connection with the 48K buffer and a modem port, plus CP/M if you get the 64K version, not to mention the ability to add a third drive for under $150 if the power supply is adequate for three disks.

Using CP/M with an Atari does have one serious problem associated with it, which is that CP/M requires an 80-column screen and the Atari screen has only 40 columns. The software that accompanies the ATR8000 contains a program that turns the Atari into a terminal for CP/M use. The screen is sectioned and moves back and forth to allow you to see the 80 columns with a 40-column window.

There is a better solution for more serious CP/M users. Austin Franklin has provided the software on a cartridge for the 800 to allow use of his 80-column board with CP/M. The system runs on the Atari 800 computer. The 80-column board and the software for using it for the ATR8000 is available from Austin Franklin Associates, Inc., 43 Grove Street, Ayer, MA 01432, (617) 772-0352. The 80-column board lists at $289.95 and the software allowing its use with the ATR8000 lists at $29.95.

Telecommunicating with your Atari Computer

Modems create one of the more unusual ways to meet people. All over the country there are free bulletin boards for computers to call. If you have a modem on your Atari computer, you were probably informed amply about major national networks where you, for a fee, can tap in and take advantage of various services. In addition, there are many telephone numbers you can use to connect your computer to services that are completely free.

These free bulletin board services, or BBS’s, are run mainly by private individuals on many different types of microcomputers. They provide a public message base, which usually have some interesting conversations that you can jump into, as well as other features. Many have downloading sections where you can obtain copies of public domain programs for your Atari. Some have “feature articles” which are the electronic equivalent of magazine articles. Most have private mail capability to allow you to communicate with specific other users if you have something private to discuss.

There are also games available for you to play on many of these BBS’s while you are connected. Bulletin files may be read, which tell you things about the computer you have connected with or about some recent alterations in the services provided. Almost all of them also have a help file you can read, which tells you how to operate the BBS.

I am now involved with two of these BBS’s. One I mentioned in a previous column, which is the Atari World section of the Outpost (617-259-0181). Another I have set up on my Atari computer. This one, Nite Lite, is on line from 6pm to 6am (eastern time) at 617-576-2426. Both support message bases and have bulletins, help screens and games. Both also answer at either 300 or 1200 baud and have lists of other boards in this area. In the near future, I will post a list of several boards in other areas of the country, so you will be able to call the number for Nite Lite (please take careful note of the hours) and get a list containing numbers that may be closer to you.

In many ways, these BBS’s resemble the CB radios, which allowed communication between people who have never met. Some of the informality and lack of self-consciousness that CB radios created in conversations can be seen on the BBS’s. The main difference between CB radio and the message bases of these BBS’s is that the messages have to be typed and can be reviewed. It seems to result in more sophisticated conversation, almost always interesting and well worth reading.

In addition to idle chatter, discussions concerning national or local politics, critiques concerning news items and other discourse, the message bases are also a very good source of help for you concerning, among other things, your computer. If you are having a problem and don’t know how to solve it, you are looking for some hardware or just some advice on making a decision, all you have to do is post a message on one of the local BBS’s. You will probably have several replies within a few days and if your problem is interesting, you may even see messages where other people have started discussing it on their own.

The future of these free BBS’s looks very promising. As an example of what can happen, both Nite Lite and the Outpost are members of BINEXNET, which is Boston INformation EXchange NETwork. One of the planned functions of this network is an exchange of mail (the messages) among the member BBS’s. If this is implemented successfully, this network will be looking to tie into other networks around the country to exchange mail. The result, if successful, will be the electronic equivalent of letter mail, except there will probably be no charge.


MICRO ISSUE 69 / FEBRUARY 1984 / PAGE 57

From Here to Atari


by Paul S. Swanson

SofToy

About a year or more ago, I purchased a copy of My First Alphabet, which nicely supplemented material my young daughter was learning from Sesame Street. The alphabet and the numbers through nine are no mystery to her. She is now 2-1/2 and still enjoys the program, but in looking for other programs for her to try, I came across SofToy, a product of Monarch Data Systems, Inc. (P.O. Box 207, Cochituate, MA 01778). The object of this game is, like My First Alphabet, teaching the letters. In SofToy, however, a much different approach is used.

The first of several levels in the program teaches keyboard zones. Nine pictures on the screen can be animated by pushing a key in the corresponding zone on the keyboard. An appropriate sound accompanies the animation. For example, the sound of the train whistle accompanies smoke pouring out of the smokestack. The next level uses the same nine pictures with numbers, performing the animation routine in response to the corresponding number key.

The levels advance next to random letters below each picture. At various times, the screen lights up and makes an easily distinguishable sound and a new set of letters appears below the picture. As with the numbers, the pictures are animated in response to pressing the corresponding keyboard key. There are also two variations of the numbers and letters schemes. One is program mode, where you can enter a string of letters or numbers, then hit RETURN and the computer will play the indicated pictures in that order. The second variation is a match game. Once the match game is set up, two pictures, one at a time, will animate. The object is to press the keys, in the same order, which correspond to those two pictures.

In contrast to My First Alphabet, SofToy is a much easier program for a preschooler to master. There are no wrong buttons on the computer at all. On My First Alphabet, SYSTEM RESET will cause a reboot and the function keys are used to display and control a menu of selections, requiring reading on the part of the operator. SofToy has no menu. The only words on it really don’t have to be read in order to operate the game and the screens indicate which mode the game is in much more obviously than does My First Alphabet.

Printing

I recently acquired an Atari 1027 letter quality printer. Although I reviewed it when I announced the new Atari product line, I have now had some practical hands on experience with it. The printer is produced by Atari and the list price is $349.95. In contrast to dot matrix printers, this 1027 is very small — barely enough room to accommodate the paper. It is about the same width as my Epson MX-80, but only half as deep and about 3/4 as high. I found this to be a convenient feature. The printer can be placed almost anywhere. No longer does a large supply of continuous form need to be placed under the printer, with enough room for long listings to scroll off onto the floor behind it. The 1027 is designed for single sheets, so no room for paper is really required at all. I use it with continuous form, ripping the sprocket holes off so that the paper will fit. Single sheets tend to slip when the end of the sheet gets past the initial rollers, which isn’t a problem with the continuous form. The printer is very slow, which is a drawback in many ways. I will admit that part of the satisfaction of this new acquisition is that I also have the faster Epson printer for listings and drafts. However, for occasional use, this very inexpensive letter quality printer is a printer worth considering.

The Atari 1027 printer produces good quality output when used within its limitations. In addition to the problems with slipping when using single sheets, I have also had problems with mailing labels. If the paper is too heavy, the surface is too soft for the printer and I have yet to discover any adjustment to compensate, so mailing labels didn’t work. Many of the letters simply didn’t legibly print. The printer is excellent for letters, reports and anything else that requires letter width paper, which may be ideal in places like a college or university for use in word processing, producing the multitude of written work required.

New Topics

Many of the topics covered in this column are based on letters received. If you would like to see any particular topic covered in this column, send a letter to me or, if you have a modem on your computer, you can leave it as a message on Nite Lite or in the Atari World section of the Outpost, which is at (617) 259-0181.


MICRO ISSUE 70 / MARCH 1984 / PAGE 41

From Here to Atari


by Paul S. Swanson

Free Connections

In a surprising number of homes all over the country people are donating their time, computer equipment and phone lines to the public. These people operate computer bulletin board services (BBS’s). Calling BBS’s is becoming a very popular pasttime. These BBS’s, or “boards” as they are more commonly called, usually contain a message base where callers can post messages on just about any topic they care to discuss. For example, in the message bases of the boards I call in this area contain ongoing discussions about national politics, US-USSR relations, nuclear weapons control and economics. There are also other discussions concerning the possibilities of colonizing other planets. In addition, there are more “down to earth” topics such as for sale and wanted ads, announcements of the numbers of new boards, questions and answers about computers and critiques of television shows and movies. Other features offered by these boards include on-line games, local weather reports, public domain software, private electronic mail, lists of the telephone numbers of other boards, help screens and chat. The chat mode calls for the BBS’s owner, usually referred to as the “SysOp,” to converse via the keyboards. Almost all of the boards have most of these features. Some boards also have multiple message bases so that conversations are categorized by some general criteria. If, for example, you didn’t want to have anything to do with the current political discussion, you wouldn’t have to see it at all, but could look at all of the other messages.

Obtaining the public domain software available on the boards requires that you have a terminal program that can download files. Normally, this requires that you have a disk drive on your system, but there are some programs that will work with cassettes. There are an enormous number of public domain programs on the boards ranging from games to serious utility programs, which makes obtaining a terminal program that allows downloading a worthwhile effort. If you run into problems finding one for your particular computer, you can leave a message on one of the boards asking for help.

This service is, of course, not free of problems. Occasionally there will be a “problem caller” on a board, doing some things which cause problems on the system. For this reason, many boards have instituted password systems. These passwords are almost always free as long as you leave your real name and a valid telephone number for verification. That way, the SysOp knows who is using his computer and if anyone causes problems, he knows who to call by the password used. Although having to apply for a password intimidates some new users, it has been effective in eliminating problems like this on most boards. Usually on these password systems, you are also allowed use of a fictitious name on the board so that, if you are shy about using your own name, only you and the SysOp know who you really are. Getting started is usually the hardest part of communicating with free boards. The problem is getting the first number to call. Not too many places list these free telephone numbers. I have listed some boards below which are in the Cambridge area. North Shore AMIS, which is running on an Atari, has a list of Atari-run boards all over the country. The numbers are in the Features section in a file called ATARIBBS. When you have called there for the list, call the board that is listed as being nearest you to look for the numbers of other boards that are in your area.

There are some standards to be considered in the communication. Almost all boards, at either 300 or 1200 baud, communicate with 8 bits per word with one stop bit, no parity, full duplex ASCII. If your terminal program has ways to alter the communications parameters, those will probably be the items listed. If any of them are not listed or not alterable, your terminal program probably already assumes the correct value, since those selections are so standard. If you are not sure of any particular setting, try it one way and call a board. If you find that the computers cannot communicate, alter the parameter in question and try again. Trial and error will eventually get you through, although odds are good that the default values set for your program are those described above.

Calling the boards in your area can be informative, useful and, of course, very entertaining. The biggest problem with them is that they are addictive, so you have to keep careful track of how much time you spend on this interesting new hobby. Some BBS’s in the Cambridge area (all in the 617 area code) are:

There are actually over 30 free boards which are in the local dialing area of Cambridge. The other numbers are listed on the above boards. All of the boards above will answer at either 300 or 1200 baud except King’s Castle, which is 300 baud only. The hours for my board, Nite Lite, are eastern time. Please make the appropriate adjustment for your time zone.


MICRO ISSUE 70 / MARCH 1984 / PAGE 78

From Here to Atari


by Paul S. Swanson

I have been testing my ATR8000 (a peripheral discussed previously in Micro No. 68) in different modes this month and am impressed by its versatility. I recently acquired the latest release of MYDOS which greatly expands the capacity of the ATR8000 when used as an Atari peripheral.

MYDOS replaces the functions of Atari DOS and adds others required to support more features of the ATR8000. MYDOS will act as a direct replacement for Atari DOS when used with most programs. The only exception I found is the result of a bug in MYDOS not allowing random access updating in files, but have received word that the problem is being addressed by the author of MYDOS, Charles W. Marslett. MYDOS is distributed by SWP Microcomputer Products, Inc., in Arlington, Texas 76011, which is the company producing the ATR8000.

Most of the additional features of MYDOS concern the different configurations of disk drives available through the ATR8000. Supported in the 5-1/4" line are single sided single density 40 track disks, like the 810 drives use, giving about 90K of storage, to double sided double density 80 track drives which store over 700K. With a $19.95 adapter for each, the ATR8000 will also support 8" drives. Single sided 8" drives will hold almost 500K and double sided 8" drives will hold 990K. The net result of this is a lot more storage capacity for the Atari computer. For example, using four 5-1/4" double sided double density 80 track drives yields about 2.8 megabytes of on-line storage. Four double sided 8" drives would hold almost 4 megabytes. To transfer back and forth from the single sided single density Atari-compatible disk formats there must be one such disk on line, but for maximum storage that drive can first be used to make the transfers, then removed and replaced with a larger capacity drive for actual operation.

On my system (until I go get a double sided 80 track 5-1/4" drive, anyway) I have two TRS-80 drives connected by a Radio Shack drive cable. Used in double density mode this gives me the equivalent of four Atari disk drives, or about 360K. MYDOS will allow me to define these disks as either single or double density and will automatically redefine them if, for example, I put a single density disk in a double density configured drive, or vice versa. This automatic redefinition will work in DOS mode, but is not automatic once a program is running, so before executing a program it is important to verify that the disks are configured the way you want to use them.

Other interesting features in MYDOS includes modification to the DOS C (copy file), I (initialize) and J (duplicate) commands. Copy may be done from any filespec to any filespec, and with the RS232 version of MYDOS, version 3.16, a file may even be copied from disk to the RS232 port, which is not possible under Atari DOS or without the ATR8000 RS232 port. Initialized, used in Atari DOS as a format command, can be specified to format or just erase the diskette. The duplicate command has two options. First, only a certain range of sectors may be specified. Second, the destination drive may be either formatted or erased before the duplication is done.

Another interesting feature of MYDOS is the ability to create multiple directories on one disk. This eliminates the 64-file limit imposed under Atari DOS. Each additional directory is installed as the equivalent of one file name in the main directory and may also contain up to 64 file names. Since the ATR8000 supports so many different drive configurations, some further control is also supported. For example, different disk drives will respond at different speeds. One of the additional controls sets the amount of time required to move the disk read/write head from one track to the next to accommodate slower drives. This can be set differently for each drive on the system. The default for 5-1/4" disks is 6ms per track, but that may be redefined to as slow as 30 ms per track. Basically, if you are having problems reading disks on a particular drive, you can try slowing it down on the assumption that you are not giving the disk sufficient time to position the head before a read or write operation. There are also several other double density disks compatible with the Atari computers. MYDOS will support these drives also. Some of these third party disk drives, like the Trak drive produced by Trak Microcomputer Corporation at 1511 Ogden Ave., Downers Grove, Ill. 60515, retailing at $499.00, also has a printer port with a small built-in printer buffer (4K).

MYDOS also has added file manager routines, accessible in BASIC using the XIO command, to support these new functions. On some, the same XIO commands are available as in Atari DOS, but the AUX1 and AUX2 bytes, normally zero for Atari DOS, have some other information in them. These control the type of formatting to be done, the number of sectors on the drive and so forth. XIO commands added include things like creation of new directories and setting the default directory.

In addition, MYDOS 1.16 supports the ATR8000 RS232 port. The basic difference between this RS232 handler and the one used with the 850 interface is that MYDOS contains the handler as an integral part of DOS. This means that, if you are using DUP.SYS (DOS command from BASIC) you don’t lose the RS232 handler. It is simply always there. This drawback to the 850 handler is particularly annoying when working in machine language because it is always required to append the object file to the AUTORUN.SYS file used to load the handler. In MYDOS, the machine language routine that accesses the RS232 port can be run directly without worrying about loading any handler.


You may contact Paul Swanson at 97 Jackson St., Cambridge, MA 02140.

MICRO ISSUE 71 / APRIL 1984 / PAGE 73

From Here to Atari


by Paul S. Swanson

I recently added an Atari 800xl computer to my collection. The main differences between that system and the earlier Atari 400, 800 and 1200xl computers is that no BASIC cartridge is required. BASIC is built in. I also noted some differences in the keyboard. The Atari 1200xl keyboard is still the best of the series and I use that system for my word processing. However, the Atari 800xl keyboard is close competition. The keys are non-glare type finish and have shorter strokes than the ones on the Atari 1200xl computer, which may be preferable to some touch typists.

What really impressed me about the Atari 800xl computer was one of the details of the design. The cartridge slot has two metal strips forming a double door configuration, opening inward when a cartridge is inserted. When the cartridge is removed they spring closed again. The impressive detail is that there is no way to trap your finger in it. This seems like a minor point until you consider having a small child at the computer. The configuration of the cartridge door looks like an ideal setup for trapping small fingers, but after spending about 20 minutes studying the door, I concluded that there was no way it could trap anything.

MYDOS UPDATE

Last month I reported a few bugs in MYDOS. Since then I have been in communication with SWP concerning that product. The updating of random access files has been corrected in versions 3.012 and 3.17. I noted that other minor bugs that I had uncovered have also been corrected. The new version should be available by the time you read this column.

I also acquired an 80-track disk drive for my ATR8000. Using MYDOS to configure it, the 80-track double sided Qume disk holds about 734K of usable disk space. That is a little more than eight times the capacity of an Atari 810 disk drive.

TELECOM UPDATE

Nite Lite, the computer bulletin board I’m running every night, has been a good source of information concerning how people are setting their Ataris up for telecommunication. If you have an Atari 850 interface or an ATR8000 you still have the widest selection. Any RS-232 compatible modem will connect to either of these devices directly.

There are many callers who do not have Atari 850 interfaces or ATR8000’s connected to their systems. These Atari owners use either the Atari 835 modem or the MPP-1000. The Atari 835 is a little more expensive, but connects along the serial bus like other peripherals. The MPP-1000 plugs into a joystick port.

I have noted one problem with the MPP-1000C, which is that it doesn’t respond as device R: so no custom software or any other software not specifically written for that modem will work. That eliminates what seems to be the most popular software on the Atari computer in this area, which is a public domain program called AMODEM. However, the MPP-1000 comes with software that is at least comparable. The problem arises when you want to do other things with the modem. For example, there are several people who want to start their own computer bulletin boards, which requires different software.

If you are looking for ways to get into telecommunication with your Atari computer, without an Atari 850 interface module or an ATR8000, the MPP-1000 is the least expensive route. Other than that one problem, I have heard no complaints, so that modem seems to be worthy of consideration. I will be looking into the features of that modem and ways around the problem of interfacing it to other software. This will be reported in future columns.

Information such as this can also be found on Nite Lite if you already have telecommunications capabilities at either 300 or 1200 baud. Nite Lite operates from 7:00 pm until 7:00 am, eastern time, at (617) 576-2426. If you call, leave me a message telling me that you got the number from this column. You are, of course, welcome to leave suggestions of issues for me to address in this column on Nite Lite.

Telecommunications is a rapidly expanding area on personal computers. As the number of callers increases, the amount of information and entertainment available from these computer bulletin boards increases proportionally. There are also other new services opening up that are accessible using the same equipment and software required to access the free bulletin boards.