Home » Personal collection » Acorn ADFS disks » Electron » MTF_finished_programs.ADF » TAPE3/A/mcPRIMES3
TAPE3/A/mcPRIMES3
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/mcPRIMES3 |
Read OK: | ✔ |
File size: | 0472 bytes |
Load address: | FFFF1D00 |
Exec address: | FFFF8023 |
Duplicates
There are 2 duplicate copies of this file in the archive:
- Personal collection » Acorn ADFS disks » Electron » MTF_finished_programs.ADF » TAPE3/A/mcPRIMES3
- Personal collection » Acorn ADFS disks » Electron » Finished_programs.ADF » TAPE3/A/mcPRIMES3
- Personal collection » Acorn hard disk » zipped_disks » elk03 » finished/TAPE3/A/mcPRIMES3
File contents
10 REM Fast machine code prime numbers (4/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#25: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:DEX:BCCdivloop:JMPdiventry:.divloop2 ROL&80:ROL&81:ROL&82:.diventry ROL&7C:ROL&7D:LDA&7C:SEC:SBC&76:STA&86:LDA&7D:SBC&77:BCCtoobig:STA&7D:LDA&86:STA&7C:.toobig DEX:BNEdivloop2: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 (4/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#25: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:DEX:BCCdivloop:JMPdiventry:.divloop2 ROL&80:ROL&81:ROL&82:.diventry ROL&7C:ROL&7D:LDA&7C:SEC:SBC&76:STA&86:LDA&7D:SBC&77:BCCtoobig:STA&7D:LDA&86:STA&7C:.toobig DEX:BNEdivloop2: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 34 2f 38 2f 39 | (4/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 35 3a 4c 44 59 23 30 3a 4c 44 41 28 26 |X#25: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 e7 |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 44 |:ROL&81:ROL&82:D| 00000170 45 58 3a 42 43 43 64 69 76 6c 6f 6f 70 3a 4a 4d |EX:BCCdivloop:JM| 00000180 50 64 69 76 65 6e 74 72 79 3a 2e 64 69 76 6c 6f |Pdiventry:.divlo| 00000190 6f 70 32 20 52 4f 4c 26 38 30 3a 52 4f 4c 26 38 |op2 ROL&80:ROL&8| 000001a0 31 3a 52 4f 4c 26 38 32 3a 2e 64 69 76 65 6e 74 |1:ROL&82:.divent| 000001b0 72 79 20 52 4f 4c 26 37 43 3a 52 4f 4c 26 37 44 |ry ROL&7C:ROL&7D| 000001c0 3a 4c 44 41 26 37 43 3a 53 45 43 3a 53 42 43 26 |:LDA&7C:SEC:SBC&| 000001d0 37 36 3a 53 54 41 26 38 36 3a 4c 44 41 26 37 44 |76:STA&86:LDA&7D| 000001e0 3a 53 42 43 26 37 37 3a 42 43 43 74 6f 6f 62 69 |:SBC&77:BCCtoobi| 000001f0 67 3a 53 54 41 26 37 44 3a 4c 44 41 26 38 36 3a |g:STA&7D:LDA&86:| 00000200 53 54 41 26 37 43 3a 2e 74 6f 6f 62 69 67 20 44 |STA&7C:.toobig D| 00000210 45 58 3a 42 4e 45 64 69 76 6c 6f 6f 70 32 3a 52 |EX:BNEdivloop2:R| 00000220 4f 4c 26 38 30 3a 52 4f 4c 26 38 31 3a 52 4f 4c |OL&80:ROL&81:ROL| 00000230 26 38 32 0d 00 6e 2c 20 4c 44 41 26 37 43 3a 42 |&82..n, LDA&7C:B| 00000240 4e 45 6e 6f 74 66 61 63 74 6f 72 3a 4c 44 41 26 |NEnotfactor:LDA&| 00000250 37 44 3a 42 4e 45 6e 6f 74 66 61 63 74 6f 72 0d |7D:BNEnotfactor.| 00000260 00 78 65 20 2e 6e 6f 74 70 72 69 6d 65 20 43 4c |.xe .notprime CL| 00000270 43 3a 4c 44 41 26 37 30 3a 41 44 43 23 32 3a 53 |C:LDA&70:ADC#2:S| 00000280 54 41 26 37 30 3a 42 43 43 6e 65 78 74 3a 49 4e |TA&70:BCCnext:IN| 00000290 43 26 37 31 3a 42 4e 45 6e 65 78 74 3a 49 4e 43 |C&71:BNEnext:INC| 000002a0 26 37 32 3a 42 4e 45 6e 65 78 74 3a 49 4e 43 26 |&72:BNEnext:INC&| 000002b0 37 33 3a 52 54 53 3a 2e 6e 65 78 74 20 4a 4d 50 |73:RTS:.next JMP| 000002c0 63 6f 64 65 0d 00 82 5a 20 2e 6e 6f 74 66 61 63 |code...Z .notfac| 000002d0 74 6f 72 20 4c 44 41 26 38 32 3a 42 4e 45 63 61 |tor LDA&82:BNEca| 000002e0 72 72 79 6f 6e 3a 4c 44 41 26 38 31 3a 43 4d 50 |rryon:LDA&81:CMP| 000002f0 26 37 37 3a 42 43 43 70 72 69 6d 65 3a 42 4e 45 |&77:BCCprime:BNE| 00000300 63 61 72 72 79 6f 6e 3a 4c 44 41 26 38 30 3a 43 |carryon:LDA&80:C| 00000310 4d 50 26 37 36 3a 42 43 43 70 72 69 6d 65 0d 00 |MP&76:BCCprime..| 00000320 8c 50 20 2e 63 61 72 72 79 6f 6e 20 43 4c 43 3a |.P .carryon CLC:| 00000330 4c 44 41 26 37 34 3a 41 44 43 23 33 3a 53 54 41 |LDA&74:ADC#3:STA| 00000340 26 37 34 3a 42 43 43 6e 65 78 74 66 61 63 74 6f |&74:BCCnextfacto| 00000350 72 3a 49 4e 43 26 37 35 3a 2e 6e 65 78 74 66 61 |r:INC&75:.nextfa| 00000360 63 74 6f 72 20 4a 4d 50 64 69 76 69 64 65 0d 00 |ctor JMPdivide..| 00000370 96 b9 20 2e 70 72 69 6d 65 20 4c 44 59 23 30 3a |.. .prime LDY#0:| 00000380 4c 44 58 23 33 3a 2e 73 74 6f 72 65 20 4c 44 41 |LDX#3:.store LDA| 00000390 26 37 30 2c 59 3a 53 54 41 28 26 38 38 29 2c 59 |&70,Y:STA(&88),Y| 000003a0 3a 49 4e 59 3a 44 45 58 3a 42 4e 45 73 74 6f 72 |:INY:DEX:BNEstor| 000003b0 65 3a 4c 44 41 26 38 38 3a 43 4c 43 3a 41 44 43 |e:LDA&88:CLC:ADC| 000003c0 23 33 3a 53 54 41 26 38 38 3a 42 43 43 65 6e 64 |#3:STA&88:BCCend| 000003d0 3a 49 4e 43 26 38 39 3a 4c 44 41 26 38 39 3a 43 |:INC&89:LDA&89:C| 000003e0 4d 50 23 26 36 30 3a 42 4e 45 65 6e 64 3a 44 45 |MP#&60:BNEend:DE| 000003f0 43 26 38 39 3a 2e 65 6e 64 20 49 4e 43 26 38 43 |C&89:.end INC&8C| 00000400 3a 42 4e 45 72 65 74 3a 49 4e 43 26 38 44 3a 42 |:BNEret:INC&8D:B| 00000410 4e 45 72 65 74 3a 49 4e 43 26 38 45 3a 2e 72 65 |NEret:INC&8E:.re| 00000420 74 20 52 54 53 3a 5d 0d 00 a0 0b 20 ed 20 70 61 |t RTS:].... . pa| 00000430 73 73 0d 00 aa 0a 20 f1 20 32 2c 31 0d 00 b4 34 |ss.... . 2,1...4| 00000440 20 e7 20 3f 26 37 33 3e 30 20 8c 20 f1 22 45 4e | . ?&73>0 . ."EN| 00000450 44 22 20 8b 20 f1 20 21 26 37 30 2c 21 26 38 43 |D" . . !&70,!&8C| 00000460 3a d6 6e 6f 74 70 72 69 6d 65 3a e5 8d 74 74 40 |:.notprime:..tt@| 00000470 0d ff |..| 00000472