8/7/2019 The Transactor V1 05 1978 Sep 30 http://slidepdf.com/reader/full/the-transactor-v1-05-1978-sep-30 1/37 (:commodore The Transactor Copyright Commodore Business Machines Ltd. 1978 1. PET INSTRUCTION BOOK SET comments and bulletins concerning your COMMODORE PET BULLETIN # 5 September 30, 1978 All PETs are currently being shipped with the revised instruction book, plus a booklet titled lIPet Communications With The Outside World" (this information was issued with Transactor Bulletins 3 and 4), plus the booklet containing a description of the programs "Bigtime", "Squiggle", and "Machine Langugage Monitor" plus either the tape, or a print- out of the programmes if the tapes are not available. Also available on request is a revised issue of the "Compendium . of Notes.1t Enclosed is copy of all of the above - except "Pet Communications With The Outside World" which was issued in the last two bulletins, and 'tBigtime/Squiggle" which were issued in Transactor Bulletin #2. 2 • PERIPHERALS C2N Second Cassette - available ex-stock $100 USA, $120 CDA. Printer - Although many delivery dates have been quoted, tne Commodore Printer is unlikely to be available before January, 1978. $695 USA, $995 CDA. Floppy Disk - Still on target for the end of the year. Specification will certainly be worth waiting for. $1,000 USA approximately, $1,500 CDA. approximately. Dual drive. Expansion Memory - End of the year. No price yet. Modem - No price or delivery date yet. Although only C2N cassette is available, yet various printers with parrallel a n d T ~ e r i a l interfaces giving ASCII characters will work with PET using adaption leads e.g. Serial from Connecticut Micro Computer, Parrallel from Computer Factory (see this bulletin). Also IEEE Floppy from H.P. or Tectronix, and Expansion Memory from Convenience Living Systems (see Bulletin 4). For modem, see Bulletin 2.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
The TransactorCopyright Commodore Business Machines Ltd. 1978
1. PET INSTRUCTION BOOK SET
comments and bulletins
concerning your
COMMODORE PET
BULLETIN # 5
September 30, 1978
All PETs are currently being shipped with the revisedinstruction book, plus a booklet t i t led lIPet CommunicationsWith The Outside World" ( this information was issued withTransactor Bulletins 3 and 4), plus the booklet containinga description of the programs "Bigtime", "Squiggle", and"Machine Langugage Monitor" plus either the tape, or a print -
out of the programmes i f the tapes are not available. Alsoavailable on request is a revised issue of the "Compendium .of Notes.1t Enclosed is copy of a l l of the above - except "PetCommunications With The Outside World" which was issued inthe l as t two bullet ins , and 'tBigtime/Squiggle" which wereissued in Transactor Bullet in #2.
2 • PERIPHERALS
C2N Second Cassette - available ex-stock $100 USA, $120 CDA.
Printer - Although many delivery dates have been quoted, tneCommodore Printer i s unlikely to be available beforeJanuary, 1978. $695 USA, $995 CDA.
Floppy Disk - St i l l on target for the end of the year.Specification wil l certainly be worth waitingfor . $1,000 USA approximately, $1,500 CDA.approximately. Dual drive.
Expansion Memory - End of the year. No price yet .
Modem - No price or delivery date yet .
Although only C2N casset te is available, yet various printers
with parral le la n d T ~ e r i a l
interfaces giving ASCII characterswill work with PET using adaption leads e.g. Serial fromConnecticut Micro Computer, Parral lel from Computer Factory(see this bul le t in) . Also IEEE Floppy from H.P. orTectronix, and Expansion Memory from Convenience LivingSystems (see Bullet in 4). For modem, see Bullet in 2.
"Getting Started With Your PET" is a new workbook now availableto PET users who are anxious to put the i r PET to work.
This beginner's workbook supplements the documentation providedby Commodore. I t covers the fundamentals of PET BASIC and explainsi t s character is t ics , l imitat ions, and useful features. Thedescriptive t ext is heavily laced with step-by-step, detai ledexercises including the expected PET responses.
I f you are already an expert on your PET, "Getting StartedWith Your PET" is an excellent guide fo r other members of yourfamily who want to use the PET.
In addit ion to th is beginning text , workbooks on advancedtopics are available. Some of the advanced techniques covered inthese workbooks include st r ing handling, arrays and loopings,graphics, cursor control , PEEK and POKE memory, programmed casset teI/O, real time clock, linkage to assembly language subroutines,
subroutine nesting.
TIS also provides software applications for the PET. Theseprograms are available as source l is t ings and casset tes with operatinginstruct ions, theory of operations description, and performance timeand space l imitat ions.
For more information contact Total Information Services,P.O. Box 921, Los Alamos, NM 87544.
1.6 MEGABYTE FLOPPY DISK SYSTEM
D a t a t r 6 ~ i c s has an 800K byte and 1.6M byte S-lOO floppy diskstorage system. Based on the PerSci Model 277 drive with voicecoi l head posit ioning, this system offers more storage in a standardsize drive than most other currently available drives.
The 800K byte model is a single density drive system, whilethe others employ dual-density recording techniques. The S-lOOcontrol ler i s processor independent, and can be used with most8080, 8085, Z-80 and 6502 based systems as well as with the Datatronics6800 CPU (S-lOO based). Several formats are allowed, including IBM 3740.
Software included with the systems is written for the 6800, but8080 (8085 and Z-80) versions wil l be available soon. Termed SDOS,
this Disk Operating System offers fu l l dynamic f i le allocat ion andf i le maintenance. That means tha t data or program f i les may expandor shrink as needed with a l l necessary housekeeping being tota l lytransparent to the user.
513 CLR: PR I N T " l " ~ / I ; :POKE 245,6: PR INT109 PR IN TilTH I S PROGRAM TES TS YOUR REFLEXES B f"299 PRINT"MEASURING YOUR REACTION TIME. WHENEVER"309 PRINT"THE SCREEN IS CLEARED HIT ANY CHARACTER-"41313 PRItH"'y 'OUR REACTION TIME IN SECONDS WILL BE"
S90 PRINT"DISPLAYED--WHEN THIS DISSAPPEARS HIT"609 PRINT"ANOTHER KE'i (AN'i KEY WILL DO) AND SO ON-"659 FOR 1=1 TO 151313: NEXT: PR INT TAB (15) "I:aGET READY"709 FOR 1=1 TO 2500: NEXT: PR I N T " L ' ~ " : POKE 245,118139 PRItH:PRINT TAB(l1)"( I : iHIT ANY I<EY NOW!!!)":GETA$,A$d'1$,A$,A$,A$,A$:GOTO
1090 FOR 1=1 TO RND(1)*2ae0+750:GET C $ : N E X T : P R I N T " " ' ~ " ; l1e0 T=T I :FOR 1=1 TO 500: GET C$: IF C$(} ' " ' THEN 1500120e NEl<: T :PR IN T" l " ~ " :POKE 245) 10 :PR IN T1300 PRINT"1;1 'IOU SHOULD HAVE TYPED A CHARECTER WHEN " ;
135e PRINT"I:i1400 PRINT"I:=I THE SCREEN WAS CLEARED142e FOR 1=1 TO 100e:NEXT
1425 FOR 1=1 TO 40: PR ItH"1ia " ; : NEXT1430 PRINT"1;1 (STAND B't FOR M()RE INSTRUCTIONS)1440 FOR 1=1 TO 10e0: GETC$: IF C$(} " " THEN 1500
141e NEXT:GOTO 501415 GOTO 5015e0 T l = T I - T : P R I t H " " ' ~ " ; :POKE 245.111530 FOR 1=1 TO 25e0:GETC$:IF C$(}"11 THEN 15001550 PRINT:POKE 226,1116130 PRINT INT(CT1/60*1000)+.5)/1000:GOT01000
The following programs on cassette are now available from Commodore and short lyt s dealers. Each program uses 8K of RAM unless otherwise specified.
DIET PLANNER AND BIORHYTHM
Diet Planner (by Les Palanik) determines your ideal weight and computes the
number of calories needed each day to maintain that weight or reduce to thatweight. Biorhythm displays a chart of the intel lectual , emotional andphysical biorhythmic cycles.
Part 321002 $14.95 USA
$15.95 CDA
TARGET PONG AND OFF THE WALL
Target Pong. Insert paddles in the path of a fast moving bal l to def lect the
bal l into a target . The secret is to use th e fewest number of paddles and the
least time to h i t th e target just once. Off Wall is exactly the opposite.
Here the secret is to use as many paddles as you can without hi t t ing th etargets. And just to make the gaine more di.fficult., there are many targets inthis game.
Part 321003 $ 9.95 USA
$10.95 CDABASIC BASIC
Basic Basic (by Ralph James and Ron Lodewyck) is a tutorial program introducingyou to the BASIC language. Thoroughly in teract ive; your PET will teach you how
to operate your PET! Basic Basic is written by two very experienced collegeprofessors. The topics covered include l ine numbers, variables, str ings, arrays,and the use of the various commands such as LIST, RUN, and SAVE. Also basickeywords will be explained and used such as PRINT, READ/DATA, INPUT, IF/THEN,GOTO, and FOR/NEXT. Fifteen chapters, six sample programs ••• and homeworkassignments. Uses just 4K of RAM memory.
Part 321005 $14.95 USA
$15.95 CDA
~ ~ s Balaxy Games (by Peter Ruetz). Maneuver your space ship while firing at theenemy, and at the same time avoid hit t ing a star . In one game, you're f ir ingat fixed targets. In the other game, you're firing at a spaceship that 's being
piloted by an obviously drunk astronaut1Part 321006
MORTGAGE
$ 9.95 USA .,$10.95 CDA
Mortgage computes the payment amount, given the principal , interest rate andterm of the loan. For any payment period i t computes th e amount that is
principal and th e amount that is interest (amortization schedule) and givesthe interest , principal , and to ta l amount paid to date.
A problem with opening files to write on either built-in cassette #1, orexternal cassette #2, has been discovered. When a file is opened, garbagewill be written out instead of a proper data tape file header. Without thisheader it is impossible to open the tape file for reading.
You may not have encountered this problem previously because i t isdisguised by having loaded a program on the cassette prior to writing a data file.
In this mode I the start address of the buffer with the header information isinitial ized properly but cassette data file operation still could be random.
Fortunately there is a software patch you can implement in your BASICprogram to force the open for write on tape to work every time.
Before opening to write on #1 cassette:
and on #2 cassette:
POKE 243,122
POKE 244,2
POKE 243,58POKE 244,3
Locations 243 and 244 contain the 10 and hi order bytes respectively ofthe address of the currently active c a s ~ e t t e buffer. The start address of buffer#2 is $33A which is 3 / 58 ($3=:=3,$3A=58) in double byte decimaL Similarlycassette #1 is $27A <$2=2, $7A=122 >.
TAPE HEAD CARE
I t has been noted that the READ/WRITE head in the PET
casset te deck has the annoying habit of magnetising i t s e l f
after a remarkably short period of operation. I t i s in fact
possible to part ia l ly erase your tapes by up to 15% af te r only
15 or passes over the head. The most convenient way to
deal with this problem i s to demagnestise the tape head very
frequently. ie every couple of days with a demagnetising
casset te . AMPEX market quite a good one for about £3.-
f l I 9 j ~ f I ¢ f 2 ' 2 flfl'fl'5f I ~ A - f l I 9 j 5 A flfl'5C
flfl'5Eflfl'5Ffl'fl'7A-flf"7BGJiJ7C-007DflI9j7E-¢f2'7FflI9j8f"-flf"81flI9j82-flf"83~ 8 4 - ~ 8 5 f"fl'86-¢f2'87flI9j88-flfl'89~ 8 A - f " f " 8 8 ~ 8 C - f " f l ' 8 D ~ 9 2 - f l ' f l ' 9 3 fl'fl'94-f"f"95flI9j96-flI9j97flfl'AE-f"f"AF¢f2'8fl'f"fl'81~ 8 2 ~ 8 3 ~ 8 4 f"f"85flf"88-f"f"Cfl'fl'¢f2'2-f"f"C9-f"f"CA
-flfl'D9flI9jE¢--~ E l - f l ' f l ' E 2 f l ' f l ' ~ 3 - f l ' f l ' E 4 ~ E 5 - f l ' f " E 6 ~ ~ E A ~ s m E
CURRENT RESULT TYPE (FF) STRING ( ¢ ~ ) NUMERIC" " " ( 8 0 ) I N T E G E R ( ~ ) F L O A T I N G POINT
START OF BASIC S T A T E M E ~ S START OF VARIABLE TABLEEND OF VARIABLE TABLESTART OF AVAILABLE SPACEBOTTOM OF STRINGS (MOVING DOWN)TOP OF STRINGS (MOVING DOWN)TOP OF MEMORY ALLOCATED FOR BASIC WORKING AREACURRENT PROGRAM LINE NUMBER
" " " " SAVED BY END" " POINTER'SAVED BY END
DATA STATEMENT POINTERCURRENT VARIABLE SYMBOLSCURRENT VARIABLE STARTING POINTPOINTER ASSOCIATED WITH BASIC BUFF TRANSFEREXPONENT + S 8 ~ )MANTISSA MSB )
I, )__ (FLOATING POINT ACCUMULATOR)
" )LSB )
SIGN OF MANTISSA (0 IF ZERO) (+ IF POS.) (- IF NEG.)DYADIC HOLDING AREASTART OF ROUTINE FOR FETCHING NEXT BASIC CHARACTERPROGRAM POINTER
END OF CHARACTER FETCHSCREEN POSITION ON LINEPOSITION OF LINE STARTCURRENT TAPE BUFFER POINTEREND OF CURRENT PROGRAMQUOTE MODE ( ~ ~ IF NOT IN QUOTE)
~ F ~ ~ f i ' F l ~ F 3 - ~ F 4 ~ F 5 ~ F 6 ~ F 7 - ~ ~ F 8 ~ F 9 - ~ ~ F A ~ F C ~ F D ~ F E ~ F F - I F F ~ 2 ~ f i ' - ~ 2 ~ 2 ~ 2 ~ 3 ~ 2 ~ 4 ~ 2 ~ 5 - ~ 2 ~ 6 ~ 2 ~ 7 ~ 2 ~ 8 ~ 2 ~ 9 ~ 2 ~ ~ 2 ~ ~ 2 ~ D ~ 2 ~ E - c ; 2 1 6 ~ 2 1 9 - ~ 2 1 A f i ' 2 l B - ~ 2 1 C ~ 2 2 3 flJ225,,228~ 2 4 2 - ~ 2 4 B ~ 2 4 C - { t Y 2 5 5 {tY256-{tY25F~ 2 6 2 ~ 2 6 5 flJ268flJ26Cf l J 2 7 ~ flJ273
GPIB F l L E ~ GPIB COMMANDGP IB DEVICE'#START OF TAPE BUFFERCURRENT SCREEN L I N E ~ RUNNING CHECKSUM OF BUFFERPOINTER TO PROGRAM DURING VERIFY,LOADFILENAME STARTING POINTERSERIAL WORDNUMBER OF BLOCKS R E M I A ~ I N G TO WRITESERIAL WORD BUFFERBASIC STACK ETC.CLOCK H.M.S.MATRIX COORDINATE OF LAST KEY DOWN (255 IF NONE)SHIFT KEY STATUS (1 IF DOWN)JIFFY CLOCKCASSETTE 1 ON SWITCHCASSETTE 2 ON SWITCH
KEYSWITCH PIALOAD 0, VERIFY 1STATUSNUMBER OF CHR IN KBD BUFFERKYBD INPUT BUFFERHARDWARE INTERRUPT VECTORBREAD INTERRUPT VECTORKEY IMAGECURSOR TIMINGTAPE WRITELOGICAL NUMBERS OF OPEN FILESDEVICE NUMBERS OF OPEN FILESR/W MODES OF OPEN FILES (COMMAND TABLE)
GPIB TABLE LENGTHPARITYPOINTER IN FILENAME TRANSFERSERIAL BIT COUNTTAPE WRITE COUNTDOWNLEADER COUNTER
8 ~ ~ 8 F F F 9 ~ - B F F F C ~ - E ~ ~ E ~ 8 5 - E 2 7 D E294-E66A
E66B-E684E685-E75BE75C-E7D4E 8 ~ - E F F F ~ 8 6 - F 2 2 6 F346-F82CF82D-Fd15F038-FFB2FFCiS-FFEDFFFA-FFFF
IF FIRST HALF BYTE MARKER NOT WRITTENIF SECOND " " " " "
CHECKSUM WORKING WORD
BUFFER FOR CASSETTE.. 1"It "-'2
START OF BASIC STATEMENTSEND OF AVAILABLE RAM (81( VERSION)END OF AVAILABLE RAM EXPANSIONVIDEO RAM
AVAILABLE ROM EXPANSION AREAMICROSOFT "8K" BASICSYSTEM SET UPVIDEO DRIVER
INTERRUPT HANDLERCLOCK UPDATE,KYBD SCAN(60HZ INT.)KYBD ENCODING TABLEPIA'SGPIB HANDLERFILE CONTROLTAPE CONTROLDIAGNOSTICSJUMP VECTORS65¢2 INTERRUPT VECTORS (NMI NOT USED IN ORIG. VERSION
Since th i s i s the f i r s t time I haveattempted to se t down a machine language program for the public eye, I willattempt to be as complete as practicalwithout overdoing i t .
The programs I will document here areconcerned with th e game of "LIFE", andare written in 6502 mach ine languagespecifically for th e PET 2001 (8K ver-51on). The pr inciples apply to any6502 system with graphic display capability, and can be debugged (as I did)on non-graphic systems such as theKIM-l.
The f i r s t I heard of LIFe was in Martin
Gardner's "Recreational Mathematics"section in Scientific American, Oct-Nov1970; Feb. 1971. As I understand it,
the game was invented by John H. Conway, an English mathematician. Inbrief, LIFE i s a "cellular automation"scheme. where the arena is a rectangular grid (idel'!lly of infini te size) .Each square in th e grid is either occupied or unoccupied with "seeds", thefate of which are governed by relat ively simple ru les , i . e . the " fac ts ofLIFE" . The rules are: , . A seed survives to the next generation i f and only i f i t has two or three neighbors
(right. l e f t , uP. down, and th e fourdiagonally adjacent cells) otherwise i tdies of lone l iness or overcrOWding,as the case may be. 2. A seed is bornin a vacant ce l l o n th e next generat ion i f i t has exact ly 3 neighbors.
With these simple rules, a surprisinglyrich game results . The original Scient i f ic American ar t i c l e , and severalsubsequent art ic les reveal many curiousand surpr is ing in i t i91 pat te rns andresul ts . I understand that there evenhas been formed a LIFE: group, complete
with newsletter,a l t h ~ ' ) u g h
I have notpersonally seen i t .
The game can of course be played manually on a piece of graph paper, but i tis slow and prone to mistakes, whichhave usually disasterous effects on thefinal resul ts . I t would seem to be theideal thing to put to a microprocessorwith bare-bones graphics , s ince therules are so simple and there are es-
sential ly no arithmetic operations involved, except for keeping track of addresses and locating neighbors.
As you know, the PET-2001 has an excellent BASIC interpreter , but as yet veryl i t t le documentation on machine language operation. My f i r s t stab was towrite a BASIC program, using the entirePET display as th e arena (more lboutboundaries l a t e r ) , and the f1 lIedcircle graphic display character as theseed. This worked just fine, exceptfor one thing - i t took about 2-1/2minutes for the in terpreter to gothrough one generation! I suppose Ishouldn't have been surprised since th e
program has to check eight neighboringcells to determine th e fate of a par't icular cel l , and do this 1000 times tocomplete th e entire generation (40x25characters for th e PET display).
The program following is a 6502 versionof LIFE written for the PET. I t needsto be POKE t d Into the PET memory,since I have yet to see or discover amachine language monitor for the PET.I did it wi th a simple BASIC programand many DATA statements ( taking upmuch more of the program memory spacethan the actual machine language program!). A routine for assembling, andsaving on tape machine language programs on the PET is sorely needed.
The program is accessed by the SYS command. and takes advantage of the display moni tor (cursor control) for inserting seeds, and clearing the arena.Without a serious attempt at maximizingfor speed. the program takes about 1/2second to go through an entire generation about 300 times faster than th eBASIC equivalent r Enough said at)outthe efficiency of machine language pro
gramming versus BASIC in terpreters?
BASIC is great for number crunching,where you can Quickly compose your program and have plenty of time to awaitthe results .
The program may be broken down intomanageable chunks by subroutining.There follows a brief description ofthe salient features of each section:
In a f i t of overcaution (since this wasthe f i r s t time I attempted to write aPET machine language program) youwill notice the ser ies of pushes at thebeginning and pulls a t the end. I de-cided to save a ll the internal regis-ters on th e stack in page 1, and alsoincluded the CLD (clear decimal mode)
just in case. Then follows a ser ies ofsubroutine cal ls to do th e LIFE genera-tion and display t ransfers. The zeropage location, TIMES, is a counter topermit several loops through LIFE be-fore returning. As set up, TIMES is
ini t ia l ized to zero (hex location 1953)so that it will loop 256 times beforejumping back. This of course can bechanged either in i t ia l ly or while inBASIC via the POKE command. The returnvia the JMP BASIC (4C 8B C3) may not bes t r ic t ly orthodox, but i t seems to worka l l r ight .
INIT (hex 1930) and DATA (hex 1938)
This shorty reads in the constantsneeded, and stores them in page zero.SCR refers to the PET screen, TEMP isa temporary wor'king area to hold thenew generation as i t is evolved, andRCS is essent ial ly a copy of th e PETscreen data, which 1 found to be neces-sary to avoid "snow" on the screen dur-ing read/write operations direct ly onth e screen locations. Up, down, etc .are the offsets to be added or subtrac-ted from an address to get a l l the
neighbor addresses. The observantreader will note the gap in the addres-ses between some of the routines.
TMPSCR (hex 1970)
This subroutine quickly transfers thecontents of Temp and dumps it to thescreen, using a dot (81 dc.c) symool fo ra l ive cell (a 1 in TEMP) and a space(32 dec) for th e absence of a l ive cell(& 0 in TJ:;MP).
SCRIMP (hex 198A)
This is th e inverse of TMPSCR, quicklyt r ans fe r r ing (and encoding) datafrom th e screen into TEMP.
RSTORE (hex 19A6)
This subrout ine fetches the i n i t i a laddreSSeS (high Clnd low) for the SCR,TEMP, and RCS memory spaces.
NXTADR (hex 19BD)
SinCe we are dealing with 1000 bytes ofdata, we need a routine to increment toth e next location, check for page cros-sing (adding 1 to th e high address wheni t occurs), and Checking for the end.The end is signa led by returning a 01in the accumulator, otherwise a 00 isreturned via the accumuiator.
TMPRCS ( h ~ x 19E6)
The RCS address space is a copy of thescreen , used as mentioned before toavoid constant "snow" on the screen i fth e screen were being cont inually ac-cessed. This subrout ine dumps datafrom TEMP, where the new generation hasbeen computed, to RCS.
GENER (hex lAOO)
We finally arrive at a subroutine whereLIFE is actual ly generated. Afterfinding out the number of neighbors ofthe cur'rent RCS data byte from NBRS,GENER checks for births (CMPIM $03 athex addr. lAOE) i f tLI.: cel l was prev-iously unoccupied. I f a bir th does notoccur, there is an immediate branch toGENA DR (the data byte remains 00). I fth e cell was occupied (CMPIM 81 dec a thex lA08), OCC checks for surviva l(CMPIM $03 at hex lA1A and CMPIM $02 athex lAlE), branching to GENADH whenthese two conditions are met, otherwisethe cell dies (LDAIM $00 at hex lA22).
The resul ts are stored in TEMP for the1000 cel ls .
NBRS (hex lA2F)
NBRS is the subroutine that really doesmost of the work ~ n d where most of thespeed could be gained by more effic ientprogramming. I ts job, to find the tot-al number of occupied neighbors of agiven RCS data location, is complicatedby page crossing and edge boundaries.In the present version, page crossingis taken care of, but: edge boundaries
( le f t , r ight , top, and bottom of th escreen) are somewhat "strange". Abovethe top l ine and below th e bottom l ineare considered as sort of forbidden re-gions where there should practicallyalways be no "l ife" (data in those re-gions are not defined by the program,bu t 1 have found that there has neverbeen a case where 81's have been pres-ent (al l other data is considered as"unoccupied" characters). The rightand l e f t edges are different , however,
and lead to a special type of "geometry". A ce l l at e i ther edge i s notconsidered a ~ ; special by NBRS, and soto th e r igh t of a r ight-edge locationis the next sequent ial address. On thescreen t h i s i s rea l ly the l e f t edgelocation, and one l ine lower. The in verse is t rue, of course for tft addresses of left-edge locat ions Topo
log ica l ly . t h i s i s equivalen, to a
"helix" . No special ef fec ts d f th isare seen during a simple LIFE e v o i ~ ~ i o n since i t jus t gives the impression ofdisappearing off one edge while a p p e ~ r ing on the other edge. For an objectl ike the "spaceship" (see Scien t i f icAmerican a r t i c l e s ) , then f the patheventually would cover the whole LIFEarena. The fun comes in when a configuration spreads out so much tha t it
spi l ls over both edges, and in te rac ts
with i t se l f . This, of course cannothappen in an in f in i te universe, so thatsome of the more complex patterns wil lno t have the same fate in the presentversion of LIFE. Most of the "bl inkers", including the "glider gun" comeout OK.
This 40x25 version of LIFE ca n undoubtedly be made more ef f ic ient , and otheredge algorithms could be found, but 1chose to l ~ a v e i t in i t s original formas a benchmark for my f i r s t successfully executed program in writing machine
A Brief Introduction
to the Game of Life
One of the in terest ing properties ofth e game of LIFE i s that such simplerules can lead to such complex act i vi t y . The simplic i ty comes from thefact that the rules a ~ p l y to each in dividual ce l l . The complexity comesfrom th e interact ions between th e individual cel l s . Each individual cel l isaffected by i t s eight adjacent neighbors, and nothing else .
The rules are:
1. A ce l l survives i f it has two or
language on the PET. One confession.however - I used the KIM-l to debugmost of the subroutines. Almost a l l ofthem did not run on the f i r s t shot!Without a good understanding of PETmemory al locat ion part icularly in pagezero, I was bound to crash many timesover, with no recovery other than pull ing th e pI ug. The ac tual BASIC program consisted of a POKING loop with
many DATA statements (always save ontape before running!).
2. A cel l dies from overcrowding if it
has four or more neighbors. . I t diesfrom isolat ion i f it has one or zeroneighbors.
3. A cel l i s born when an empty spacehas exactly three neighbors.
with these few rules, many differenttypes of act ivi ty can occur. Some patterns are ,sTABLE, that i s they do notchange a t a l l . Some are REPEATER,s,pat terns which undergo on e or m o r ' ( ~ changes an d re turn to the or igin:dpat tern. A REPEATER may repeat as fast
as every other generation, or may havea longer period. A GLIDER i s a patternWilich moves as i t repeats.
19EF 91 39 STAIY RCSL STORE IT IN SCREEN COPY19F1 DO 04 BNE NEWADR THEN ON TO A NEW ADDRESS
19F3 A9 51 TRONE LDAIM DOT THE DOT SYMBOL19F5 91 39 STAIY RCSL STORE IT IN SCREEN COpy19F1 20 BD 19 NEWADR JSR NXTADR FETCH NEXT ADDRESS19FA Fa ED BEQ TRLOAD IF A=O, THEN NOT DONE19FC 20 A6 19 JSR RSTORE ELSE DONE. RESTORE19FF 60 RTS
1100 20 A6 19 GENER JSR RSTORE IN IT ADDRESSES1A03 20 2F 1A AGAIN JSR NBRS FETCH NUMBER OF NEIGHBORS1A06 B1 39 LDAIY RCSL FETCH CURRENT DATA1108 C9 51 CHPIM DOT IS IT A DOT?lAOA FO OC BEQ OCC IF YES, THEN BRANCHlAOC A5 32 LDAZ N OTHERWISE ITS BLANKlAOE C9 03 CMPIM $03 SO WE CHECK FORlAl0 DO 14 BNE GENAOR A BIRTH1112,A9 01 BIRTH LDAlM $01 IT GIVES BIRTH11 14 91 26 STAIY TEMPL STORE IT IN TEMP1A16 DO OE BNE GENAOR INCONDITIONAL BRANCH
1118 A5 32 OCC LOAZ N FETCH NUMBER OF NEIGHBORS
lA1A C9 03 CMPIM $03 IF IT HAS 3 OR 2lAlC FO 08 BEQ GENA DR NEIGHBORS IT SURVIVES11 1E C9 02 CMPIM $021A20 FO 04 BEQ GENA DR
1A22 A9 00 DEATH LDAIM $00 IT DIED!1124 91 26 STAlY TEMPL STORE IT IN TEMP1A26 20 BD 19 GENA DR JSR NXTADR FETCH NEXT ADDRESS1A29 FO 08 BEQ AGAW IF 0, THEN NOT DONE
1A33 AO 00 LDYIM $00 SET Y AND N = 01A35 84 32 STYZ N1A31 A2 08 LDXIM $OB CHECK 8 NEIGHBORS1A39 B5 29 OFFS LDAZI OFFSET -011A3B 10 15 BPL ADD ADD IF OFFSET IS POSITIVE1A3D 49 FF EORIM $FF OTHERWISE GE'I' SET TO
1A3F 85 31 STAl TMP SUBTRACT
1141 38 SEC SET CARRY BIT FOR SUBTRACT
1A42 A5 39 LDAl RCSL
1A44 E5 31 SBCl TMP SUBTRACT TO GET THE
1A46 85 22STU CHL CORRECT NEIGHBOR ADDRESS
1A48 A5 3A LDAZ RCSH
1A4A 85 23 STAl CHH
114C BO 11 BCS EXAM OK, FIND OUT ~ H A T ' S THERE
310 DATA 0 8 . 4 8 , 8 A , 4 8 . 9 8 , 4 8 , B A , 8 A , 4 8 , D 8 , 2 0 , 3 ~ , 1 9 . 2 ~ , 8 A , 1 9 , 2 e . E 6 . 1 9 , 2 ~ , 0 0 , l A 320 DATA20,70.1 9,A9,FF,CD,12,E8,F0,F0,4C,8B,C3,AA,68,28,4C,8B,(3
330 DATA E A , E A , E A , E A , E A , E A , E A , A 2 , 1 9 , B D , 3 A , 1 9 , 9 5 , I F , C A , D 0 . F 8 , 6 ~ , 0 0 , 8 0 , 0 0 , 1 5 , 0 0 340 DATA80,00,IB,00,IB,D7,28,01 , F E , D 8 , D 6 , 2 9 , 2 7 , 0 0 , E 8 , 8 3 , 0 0 , 1 5 , 0 ~ , 0 0 350 D A T A E A , E A , E A , E A , E A . E A , E A , E A . E A , E A . E A . E A , E A . E A , E A . E A , E A , ~ ~ , A.EA.EA,EA,EA
360 fi ATAEA, EA, EA EA EA 2" , A , 19 , B1 • 20 , [10 , "6 • A , 2" • 9 1 ,20 , [I \ . ~ • (.14 , A , '3 i , 91 , ~ 0 , 20
370 DATA BD,19,F0,ED,20,A6,19,60,20,A6,19,Bl ,20,C9,51,F0,06,A9,00,91 , ~ o . F e 380 DATA04,A9,01 ,91 ,26,2",BD,19,F0,EB.20,A6.19,60,A9,00,AA,A8,85,20,85,26,85390 DATA39,A5,25,85,21,A5,2 9 ,85,2 7 ,A5,36,85,3A,60,Eo,26,E6,20,E6,3 9,E8,E4
410 DATA 60,A9,01 ,60,EA,EA,EA,EA,EA,EA.20,A6,19.Bl ,26.D0,16,A1,20,91,J9,D0
420 DATA04, A , 51 , 91 ,39,20. B i , 19 , F0, ED •20 , A , 19 • 6'; , 20 , A , 1t , 20 , 2F , I,;, B1 • J 9, C(
430 DATA51 , F 0 , 0 C , A 5 , 3 2 , C 9 , 0 J , D 0 . 1 4 , A 9 , 0 1 . 9 1 , 2 6 , D 0 , 0 E , A ~ S , 3 2 , C 9 , l l J , F 0 , 0 8 , C 9 , 0 2 440 DATAF0,04,A9,00,91,26,20,BD,t9,F0,D8,20,A6,19,60,9B.48,8A.48,A0.00.84,32