title the prverbial munching squares a=1 ;position of square b=2 c=3 d=4 e=5 ;square in use f=6 ;flags p=17 time==3 ;time (in 30'ths) between munches pdl==10 tv=2000*100 begflg==10 ;first time around pstack: -pdl,,. block pdl munch: move p,pstack tro f,begflg movei b,0 .call [setz 'corblk 1000,,300000 1000,,-1 [-10,,100] 1000,,-2 setz b] .value .value [asciz/:proced /] .rtime a, andi a,7 loop: move b,square(e) pushj p,put movei b,time .sleep b, move b,square(e) pushj p,unput addi a,18. idivi a,440.*18. skipe a trz f,begflg movei a,(b) caige a,18. subi a,1 jumpge a,.+2 movei a,17. addi e,1 cail e,nsquar ;the number of diff. squares movei e,0 jrst loop square: -sqlen,,squar1 -sqlen,,squar2 -sqlen,,squar3 -sqlen,,squar4 nsquar==.-square put: movei c,(a) put1: caige c,440.*18. jrst put2 jrst put3 put2: move d,(b) iorm d,tv(c) put3: subi c,18. jumpge c,put4 addi c,440.*18.+1 trne f,begflg popj p, put4: aobjn b,put1 popj p, unput: movei c,(a) unput1: caige c,440.*18. jrst unput2 jrst unput3 unput2: move d,(b) andcam d,tv(c) unput3: subi c,18. jumpge c,unput4 addi c,440.*18.+1 trne f,begflg popj p, unput4: aobjn b,unput1 popj p, radix 2 squar1: 000000000000000000000000000000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 sqlen=.-squar1 squar2: 000000000000000000000000000000000000 000011111111100000111111111100000000 000011111111110001111111111100000000 000011111111111011111111111100000000 000001111111110001111111111000000000 000001111111111011111111111000000000 000001111111111111111111111000000000 000001111111111111111111111000000000 000001111111111111111111111000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 ifn .-squar2-sqlen , .err bad block squar3: 000000000000000000000000000000000000 000111111000000000000000001110000000 000111111100000000000000011110000000 000111111110000000000000111110000000 000111111111000000000001111110000000 000111111110000000000000111110000000 000111111100000000000000011110000000 000011111111000000000001111100000000 000011111111110000000111111100000000 000011111111100000000011111100000000 000011111111000000000001111100000000 000011111111110000000111111100000000 000001111111111100011111111100000000 000001111111111000001111111000000000 000001111111111100011111111000000000 000000111111111110111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111111111111111110000000000 000000111111110000111111110000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 ifn .-squar3-sqlen, .err square 3 is bad squar4: 000000000000000000000000000000010000 110000000000000000000000000001110000 111100000000000000000000000111110000 111111000000000000000000011111110000 111110000000000000000000001111110000 011100000000000000000000000111100000 011111000000000000000000011111100000 011111110000000000000001111111100000 011111111100000000000111111111100000 001111111000000000000011111111000000 001111110000000000000001111111000000 001111111100000000000111111111000000 001111111111000000011111111111000000 000111111110000000001111111110000000 000111111100000000000111111110000000 000111111111000000011111111110000000 000011111111110001111111111100000000 000011111111111011111111111100000000 000011111111111111111111111100000000 000001111111111111111111111100000000 000001111111111001111111111100000000 000000111111100000011111111000000000 000000111110000000000011110000000000 000000110000000000000000110000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 000000000000000000000000000000000000 ifn .-squar4-sqlen, .err bad square 4 end munch