Dale’s Atari 800 Games › Stan Ockers
Alphabet Bee
By Stan Ockers, in the ACE newsletter of June 1984.
Play Alphabet BeeStan’s write-up
Alphabet Bee is a program to help pre-schoolers learn the alphabet. The object is to pick letters in alphabetical order and carry them to the hives at the right and left limits of travel. If the wrong letter is brought, it will return to another flower. Use a joystick in player #1 position and press the fire button to pick up or release the letters. If you have difficulty picking up the letters, you can hold the button down while you ‘buzz’ around the flower. The letters can't be released until you reach the limits of travel. You can restart at any time by using the START key. The OPTION key will toggle on and off a listing of the alphabet to copy.
The program uses a number of techniques you might like to investigate. Horizontal scrolling is provided by installing a display list in page six. Action! has no trouble in changing the LMS addresses fast enough to scroll quite smoothly. A single line player missile graphics area is placed at the top eight pages of memory. The ten pages below this are allocated to screen data, each page holding data for two horizontal lines. Memory top is lowered for this 18 pages before a Graphics 1 command is issued. This places the text area 180 bytes below the new memtop. The graphics 1 screen created is never used, but information is put in the text area which the display list has changed to graphics 1 lines.
A new character set is created in the 1K area unused by the players. All letters are made in inverse so they blend with the flowers. Display list interrupts are used to change flower colors part way down the screen. Text area colors are also changed with DLI's. The interrupt routine is placed in page six and has the ability to change two colors for each DLI. I found much interference between the DLI's and player missile graphics. In certain cases the interrupts had to be disabled as when the alphabet is put into the text area or when the program is restarted using the START key.
Timing is largly based on waiting for the vertical blank interrupt (until vcount = 128). This gives the basic speed to movement as well as tempo to the tune played. The notes are made to trail off in amplitude after the count for their duration reaches a certain value. Sound routines were set up so other tunes or sequences of tones could be added. The data for these must be transferred to the array tune1 or tune2, (voices 1&2), before they are activated (sndflg1 = 1). I hope study of the techniques used proves valuable to you.
—Stan Ockers

The program
The listing, “Alphabet Bee 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 copy), and its bee and wing shapes, character set, tune and machine-code display list interrupt were checked byte for byte against a compiled copy of the game from the Atari archives. The game page runs a hand translation of the listing into JavaScript; Stan's display list, character set and interrupt routine run in the emulated Atari just as his program set them up.
Show the listing
; Alphabet Bee
; Stan Ockers 6-84
; Written in Action! (c) 1983 ACS
; ACE Newsletter, 3662 Vine Maple Dr.
; Eugene, OR 97405 June 1984 $12 year
;
MODULE
BYTE ARRAY dlist(72)=$0600,flwpos(108),
flwchr(108)
BYTE j,pmpage,vpos=[100],scrnpage,
hpos=[0],x,y,pickflg=[0],colr,chr,
vpos2,sel,cnt,match=[65],p,q,
dlicnt=$D1,sndcnt1,sndflg1=[0],
sndpos1=[0],maxloud=[13],audf1=$D200,
audc1=$D201,falloff=[5],pospnt=[0],
vcount=$D40B,audf2=$D202,audc2=$D203,
sndpos2=[0],sndflg2=[0],sndcnt2,pflg
CARD ptr=560,pmbase,source,dest,
scrnbase,csptr=[57344]
BYTE ARRAY bee1=[0 0 216 80 112 248
248 248 113 39 126 126 60 60 24 0
0], bee2=[0 0 27 10 14 31 31 31
142 228 126 126 60 60 24 0 0],
wings1=[0 0 2 5 9 2 2 5 81 82 84
0 2 42 40 20 20 0 0], wings2=[0 0
64 160 144 64 64 160 138 74 42 0
64 84 20 40 40 0 0],bee(16),
wings(18),chr1=[0 0 0 0 0 0 0 0 0
0],dli=[$48 $8A $48 $A6 $D1 $BD
$AB $06 $8D $A2 $06 $E8 $BD $AB
$06 $A8 $E8 $BD $AB $06 $8D $A5
$06 $E8 $BD $AB $06 $E8 $86 $D1
$8D $0A $D4 $8C $00 $D0 $8D $00
$D0 $68 $AA $68 $40 $17 72 $18
218 $16 32 $1A 212 $16 50 $1A 57],
tune1(66),tune2(66),
theme=[20 53 20 60 40 64
10 72 10 64 10 60 10 72 40 81 10
64 10 60 10 53 10 64 10 72 10 64
10 60 10 72 10 64 10 60 10 53 10
64 10 72 10 64 10 60 10 72 20 53
20 60 40 64 10 72 10 64 10 60 10
72 40 81 0 0],
themeb=[10 128 10 108 10 144 10
108 10 162 10 108 10 128 10 108 40
121 10 128 10 108 10 128 10 108 20
162 20 128 40 121 20 108 20 128 40
121 10 128 10 108 10 144 10 108 10
162 10 108 10 128 10 108 40 121 10
128 10 108 20 162 0 0]
BYTE POINTER filit
PROC Arainit() ; set up display list
FOR j=0 TO 2 DO dlist(j)=112 OD
FOR j=3 TO 60 STEP 3 DO
dlist(j)=86 OD dlist(63)=70
dlist(66)=134
FOR j=67 TO 68 DO dlist(j)=6 OD
dlist(69)=65 dlist(70)=0 dlist(71)=6
dlist(64)=96 dlist(65)=Peek(106)-1
scrnpage=Peek(106)
FOR j=0 to 18 STEP 2 DO
dlist(3*j+5)=scrnpage+j/2
dlist(3*j+8)=scrnpage+j/2
dlist(3*j+4)=0
dlist(3*j+7)=128 OD dlist(60)=$D6
dlist(36)=$D6
RETURN
PROC Pminit() ; player missiles
pmpage=Peek(106)+10 pmbase=pmpage*256
SetBlock(pmbase+1024,1024,0)
Poke(54279,pmpage) Poke(559,62)
Poke(53277,3) Poke(623,1)
Poke(53248,114) Poke(704,34)
Poke(705,46) Poke(53249,114)
Poke(53250,114) Poke(706,72)
Poke(53256,0) Poke(53257,0)
RETURN
PROC Csinit() ; a new character set
BYTE POINTER pick
BYTE ARRAY newchr=[8 8 12 12 14 14
15 15 24 24 60 60 126 126 255 255
16 16 48 48 112 112 240 240 15 15
7 7 3 3 1 1 240 240 224 224 192 192
128 128 255 255 126 126 60 60 24 24
24 219 90 126 126 60 24 24 24 24 24
24 24 24 24 24 0 0 31 63 127 255 255
255 0 0 248 252 254 255 255 255 0 0
252 240 240 192 0 0 0 0 63 15 15 3
0 0 0 0 255 255 255 255 255 255]
source=csptr dest=pmbase
MoveBlock(dest,source,1024)
FOR pick=pmbase+256 TO pmbase+263
DO pick^=255 OD
FOR pick=pmbase+33*8 TO pmbase+59*8-1
DO pick^==! 255 OD
FOR j=0 TO 104
DO pick=pmbase+24+j pick^=newchr(j) OD
Poke(756,pmpage)
RETURN
PROC Dlinit() ; insert new display list
FOR j=0 TO 58
DO Poke($680+j,dli(j)) OD
Poke(512,$80) Poke(513,6) ptr=$600
Poke(54286,192)
RETURN
PROC Flwr(BYTE x,y,chr,colr) ; a flower
BYTE addon
addon=64*colr filit=scrnbase+128*y+x
filit^=3+addon filit==+1 filit^=4+addon
filit==+1 filit^=5+addon filit==+126
filit^=6+addon filit==+1
filit^=chr-32+addon filit==+1
filit^=7+addon filit==+127
filit^=8+addon filit==+128 filit^=9
FOR j=y+4 TO 19
DO filit==+128 filit^=10 OD
RETURN
PROC Flwinit() ; a field of flowers
FOR j=0 TO 108 DO
flwpos(j)=0 flwchr(j)=0 OD
FOR j=65 TO 90 DO
DO sel=Rand(98)+5 UNTIL
flwpos(sel)=0 AND flwpos(sel-1)=0
AND flwpos(sel+1)=0 OD
DO flwpos(sel)=6+3*Rand(4) UNTIL
flwpos(sel)<>flwpos(sel-2) AND
flwpos(sel)<>flwpos(sel+2) OD
flwchr(sel)=j OD
FOR cnt=4 TO 103 DO
IF flwpos(cnt)=0 AND flwpos(cnt+1)=0
AND flwpos(cnt+2)=0 THEN
DO flwpos(cnt+1)=6+3*Rand(4) UNTIL
flwpos(cnt+1)<>flwpos(cnt-1) AND
flwpos(cnt+1)<>flwpos(cnt+3) OD
flwchr(cnt+1)=64 FI OD
FOR cnt=0 TO 108 DO
IF flwpos(cnt)>0 THEN
x=cnt+9 y=flwpos(cnt) colr=Rand(4)
Flwr(x,y,flwchr(cnt),colr) FI OD
RETURN
PROC Hivepart(BYTE x,y,len)
filit=scrnbase+128*y+x filit^=11
FOR j=1 TO len-2 DO
filit==+1 filit^=15 OD filit==+1
filit^=12 filit==+128-len
FOR j=1 TO len
DO filit==+1 filit^=32 OD
RETURN
PROC Hivedoor(Byte x,y)
filit=scrnbase+128*y+x filit^=13
filit==+1 filit^=0 filit==+1
filit^=14 FOR j=1 TO 6
DO filit==+125 FOR cnt=1 TO 3
DO filit==+1 filit^=0 OD OD
RETURN
PROC Hive(BYTE p,q) ; draw a hive
Hivepart(p+3,q,3) Hivepart(p+2,q+2,5)
Hivepart(p+1,q+4,7) FOR CNT=0 TO 5
DO Hivepart(p,q+6+2*cnt,9) OD
RETURN
PROC Scrninit() ; draw background
CARD num
scrnbase=scrnpage*256 Poke(712,144)
SetBlock(scrnbase,2560,0)
Poke(709,54) Poke(710,102) Poke(711,68)
Flwinit()
Poke(656,1) Poke(657,0)
Hive(5,2) Hivedoor(10,10)
Hive(118,2) Hivedoor(120,10)
RETURN
PROC Plapart() ; play part of theme
cnt=0 j=0 DO
tune1(j)=theme(pospnt)
IF j MOD 2=0 THEN cnt==+theme(pospnt)
FI j==+1 pospnt==+1
UNTIL cnt>=80 OD tune1(j)=theme(pospnt)
tune1(j+1)=0 pospnt==+1
IF pospnt=64 THEN pospnt=0 FI
audf1=tune1(1) sndcnt1=tune1(0)
sndpos1=1 sndflg1=1 audc1=$A0%maxloud
RETURN
PROC Plall() ; play all of theme
FOR j=0 TO 65 DO tune1(j)=theme(j) OD
audf1=theme(1) sndcnt1=theme(0)
sndpos1=1 sndflg1=1 audc1=$A0%maxloud
FOR j=0 TO 65 DO tune2(j)=themeb(j) OD
audf2=themeb(1) sndcnt2=themeb(0)
sndpos2=1 sndflg2=1 audc2=$A0%maxloud
RETURN
PROC Grab() ; take a letter
x=hpos y=flwpos(x) chr=flwchr(x)
filit=scrnbase+128*y+x+9 colr=filit^
colr==/64 vpos2=vpos+16
Flwr(x+9,y,64,colr) flwchr(x)=64
pickflg=1 source=csptr+(chr-32)*8
dest=pmbase+1536+vpos2
MoveBlock(dest,source,8) dest=chr1+1
MoveBlock(dest,source,8)
Plapart() Poke(77,0)
RETURN
PROC Letgo() ; drop a letter
FOR j=1 TO 8 DO chr1(j)=0 OD
source=chr1 dest=pmbase+1536+vpos2
Moveblock(dest,source,10)
pickflg=0
IF chr<>match THEN ; back if no match
DO sel=Rand(98)+5 UNTIL
flwchr(sel)=64 OD
flwchr(sel)=chr x=sel y=flwpos(sel)
colr=Rand(4) flwr(x+9,y,chr,colr)
ELSE Put(chr) match==+1
IF match=91 AND pflg=0 THEN Plall()
pflg=1 ELSE Plapart() FI FI
RETURN
PROC Abet() ; show/remove alphabet
BYTE flipit=[0]
filit=(scrnpage-1)*256+96 Poke(54286,64)
FOR j=161 TO 186 DO
IF flipit=0 THEN filit^=j ELSE
filit^=0 FI filit==+1 OD
IF flipit=0 THEN flipit=1 ELSE
flipit=0 FI
DO UNTIL Peek(53279)<>3 OD Poke(54286,194)
RETURN
PROC Main()
BYTE byt,stk=$278
INT hscr=[0]
CARD wait
j=Peek(106) Poke(106,j-18)
DO FOR j=0 TO 16 DO bee(j)=bee1(j) OD
FOR j=0 TO 18 DO wings(j)=wings1(j) OD
Arainit() Graphics(1) Pminit()
Csinit() Scrninit() Dlinit() Plall()
source=(Peek(106)-1)*256
Setblock(source,256,0)
match=65 hpos=0 vpos=100 pflg=0
DO
DO UNTIL vcount=128 OD dlicnt=0
IF sndflg1=1 THEN sndcnt1==-1
IF sndcnt1<falloff AND sndcnt1>0
THEN audc1==-1 FI
IF sndcnt1=0 THEN sndpos1==+1
sndcnt1=tune1(sndpos1)
IF sndcnt1=0 THEN sndflg1=0
audc1=160 ELSE sndpos1==+1
audf1=tune1(sndpos1)
audc1=$A0 % maxloud FI FI FI
IF sndflg2=1 THEN sndcnt2==-1
IF sndcnt2<falloff AND sndcnt2>0
THEN audc2==-1 FI
IF sndcnt2=0 THEN sndpos2==+1
sndcnt2=tune2(sndpos2)
IF sndcnt2=0 THEN sndflg2=0
audc2=160 ELSE sndpos2==+1
audf2=tune2(sndpos2)
audc2=$A0 % maxloud FI FI FI
IF (stk&4)=0 AND hpos>0 THEN hscr==+1
IF hscr=8 THEN FOR j=4 TO 61 STEP 3
DO dlist(j)==-1 OD hscr=0 hpos==-1 FI
FOR j=0 TO 16 DO bee(j)=bee1(j) OD
FOR j=0 TO 18 DO wings(j)=wings1(j) OD
Poke(54276,hscr) FI
IF (stk&8)=0 AND hpos<111 THEN hscr==-1
IF hscr=-1 THEN FOR j=4 TO 61 STEP 3
DO dlist(j)==+1 OD hscr=7 hpos==+1 FI
FOR j=0 TO 16 DO bee(j)=bee2(j) OD
FOR j=0 TO 18 DO wings(j)=wings2(j) OD
Poke(54276,hscr) FI
IF (stk&1)=0 AND vpos>20 THEN
vpos==-1 vpos2==-1 FI
IF (stk&2)=0 AND vpos<170 THEN
vpos==+1 vpos2==+1 FI
IF Rand(16)<1 THEN vpos==+1
vpos2==+1 FI
IF Rand(16)<1 THEN vpos==-1
vpos2==-1 FI
dest=pmbase+1021+vpos
source=wings MoveBlock(dest,source,19)
dest=pmbase+1280+vpos source=bee
MoveBlock(dest,source,17)
dest=pmbase+1536+vpos2 source=chr1
MoveBlock(dest,source,10)
IF Strig(0)=0 AND pickflg=0 AND
flwchr(hpos)>64 AND flwchr(hpos)<91
AND vpos>flwpos(hpos)*8+20
AND vpos<flwpos(hpos)*8+30
THEN Grab() FI
IF Strig(0)=0 AND pickflg=1 AND
(hpos=0 OR hpos=111) THEN Letgo() FI
IF Peek(53279)=3 THEN Abet() FI
IF Peek(53279)=6 THEN Poke(54286,64)
EXIT FI OD OD
RETURN