Home » Archimedes archive » Acorn User » AU 1998-04 A.adf » Regulars » StarInfo/Reysenbach/MSearch

StarInfo/Reysenbach/MSearch

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 1998-04 A.adf » Regulars
Filename: StarInfo/Reysenbach/MSearch
Read OK:
File size: 0BF6 bytes
Load address: 0000
Exec address: 0000
File contents
   10 REM >MSEARCH2
   20 REM Mersenne prime numbers
   30 REM by A Reysenbach
   40 :
   50 MODE 28
   60 size%=29                  :REM adjust size% HERE
   70 room%=4+3*(size%<<10)
   80 a=0:b=1:c=2
   90 d=3:e=4:f=5:g=6
  100 exp=7:num=8:w=9
  110 x=10:y=11:z=12
  120 DIM search 420 + room%
  130 FOR pass=0 TO 2 STEP 2
  140 P%=search
  150[
  160 OPT    pass
  170 ADR    d,block
  180 ADD    x,d,#size%<<11
  190 ADD    num,x,#size%<<10
  200 SUB    b,exp,#1
  210 MOV    w,b,LSR #4
  220 MOV    w,w,LSL #2
  230 ADD    f,w,#4
  240 SUB    c,num,f
  250 MOV    z,#0
  260.zeroes
  270 STR    z,[c,f]
  280 SUBS   f,f,#4
  290 BGE    zeroes
  300 MOV    c,#3
  310 STR    c,[num]
  320.square
  330 SUB    g,num,w
  340 MOV    e,x
  350 MOV    f,w
  360.init
  370 LDR    c,[g,f]
  380 MUL    d,c,c
  390 MOV    c,d,LSR #16
  400 BIC    d,d,c,LSL #16
  410 STR    d,[e],#-4
  420 SUBS   f,f,#4
  430 STR    c,[e],#-4
  440 BGE    init
  450 MOV    g,#4
  460 MOV    y,#0
  470.fetch
  480 CMP    g,w,LSL #1
  490 BGE    spread
  500 MOV    a,#0
  510 SUBS   c,g,w
  520 MOVLE  e,num
  530 SUBGT  e,num,c
  540 SUBLE  f,num,g
  550 SUBGT  f,num,w
  560.accum
  570 LDR    c,[e],#-4
  580 LDR    d,[f],#4
  590 MUL    c,d,c
  600 ADDS   a,a,c
  610 ADC    z,z,#0
  620 CMP    e,f
  630 BGT    accum
  640 LDR    c,[x,-g]
  650 ADDS   a,a,a
  660 ADC    z,z,z
  670 ADD    c,c,y
  680 ADDS   a,a,c
  690 ADC    z,z,#0
  700 MOV    c,a,LSR #16
  710 ADD    y,c,z,LSL #16
  720 BIC    c,a,c,LSL #16
  730 STR    c,[x,-g]
  740 ADD    g,g,#4
  750 MOV    z,#0
  760 B      fetch
  770.spread
  780 LDR    c,[x,-g]
  790 ADD    y,y,c
  800 MOVS   c,y,LSR #16
  810 BICGT  y,y,c,LSL #16
  820 STR    y,[x,-g]
  830 ADDGT  g,g,#4
  840 LDRGT  y,[x,-g]
  850 ADDGT  y,y,c
  860 STRGT  y,[x,-g]
  870 LDR    d,[x,-w]
  880 AND    y,exp,#%1111
  890 MOV    e,d,LSR y
  900 BIC    a,d,e,LSL y
  910 MOV    d,d,LSR y
  920 STR    a,[x,-w]
  930 MOV    f,w
  940 SUB    e,x,w
  950 SUB    g,e,w
  960 SUB    g,g,#4
  970 SUB    c,num,w
  980.modul
  990 LDR    a,[g,f]
 1000 MOV    a,a,LSL #16
 1010 ADD    d,d,a,LSR y
 1020 LDR    a,[e,f]
 1030 ADD    a,d,a
 1040 MOV    d,a,LSR #16
 1050 BIC    a,a,d,LSL #16
 1060 STR    a,[c,f]
 1070 SUBS   f,f,#4
 1080 BGE    modul
 1090 LDR    a,[num,-w]
 1100 MOV    f,a,LSR y
 1110.final
 1120 BIC    a,a,f,LSL y
 1130 STR    a,[num,-w]
 1140 SUBS   b,b,#1
 1150 ADDEQ  f,f,#4
 1160 MOV    d,num
 1170.carry
 1180 LDR    a,[d],#-4
 1190 ADD    a,a,f
 1200 MOVS   f,a,LSR #16
 1210 BIC    a,a,f,LSL #16
 1220 STR    a,[d,#4]
 1230 BGT    carry
 1240 CMP    b,#0
 1250 BGT    square
 1260 LDR    a,[num,-w]
 1270 MOVS   f,a,LSR y
 1280 BGT    final
 1290 LDR    a,[num]
 1300 MOV    pc,r14
 1310.block
 1320 FN_work(room%)
 1330]
 1340 NEXT pass
 1350 CLS
 1360 max%=(size%<<12)-31
 1370 :
 1380 DIM pr%(max%)
 1390 FOR a%=3 TO SQR(max%) STEP 2
 1400  IF pr%(a%)=0 FOR b%=a%*a% TO max% STEP a%<<1:pr%(b%)=1:NEXT
 1410 NEXT
 1420 :
 1430 PRINT"search for Mersenne prime numbers !"
 1440 INPUT'"exponents from .. to ....";X%,Y%
 1450 X%=ABS(X%):Y%=ABS(Y%)
 1460 IF X%>Y% SWAP X%,Y%
 1470 IF X%<3 X%=3
 1480 IF Y%>max% PRINT"max.=";max%;", adjust variable size%'":END
 1490 TIME=0
 1500 FOR H%=((X%>>1)<<1)+1 TO Y% STEP 2
 1510  IF pr%(H%)=0 THEN
 1520   Z%=USR(search)
 1530   PRINT"2^";H%;"-1 is ";
 1540   IF Z%<>1 PRINT"composite"ELSE PRINT"prime"
 1550  ENDIF
 1560 NEXT H%
 1570 PRINTTIME/100" sec"
 1580 END
 1590 :
 1600 DEF FN_work(bytes%)
 1610 P%+=bytes%
 1620 =pass

 � >MSEARCH2
 � Mersenne prime numbers
 � by A Reysenbach
( :
2	 � 28
<3 size%=29                  :� adjust size% HERE
F room%=4+3*(size%<<10)
P a=0:b=1:c=2
Z d=3:e=4:f=5:g=6
d exp=7:num=8:w=9
n x=10:y=11:z=12
x � search 420 + room%
� � pass=0 � 2 � 2
� P%=search
�[
� OPT    pass
� ADR    d,block
� ADD    x,d,#size%<<11
� ADD    num,x,#size%<<10
� SUB    b,exp,#1
� MOV    w,b,LSR #4
� MOV    w,w,LSL #2
� ADD    f,w,#4
� SUB    c,num,f
� MOV    z,#0
.zeroes
 STR    z,[c,f]
 SUBS   f,f,#4
" BGE    zeroes
, MOV    c,#3
6 STR    c,[num]
@.square
J SUB    g,num,w
T MOV    e,x
^ MOV    f,w
h	.init
r LDR    c,[g,f]
| MUL    d,c,c
� MOV    c,d,LSR #16
� BIC    d,d,c,LSL #16
� STR    d,[e],#-4
� SUBS   f,f,#4
� STR    c,[e],#-4
� BGE    init
� MOV    g,#4
� MOV    y,#0
�
.fetch
� CMP    g,w,LSL #1
� BGE    spread
� MOV    a,#0
� SUBS   c,g,w
 MOVLE  e,num
 SUBGT  e,num,c
 SUBLE  f,num,g
& SUBGT  f,num,w
0
.accum
: LDR    c,[e],#-4
D LDR    d,[f],#4
N MUL    c,d,c
X ADDS   a,a,c
b ADC    z,z,#0
l CMP    e,f
v BGT    accum
� LDR    c,[x,-g]
� ADDS   a,a,a
� ADC    z,z,z
� ADD    c,c,y
� ADDS   a,a,c
� ADC    z,z,#0
� MOV    c,a,LSR #16
� ADD    y,c,z,LSL #16
� BIC    c,a,c,LSL #16
� STR    c,[x,-g]
� ADD    g,g,#4
� MOV    z,#0
� B      fetch
.spread
 LDR    c,[x,-g]
 ADD    y,y,c
  MOVS   c,y,LSR #16
* BICGT  y,y,c,LSL #16
4 STR    y,[x,-g]
> ADDGT  g,g,#4
H LDRGT  y,[x,-g]
R ADDGT  y,y,c
\ STRGT  y,[x,-g]
f LDR    d,[x,-w]
p �    y,exp,#%1111
z MOV    e,d,LSR y
� BIC    a,d,e,LSL y
� MOV    d,d,LSR y
� STR    a,[x,-w]
� MOV    f,w
� SUB    e,x,w
� SUB    g,e,w
� SUB    g,g,#4
� SUB    c,num,w
�
.modul
� LDR    a,[g,f]
� MOV    a,a,LSL #16
� ADD    d,d,a,LSR y
� LDR    a,[e,f]
 ADD    a,d,a
 MOV    d,a,LSR #16
 BIC    a,a,d,LSL #16
$ STR    a,[c,f]
. SUBS   f,f,#4
8 BGE    modul
B LDR    a,[num,-w]
L MOV    f,a,LSR y
V
.final
` BIC    a,a,f,LSL y
j STR    a,[num,-w]
t SUBS   b,b,#1
~ ADDEQ  f,f,#4
� MOV    d,num
�
.carry
� LDR    a,[d],#-4
� ADD    a,a,f
� MOVS   f,a,LSR #16
� BIC    a,a,f,LSL #16
� STR    a,[d,#4]
� BGT    carry
� CMP    b,#0
� BGT    square
� LDR    a,[num,-w]
� MOVS   f,a,LSR y
 BGT    final

 LDR    a,[num]
 MOV    pc,r14

.block
( �_work(room%)
2]
< � pass
F �
P max%=(size%<<12)-31
Z :
d � pr%(max%)
n � a%=3 � �(max%) � 2
x7  � pr%(a%)=0 � b%=a%*a% � max% � a%<<1:pr%(b%)=1:�
� �
� :
�+ �"search for Mersenne prime numbers !"
�( �'"exponents from .. to ....";X%,Y%
� X%=�(X%):Y%=�(Y%)
� � X%>Y% Ȕ X%,Y%
� � X%<3 X%=3
�9 � Y%>max% �"max.=";max%;", adjust variable size%'":�
� �=0
�! � H%=((X%>>1)<<1)+1 � Y% � 2
�  � pr%(H%)=0 �
�   Z%=�(search)
�   �"2^";H%;"-1 is ";
%   � Z%<>1 �"composite"� �"prime"
  �
	 � H%
" �/100" sec"
, �
6 :
@ � �_work(bytes%)
J P%+=bytes%
T
 =pass
�
00000000  0d 00 0a 10 20 f4 20 3e  4d 53 45 41 52 43 48 32  |.... . >MSEARCH2|
00000010  0d 00 14 1d 20 f4 20 4d  65 72 73 65 6e 6e 65 20  |.... . Mersenne |
00000020  70 72 69 6d 65 20 6e 75  6d 62 65 72 73 0d 00 1e  |prime numbers...|
00000030  16 20 f4 20 62 79 20 41  20 52 65 79 73 65 6e 62  |. . by A Reysenb|
00000040  61 63 68 0d 00 28 06 20  3a 0d 00 32 09 20 eb 20  |ach..(. :..2. . |
00000050  32 38 0d 00 3c 33 20 73  69 7a 65 25 3d 32 39 20  |28..<3 size%=29 |
00000060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000070  20 3a f4 20 61 64 6a 75  73 74 20 73 69 7a 65 25  | :. adjust size%|
00000080  20 48 45 52 45 0d 00 46  1a 20 72 6f 6f 6d 25 3d  | HERE..F. room%=|
00000090  34 2b 33 2a 28 73 69 7a  65 25 3c 3c 31 30 29 0d  |4+3*(size%<<10).|
000000a0  00 50 10 20 61 3d 30 3a  62 3d 31 3a 63 3d 32 0d  |.P. a=0:b=1:c=2.|
000000b0  00 5a 14 20 64 3d 33 3a  65 3d 34 3a 66 3d 35 3a  |.Z. d=3:e=4:f=5:|
000000c0  67 3d 36 0d 00 64 14 20  65 78 70 3d 37 3a 6e 75  |g=6..d. exp=7:nu|
000000d0  6d 3d 38 3a 77 3d 39 0d  00 6e 13 20 78 3d 31 30  |m=8:w=9..n. x=10|
000000e0  3a 79 3d 31 31 3a 7a 3d  31 32 0d 00 78 19 20 de  |:y=11:z=12..x. .|
000000f0  20 73 65 61 72 63 68 20  34 32 30 20 2b 20 72 6f  | search 420 + ro|
00000100  6f 6d 25 0d 00 82 15 20  e3 20 70 61 73 73 3d 30  |om%.... . pass=0|
00000110  20 b8 20 32 20 88 20 32  0d 00 8c 0e 20 50 25 3d  | . 2 . 2.... P%=|
00000120  73 65 61 72 63 68 0d 00  96 05 5b 0d 00 a0 10 20  |search....[.... |
00000130  4f 50 54 20 20 20 20 70  61 73 73 0d 00 aa 13 20  |OPT    pass.... |
00000140  41 44 52 20 20 20 20 64  2c 62 6c 6f 63 6b 0d 00  |ADR    d,block..|
00000150  b4 1a 20 41 44 44 20 20  20 20 78 2c 64 2c 23 73  |.. ADD    x,d,#s|
00000160  69 7a 65 25 3c 3c 31 31  0d 00 be 1c 20 41 44 44  |ize%<<11.... ADD|
00000170  20 20 20 20 6e 75 6d 2c  78 2c 23 73 69 7a 65 25  |    num,x,#size%|
00000180  3c 3c 31 30 0d 00 c8 14  20 53 55 42 20 20 20 20  |<<10.... SUB    |
00000190  62 2c 65 78 70 2c 23 31  0d 00 d2 16 20 4d 4f 56  |b,exp,#1.... MOV|
000001a0  20 20 20 20 77 2c 62 2c  4c 53 52 20 23 34 0d 00  |    w,b,LSR #4..|
000001b0  dc 16 20 4d 4f 56 20 20  20 20 77 2c 77 2c 4c 53  |.. MOV    w,w,LS|
000001c0  4c 20 23 32 0d 00 e6 12  20 41 44 44 20 20 20 20  |L #2.... ADD    |
000001d0  66 2c 77 2c 23 34 0d 00  f0 13 20 53 55 42 20 20  |f,w,#4.... SUB  |
000001e0  20 20 63 2c 6e 75 6d 2c  66 0d 00 fa 10 20 4d 4f  |  c,num,f.... MO|
000001f0  56 20 20 20 20 7a 2c 23  30 0d 01 04 0b 2e 7a 65  |V    z,#0.....ze|
00000200  72 6f 65 73 0d 01 0e 13  20 53 54 52 20 20 20 20  |roes.... STR    |
00000210  7a 2c 5b 63 2c 66 5d 0d  01 18 12 20 53 55 42 53  |z,[c,f].... SUBS|
00000220  20 20 20 66 2c 66 2c 23  34 0d 01 22 12 20 42 47  |   f,f,#4..". BG|
00000230  45 20 20 20 20 7a 65 72  6f 65 73 0d 01 2c 10 20  |E    zeroes..,. |
00000240  4d 4f 56 20 20 20 20 63  2c 23 33 0d 01 36 13 20  |MOV    c,#3..6. |
00000250  53 54 52 20 20 20 20 63  2c 5b 6e 75 6d 5d 0d 01  |STR    c,[num]..|
00000260  40 0b 2e 73 71 75 61 72  65 0d 01 4a 13 20 53 55  |@..square..J. SU|
00000270  42 20 20 20 20 67 2c 6e  75 6d 2c 77 0d 01 54 0f  |B    g,num,w..T.|
00000280  20 4d 4f 56 20 20 20 20  65 2c 78 0d 01 5e 0f 20  | MOV    e,x..^. |
00000290  4d 4f 56 20 20 20 20 66  2c 77 0d 01 68 09 2e 69  |MOV    f,w..h..i|
000002a0  6e 69 74 0d 01 72 13 20  4c 44 52 20 20 20 20 63  |nit..r. LDR    c|
000002b0  2c 5b 67 2c 66 5d 0d 01  7c 11 20 4d 55 4c 20 20  |,[g,f]..|. MUL  |
000002c0  20 20 64 2c 63 2c 63 0d  01 86 17 20 4d 4f 56 20  |  d,c,c.... MOV |
000002d0  20 20 20 63 2c 64 2c 4c  53 52 20 23 31 36 0d 01  |   c,d,LSR #16..|
000002e0  90 19 20 42 49 43 20 20  20 20 64 2c 64 2c 63 2c  |.. BIC    d,d,c,|
000002f0  4c 53 4c 20 23 31 36 0d  01 9a 15 20 53 54 52 20  |LSL #16.... STR |
00000300  20 20 20 64 2c 5b 65 5d  2c 23 2d 34 0d 01 a4 12  |   d,[e],#-4....|
00000310  20 53 55 42 53 20 20 20  66 2c 66 2c 23 34 0d 01  | SUBS   f,f,#4..|
00000320  ae 15 20 53 54 52 20 20  20 20 63 2c 5b 65 5d 2c  |.. STR    c,[e],|
00000330  23 2d 34 0d 01 b8 10 20  42 47 45 20 20 20 20 69  |#-4.... BGE    i|
00000340  6e 69 74 0d 01 c2 10 20  4d 4f 56 20 20 20 20 67  |nit.... MOV    g|
00000350  2c 23 34 0d 01 cc 10 20  4d 4f 56 20 20 20 20 79  |,#4.... MOV    y|
00000360  2c 23 30 0d 01 d6 0a 2e  66 65 74 63 68 0d 01 e0  |,#0.....fetch...|
00000370  16 20 43 4d 50 20 20 20  20 67 2c 77 2c 4c 53 4c  |. CMP    g,w,LSL|
00000380  20 23 31 0d 01 ea 12 20  42 47 45 20 20 20 20 73  | #1.... BGE    s|
00000390  70 72 65 61 64 0d 01 f4  10 20 4d 4f 56 20 20 20  |pread.... MOV   |
000003a0  20 61 2c 23 30 0d 01 fe  11 20 53 55 42 53 20 20  | a,#0.... SUBS  |
000003b0  20 63 2c 67 2c 77 0d 02  08 11 20 4d 4f 56 4c 45  | c,g,w.... MOVLE|
000003c0  20 20 65 2c 6e 75 6d 0d  02 12 13 20 53 55 42 47  |  e,num.... SUBG|
000003d0  54 20 20 65 2c 6e 75 6d  2c 63 0d 02 1c 13 20 53  |T  e,num,c.... S|
000003e0  55 42 4c 45 20 20 66 2c  6e 75 6d 2c 67 0d 02 26  |UBLE  f,num,g..&|
000003f0  13 20 53 55 42 47 54 20  20 66 2c 6e 75 6d 2c 77  |. SUBGT  f,num,w|
00000400  0d 02 30 0a 2e 61 63 63  75 6d 0d 02 3a 15 20 4c  |..0..accum..:. L|
00000410  44 52 20 20 20 20 63 2c  5b 65 5d 2c 23 2d 34 0d  |DR    c,[e],#-4.|
00000420  02 44 14 20 4c 44 52 20  20 20 20 64 2c 5b 66 5d  |.D. LDR    d,[f]|
00000430  2c 23 34 0d 02 4e 11 20  4d 55 4c 20 20 20 20 63  |,#4..N. MUL    c|
00000440  2c 64 2c 63 0d 02 58 11  20 41 44 44 53 20 20 20  |,d,c..X. ADDS   |
00000450  61 2c 61 2c 63 0d 02 62  12 20 41 44 43 20 20 20  |a,a,c..b. ADC   |
00000460  20 7a 2c 7a 2c 23 30 0d  02 6c 0f 20 43 4d 50 20  | z,z,#0..l. CMP |
00000470  20 20 20 65 2c 66 0d 02  76 11 20 42 47 54 20 20  |   e,f..v. BGT  |
00000480  20 20 61 63 63 75 6d 0d  02 80 14 20 4c 44 52 20  |  accum.... LDR |
00000490  20 20 20 63 2c 5b 78 2c  2d 67 5d 0d 02 8a 11 20  |   c,[x,-g].... |
000004a0  41 44 44 53 20 20 20 61  2c 61 2c 61 0d 02 94 11  |ADDS   a,a,a....|
000004b0  20 41 44 43 20 20 20 20  7a 2c 7a 2c 7a 0d 02 9e  | ADC    z,z,z...|
000004c0  11 20 41 44 44 20 20 20  20 63 2c 63 2c 79 0d 02  |. ADD    c,c,y..|
000004d0  a8 11 20 41 44 44 53 20  20 20 61 2c 61 2c 63 0d  |.. ADDS   a,a,c.|
000004e0  02 b2 12 20 41 44 43 20  20 20 20 7a 2c 7a 2c 23  |... ADC    z,z,#|
000004f0  30 0d 02 bc 17 20 4d 4f  56 20 20 20 20 63 2c 61  |0.... MOV    c,a|
00000500  2c 4c 53 52 20 23 31 36  0d 02 c6 19 20 41 44 44  |,LSR #16.... ADD|
00000510  20 20 20 20 79 2c 63 2c  7a 2c 4c 53 4c 20 23 31  |    y,c,z,LSL #1|
00000520  36 0d 02 d0 19 20 42 49  43 20 20 20 20 63 2c 61  |6.... BIC    c,a|
00000530  2c 63 2c 4c 53 4c 20 23  31 36 0d 02 da 14 20 53  |,c,LSL #16.... S|
00000540  54 52 20 20 20 20 63 2c  5b 78 2c 2d 67 5d 0d 02  |TR    c,[x,-g]..|
00000550  e4 12 20 41 44 44 20 20  20 20 67 2c 67 2c 23 34  |.. ADD    g,g,#4|
00000560  0d 02 ee 10 20 4d 4f 56  20 20 20 20 7a 2c 23 30  |.... MOV    z,#0|
00000570  0d 02 f8 11 20 42 20 20  20 20 20 20 66 65 74 63  |.... B      fetc|
00000580  68 0d 03 02 0b 2e 73 70  72 65 61 64 0d 03 0c 14  |h.....spread....|
00000590  20 4c 44 52 20 20 20 20  63 2c 5b 78 2c 2d 67 5d  | LDR    c,[x,-g]|
000005a0  0d 03 16 11 20 41 44 44  20 20 20 20 79 2c 79 2c  |.... ADD    y,y,|
000005b0  63 0d 03 20 17 20 4d 4f  56 53 20 20 20 63 2c 79  |c.. . MOVS   c,y|
000005c0  2c 4c 53 52 20 23 31 36  0d 03 2a 19 20 42 49 43  |,LSR #16..*. BIC|
000005d0  47 54 20 20 79 2c 79 2c  63 2c 4c 53 4c 20 23 31  |GT  y,y,c,LSL #1|
000005e0  36 0d 03 34 14 20 53 54  52 20 20 20 20 79 2c 5b  |6..4. STR    y,[|
000005f0  78 2c 2d 67 5d 0d 03 3e  12 20 41 44 44 47 54 20  |x,-g]..>. ADDGT |
00000600  20 67 2c 67 2c 23 34 0d  03 48 14 20 4c 44 52 47  | g,g,#4..H. LDRG|
00000610  54 20 20 79 2c 5b 78 2c  2d 67 5d 0d 03 52 11 20  |T  y,[x,-g]..R. |
00000620  41 44 44 47 54 20 20 79  2c 79 2c 63 0d 03 5c 14  |ADDGT  y,y,c..\.|
00000630  20 53 54 52 47 54 20 20  79 2c 5b 78 2c 2d 67 5d  | STRGT  y,[x,-g]|
00000640  0d 03 66 14 20 4c 44 52  20 20 20 20 64 2c 5b 78  |..f. LDR    d,[x|
00000650  2c 2d 77 5d 0d 03 70 16  20 80 20 20 20 20 79 2c  |,-w]..p. .    y,|
00000660  65 78 70 2c 23 25 31 31  31 31 0d 03 7a 15 20 4d  |exp,#%1111..z. M|
00000670  4f 56 20 20 20 20 65 2c  64 2c 4c 53 52 20 79 0d  |OV    e,d,LSR y.|
00000680  03 84 17 20 42 49 43 20  20 20 20 61 2c 64 2c 65  |... BIC    a,d,e|
00000690  2c 4c 53 4c 20 79 0d 03  8e 15 20 4d 4f 56 20 20  |,LSL y.... MOV  |
000006a0  20 20 64 2c 64 2c 4c 53  52 20 79 0d 03 98 14 20  |  d,d,LSR y.... |
000006b0  53 54 52 20 20 20 20 61  2c 5b 78 2c 2d 77 5d 0d  |STR    a,[x,-w].|
000006c0  03 a2 0f 20 4d 4f 56 20  20 20 20 66 2c 77 0d 03  |... MOV    f,w..|
000006d0  ac 11 20 53 55 42 20 20  20 20 65 2c 78 2c 77 0d  |.. SUB    e,x,w.|
000006e0  03 b6 11 20 53 55 42 20  20 20 20 67 2c 65 2c 77  |... SUB    g,e,w|
000006f0  0d 03 c0 12 20 53 55 42  20 20 20 20 67 2c 67 2c  |.... SUB    g,g,|
00000700  23 34 0d 03 ca 13 20 53  55 42 20 20 20 20 63 2c  |#4.... SUB    c,|
00000710  6e 75 6d 2c 77 0d 03 d4  0a 2e 6d 6f 64 75 6c 0d  |num,w.....modul.|
00000720  03 de 13 20 4c 44 52 20  20 20 20 61 2c 5b 67 2c  |... LDR    a,[g,|
00000730  66 5d 0d 03 e8 17 20 4d  4f 56 20 20 20 20 61 2c  |f].... MOV    a,|
00000740  61 2c 4c 53 4c 20 23 31  36 0d 03 f2 17 20 41 44  |a,LSL #16.... AD|
00000750  44 20 20 20 20 64 2c 64  2c 61 2c 4c 53 52 20 79  |D    d,d,a,LSR y|
00000760  0d 03 fc 13 20 4c 44 52  20 20 20 20 61 2c 5b 65  |.... LDR    a,[e|
00000770  2c 66 5d 0d 04 06 11 20  41 44 44 20 20 20 20 61  |,f].... ADD    a|
00000780  2c 64 2c 61 0d 04 10 17  20 4d 4f 56 20 20 20 20  |,d,a.... MOV    |
00000790  64 2c 61 2c 4c 53 52 20  23 31 36 0d 04 1a 19 20  |d,a,LSR #16.... |
000007a0  42 49 43 20 20 20 20 61  2c 61 2c 64 2c 4c 53 4c  |BIC    a,a,d,LSL|
000007b0  20 23 31 36 0d 04 24 13  20 53 54 52 20 20 20 20  | #16..$. STR    |
000007c0  61 2c 5b 63 2c 66 5d 0d  04 2e 12 20 53 55 42 53  |a,[c,f].... SUBS|
000007d0  20 20 20 66 2c 66 2c 23  34 0d 04 38 11 20 42 47  |   f,f,#4..8. BG|
000007e0  45 20 20 20 20 6d 6f 64  75 6c 0d 04 42 16 20 4c  |E    modul..B. L|
000007f0  44 52 20 20 20 20 61 2c  5b 6e 75 6d 2c 2d 77 5d  |DR    a,[num,-w]|
00000800  0d 04 4c 15 20 4d 4f 56  20 20 20 20 66 2c 61 2c  |..L. MOV    f,a,|
00000810  4c 53 52 20 79 0d 04 56  0a 2e 66 69 6e 61 6c 0d  |LSR y..V..final.|
00000820  04 60 17 20 42 49 43 20  20 20 20 61 2c 61 2c 66  |.`. BIC    a,a,f|
00000830  2c 4c 53 4c 20 79 0d 04  6a 16 20 53 54 52 20 20  |,LSL y..j. STR  |
00000840  20 20 61 2c 5b 6e 75 6d  2c 2d 77 5d 0d 04 74 12  |  a,[num,-w]..t.|
00000850  20 53 55 42 53 20 20 20  62 2c 62 2c 23 31 0d 04  | SUBS   b,b,#1..|
00000860  7e 12 20 41 44 44 45 51  20 20 66 2c 66 2c 23 34  |~. ADDEQ  f,f,#4|
00000870  0d 04 88 11 20 4d 4f 56  20 20 20 20 64 2c 6e 75  |.... MOV    d,nu|
00000880  6d 0d 04 92 0a 2e 63 61  72 72 79 0d 04 9c 15 20  |m.....carry.... |
00000890  4c 44 52 20 20 20 20 61  2c 5b 64 5d 2c 23 2d 34  |LDR    a,[d],#-4|
000008a0  0d 04 a6 11 20 41 44 44  20 20 20 20 61 2c 61 2c  |.... ADD    a,a,|
000008b0  66 0d 04 b0 17 20 4d 4f  56 53 20 20 20 66 2c 61  |f.... MOVS   f,a|
000008c0  2c 4c 53 52 20 23 31 36  0d 04 ba 19 20 42 49 43  |,LSR #16.... BIC|
000008d0  20 20 20 20 61 2c 61 2c  66 2c 4c 53 4c 20 23 31  |    a,a,f,LSL #1|
000008e0  36 0d 04 c4 14 20 53 54  52 20 20 20 20 61 2c 5b  |6.... STR    a,[|
000008f0  64 2c 23 34 5d 0d 04 ce  11 20 42 47 54 20 20 20  |d,#4].... BGT   |
00000900  20 63 61 72 72 79 0d 04  d8 10 20 43 4d 50 20 20  | carry.... CMP  |
00000910  20 20 62 2c 23 30 0d 04  e2 12 20 42 47 54 20 20  |  b,#0.... BGT  |
00000920  20 20 73 71 75 61 72 65  0d 04 ec 16 20 4c 44 52  |  square.... LDR|
00000930  20 20 20 20 61 2c 5b 6e  75 6d 2c 2d 77 5d 0d 04  |    a,[num,-w]..|
00000940  f6 15 20 4d 4f 56 53 20  20 20 66 2c 61 2c 4c 53  |.. MOVS   f,a,LS|
00000950  52 20 79 0d 05 00 11 20  42 47 54 20 20 20 20 66  |R y.... BGT    f|
00000960  69 6e 61 6c 0d 05 0a 13  20 4c 44 52 20 20 20 20  |inal.... LDR    |
00000970  61 2c 5b 6e 75 6d 5d 0d  05 14 12 20 4d 4f 56 20  |a,[num].... MOV |
00000980  20 20 20 70 63 2c 72 31  34 0d 05 1e 0a 2e 62 6c  |   pc,r14.....bl|
00000990  6f 63 6b 0d 05 28 12 20  a4 5f 77 6f 72 6b 28 72  |ock..(. ._work(r|
000009a0  6f 6f 6d 25 29 0d 05 32  05 5d 0d 05 3c 0b 20 ed  |oom%)..2.]..<. .|
000009b0  20 70 61 73 73 0d 05 46  06 20 db 0d 05 50 18 20  | pass..F. ...P. |
000009c0  6d 61 78 25 3d 28 73 69  7a 65 25 3c 3c 31 32 29  |max%=(size%<<12)|
000009d0  2d 33 31 0d 05 5a 06 20  3a 0d 05 64 10 20 de 20  |-31..Z. :..d. . |
000009e0  70 72 25 28 6d 61 78 25  29 0d 05 6e 19 20 e3 20  |pr%(max%)..n. . |
000009f0  61 25 3d 33 20 b8 20 b6  28 6d 61 78 25 29 20 88  |a%=3 . .(max%) .|
00000a00  20 32 0d 05 78 37 20 20  e7 20 70 72 25 28 61 25  | 2..x7  . pr%(a%|
00000a10  29 3d 30 20 e3 20 62 25  3d 61 25 2a 61 25 20 b8  |)=0 . b%=a%*a% .|
00000a20  20 6d 61 78 25 20 88 20  61 25 3c 3c 31 3a 70 72  | max% . a%<<1:pr|
00000a30  25 28 62 25 29 3d 31 3a  ed 0d 05 82 06 20 ed 0d  |%(b%)=1:..... ..|
00000a40  05 8c 06 20 3a 0d 05 96  2b 20 f1 22 73 65 61 72  |... :...+ ."sear|
00000a50  63 68 20 66 6f 72 20 4d  65 72 73 65 6e 6e 65 20  |ch for Mersenne |
00000a60  70 72 69 6d 65 20 6e 75  6d 62 65 72 73 20 21 22  |prime numbers !"|
00000a70  0d 05 a0 28 20 e8 27 22  65 78 70 6f 6e 65 6e 74  |...( .'"exponent|
00000a80  73 20 66 72 6f 6d 20 2e  2e 20 74 6f 20 2e 2e 2e  |s from .. to ...|
00000a90  2e 22 3b 58 25 2c 59 25  0d 05 aa 16 20 58 25 3d  |.";X%,Y%.... X%=|
00000aa0  94 28 58 25 29 3a 59 25  3d 94 28 59 25 29 0d 05  |.(X%):Y%=.(Y%)..|
00000ab0  b4 15 20 e7 20 58 25 3e  59 25 20 c8 94 20 58 25  |.. . X%>Y% .. X%|
00000ac0  2c 59 25 0d 05 be 10 20  e7 20 58 25 3c 33 20 58  |,Y%.... . X%<3 X|
00000ad0  25 3d 33 0d 05 c8 39 20  e7 20 59 25 3e 6d 61 78  |%=3...9 . Y%>max|
00000ae0  25 20 f1 22 6d 61 78 2e  3d 22 3b 6d 61 78 25 3b  |% ."max.=";max%;|
00000af0  22 2c 20 61 64 6a 75 73  74 20 76 61 72 69 61 62  |", adjust variab|
00000b00  6c 65 20 73 69 7a 65 25  27 22 3a e0 0d 05 d2 08  |le size%'":.....|
00000b10  20 d1 3d 30 0d 05 dc 21  20 e3 20 48 25 3d 28 28  | .=0...! . H%=((|
00000b20  58 25 3e 3e 31 29 3c 3c  31 29 2b 31 20 b8 20 59  |X%>>1)<<1)+1 . Y|
00000b30  25 20 88 20 32 0d 05 e6  13 20 20 e7 20 70 72 25  |% . 2....  . pr%|
00000b40  28 48 25 29 3d 30 20 8c  0d 05 f0 13 20 20 20 5a  |(H%)=0 .....   Z|
00000b50  25 3d ba 28 73 65 61 72  63 68 29 0d 05 fa 19 20  |%=.(search).... |
00000b60  20 20 f1 22 32 5e 22 3b  48 25 3b 22 2d 31 20 69  |  ."2^";H%;"-1 i|
00000b70  73 20 22 3b 0d 06 04 25  20 20 20 e7 20 5a 25 3c  |s ";...%   . Z%<|
00000b80  3e 31 20 f1 22 63 6f 6d  70 6f 73 69 74 65 22 8b  |>1 ."composite".|
00000b90  20 f1 22 70 72 69 6d 65  22 0d 06 0e 07 20 20 cd  | ."prime"....  .|
00000ba0  0d 06 18 09 20 ed 20 48  25 0d 06 22 11 20 f1 91  |.... . H%..". ..|
00000bb0  2f 31 30 30 22 20 73 65  63 22 0d 06 2c 06 20 e0  |/100" sec"..,. .|
00000bc0  0d 06 36 06 20 3a 0d 06  40 15 20 dd 20 a4 5f 77  |..6. :..@. . ._w|
00000bd0  6f 72 6b 28 62 79 74 65  73 25 29 0d 06 4a 0f 20  |ork(bytes%)..J. |
00000be0  50 25 2b 3d 62 79 74 65  73 25 0d 06 54 0a 20 3d  |P%+=bytes%..T. =|
00000bf0  70 61 73 73 0d ff                                 |pass..|
00000bf6