Home » Personal collection » Acorn ADFS disks » Electron » MTF_finished_programs.ADF » TAPE3/A/mcPRIMES2

TAPE3/A/mcPRIMES2

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 » Personal collection » Acorn ADFS disks » Electron » MTF_finished_programs.ADF
Filename: TAPE3/A/mcPRIMES2
Read OK:
File size: 042D bytes
Load address: FFFF0E00
Exec address: FFFF8023
Duplicates

There are 2 duplicate copies of this file in the archive:

File contents
   10 REM Fast machine code prime numbers                    (3/8/94)
   20 HIMEM=&1800
   30 !&8C=2
   40 !&70=3
   50 !&1800=3:!&88=&1803
   60 FOR pass=0 TO 2 STEP 2:P%=&A00
   70 [OPT pass
   80 .code LDA#0:STA&74:LDA#&18:STA&75
   90 .divide LDA#0:STA&7C:STA&7D:LDX#24:LDY#0:LDA(&74),Y:STA&76:INY:LDA(&74),Y:STA&77:LDA&70:STA&80:LDA&71:STA&81:LDA&72:STA&82
  100 .divloop ROL&80:ROL&81:ROL&82:ROL&7C:ROL&7D:LDA&7C:SEC:SBC&76:STA&86:LDA&7D:SBC&77:BCCtoobig:STA&7D:LDA&86:STA&7C:.toobig DEX:BNEdivloop:ROL&80:ROL&81:ROL&82
  110 LDA&7C:BNEnotfactor:LDA&7D:BNEnotfactor
  120 .notprime CLC:LDA&70:ADC#2:STA&70:BCCnext:INC&71:BNEnext:INC&72:BNEnext:INC&73:RTS:.next JMPcode
  130 .notfactor LDA&82:BNEcarryon:LDA&81:CMP&77:BCCprime:BNEcarryon:LDA&80:CMP&76:BCCprime
  140 .carryon CLC:LDA&74:ADC#3:STA&74:BCCnextfactor:INC&75:.nextfactor JMPdivide
  150 .prime LDY#0:LDX#3:.store LDA&70,Y:STA(&88),Y:INY:DEX:BNEstore:LDA&88:CLC:ADC#3:STA&88:BCCend:INC&89:LDA&89:CMP#&60:BNEend:DEC&89:.end INC&8C:BNEret:INC&8D:BNEret:INC&8E:.ret RTS:]
  160 NEXT pass
  170 PRINT 2,1
  180 IF ?&73>0 THEN PRINT"END" ELSE PRINT !&70,!&8C:CALLnotprime:GOTO180

B � Fast machine code prime numbers                    (3/8/94)
 �=&1800
 !&8C=2
( !&70=3
2 !&1800=3:!&88=&1803
< � pass=0 � 2 � 2:P%=&A00
F [OPT pass
P& .code LDA#0:STA&74:LDA#&18:STA&75
Z .divide LDA#0:STA&7C:STA&7D:LDX#24:LDY#0:LDA(&74),Y:STA&76:INY:LDA(&74),Y:STA&77:LDA&70:STA&80:LDA&71:STA&81:LDA&72:STA&82
d� .divloop ROL&80:ROL&81:ROL&82:ROL&7C:ROL&7D:LDA&7C:SEC:SBC&76:STA&86:LDA&7D:SBC&77:BCCtoobig:STA&7D:LDA&86:STA&7C:.toobig DEX:BNEdivloop:ROL&80:ROL&81:ROL&82
n, LDA&7C:BNEnotfactor:LDA&7D:BNEnotfactor
xe .notprime CLC:LDA&70:ADC#2:STA&70:BCCnext:INC&71:BNEnext:INC&72:BNEnext:INC&73:RTS:.next JMPcode
�Z .notfactor LDA&82:BNEcarryon:LDA&81:CMP&77:BCCprime:BNEcarryon:LDA&80:CMP&76:BCCprime
�P .carryon CLC:LDA&74:ADC#3:STA&74:BCCnextfactor:INC&75:.nextfactor JMPdivide
�� .prime LDY#0:LDX#3:.store LDA&70,Y:STA(&88),Y:INY:DEX:BNEstore:LDA&88:CLC:ADC#3:STA&88:BCCend:INC&89:LDA&89:CMP#&60:BNEend:DEC&89:.end INC&8C:BNEret:INC&8D:BNEret:INC&8E:.ret RTS:]
� � pass
�
 � 2,1
�4 � ?&73>0 � �"END" � � !&70,!&8C:�notprime:�tt@
�
00000000  0d 00 0a 42 20 f4 20 46  61 73 74 20 6d 61 63 68  |...B . Fast mach|
00000010  69 6e 65 20 63 6f 64 65  20 70 72 69 6d 65 20 6e  |ine code prime n|
00000020  75 6d 62 65 72 73 20 20  20 20 20 20 20 20 20 20  |umbers          |
00000030  20 20 20 20 20 20 20 20  20 20 28 33 2f 38 2f 39  |          (3/8/9|
00000040  34 29 0d 00 14 0c 20 d3  3d 26 31 38 30 30 0d 00  |4).... .=&1800..|
00000050  1e 0b 20 21 26 38 43 3d  32 0d 00 28 0b 20 21 26  |.. !&8C=2..(. !&|
00000060  37 30 3d 33 0d 00 32 18  20 21 26 31 38 30 30 3d  |70=3..2. !&1800=|
00000070  33 3a 21 26 38 38 3d 26  31 38 30 33 0d 00 3c 1d  |3:!&88=&1803..<.|
00000080  20 e3 20 70 61 73 73 3d  30 20 b8 20 32 20 88 20  | . pass=0 . 2 . |
00000090  32 3a 50 25 3d 26 41 30  30 0d 00 46 0e 20 5b 4f  |2:P%=&A00..F. [O|
000000a0  50 54 20 70 61 73 73 0d  00 50 26 20 2e 63 6f 64  |PT pass..P& .cod|
000000b0  65 20 4c 44 41 23 30 3a  53 54 41 26 37 34 3a 4c  |e LDA#0:STA&74:L|
000000c0  44 41 23 26 31 38 3a 53  54 41 26 37 35 0d 00 5a  |DA#&18:STA&75..Z|
000000d0  7f 20 2e 64 69 76 69 64  65 20 4c 44 41 23 30 3a  |. .divide LDA#0:|
000000e0  53 54 41 26 37 43 3a 53  54 41 26 37 44 3a 4c 44  |STA&7C:STA&7D:LD|
000000f0  58 23 32 34 3a 4c 44 59  23 30 3a 4c 44 41 28 26  |X#24:LDY#0:LDA(&|
00000100  37 34 29 2c 59 3a 53 54  41 26 37 36 3a 49 4e 59  |74),Y:STA&76:INY|
00000110  3a 4c 44 41 28 26 37 34  29 2c 59 3a 53 54 41 26  |:LDA(&74),Y:STA&|
00000120  37 37 3a 4c 44 41 26 37  30 3a 53 54 41 26 38 30  |77:LDA&70:STA&80|
00000130  3a 4c 44 41 26 37 31 3a  53 54 41 26 38 31 3a 4c  |:LDA&71:STA&81:L|
00000140  44 41 26 37 32 3a 53 54  41 26 38 32 0d 00 64 a2  |DA&72:STA&82..d.|
00000150  20 2e 64 69 76 6c 6f 6f  70 20 52 4f 4c 26 38 30  | .divloop ROL&80|
00000160  3a 52 4f 4c 26 38 31 3a  52 4f 4c 26 38 32 3a 52  |:ROL&81:ROL&82:R|
00000170  4f 4c 26 37 43 3a 52 4f  4c 26 37 44 3a 4c 44 41  |OL&7C:ROL&7D:LDA|
00000180  26 37 43 3a 53 45 43 3a  53 42 43 26 37 36 3a 53  |&7C:SEC:SBC&76:S|
00000190  54 41 26 38 36 3a 4c 44  41 26 37 44 3a 53 42 43  |TA&86:LDA&7D:SBC|
000001a0  26 37 37 3a 42 43 43 74  6f 6f 62 69 67 3a 53 54  |&77:BCCtoobig:ST|
000001b0  41 26 37 44 3a 4c 44 41  26 38 36 3a 53 54 41 26  |A&7D:LDA&86:STA&|
000001c0  37 43 3a 2e 74 6f 6f 62  69 67 20 44 45 58 3a 42  |7C:.toobig DEX:B|
000001d0  4e 45 64 69 76 6c 6f 6f  70 3a 52 4f 4c 26 38 30  |NEdivloop:ROL&80|
000001e0  3a 52 4f 4c 26 38 31 3a  52 4f 4c 26 38 32 0d 00  |:ROL&81:ROL&82..|
000001f0  6e 2c 20 4c 44 41 26 37  43 3a 42 4e 45 6e 6f 74  |n, LDA&7C:BNEnot|
00000200  66 61 63 74 6f 72 3a 4c  44 41 26 37 44 3a 42 4e  |factor:LDA&7D:BN|
00000210  45 6e 6f 74 66 61 63 74  6f 72 0d 00 78 65 20 2e  |Enotfactor..xe .|
00000220  6e 6f 74 70 72 69 6d 65  20 43 4c 43 3a 4c 44 41  |notprime CLC:LDA|
00000230  26 37 30 3a 41 44 43 23  32 3a 53 54 41 26 37 30  |&70:ADC#2:STA&70|
00000240  3a 42 43 43 6e 65 78 74  3a 49 4e 43 26 37 31 3a  |:BCCnext:INC&71:|
00000250  42 4e 45 6e 65 78 74 3a  49 4e 43 26 37 32 3a 42  |BNEnext:INC&72:B|
00000260  4e 45 6e 65 78 74 3a 49  4e 43 26 37 33 3a 52 54  |NEnext:INC&73:RT|
00000270  53 3a 2e 6e 65 78 74 20  4a 4d 50 63 6f 64 65 0d  |S:.next JMPcode.|
00000280  00 82 5a 20 2e 6e 6f 74  66 61 63 74 6f 72 20 4c  |..Z .notfactor L|
00000290  44 41 26 38 32 3a 42 4e  45 63 61 72 72 79 6f 6e  |DA&82:BNEcarryon|
000002a0  3a 4c 44 41 26 38 31 3a  43 4d 50 26 37 37 3a 42  |:LDA&81:CMP&77:B|
000002b0  43 43 70 72 69 6d 65 3a  42 4e 45 63 61 72 72 79  |CCprime:BNEcarry|
000002c0  6f 6e 3a 4c 44 41 26 38  30 3a 43 4d 50 26 37 36  |on:LDA&80:CMP&76|
000002d0  3a 42 43 43 70 72 69 6d  65 0d 00 8c 50 20 2e 63  |:BCCprime...P .c|
000002e0  61 72 72 79 6f 6e 20 43  4c 43 3a 4c 44 41 26 37  |arryon CLC:LDA&7|
000002f0  34 3a 41 44 43 23 33 3a  53 54 41 26 37 34 3a 42  |4:ADC#3:STA&74:B|
00000300  43 43 6e 65 78 74 66 61  63 74 6f 72 3a 49 4e 43  |CCnextfactor:INC|
00000310  26 37 35 3a 2e 6e 65 78  74 66 61 63 74 6f 72 20  |&75:.nextfactor |
00000320  4a 4d 50 64 69 76 69 64  65 0d 00 96 b9 20 2e 70  |JMPdivide.... .p|
00000330  72 69 6d 65 20 4c 44 59  23 30 3a 4c 44 58 23 33  |rime LDY#0:LDX#3|
00000340  3a 2e 73 74 6f 72 65 20  4c 44 41 26 37 30 2c 59  |:.store LDA&70,Y|
00000350  3a 53 54 41 28 26 38 38  29 2c 59 3a 49 4e 59 3a  |:STA(&88),Y:INY:|
00000360  44 45 58 3a 42 4e 45 73  74 6f 72 65 3a 4c 44 41  |DEX:BNEstore:LDA|
00000370  26 38 38 3a 43 4c 43 3a  41 44 43 23 33 3a 53 54  |&88:CLC:ADC#3:ST|
00000380  41 26 38 38 3a 42 43 43  65 6e 64 3a 49 4e 43 26  |A&88:BCCend:INC&|
00000390  38 39 3a 4c 44 41 26 38  39 3a 43 4d 50 23 26 36  |89:LDA&89:CMP#&6|
000003a0  30 3a 42 4e 45 65 6e 64  3a 44 45 43 26 38 39 3a  |0:BNEend:DEC&89:|
000003b0  2e 65 6e 64 20 49 4e 43  26 38 43 3a 42 4e 45 72  |.end INC&8C:BNEr|
000003c0  65 74 3a 49 4e 43 26 38  44 3a 42 4e 45 72 65 74  |et:INC&8D:BNEret|
000003d0  3a 49 4e 43 26 38 45 3a  2e 72 65 74 20 52 54 53  |:INC&8E:.ret RTS|
000003e0  3a 5d 0d 00 a0 0b 20 ed  20 70 61 73 73 0d 00 aa  |:].... . pass...|
000003f0  0a 20 f1 20 32 2c 31 0d  00 b4 34 20 e7 20 3f 26  |. . 2,1...4 . ?&|
00000400  37 33 3e 30 20 8c 20 f1  22 45 4e 44 22 20 8b 20  |73>0 . ."END" . |
00000410  f1 20 21 26 37 30 2c 21  26 38 43 3a d6 6e 6f 74  |. !&70,!&8C:.not|
00000420  70 72 69 6d 65 3a e5 8d  74 74 40 0d ff           |prime:..tt@..|
0000042d
TAPE3/A/mcPRIMES2.m0
TAPE3/A/mcPRIMES2.m1
TAPE3/A/mcPRIMES2.m2
TAPE3/A/mcPRIMES2.m4
TAPE3/A/mcPRIMES2.m5