Home » Archimedes archive » Acorn User » AU 1993-04.adf » !StarInfo/Files/EightBit/Monkey2

!StarInfo/Files/EightBit/Monkey2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1993-04.adf
Filename: !StarInfo/Files/EightBit/Monkey2
Read OK:
File size: 0582 bytes
Load address: FFFFFB44
Exec address: 696E8551
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
   10REM     >Monkey2 (Info14)
   20REM By  Richard Talbot-Watkins
   30REM     & Matthew Godbolt
   40REM For 8-bit machines
   50REM (C) BAU April 1993
   60:
   70MODE 7
   80HIMEM=PAGE+&A00
   90PROCinit
  100PROCbuild
  110PROCoutput
  120END
  130:
  140DEF PROCinit
  150insertdata=&900
  160findword=&903
  170checkword=&906
  180:
  190mem%=PAGE+&A00
  200top=&70
  210addr=&74
  220temp=&78
  230wordno=&7C
  240thisword=&80
  250data=&84
  260:
  270FOR N%=&70 TO &87 STEP 4
  280!N%=0
  290NEXT
  300ENDPROC
  310:
  320DEF PROCbuild
  330INPUT "Enter text filename: "file$
  340file%=OPENIN (file$)
  350IF file%=0 PRINT CHR$129;CHR$7;"File not found":END
  360PRINT'"OK..Building word tables.."''
  370:
  380A$="Longest possible string"
  390P$=".:!? "+CHR$13
  400A%=32
  410?mem%=13:mem%!1=0
  420!top=mem%+3
  430oldword%=0
  440REPEAT
  450IF A%=32 REPEAT:A%=BGET #file%:UNTIL A%<>32
  460A$=CHR$(A%)
  470REPEAT
  480A%=BGET #file%
  490end%=INSTR(P$,CHR$(A%))
  500IF end%=0 A$=A$+CHR$(A%)
  510UNTIL end%
  520IF LEN(A$)+POS>39 PRINT
  530PRINT A$;" ";
  540$&700=A$
  550CALL checkword
  560word%=!wordno
  570IF oldword% !thisword=oldword%:!data=word%:CALL insertdata
  580oldword%=word%
  590UNTIL end%=6 OR !top>&7B80
  600CLOSE #file%
  610ENDPROC
  620:
  630DEF PROCoutput
  640CLS
  650FOR N%=0 TO 1
  660VDU 132,157,141,131
  670PRINT "Infinite Monkeys - random output"
  680NEXT
  690PRINT SPC(8);CHR$(130);"Press <SHIFT> to scroll"
  700VDU 28,0,24,39,4,14
  710:
  720REPEAT
  730word%=1
  740REPEAT
  750!thisword=word%
  760CALL findword
  770ptr%=!addr
  780A$=$(ptr%)
  790IF LEN(A$)+POS>39 PRINT
  800IF LEN(A$)=1 AND INSTR(P$,A$) PRINT CHR$(8);A$ ELSE PRINT A$;" ";
  810num%=ptr%!(LEN(A$)+1) AND &FFFF
  820IF num% word%=ptr%!(LEN(A$)+3+(RND(num%)-1 AND -2)) AND &FFFF
  830UNTIL num%=0
  840UNTIL FALSE
�     >Monkey2 (Info14)
 � By  Richard Talbot-Watkins
�     & Matthew Godbolt
(� For 8-bit machines
2� (C) BAU April 1993
<:
F� 7
P�=�+&A00
Z	�init
d
�build
n�output
x�
�:
�� �init
�insertdata=&900
�findword=&903
�checkword=&906
�:
�mem%=�+&A00
�top=&70
�addr=&74
�temp=&78
�wordno=&7C
�thisword=&80
�data=&84
:
� N%=&70 � &87 � 4
	!N%=0
"�
,�
6:
@� �build
J"� "Enter text filename: "file$
Tfile%=� (file$)
^*� file%=0 � �129;�7;"File not found":�
h$�'"OK..Building word tables.."''
r:
| A$="Longest possible string"
�P$=".:!? "+�13
�	A%=32
�?mem%=13:mem%!1=0
�!top=mem%+3
�oldword%=0
��
�"� A%=32 �:A%=� #file%:� A%<>32
�A$=�(A%)
��
�A%=� #file%
�end%=�P$,�(A%))
�� end%=0 A$=A$+�(A%)
�
� end%
� �(A$)+�>39 �

� A$;" ";
$&700=A$
&� checkword
0word%=!wordno
::� oldword% !thisword=oldword%:!data=word%:� insertdata
Doldword%=word%
N� end%=6 � !top>&7B80
X� #file%
b�
l:
v
� �output
��
�� N%=0 � 1
�� 132,157,141,131
�(� "Infinite Monkeys - random output"
��
�+� �(8);�(130);"Press <SHIFT> to scroll"
�� 28,0,24,39,4,14
�:
��
�word%=1
��
�!thisword=word%
�� findword
ptr%=!addr
A$=$(ptr%)
� �(A$)+�>39 �
 -� �(A$)=1 � �P$,A$) � �(8);A$ � � A$;" ";
*num%=ptr%!(�(A$)+1) � &FFFF
48� num% word%=ptr%!(�(A$)+3+(�(num%)-1 � -2)) � &FFFF
>� num%=0
H� �
�
00000000  0d 00 0a 1b f4 20 20 20  20 20 3e 4d 6f 6e 6b 65  |.....     >Monke|
00000010  79 32 20 28 49 6e 66 6f  31 34 29 0d 00 14 20 f4  |y2 (Info14)... .|
00000020  20 42 79 20 20 52 69 63  68 61 72 64 20 54 61 6c  | By  Richard Tal|
00000030  62 6f 74 2d 57 61 74 6b  69 6e 73 0d 00 1e 1b f4  |bot-Watkins.....|
00000040  20 20 20 20 20 26 20 4d  61 74 74 68 65 77 20 47  |     & Matthew G|
00000050  6f 64 62 6f 6c 74 0d 00  28 18 f4 20 46 6f 72 20  |odbolt..(.. For |
00000060  38 2d 62 69 74 20 6d 61  63 68 69 6e 65 73 0d 00  |8-bit machines..|
00000070  32 18 f4 20 28 43 29 20  42 41 55 20 41 70 72 69  |2.. (C) BAU Apri|
00000080  6c 20 31 39 39 33 0d 00  3c 05 3a 0d 00 46 07 eb  |l 1993..<.:..F..|
00000090  20 37 0d 00 50 0c d3 3d  90 2b 26 41 30 30 0d 00  | 7..P..=.+&A00..|
000000a0  5a 09 f2 69 6e 69 74 0d  00 64 0a f2 62 75 69 6c  |Z..init..d..buil|
000000b0  64 0d 00 6e 0b f2 6f 75  74 70 75 74 0d 00 78 05  |d..n..output..x.|
000000c0  e0 0d 00 82 05 3a 0d 00  8c 0b dd 20 f2 69 6e 69  |.....:..... .ini|
000000d0  74 0d 00 96 13 69 6e 73  65 72 74 64 61 74 61 3d  |t....insertdata=|
000000e0  26 39 30 30 0d 00 a0 11  66 69 6e 64 77 6f 72 64  |&900....findword|
000000f0  3d 26 39 30 33 0d 00 aa  12 63 68 65 63 6b 77 6f  |=&903....checkwo|
00000100  72 64 3d 26 39 30 36 0d  00 b4 05 3a 0d 00 be 0f  |rd=&906....:....|
00000110  6d 65 6d 25 3d 90 2b 26  41 30 30 0d 00 c8 0b 74  |mem%=.+&A00....t|
00000120  6f 70 3d 26 37 30 0d 00  d2 0c 61 64 64 72 3d 26  |op=&70....addr=&|
00000130  37 34 0d 00 dc 0c 74 65  6d 70 3d 26 37 38 0d 00  |74....temp=&78..|
00000140  e6 0e 77 6f 72 64 6e 6f  3d 26 37 43 0d 00 f0 10  |..wordno=&7C....|
00000150  74 68 69 73 77 6f 72 64  3d 26 38 30 0d 00 fa 0c  |thisword=&80....|
00000160  64 61 74 61 3d 26 38 34  0d 01 04 05 3a 0d 01 0e  |data=&84....:...|
00000170  16 e3 20 4e 25 3d 26 37  30 20 b8 20 26 38 37 20  |.. N%=&70 . &87 |
00000180  88 20 34 0d 01 18 09 21  4e 25 3d 30 0d 01 22 05  |. 4....!N%=0..".|
00000190  ed 0d 01 2c 05 e1 0d 01  36 05 3a 0d 01 40 0c dd  |...,....6.:..@..|
000001a0  20 f2 62 75 69 6c 64 0d  01 4a 22 e8 20 22 45 6e  | .build..J". "En|
000001b0  74 65 72 20 74 65 78 74  20 66 69 6c 65 6e 61 6d  |ter text filenam|
000001c0  65 3a 20 22 66 69 6c 65  24 0d 01 54 13 66 69 6c  |e: "file$..T.fil|
000001d0  65 25 3d 8e 20 28 66 69  6c 65 24 29 0d 01 5e 2a  |e%=. (file$)..^*|
000001e0  e7 20 66 69 6c 65 25 3d  30 20 f1 20 bd 31 32 39  |. file%=0 . .129|
000001f0  3b bd 37 3b 22 46 69 6c  65 20 6e 6f 74 20 66 6f  |;.7;"File not fo|
00000200  75 6e 64 22 3a e0 0d 01  68 24 f1 27 22 4f 4b 2e  |und":...h$.'"OK.|
00000210  2e 42 75 69 6c 64 69 6e  67 20 77 6f 72 64 20 74  |.Building word t|
00000220  61 62 6c 65 73 2e 2e 22  27 27 0d 01 72 05 3a 0d  |ables.."''..r.:.|
00000230  01 7c 20 41 24 3d 22 4c  6f 6e 67 65 73 74 20 70  |.| A$="Longest p|
00000240  6f 73 73 69 62 6c 65 20  73 74 72 69 6e 67 22 0d  |ossible string".|
00000250  01 86 12 50 24 3d 22 2e  3a 21 3f 20 22 2b bd 31  |...P$=".:!? "+.1|
00000260  33 0d 01 90 09 41 25 3d  33 32 0d 01 9a 15 3f 6d  |3....A%=32....?m|
00000270  65 6d 25 3d 31 33 3a 6d  65 6d 25 21 31 3d 30 0d  |em%=13:mem%!1=0.|
00000280  01 a4 0f 21 74 6f 70 3d  6d 65 6d 25 2b 33 0d 01  |...!top=mem%+3..|
00000290  ae 0e 6f 6c 64 77 6f 72  64 25 3d 30 0d 01 b8 05  |..oldword%=0....|
000002a0  f5 0d 01 c2 22 e7 20 41  25 3d 33 32 20 f5 3a 41  |....". A%=32 .:A|
000002b0  25 3d 9a 20 23 66 69 6c  65 25 3a fd 20 41 25 3c  |%=. #file%:. A%<|
000002c0  3e 33 32 0d 01 cc 0c 41  24 3d bd 28 41 25 29 0d  |>32....A$=.(A%).|
000002d0  01 d6 05 f5 0d 01 e0 0f  41 25 3d 9a 20 23 66 69  |........A%=. #fi|
000002e0  6c 65 25 0d 01 ea 13 65  6e 64 25 3d a7 50 24 2c  |le%....end%=.P$,|
000002f0  bd 28 41 25 29 29 0d 01  f4 18 e7 20 65 6e 64 25  |.(A%))..... end%|
00000300  3d 30 20 41 24 3d 41 24  2b bd 28 41 25 29 0d 01  |=0 A$=A$+.(A%)..|
00000310  fe 0a fd 20 65 6e 64 25  0d 02 08 12 e7 20 a9 28  |... end%..... .(|
00000320  41 24 29 2b b1 3e 33 39  20 f1 0d 02 12 0d f1 20  |A$)+.>39 ...... |
00000330  41 24 3b 22 20 22 3b 0d  02 1c 0c 24 26 37 30 30  |A$;" ";....$&700|
00000340  3d 41 24 0d 02 26 0f d6  20 63 68 65 63 6b 77 6f  |=A$..&.. checkwo|
00000350  72 64 0d 02 30 11 77 6f  72 64 25 3d 21 77 6f 72  |rd..0.word%=!wor|
00000360  64 6e 6f 0d 02 3a 3a e7  20 6f 6c 64 77 6f 72 64  |dno..::. oldword|
00000370  25 20 21 74 68 69 73 77  6f 72 64 3d 6f 6c 64 77  |% !thisword=oldw|
00000380  6f 72 64 25 3a 21 64 61  74 61 3d 77 6f 72 64 25  |ord%:!data=word%|
00000390  3a d6 20 69 6e 73 65 72  74 64 61 74 61 0d 02 44  |:. insertdata..D|
000003a0  12 6f 6c 64 77 6f 72 64  25 3d 77 6f 72 64 25 0d  |.oldword%=word%.|
000003b0  02 4e 19 fd 20 65 6e 64  25 3d 36 20 84 20 21 74  |.N.. end%=6 . !t|
000003c0  6f 70 3e 26 37 42 38 30  0d 02 58 0c d9 20 23 66  |op>&7B80..X.. #f|
000003d0  69 6c 65 25 0d 02 62 05  e1 0d 02 6c 05 3a 0d 02  |ile%..b....l.:..|
000003e0  76 0d dd 20 f2 6f 75 74  70 75 74 0d 02 80 05 db  |v.. .output.....|
000003f0  0d 02 8a 0e e3 20 4e 25  3d 30 20 b8 20 31 0d 02  |..... N%=0 . 1..|
00000400  94 15 ef 20 31 33 32 2c  31 35 37 2c 31 34 31 2c  |... 132,157,141,|
00000410  31 33 31 0d 02 9e 28 f1  20 22 49 6e 66 69 6e 69  |131...(. "Infini|
00000420  74 65 20 4d 6f 6e 6b 65  79 73 20 2d 20 72 61 6e  |te Monkeys - ran|
00000430  64 6f 6d 20 6f 75 74 70  75 74 22 0d 02 a8 05 ed  |dom output".....|
00000440  0d 02 b2 2b f1 20 89 28  38 29 3b bd 28 31 33 30  |...+. .(8);.(130|
00000450  29 3b 22 50 72 65 73 73  20 3c 53 48 49 46 54 3e  |);"Press <SHIFT>|
00000460  20 74 6f 20 73 63 72 6f  6c 6c 22 0d 02 bc 15 ef  | to scroll".....|
00000470  20 32 38 2c 30 2c 32 34  2c 33 39 2c 34 2c 31 34  | 28,0,24,39,4,14|
00000480  0d 02 c6 05 3a 0d 02 d0  05 f5 0d 02 da 0b 77 6f  |....:.........wo|
00000490  72 64 25 3d 31 0d 02 e4  05 f5 0d 02 ee 13 21 74  |rd%=1.........!t|
000004a0  68 69 73 77 6f 72 64 3d  77 6f 72 64 25 0d 02 f8  |hisword=word%...|
000004b0  0e d6 20 66 69 6e 64 77  6f 72 64 0d 03 02 0e 70  |.. findword....p|
000004c0  74 72 25 3d 21 61 64 64  72 0d 03 0c 0e 41 24 3d  |tr%=!addr....A$=|
000004d0  24 28 70 74 72 25 29 0d  03 16 12 e7 20 a9 28 41  |$(ptr%)..... .(A|
000004e0  24 29 2b b1 3e 33 39 20  f1 0d 03 20 2d e7 20 a9  |$)+.>39 ... -. .|
000004f0  28 41 24 29 3d 31 20 80  20 a7 50 24 2c 41 24 29  |(A$)=1 . .P$,A$)|
00000500  20 f1 20 bd 28 38 29 3b  41 24 20 8b 20 f1 20 41  | . .(8);A$ . . A|
00000510  24 3b 22 20 22 3b 0d 03  2a 1f 6e 75 6d 25 3d 70  |$;" ";..*.num%=p|
00000520  74 72 25 21 28 a9 28 41  24 29 2b 31 29 20 80 20  |tr%!(.(A$)+1) . |
00000530  26 46 46 46 46 0d 03 34  38 e7 20 6e 75 6d 25 20  |&FFFF..48. num% |
00000540  77 6f 72 64 25 3d 70 74  72 25 21 28 a9 28 41 24  |word%=ptr%!(.(A$|
00000550  29 2b 33 2b 28 b3 28 6e  75 6d 25 29 2d 31 20 80  |)+3+(.(num%)-1 .|
00000560  20 2d 32 29 29 20 80 20  26 46 46 46 46 0d 03 3e  | -2)) . &FFFF..>|
00000570  0c fd 20 6e 75 6d 25 3d  30 0d 03 48 07 fd 20 a3  |.. num%=0..H.. .|
00000580  0d ff                                             |..|
00000582