þþEdX;LIFE IN THE FAST LANEi!X;Atari 8-bit Ver 1.00 4-20-86n$X;Copyright 1986 Analog ComputingsX;Programmed by James HaguexX;} X;Part II‚X;‡X;-----------------ŒX; VB DING HANDLER‘X;-----------------–X;›„DING Q…SOUND;;Get sound vol.¥,;;add distortionªO> ;;value¯P…AUDC1;;and set it´Q„TONE;;Set proper¹P…AUDF1;;frequency¾Q…SOUND;;If vol is 0ÃF‡XITDING;;then exit!È"…SOUND;;Else lower volÍ ‡XITDING:ÒX;×X;--------------ÜX; DRAW CURSORáX;--------------æX;ë#X;The cursor consists of misslesðX;zero thru three.õX;ú ‡DRAWCURÿ%„CURY;;Move 10 bytes$> ;;of cursor shape …CDRAWQ†CURDAT9;;data intoP…MISSL8;;missile memory30 I…CDRAW"X;'$>;;Set horizontal,Q„CURX;;positions for1†SETCHPP†HPOSM09;;the 46,;;missiles. Each;O>;;one is two@0;;units away fromEI†SETCHP;;previousJ:;;missile.OX;T"X;Cursor shape data: 8 bytes ofY!X;actual data plus leading and^#X;trailing zeroes to make motionc X;easier.hX;m†CURDAT =ç===r ===ç=wX;|X;----------------------X; CONSOLE KEY ROUTINES†X;----------------------‹X;X;Init console key flag•X;š"X;Set CONKEY to 0 if no consoleŸ"X;keys are pressed, else set it¤ X;to 1©X;® ‡INITCON³$>¸Q†CONSOL;;Get keys½R>;;If not downÂF†NOCKEY;;set to 0,Ç2;;else set to 1̆NOCKEY&†CONKEYÑ:ÖX;ÛX;Check console keysàX;å#X;Return 0 in acc. if no consoleê"X;keys are pressed, else returnï X;the value of CONSOL in acc.ôX;ù †CHKCONþQ†CONSOL;;Any consoleR>;;keys pressed?H…CCHK1;;No, check more! Q>;;Yes, zero keyP†CONKEY;;flag and return :;;a zero!X;!…CCHK15;;Save CONSOL&Q†CONKEY;;Flag clear?+F…CCHK2;;Yes, go do it!07;;No, get CONSOL5Q>;;back and return: :;;a zero!?X;D…CCHK27;;A legal press!!I:;;Return CONSOL!NX;SX;------------------------XX; CELL PLACEMENT HANDLER]X;------------------------bX;gX;InitializelX;q …PLACEv$>4„MSG0;;Print instruc-{%>5„MSG0;;tion message€ …PRINT…Q>;;Init cursorŠP„CURY;;coordinates...Q>x” P„CURX™ ‡DRAWCUR;;Draw cursorž ‡INITCON;;Set key flag£$>ÿ;;Clear any stray¨&‚CH;;keypresses­2;;Clear important²&…SOUND;;variables...· &…PRESS¼ &†SELECTÁ &„DISTÆ&†VBICTL;;Set VB modeËX;ÐX;Main placement loopÕX;Ú‡CLRCLOKQ>;;Clear clockß P†RTCLOKäQ†SELECT;;Decrement theéF†HANGON;;select keyî"†SELECT;;timer, if set.óX;ø†HANGONQ†RTCLOK;;If 1/30 secýR>;;has elapsed,D†NOTYET;;handle the ‡MOVECUR;;cursor and !‡CLRCLOK;;reset the clockX;†NOTYETQ‚CH;;If escape isR>;;pressed, call H…NOESC;;the cell clear/% …CLEAR;;reset routine*Q>ÿ;;And clear the/P‚CH;;keyboard!4X;9 …NOESC †CHKCON;;If no console>F†HANGON;;keys, go loop!CW?;;If start isHE†NOSTRT;;pressedMQ>;;put the VBRP†VBICTL;;on hold,W …QUIET;;kil sound,\ ‡CLRMISS;;clear cursor,a:;;and leave!fX;k†NOSTRTW?;;If select ispD‡NEWMODE;;pressed, handleuQ>;;it, otherwisezP†SELECT;;clear the sel-F†HANGON;;ect key timer.„ ‡NEWMODEQ†SELECT;;If timer is‰H†HANGON;;set, then bye!ŽQ> ;;A legal press!“P†SELECT;;Reset key timer˜$„MODE;;and add 1 to2;;the current¢(>;;mode making§H†MODEOK;;sure it isn't¬$>;;greater than 4±†MODEOK&„MODE¶ ‡SHOMODE;;Show new mode»!†HANGON;;and loop!ÀX;ÅX;Instruction messageÊX;Ï„MSG0 A’ Use joystick to AÔ Aplace cells on AÙ A…boardAÞ ƒEOLãX;èX;----------------íX; CURSOR HANDLERòX;----------------÷X;ü ‡MOVECUR ‡CHKTRIG;;Check triggerQ†STICK0;;If cursor is $„DIST;;moving, thenH†MOVING;;go move it!R>;;If stick isF‡XITMOVE;;pushed, thenPƒDIR;;start up the$Q>;;cursor and go)P„DIST;;slie it!. H…SLIDE3X;8†MOVING$ƒDIR;;The cursor is=R…OPDIR9;;moving! IfBH…SLIDE;;the stick isGQ…OPDIR9;;being pulledLPƒDIR;;in the direc-QQ>;;tion oppositeV;;;of cursor[S„DIST;;motion, reverse`P„DIST;;its direction!eX;j…SLIDE$ƒDIR;;Calculate newoQ„CURX;;cursor x coordt,;;and make sureyO„XOFF9;;it is legal...~?ƒR>@ˆ D†HOLDITR>¹’DƒDOY;;Its legal!—X;œ†HOLDITQ>;;Stop all motion¡P„DIST;;if a bad coord¦‡XITMOVE:;;is found.«X;°ƒDOYQ„CURY;;Calculate newµ,;;y coord andºO„YOFF9;;make sure it¿R>G;;is legal...Ä D†HOLDITÉR>ÀÎ E†HOLDITÓP„CURY;;Save new y andØ'„CURX;;new x, thenÝ"„DIST;;record moveâQ>;;and clear theçP…PRESS;;trigger flagì!‡DRAWCUR;;Re-draw cursor!ñX;öX;Movement dataûX;„XOFF ====ÿ=ÿ=ÿ ==  „YOFF =ÿ====ÿ== =ÿ!…OPDIR  = = ===== = X;#X;-----------------(X; TRIGGER HANDLER-X;-----------------2X;7 ‡CHKTRIG<$…TRIG0;;If trigger isAF†YESCHK;;pressed, theF0;;trigger flagK&…PRESS;;is clear, andP…NOCHK:;;the cursor isU†YESCHKQ„DIST;;aligned on aZH…NOCHK;;square, then_Q…PRESS;;process itd H…NOCHKiX;n$>;;Set triggers&…PRESS;;flagx&…GENER;;Set generation} 0;;to one‚&…GENER;;Calculate scrn‡ ‡CONVERT;;addr of cursorŒ<;;Decimal mode!‘Q@„PNT17;;If on a space–F‡ADDCELL;;add a cell›X; Q>;;Remove a cell!¥ P@„PNT17ªQƒPOP;;Subtract (bcd)¯;;;one from the´S>;;colony popula-¹PƒPOP;;tion, max. pop.¾P„MOST;;and startingà QƒPOPÈS>Í PƒPOPÒ P„MOST×$>–;;Go set properÜH†SETSND;;ding soundáX;æ‡ADDCELLQ> ;;Add a cell!ë P@„PNT17ðQƒPOP;;Add 1 to theõ,;;colony popula-úO>;;tion, max. pop.ÿPƒPOP;;and startingP„MOST;;pop...  QƒPOPO> PƒPOP P„MOST$>;;Go set sound"X;'†SETSND-;;Decimal off!,Q>;;Set correct1P…SOUND;;add/remove6&„TONE;;sound; †SHOGEN;;Show updated@ †SHOPOP;;cell data...E ‡SHOSTRTJ !‡SHOMOSTOX;TX;----------------------YX; COORDINATE CONVERTER^X;----------------------cX;h"X;Convert cursor pm coordinatesmX;to a screen memory addressrX;wX;Call with:|!X; curx - cursor pm x coord.!X; cury - cursor pm y coord.†X;‹ X;Return: X; pnt1 - base line address•X; y reg - column offsetšX;Ÿ ‡CONVERT¤Q„CURY;;Convert pm y©;;;coord to board®S>G;;row number³V?;;(0 to 15)...¸V?½V?Â5;;Save the resultÇP„PNT1;;and put it intoÌQ>;;the work areaÑ P„PNT1Ö$>;;Now multiplyÛ †MULT16T„PNT1;;the column numàU„PNT1;;by 20 toå0;;determine theêI†MULT16;;offset from theï7;;beginning ofôT?;;board memory.ùT?;;This takes 2þ,;;steps: 1stO„PNT1;;mult the columnP„PNT1;;by 16, then by Q„PNT1;;4; now add theO>;;two results andP„PNT1;;save the mess!Q„PNT1;;Finally, add!,;;the offset to&O>4„DISPd ;;the start+P„PNT1;;of board memory0Q„PNT1;;for the base5O>5„DISPd ;;line:P„PNT1;;address! WHEW!?X;DQ„CURX;;Convert theI;;;cursor pm xNS>0;;coord to theSV?;;column offsetXV?;;from the base]V?;;line addres,b?;;and put it ing:;;the y reg!lX;qX;-------------------vX; CLEAR/RESET CELLS{X;-------------------€X;… …CLEARŠQƒPOP;;If cell pop. isH‡CLEAROK;;0, then there”QƒPOP;;is no reason to™F†XITCLR;;clear them!žX;£‡CLEAROKQ>4…BOARD;;If some¨P„PNT1;;cells exist,­Q>5…BOARD;;fill the²P„PNT1;;16x16 board·$>;;area with¼†CLRROWQ>;;0s (spaces)...Á%>ƆCLRCOLP@„PNT17Ë1Ð I†CLRCOLÕQ„PNT1;;Add 20 to cur-Ú,;;rent screenßO>;;address to getäP„PNT1;;address oféQ„PNT1;;next line...îO>ó P„PNT1ø0ý I†CLRROWX; ‡SETCELL;;Reset cell data  †SHOGEN;;Display new †SHOPOP;;cell data... ‡SHOMOST ‡SHOSTRT †XITCLR:;;Return!%X;*X;-----------------/X; CHECK FOR PAUSE4X;-----------------9X;>"X;Only the accumulator is used!CX;H…PAUSEQ‚CH;;Space barMR>!;;pressed?RH‡NOPAUSE;;Nope, leave!WQ†RTCLOK;;Yes! Save\5;;clock value,a …QUIET;;shut up, andf$>';;save whateverk†TCOPY1Q„TEXT9;;text is onpP…TSAVE9;;the messageu 0;;line...z I†TCOPY1$>4†PAUSED;;and print a„%>5†PAUSED;;special‰ …PRINT;;messageŽX;“„PAUZQ‚CH;;Wait for˜R>!;;a differentF„PAUZ;;key.¢$>';;When one is§†TCOPY2Q…TSAVE9;;found, res-¬P„TEXT9;;tore the old±0;;message line...¶ I†TCOPY2»7;;Restore clockÀ P†RTCLOKŇNOPAUSE:;;And go back!ÊX;ÏX;Pause messageÔX;Ù†PAUSED A AÞ A‡ PausedAã ƒEOLèX;íX;---------------òX; DELAY ROUTINE÷X;---------------üX; X;Call with: "X; acc. - # of jiffies to wait X; X;Return a non-0 number if a !X;console key aborts the delay X;else return a 0. X;$ "X;Only the accumulator is used!) X;. …DELAY3 5;;Clear RTCLOK...8 Q>= P†RTCLOKB †DELAY27;;Wair until timeG R†RTCLOK;;is up, or untilL F‡TIMESUP;;a console keyQ 5;;is pressedV †CHKCON[ F†DELAY2` 7e :j ‡TIMESUPQ>o :t X;y X;-------------------~ X; MAIN LIFE ROUTINEƒ X;-------------------ˆ X; „LIFE’  ‡INITCON;;Init console— QƒPOP;;If populationœ H†DOLIFE;;is zero, then¡ QƒPOP;;print a message¦ H†DOLIFE;;saying so and« $>4„MSG1;;exit...° %>5„MSG1µ !…DOMSGº X;¿ †DOLIFE$>ÿ;;Clear keyboardÄ &‚CHÉ 2;;Use the firstÎ &…CHORD;;chordÓ ‡NEXTGEN „SCAN;;Scan boardØ Q†ACTIVE;;If no cells areÝ H†UNSTAB;;active then theâ $>4„MSG5;;population hasç %>5„MSG5;;stabilized!ì !…DOMSG;;(right Zink?)ñ †UNSTAB$>4„MSG2;;Unsatble, soö %>5„MSG2;;print lifeû  …PRINT;;message  †GROWTH;;Regenerate! H‡XITLIFE;;If aborted, bye QƒPOP;;If new popu- H„CONT;;lation is 0, QƒPOP;;then the colony H„CONT;;is dead, so $>4„MSG3;;print a message# %>5„MSG3;;and exit...( !…DOMSG- X;2 „CONTQ„MODE;;If in FaST mode7 R>;;check for pause< H†NOTFST;;or console keyA  …PAUSE;;then jump rightF  †CHKCON;;into the nextK F‡NEXTGEN;;generationP :U X;Z †NOTFSTR>;;If in Single_ D‡REGULAR;;Step mode,d …SSTEPQ…TRIG0;;check for ai F‡NEXTGEN;;trigger press,n $>4„MSG4;;print a messages %>5„MSG4;;to the user,x  …PRINT;;check console}  †CHKCON;;keys, and‚ F…SSTEP;;repeat!‡ :Œ X;‘ ‡REGULARQ>;;If in ReGular– P†RTCLOK;;mode, wait 1/2› ‡REGWAITQ†RTCLOK;;a sec while  R>;;checking for a¥ E‡NEXTGEN;;pause or aª  …PAUSE;;console key...¯ †CHKCON´ F‡REGWAIT¹ :¾ X;à …DOMSG …PRINT;;Print message,È Q>x;;wait a while,Í  …DELAY;;and thenÒ ‡XITLIFE:;;exit life!× X;Ü X;Life related messagesá X;æ „MSG1 A’ No cells have beeAë  A“n placed on the boaAð A‚rdAõ  ƒEOLú „MSG2 A’ Let theAÿ  A‹re be life!A  ƒEOL „MSG3 A’ The cell cA  AŽolony has diedA  ƒEOL „MSG4 A’ Press trigger fA  A’or next generationA"  ƒEOL' „MSG5 A’ Cell populatiA,  A‘on has stabilizedA1  ƒEOL6 X;; X;-------------------@ X; PLAYFIELD SCANNERE X;-------------------J X;O X;Return # of active cells inT !X;ACTIVE and information aboutY !X;these cells in CADRL, CADRH,^ X;and CTYPEc X;h „SCANm Q>;;Clear cellr P†ACTIVE;;counter, andw Q>4…BOARD ;;move| P„PNT1;;board address Q>5…BOARD ;;into† P„PNT1;;PNT1...‹ X; Q>;;Init row index• PƒROWš …DOROWQ>;;Init columnŸ PƒCOL;;index¤ …DOCOLQ>;;Clear counter© P…COUNT® $>;;Scan 8 times³ †SEARCH%‡SCANADD9;;Get offset¸ Q@„PNT17;;Is there a½ R> ;;cell here? H†NOCELL;;No, ignore it!Ç #…COUNT;;Yes, add 1 toÌ †NOCELL0;;the counter andÑ I†SEARCH;;keep searching!Ö X;Û $…COUNT;;If the currentà %>;;char is a spaceå Q@„PNT17;;with 3 friendsê H…ACELL;;then grow aï (>;;cell hereô H…NOACTù F†RECORDþ …ACELL(>;;If it is a cell F…NOACT;;with 2 or 3 (>;;friends, keep F…NOACT;;it alive, else †RECORD#†ACTIVE;;kill it! $†ACTIVE;;Record any P…CTYPE9;;changes that! Q„PNT1;;are made to the& ,;;cell colony...+ O>;;(the cell is 210 P…CADRL9;;bytes ahead of5 Q„PNT1;;the current: O>;;address in? P…CADRH9;;PNT1)D X;I …NOACTQ„PNT1;;Add 1 to PNT1N ,;;so it pointsS O>;;to the nextX P„PNT1;;board square...] Q„PNT1b O>g P„PNT1l "ƒCOL;;Loop until 16q I…DOCOL;;cols are done!v Q„PNT1;;Add 4 to PNT1{ ,;;so it points€ O>;;to the first… P„PNT1;;square in theŠ Q„PNT1;;next row... O>” P„PNT1™ "ƒROW;;Loop until 16ž I…DOROW;;rows are done!£ :¨ X;­ X;Scan data² X;· ‡SCANADD ===¼  =(=)=*Á X;Æ X;----------------------Ë X; GROWTH/DEATH HANDLERÐ X;----------------------Õ X;Ú X;Put growth/death charactersß X;in proper places on boardä X;é †GROWTHî Q„MODE;;If in FaST modeó R>;;then skip theø H„DOFX;;fancy animationý !‡FSTMODE;;and just do it! „DOFX$>;;Init the ‡SETCHARQ>;;growth/death P…CHSETX9;;chars... Q†CELIMG9 P…CHSET`9 0 I‡SETCHAR% X;* %>;;Find all of the/ $†ACTIVE;;board locations4 …PLOT1Q…CADRL9;;where active9 P„PNT1;;cells or spaces> Q…CADRH9;;are, and placeC P„PNT1;;growth or deathH Q…CTYPE9;;charactersM H…DYING;;there so we canR Q> ;;animate them...W H†PLOTIT\ …DYINGQ> a †PLOTITP@„PNT17f 0k H…PLOT1p X;u X;Now animate the growing andz !X;dying cells along with sound X;effects if the current mode„ X;permits.‰ X;Ž $>;;Handle 8 frames“ &„TEMP˜ „GROW$„TEMP;;Get growth %†GROIMG9;;image # and¢ $>;;copy the image§ ‡GROANIMQ†IMAGES8;;into¬ P…CHSETX9;char 11...± 3¶ 2» (>À H‡GROANIMÅ $„TEMP;;Get deathÊ %†DIEIMG9;;image # andÏ $>;;copy the imageÔ ‡DIEANIMQ†IMAGES8;;intoÙ P…CHSET`9;;char 12...Þ 3ã 2è (>í H‡DIEANIMò X;÷ Q„MODE;;If mode doesü F‡DOCHORD;;not allow soundR>;;then skip theH‡TIMEOUT;;sound routine ‡DOCHORD$…CHORD;;otherwiseQ…NOTE19;;generate theP…AUDF1;;appropriateQ…NOTE29;;3 note chord... P…AUDF2$ Q…NOTE39) P…AUDF3.Q„TEMP;;Set volume and3,;;distortion8O>¡;;(same for all 3=P…AUDC1;;channels)...B P…AUDC2G P…AUDC3LX;Q‡TIMEOUTQ>;;Now wait aVP†RTCLOK;;short while[…SLEEPQ†RTCLOK;;Get clock`R>;;Time up?eE‡GROMORE;;Yes!j …PAUSE;;No, check pauseo †CHKCON;;and console keytF…SLEEP;;and loop!y …QUIET;;A console key~Q>;;is pressed soƒ5;;set returnˆH†REPLOT;;value to 1X;’ ‡GROMORE"„TEMP;;Do all frames—I„GROW;;and when doneœ‡FSTMODEQ>;;set return¡5;;value to 0¦X;«X;Update board and cell data°X;µ†REPLOT%>º<;;Decimal mode!¿…PLOT2$†ACTIVE;;Get theÄQ…CADRL9;;address of eachÉP„PNT1;;of the activeÎQ…CADRH9;;cells and putÓP„PNT1;;it into PNT1ØQ…CTYPE9;;Get cell typeÝH…DODIE;;Cell is dying!âQ> ;;Its growing soçP@„PNT17;;show a fullyìQƒPOP;;grown cell andñ,;;add one to theöO>;;cell populationûPƒPOP;;(in decimalQƒPOP;;mode of course)O>  PƒPOPR„MOST;;If the cell popF†CKMOST;;is greater thanD‡PLOTNXT;;(or=to) the†CKMOSTQƒPOP;;highest pop so#R„MOST;;far, then copy(D‡PLOTNXT;;POP into MOST..-‡NEWMOSTQƒPOP2 P„MOST7 QƒPOP< P„MOSTA !‡PLOTNXTF…DODIEQ>;;Its dying soKP@„PNT17;;plot a blankPQƒPOP;;space andU;;;subtract 1 fromZS>;;the population_PƒPOPd QƒPOPiS>n PƒPOPs‡PLOTNXT"†ACTIVE;;Loop tilxH…PLOT2;;ACTIVE is 0!}X;‚†XITGRO …QUIET;;No sound!‡Q…GENER;;Add 1 toŒ,;;generation (we‘O>;;are still in–P…GENER;;decimal mode)› Q…GENER O>¥ P…GENERª-;;No decimal!¯$…CHORD;;Add 1 to chord´2;;number making¹(>;;sure it is not¾H‡CHORDOK;;greater thanà $>;;5...ȇCHORDOK&…CHORDÍ †SHOGEN;;Show new cellÒ †SHOPOP;;data...× ‡SHOMOSTÜ7;;and return theá:;;correct value!æX;ëX;Regeneration image dataðX;õ†GROIMG ===ú  =(=0=8ÿ†DIEIMG 8=0=(=  === X;†IMAGES ==8=~ ~=<==X; ==8=|" |=8=='X;, ==8=|1 |===6X;; ===<@ <===EX;J ===;;Clear colors...à P†COLOR1å P†COLOR2ê P†COLBAKïQ>4ƒIDL;;Point to introô$>5ƒIDL;;display list...ù P†SDLSTLþ&†SDLSTLQ><;;Wait a sec... …DELAY  H†GOTOIT$> ;;"Fade on" the†FADEON#†COLOR1;;magazineQ>;;credits...! …DELAY& H†GOTOIT+00 I†FADEON5Q>x;;Let it hang: …DELAY;;around for a?H†GOTOIT;;sec, thenD$> ;;fade to black..I‡FADEOFF"†COLOR1NQ>S …DELAYX H†GOTOIT]0b I‡FADEOFFgQ><;;Pause a littlel …DELAY;;before showingqH†GOTOIT;;the titlevX;{X;Display title screen€X;…$>;;Set-up theŠ…CLOADQ‡TCOLORS9;;properP†COLOR09;;title screen”0;;colors...™ I…CLOADžQ>4ƒTDL;;Install the new£$>5ƒTDL;;display list...¨ P†SDLSTL­&†SDLSTL²Q>;;Turn on cell·P†VBICTL;;animation¼…TWAIT †CHKCON;;and wait forÁF…TWAIT;;a console key!ƆGOTOIT:;;AHHhhhhh.ËX;ÐX;Intro display listÕX;ÚƒIDL p=p=pß p=p=p=p=pä p=p=p=p=pé pî Bó …ISCRNø Aý ƒIDLX;X;Intro screen data X;…ISCRN A‘ Analog ComA A“puting presents A A„ A X;%X;Title screen display list*X;/ƒTDL p=p=p4 p=p=p9 F> …TSCRNC ====H pM R p=pW =\ p=p=pa f Ak ƒTDLpX;uX;Title screen datazX;$…TSCRN == ===== =„  = = = == = = ‰  ==ŽX;“! ==J=====J==J˜! ====J=====X;¢! == ===== == §  = === = = ==¬ ±X;¶! ==J=====J==J»! ====J=====ÀX;Å! == ===== == Ê! ==== =====ÏX;Ô ==J=J=J=J==J=Ù J=====J=J=J=JÞ =ãX;è €=AŽ IN THE FAST Aí €=A†LANE Aò A“ CREATED BY A÷ A Aü €=AŽ JAMES HAGA €=A†UE A @=A PRESS STARA  @=A…T AX;X;Title screen colorsX;‡TCOLORS F==–