Dale’s Atari 800 Games › Stan Ockers
By Stan Ockers, in the ACE newsletter of May 1984.
Play Johnny's PaintboxJohnny's Paintbox is a drawing program offering six colors and a number of automatic shape generators. In addition to the normal line drawing mode there are modes to draw Rectangles, Triangles, Circles the Alphabet as well as modes to Save and Load pictures.
All other modes return to the normal line drawing mode. Lines are drawn using a joystick in player #1 position. The trigger must be pressed to cause the line to be drawn. This mode is indicated by a horizontal line to the right of the numbers at the bottom of the screen. The color of the line indicates the color active at the moment. You can select a new color by pressing the number key corresponding to the desired color. This is also true for the shape modes. Color 0 can be used to erase lines, (again, the trigger must be pressed).
The ‘OPTION’ key can be used to clear the screen. It is only active in the normal mode. There is also a ‘fill’ function in the normal mode. It is activated by pressing the spacebar. An area enclosing the cursor will be filled in using the color currently active. Sometimes only part of the area will be filled in and it will be necessary to move to a blank portion and use the spacebar again. Only background area can be filled in.
The speed of the cursor can be changed using the key with the Atari symbol. When you press it, a number representing the current speed will appear. You may now select any number 1-9 with 1 being the fastest. Any other key will return you to normal mode with the speed unchanged.
The circle mode is entered by pressing the ‘C’ key. A circle in the active color will appear to the right of the numbers. Position the cursor where the circle center is to be located before you press ‘C’. Pushing the joystick up will increase the size and down will decrease the size of the circle. If you return to the original cursor size, no circle will be drawn. If any part of the circle reaches an edge you will not be allowed to increase its size further. Change the circle color by using the number keys. The circles are actually ovals because of the difference in horizontal and vertical sizes of the pixels. Press the spacebar to exit the circle mode when you have the size of circle you desire.
Use the ‘R’ key to enter this mode. The cursor must be positioned where the lower left corner of the rectangle will be. Vertical stick movement incereases and decreases the vertical size of the rectangle while horizontal movement controls the horizontal size. Number keys allow you to change the color and the spacebar is used to freeze the rectangle and exit the mode. This mode is useful to erase blocks of area on the screen. Just expand the rectangle out and contract it back to a point before hitting the spacebar.
Enter using the ‘T’ key. Horizontal joystick movement, (without the button pushed), controls the baseline of the triangle while vertical movement controls the vertical position of the vertex. The starting position is at the leftmost edge of the baseline. By pushing the fire button while moving the stick horizontally, you can control the horizontal position of the vertex. This mode is a little trickier than the others and may take some practice. Again, use the spacebar to exit.
Uppercase letters of the alphabet can be drawn in this mode. The starting position indicates the upper left corner of the first letter. Enter using the ‘A’ key. An ‘A’ in the active color indicates you are in the alphabet mode. The cursor will move after each letter is drawn. If you want to go back, the backspace key works. Again, number keys can be used to change the current color. For this reason, you can't draw numbers, just letters. The program won't let you draw letters if your position is too far to the right or too low for complete letters to be drawn. You must use the RETURN key to leave this mode since the space is a valid character.
When you have finished your sketch and wish to save it to disk, press the ‘S’ key. A question mark will appear to the right of the numbers. It is asking for a filenumber. You have a choice of ten from 0 thru 9. Press one of these number keys to save your picture. If a picture of that number already exists it will be written over. You will automatically be returned to the normal mode when the save is complete. Pressing any key other than 0-9 will abort the save.
Press ‘L’ to load a file. The question mark indicates you should press a number 0-9 as the filenumber. The program will load the file to the screen and return to the normal mode. There is no provision to allow for a file not existing, an error condition will occur and stop the program. To prevent this you should save something under each filenumber, even if it is a blank screen.
—Stan Ockers

The listing, “JOHNNY'S PAINTBOX by Stan Ockers”, is on pages 8, 9 of the issue. Stan wrote it in Action!, the compiled language from Optimized Systems Software, and readers needed the Action! cartridge to type it in and compile it. There is no Action! compiler here, so the game page runs a hand translation of the listing into JavaScript: one function for each of Stan’s procedures, with his variable names, sizes and memory addresses, driving the same emulated Atari 800 (its screen, player-missile graphics, collisions and sound) that runs the BASIC games.
Where this copy came from: Written in Action!. The listing was transcribed by hand from the scan (pages 8-9; there is no typed-in or compiled copy). The game page runs a hand translation of the listing into JavaScript. The picture is GTIA mode 10 over a GRAPHICS 7 screen; Stan's choice of colour numbers (9, 10 and 11 for three of his six paints, with only the first three playfield colours set) is taken to mean those values showed PF0-PF2 on his 800. Pictures save to “D:JOHNn.PIC” in your browser instead of a disk; loading a number never saved leaves the picture as it is instead of stopping the program.
; JOHNNY'S PAINTBOX
; Stan Ockers 3-84
; Written in Action! (c) 1983 ACS
;
; ACE NEWSLETTER, 3662 VINE MAPLE DR
; EUGENE. OR 97405 MAY 1984 $12 YEAR
;
MODULE
BYTE j,k,m,paint,consol=53279,key=764,
under,stk,v,w,byt,sel,x,y,x1,y1,
x2,y2,r,spd
BYTE ARRAY hue=[0 2 3 9 10 11 8],
sign=[18 9 65 8 79 63]
INT delx,dely
PROC Prtchar(BYTE byt)
CARD st,pos
IF byt<32 THEN st=(byt+64)*8+57344
ELSEIF byt<96 THEN
st=(byt-32)*8+57344
ELSE st=byt*8+57344 FI
FOR k=0 TO 7
DO
byt=Peek(st+k) j=7 pos=1
WHILE pos<256
DO
IF byt&pos THEN color=hue(paint)
ELSE color=0 FI
Plot(v+j,w+k)
j==-1 pos==*2
OD
OD
RETURN
PROC Ding(BYTE pitch,CARD dly)
BYTE loud
CARD wait
FOR loud=0 TO 15
DO Sound(0,pitch,10,15-loud)
FOR wait=1 to dly DO OD OD
Sndrst()
RETURN
PROC Mode() ; Print mode symbol
v=70 w=89 byt=sign(sel) Prtchar(byt)
Ding(sel*10+30,600) key=255
RETURN
PROC Init()
Graphics(23) Poke(752,1) Poke(623,128)
Poke(87,10) Poke(704,12) Poke(705,70)
Poke(706,56) Poke(708,46)
Poke(709,214) Poke(710,134)
Poke(712,102) x=40 y=40 delx=0 dely=0
color=2 Plot(0,0) DrawTo(79,0)
DrawTo(79,88) DrawTo(0,88)
DrawTo(0,0)
FOR m=1 TO 6 DO
v=8*m+8 w=89
paint=m Prtchar(48+m) OD
sel=0 Mode() x=40 y=40 under=0 spd=5
RETURN
PROC Hues() ; Change color using keys
IF key=31 THEN paint=1 Mode()
ELSEIF key=30 THEN paint=2 Mode()
ELSEIF key=26 THEN paint=3 Mode()
ELSEIF key=24 THEN paint=4 Mode()
ELSEIF key=29 THEN paint=5 Mode()
ELSEIF key=27 THEN paint=6 Mode()
ELSEIF key=50 THEN paint=0 Mode() FI
RETURN
INT FUNC Abs(INT n)
IF n<0 THEN RETURN( -n ) FI
RETURN( n )
; From Action! Programmers Disk
PROC Circle(INT r)
INT Phi,Phiy,Phixy
Phi=0 x1=r y1=0
DO Phiy = Phi + y1+y1 + 1
Phixy = Phiy - x1-x1 + 1
Plot(x+x1,y+y1) Plot(x-x1,y+y1)
Plot(x+x1,y-y1) Plot(x-x1,y-y1)
Plot(x+y1,y+x1) Plot(x-y1,y+x1)
Plot(x+y1,y-x1) Plot(x-y1,y-x1)
Phi = Phiy y1 = y1 +1
IF Abs(Phixy)+0<Abs(Phiy) THEN
Phi=Phixy x1 = x1 - 1 FI
UNTIL y1 > x1 OD
RETURN
PROC Brush() ; Fill in area with color
j=x WHILE Locate(j-1,y)=0
DO j==-1 OD color=0 Plot(x,y)
color=hue(paint)
WHILE Locate(j,y)=0 DO
k=y WHILE Locate(j,k)=0
DO Plot(j,k) k==+1 OD k=y-1
WHILE Locate(j,k)=0
DO Plot(j,k) k==-1 OD
Plot(j,y) j==+1
OD under=color
RETURN
PROC Dly(CARD wait)
DO wait==-1 UNTIL wait=0 OD
RETURN
PROC Draw()
stk=Stick(0) stk==!15 delx=0 dely=0
IF stk&1 THEN dely=-1 FI
IF stk&2 THEN dely=1 FI
IF stk&4 THEN delx=-1 FI
IF stk&8 THEN delx=1 FI
x==+delx y==+dely
IF x>78 THEN x=1 FI
IF y>87 THEN y=1 FI
IF x<1 THEN x=78 FI
IF y<1 THEN y=87 FI
IF Delx<>0 OR Dely<>0 THEN
under=Locate(x,y) FI
color=9 IF under=9 THEN
color=2 FI Plot(x,y) Dly(500*spd)
IF Strig(0)=0 THEN color=hue(paint)
ELSE color=under FI
Plot(x,y) Dly(500*spd)
RETURN
PROC Rectangle()
x1=x y1=y DO
color=0 Plot(x,y) DrawTo(x1,y)
DrawTo(x1,y1) DrawTo(x,y1) DrawTo(x,y)
stk=Stick(0) Hues()
IF(stk&1)=0 AND y1>1 THEN y1==-1 FI
IF(stk&2)=0 AND y1<y THEN y1==+1 FI
IF(stk&8)=0 AND x1<78 THEN x1==+1 FI
IF(stk&4)=0 AND x1>x THEN x1==-1 FI
color=hue(paint) Plot(x,y) DrawTo(x1,y)
DrawTo(x1,y1) DrawTo(x,y1) DrawTo(x,y)
IF key=33 THEN
IF x1>x OR y1<y THEN under=color FI
EXIT FI OD
RETURN
PROC Letters()
key=255
DO IF key<255 THEN
x=v y=w Hues() v=x w=y
IF key=12 THEN EXIT FI
IF key=52 AND v>8 THEN v=v-8 FI
byt=Peek(65342+key) key=255
IF byt<128 AND v<70 AND w<80
AND (byt>38 OR byt=32)
THEN Prtchar(byt)
IF v+8<70 THEN v=v+8 FI FI
FI
under=Locate(v,w) color=hue(2)
IF paint=2 THEN color=hue(3) FI
Plot(v,w) Dly(1000) color=under
Plot(v,w) Dly(1000) OD
RETURN
PROC Triangle()
x1=x x2=x y1=y y2=y
DO color=0 Plot(x,y) DrawTo(x1,y1)
DrawTo(x2,y2) DrawTo(x,y)
stk= Stick(0) Hues() Dly(1000)
IF (stk&1)=0 AND y1>1 THEN y1==-1 FI
IF (stk&2)=0 AND y1<87 THEN y1==+1 FI
IF (stk&8)=0 AND x2<78 AND Strig(0)=1
THEN x2==+1 FI
IF (stk&4)=0 AND x2>1 AND Strig(0)=1
THEN x2==-1 FI
IF Strig(0)=0 AND (stk&8)=0 AND x1<78
THEN x1==+1 FI
IF Strig(0)=0 AND (stk&4)=0 AND x1>1
THEN x1==-1 FI
color=hue(paint) Plot(x,y)
DrawTo(x1,y1) DrawTo(x2,y2)
DrawTo(x,y)
IF key=33 THEN
IF x1<>x OR x2<>x OR y1<>y OR y2<>y
THEN under=color FI EXIT FI OD
RETURN
PROC Round()
r=0
DO color=0 Circle(r) Hues()
stk=Stick(0)
IF (stk&1)=0 AND r+x<78 AND x-r>1
AND r+y<87 AND y-r>1 THEN
r==+1 FI
IF (stk&2)=0 AND r>0 THEN
r==-1 FI
color=hue(paint) Circle(r)
IF key=33 THEN EXIT FI
OD
RETURN
PROC CIO=$E456(BYTE areg,xreg)
; See page 137 of Action! manual
PROC Loadfile()
BYTE ARRAY filename
BYTE iocb2cmd=$362
CARD scrn,iocb2buf=$364,iocb2len=$368
filename="D:JOHNX.PIC"
key=255 byt=0
DO IF key<255 THEN byt=Peek(65278+key)
key=255 IF byt>47 AND byt<58 THEN
filename(7)=byt FI
EXIT FI OD
IF byt<48 OR byt>57 THEN RETURN FI
OPEN(2,filename,4,0) iocb2cmd=7
scrn=Peek(89)*256 scrn==+peek(88)
iocb2buf=scrn
iocb2len=3520 CIO(0,$20) Close(2)
under=Locate(x,y)
RETURN
PROC Savefile()
BYTE ARRAY filename
BYTE iocb2cmd=$362
CARD scrn,iocb2buf=$364,iocb2len=$368
filename="D:JOHNX.PIC"
key=255 byt=0
DO IF key<255 THEN byt=Peek(65278+key)
key=255 IF byt>47 AND byt<58 THEN
filename(7)=byt FI
EXIT FI OD
IF byt<48 OR byt>57 THEN RETURN FI
OPEN(2,filename,8,0) iocb2cmd=$0B
scrn=Peek(89)*256 scrn==+peek(88)
iocb2buf=scrn
iocb2len=3520 CIO(0,$20) Close(2)
RETURN
PROC Speed()
Ding(30,600) key=255 byt=spd+48
v=70 w=89 Prtchar(byt)
DO UNTIL key<255 OD
byt=Peek(65278+key)
IF byt<49 OR byt>57 THEN Mode()
RETURN FI
spd=byt-48 Mode() RETURN
PROC Main()
Init() sel=0 DO
IF sel<>0 THEN sel=0 Mode() FI
IF key=33 THEN Brush()
ELSEIF key=63 THEN sel=2 Mode()
v=x w=y Letters()
ELSEIF key=18 THEN sel=4 Mode()
Round()
ELSEIF key=40 THEN sel=1 Mode()
Rectangle()
ELSEIF key=45 THEN sel=3 Mode()
Triangle()
ELSEIF key=0 THEN sel=5 Mode()
Loadfile()
ELSEIF key=62 THEN sel=5 Mode()
Savefile()
ELSEIF key=39 THEN Speed()
FI Key=255
IF consol=3 THEN Init() FI
Draw() Hues()
OD
RETURN