>Life-MC2 ) Copyright *** Jason Wolfe 1993 *** @ A Machine Code program which simulates the 'Game of Life' (: Not a very advanced version, but it is fairly fast. 2J I have left the code disassembled for those who might be interested < in how it was done. F12 P :14 Z life d rndgen n0: x mc 12   rndgen  23,255,63,63,63,63,63,0,0,0  N%= &15000 &15A00 A=(1)  A>.65 A=1 A=0 ?N%=A     life  num=8  sum=9 " on=10 , count=11 6 offset=3 @ index=4 J base=5 T low=6 ^ top=7 h r strbuffer 20 | mc 2000  F%=&15000 : base G%=&12000 : low H%=&A00 : top   vdu=256 movecursor=31  cls=12  block=255  space=32   pass=0 3 3  P%=mc [  OPT pass MOV count,#1 & 0 .loop1 :MOV sum,#0 D MOV on,#0 NMOV index,#0 X b .loop2 lMOV sum,#0 vMOV offset,index  SUB offset,offset,#80 LDRB num,[base,offset] CMP num,#0 ADDNE sum,sum,#1  SUB offset,offset,#1 LDRB num,[base,offset] CMP num,#0 ADDNE sum,sum,#1  ADD offset,offset,#2 LDRB num,[base,offset] CMP num,#0  ADDNE sum,sum,#1   ADD offset,offset,#80 *LDRB num,[base,offset] 4CMP num,#0 >ADDNE sum,sum,#1 H RSUB offset,offset,#1 \LDRB num,[base,offset] fCMP num,#0 pMOVNE on,#1 z Q on,#0  SUB offset,offset,#1 LDRB num,[base,offset] CMP num,#0 ADDNE sum,sum,#1  ADD offset,offset,#80 LDRB num,[base,offset] CMP num,#0 ADDNE sum,sum,#1  ADD offset,offset,#1 LDRB num,[base,offset] CMP num,#0 ADDNE sum,sum,#1  $ADD offset,offset,#1 .LDRB num,[base,offset] 8CMP num,#0 BADDNE sum,sum,#1 L V .test1 ` CMP on,#0 j BNE test2 tCMP sum,#3 ~ BNE test2 MOV num,#1 STRB num,[low,index] BAL endtest   .test2  CMP on,#1 BNE endtest CMP sum,#2 BLT test2yes CMP sum,#3 BGT test2yes BAL endtest   .test2yes MOV num,#0 STRB num,[low,index] ( 2 .endtest <ADD index,index,#1 FCMP index,top P BNE loop2 Z dMOV index,#0 nSWI vdu+movecursor x MOV R0,#0 SWI "OS_WriteC"  MOV R0,#0 SWI "OS_WriteC"  .printloop LDRB num,[low,index] STRB num,[base,index] CMP num,#0 SWIEQ vdu+space SWINE vdu+block ADD index,index,#1 CMP index,top BNE printloop  .escape_routine MOV R0,#129 " MOV R1,#0 , MOV R2,#0 6SWI "OS_Byte" @CMP R2,#27 J BEQ out T ^.write_generation hSWI vdu + movecursor r MOV R0,#0 |SWI "OS_WriteC" MOV R0,#31 SWI "OS_WriteC" SWI "OS_WriteS" EQUS "Generation : "  EQUB 0 MOV R0,count ADR R1,strbuffer MOV R2,#20 SWI "OS_ConvertCardinal3" SWI "OS_Write0"  ADD count,count,#1  B loop1  .out MOV PC,R14 &] 0 : pass DA$= N