5dF=EIiX;nX;LIFE IN THE FAST LANEs"X;Atari 8-bit Ver 1.00 04-20-86x$X;Copyright 1986 Analog Computing}X;Programmed by James HagueX;X;----------------X; SYSTEM EQUATESX;----------------X;X;Page zeroX; DOSINI RTCLOK ATRACTMX; X;Misc.X;VDSLSTSDLSTL0 WSYNC SDMCTL/CONSOLRANDOM STICK0x TRIG0 NMIEN CH CHBASOLDSETX; X;Audio X; SKCTLAUDCTL AUDF1 AUDC1" AUDF2' AUDC2, AUDF31 AUDC36X;;X;P/M Graphics@X;EGRACTLJGPRIORoOPMBASETHPOSP0YHPOSP1^HPOSP2cHPOSP3hHPOSM0mHPOSM1rHPOSM2wHPOSM3|SIZEP0ЁSIZEP1 ІSIZEP2 ЋSIZEP3 А SIZEM ЕX; X;ColorsX;PCOLR0PCOLR1PCOLR2PCOLR3COLOR0COLOR1COLOR2COLOR3COLBAKHCOLR0HCOLR1X;X;System RoutinesX;SIOINVeSETVBV\XITVBLbX;X;-------------------X; PROGRAM VARIABLESX;------------------- X;X;Global misc.X;!VBICTL;;VBI CTrL. flag&PNT1;;Misc. PoiNTer+TEMP;;TEMP storage0IMAGE;;IMAGE pointer5COLTIM;;COLor TIMer:BORDER;;BORDER color?CURSOR;;CURSOR colorDCOLMSK;;COLor MaSKICONKEY;;CONsole KEY flgNX;SX;Cell DatabaseXX;]POP;;bcd POPulationbMOST;;bcd max pop.gMODE;;growth MODElGENER;;bcd GENERationqX;vX;Placement routines{X;CURX;;CURsor X pos.CURY;;CURsor Y pos.SOUND;;SOUND flagTONE;;sound TONEPRESS;;trig PRESS flagDIR;;stick DIRect.DIST;;cursor DISTanceSELECT;;SELECT key timeX;X;RegenerationX;ACTIVE;;ACTIVE cellsCOUNT;;temp COUNTerROW;;current ROWCOL;;current COLUMNCHORD;;current CHORD #X;X;Color ConstantsX;@GENTXT;;GENer label@GENNUMV;;GENer number@GR0BAK;;GR.0 BAcKground@GR0LUM ;;GR.0 text LUM.@NUM1;;NUMber color 1@NUM2;;NUMber color 2@BOARD;;BOARD squares@CELLF;;CELLsX; X;Misc. ConstantsX;EOL;;EOL characterX; X;-------------%X; GLOBAL DATA*X;-------------/X;49PM;;Player/Missile>MISSL;;memory...C PL0H PL1M PL2R PL3WCHSET;;New CHar SET\DISP;;DISPlay memoryaBOARDDISPffTEXTDISPkCADRL;;RegenerationpCADRH;;data storage...u CTYPEzTSAVE(;;Temp bufferX;X;------------------X; PROGRAM MAINLINEX;------------------X;  RESET-;;Kill decimal SETSYS;;Set-up system REDEFINE;;Redef. chset TITLE;;Do title scrn. SETUP;;Set-up programMAIN PLACE;;Place cells LIFE;;Create life!!MAIN;;Loop foreverX;X;-----------------X; VBLANK MAINLINEX;-----------------X;VBI-;;Kill decimalQVBICTL;;Get VBI flagGNOVBI;;If <0, exitQ>;;else, turn offPATRACT;;attract mode ANIMATE;;Animate cells BCOLOR;;Do border color QVBICTL;;Get flag againHNOVBI;;If not 0, exit DING;;Do ding sound#CURSOR;;Flash cursor... QCURSOR$ PCOLOR3)NOVBI!XITVBL;;Bye-bye VBI!.X;3X;---------------8X; SET-UP SYSTEM=X;---------------BX;GX;Among other things, set upLX;the VBI and any variablesQX;associated with it thatV#X;need be initialized only once.[X;` SETSYSe SIOINV;;Init sounds...j QUIEToQ>4RESET;;Steal thetPDOSINI;;reset vector...y Q>5RESET~PDOSINI$>;;Init VBI&VBICTL;;variables... &COLTIM2 &IMAGE %>4VBI $>5VBIQ> !SETVBVX;X;----------------X; SHUT OFF SOUNDX;----------------X;X;This is a general purposeX;routine that initializes#X;sound channels 1,2 & 3. It is!X;not responsible for handlingX;routine-specific flags.X; QUIETQ>;;InitializePSKCTL;;sound andQ>;;turn offPAUDCTL;;channels 1,2PAUDC1;;and 3... PAUDC2  PAUDC3:X;X;------------------X; REDEFINE CHARSET#X;------------------(X;-X;Move charset2X;7 REDEFINE<$>;;Move set fromAMOVSETQOLDSET9;;$E000 toFPCHSET9;;RAM...KQOLDSET9PPCHSET9UQOLDSET9ZPCHSET9_QOLDSET9dPCHSET9i2n HMOVSETsX;xX;Redefine a few chars}X;$>?;;Redefine chars REDEFQCHRDAT9;;2 thru 10 asPCHSET9;;the arena's 0;;borders IREDEFX;X;Install new setX; Q>5CHSET PCHBAS:X;X;Character dataX;CHRDAT === ===X; === ===X; === ===X;  = = =   = = = X; ===  == = X; === ===X;"  = ==' ===,X;1 ===6 ===;X;@X;---------------EX; PRINT MESSAGEJX;---------------OX;TX;This routine prints an EOLY X;terminated internally-coded^ X;string on the message line.cX;hX;Call with:m!X; x reg. - lo byte of stringr!X; y reg. - hi byte of stringwX;| PRINT&PNT1;;Save string'PNT1;;address%>DOCHARQ@PNT17;;Get a charR>EOL;;EOL?FPADIT;;Yes, pad line.PTEXT8;;No, show char3;;and do theHDOCHAR;;next oneX;!X;Pad rest of line with blanksX;PADITQ>;;Blank charDOPAD)>(;;All done?EPREXIT;;Yes, return.PTEXT8;;No, show blank3;;Loop untilHDOPAD;;line is done PREXIT:X;!X;---------------------------- X; NUMERICAL DISPLAY ROUTINES!X;----------------------------X;X;Show generation numberX; SHOGEN%>;;Screen offset $>P;;Color maskQGENER;;Print... BCD QGENER!!BCD&X;+X;Show population0X;5 SHOPOP:%>=;;Screen offset?$>;;Color maskDQPOP;;Print...I BCDNQPOPS!BCDXX;]X;Show starting pop.bX;g SHOSTRTl%>B;;Screen offsetq$>P;;Color maskvQPOP;;Print...{ BCDQPOP!BCDX;X;Show largest pop.X; SHOMOST%>G;;Screen offset$>;;Color maskQMOST;;Print... BCDQMOST;;Fall into BCD..X;X;Print 2 BCD digitsX;X;Call with:X; a reg. - BCD dataX; x reg. - color mask+16 X; y reg. - offset from DISPX;BCD5;;Save BCD data&COLMSK;;Save color maskV?;;Move upper 4V?;;bits into lowerV?;;4 bits...V?LCOLMSK;;make it ATASCIIPDISP8;;and show it. 3;;Goto next pos.7;;Get original #M>;;mask upper halfLCOLMSK;;make it ATASCII PDISP8;;and show it.%3;;Goto next pos.*:;;and leave./X;4X;-----------9X; SHOW MODE>X;-----------CX;H SHOMODEM%>L;;Screen offsetR$MODE;;Get mode #WQLET19;;Print first\PDISP8;;letter of modea3fQLET29;;Print secondkPDISP8;;letter...p3uQLET39;;and printzPDISP8;;final letter:X;X;Mode dataX;LET1 @=ARRSSFALET2 @=AGGSSSALET3 @=ANQNQTAX;X;---------------------X; MAIN SET-UP ROUTINEX;---------------------X; SETUPQ>;;Set mode toPMODE;;0 (RGN)PSDMCTL;;Turn DMA off SETCELL;;Set cell data SETCOLR;;Set colors SETDISP;;Set-up display SETPM;;Set PM grphicsQ>>;;Enable DMA forPSDMCTL;;screen and PM:;;and exit!X;X;--------------------X; INIT CELL DATABASE X;-------------------- X; $X;Reset all cell variables except #X;MODE which does not need to be X;changed when the cells are. X; SETCELL$ $>;;Clear out the) &POP;;population.... &POP3 &MOST;;largest pop...8 &MOST= &GENER;;Set generationB 2;;to 1 (BCD)G &GENERL :Q X;V X;---------------[ X; SET UP COLORS` X;---------------e X;j SETCOLRo $>;;Do 9 color regst COLRQCOLORS9;;Get a colory PPCOLR09;;& put in reg.~ 0;;Repeat til done ICOLR : X; X;Initial colors X; COLORS  @BOARD;;PCOLR0  @BOARD;;PCOLR1  @BOARD;;PCOLR2  @BOARD;;PCOLR3  @GENTXT;;COLOR0  @GENNUM;;COLOR1  @GR0BAK;;COLOR2  ;;COLOR3  ;;COLBAK X; X;--------------------- X; SET-UP MAIN DISPLAY X;--------------------- X; X;Clear display memory X; SETDISP $>;;Clear 480 bytes A;;in two blocks CLRDPDISP9;;of 240 each... PDISP9 2 (> HCLRD X; X;Print labels# X;( $> ;;Print- PRL1QGLABEL9;;"GENERATION:"2 PDISP9;;on line 0...7 0< IPRL1A $>#;;Print cellF PRL2QLABELS9;;data labelsK PDISP9;;on line 1...P 0U IPRL2Z X;_ X; Draw bordersd X;i Q>4DISPe ;;Draw then PPNT1;;long sectionss Q>5DISPe ;;of thex PPNT1;;border} $>;;(15 chars long) BDRAWQ>B;;Print a piece PDISPR9;;of top line Q>C;;and the bottom PDISP9;;line plus %>;;part of the Q>E;;left side P@PNT17 %>;;and finally Q>D;;a piece of the P@PNT17;;right! QPNT1;;Add 20 to the ,;;address of the O>;;current line so PPNT1;;that we'll know QPNT1;;where to print O>;;the next side PPNT1;;chars. 0;;Finish drawing! IBDRAW X; %>F;;Add upper left 'DISPQ;;corner, 3;;upper right, 'DISPb 3;;lower left, 'DISP 3;;and finally the 'DISP;;lower right! X; X;Point to main DL X; Q>4DL" PSDLSTL' Q>5DL, PSDLSTL1 X;6 X;Start up DLIs; X;@ Q>4DLI1;;Point to firstE PVDSLST;;DLI...J Q>5DLI1O PVDSLSTT Q>;;Enable DLIs andY PNMIEN;;VBIs^ X;c X;Show cell datah X;m  SHOGEN;;Show generationr  SHOPOP;;current pop.w  SHOSTRT;;starting pop.|  SHOMOST;;Maximum pop. !SHOMODE;;and mode X; X;Main display list X; DL p=p=p  =4DISP=5DISP      p  ========  =======    p    A=4DL=5DL X; X;Misc. display data X; GLABEL AGENERATION:A LABELS APopulation A  AStarting MostA  A ModeA X; X;------------------ X; MAIN SCREEN DLIs X;------------------ X; X;Set the text luminance for X;the label line (1) X; DLI15;;Save acc. Q>@GR0LUM;;Set text! PHCOLR1;;luminance& PWSYNC;;Wait for sync+ Q>4DLI2;;and point to0 PVDSLST;;next dli...5 Q>5DLI2: PVDSLST? 7;;Restore acc.D 9I X;N "X;Set colors for the numbers onS X;line 2X X;] DLI25;;Save acc.b Q>@NUM1;;Set numberg PHCOLR0;;color 1,l PWSYNC;;wait for sync,q Q>@NUM2;;and set numberv PHCOLR1;;color 2{ Q>4DLI3;;Point to next PVDSLST;;dli... Q>5DLI3 PVDSLST 7;;Restore acc. 9 X; !X;Set colors for the cells and X;border of board X; DLI35;;Save acc. Q>@CELL;;Set cell color PHCOLR0 PWSYNC;;Wait for sync QBORDER;;and set border PHCOLR1;;color Q>4DLI4;;Point to final PVDSLST;;dli... Q>5DLI4 PVDSLST 7;;Restore acc. 9 X; #X;Set text luminance for message X;line X; DLI45;;Save acc Q>@GR0LUM;;Set text PHCOLR1;;luminance, and PWSYNC;;wait for sync Q>4DLI1;;Point back to PVDSLST;;first dli... Q>5DLI1 PVDSLST% 7;;Restore acc.* 9/ X;4 X;----------------------9 X; CLEAR MISSILE MEMORY> X;----------------------C X;H CLRMISSM $>;;Fill missileR A;;memory withW CCLRPMISSL9;;zeroes\ 2a HCCLRf :k X;p X;--------------------u X; SET-UP PM GRAPHICSz X;-------------------- X; X;Clear pm memory X; SETPM  CLRMISS;;Clear missiles $>;;Clear players A;;0-3... PMCLRPPL09 PPL19 PPL29 PPL39 2 HPMCLR X; X;Init pm X; Q>5PM;;Point to pm PPMBASE;;memory Q>;;Turn on pm PGRACTL;;graphics &SIZEM;;Set missl. size >;;Set all players SETSIZEPSIZEP09;;to 0;;quadruple width ISETSIZE Q>;;Set priorityPGPRIOR;;w/5th player onX; X;Draw board squaresX;%>;;Draw squaresSQ1$>;;in players 0-3SQ2QSQRDAT9;;Get data byte$PPL0H8;;and put it in)PPL1H8;;each player.... PPL2H83 PPL3H883;;Next pm byte=0;;Finish up a setBISQ2;;of 4 squaresG)>LHSQ1;;Complete boardQX;V$>;;Set player[MOVSQQPLHPOS9;;horizontal`PHPOSP09;;positions...e0j IMOVSQo:tX;yX;Square data~X;SQRDAT ===̈ ===̍ 3=3=3=3 3=3=3=3X;X;Player horiz. positionsX;PLHPOS @=`==X;X;-------------------------X; VB BORDER COLOR HANDLERX;-------------------------X; BCOLOR#COLTIM;;Add 1 to timerHOLDCOL;;If not 0, exitQRANDOM;;Get random #M>;;Make it <16T?;;Mult by 16...T?T?T?PBORDER;;Save the resultQRANDOM;;Get random #M>;;Make it <4,,;;add 6, and addO>;;it to previous LBORDER;;result for thePBORDER;;new color! OLDCOL:X;X;-------------------#X; VB CELL ANIMATION(X;--------------------X;2 ANIMATE7QIMAGE;;Get image #<T?;;and multiplyAT?;;it by 8 for anFT?;;index into theK?;;cell dataP$>;;Copy 8 bytesU ANIMQCELIMG8;;from the dataZPCHSETP9;;table into_3;;char number 10d0i IANIMn$IMAGE;;Point to nexts 2;;imagex(>;;Last one done?}DANXIT;;No, exit$>;;Yes, reset itANXIT&IMAGE;;Save new num:X;X;Cell image dataX; CELIMG ==<=v ~=<==X; ==<=v ~=<==X; ==>=v ~=<==X; ==>=w ~=<==X; ==<= w=<==X; ==<=~ w=>==X; ==<=~ v=>== X; ==<=~ v=<==X; ==<=~" n=<=='X;, ==<=~1 n=<=8=6X;; ==<=~@ n=|=8=EX;J ==<=~O =|==TX;Y ==<=^ =<==cX;h ==|=m ~=<==rX;w =8=|=n| ~=<==X; =8=<=n ~=<==X;>D:FLIFE2.M65 RESET