Home » Personal collection » Acorn ADFS disks » Electron » MTF_finished_programs.ADF » TAPE3/A/mcPRIMES1
TAPE3/A/mcPRIMES1
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/mcPRIMES1 |
Read OK: | ✔ |
File size: | 0426 bytes |
Load address: | FFFF0E00 |
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/mcPRIMES1
- Personal collection » Acorn ADFS disks » Electron » Finished_programs.ADF » TAPE3/A/mcPRIMES1
- Personal collection » Acorn hard disk » zipped_disks » elk03 » finished/TAPE3/A/mcPRIMES1
File contents
10 REM Machine code prime numbers (7/7/93) 20 HIMEM=&17FF 30 !&70=3 40 !&1800=3:!&7B=&1803 50 FOR pass=0 TO 2 STEP 2:P%=&A00 60 [OPT pass 70 .code LDA#0:STA&74:LDA#&18:STA&75 80 .product LDA#0:STA&76:STA&77:STA&78 90 .quotient STA&79:STA&7A 100 .addloop CLC:LDA&76:LDY#0:ADC(&74),Y:STA&76:BCCendadd1:INC&77:BNEendadd1:INC&78:BNEendadd1:JMPnotfactor 110 .endadd1 LDA&77:CLC:LDY#1:ADC(&74),Y:STA&77:BCCendadd2:INC&78:BNEendadd2:JMPnotfactor 120 .endadd2 INC&79:BNEendadd3:INC&7A 130 .endadd3 LDX#3:.checkloop LDA&75,X:CMP&6F,X:BCCaddloop:BNEnotfactor:DEX:BNEcheckloop 140 .notprime CLC:LDA&70:ADC#2:STA&70:BCCnext:INC&71:BNEnext:INC&72:BNEnext:INC&73:RTS:.next JMPcode 150 .notfactor LDA&7A:LDY#1:CMP(&74),Y:BCCprime:BNEcarryon:LDA&79:LDY#0:CMP(&74),Y:BCCprime 160 .carryon CLC:LDA&74:ADC#3:STA&74:BCCnextfactor:INC&75:.nextfactor JMPproduct 170 .prime LDY#0:LDX#3:.store LDA&70,Y:STA(&7B),Y:INY:DEX:BNEstore:LDA&7B:CLC:ADC#3:STA&7B:BCCend:INC&7C:LDA&7C:CMP#&60:BNEend:DEC&7C:.end RTS:] 180 NEXT pass 190 IF ?&73>0 THEN PRINT"END" ELSE PRINT !&70:CALLnotprime:GOTO190
> � Machine code prime numbers (7/7/93) �=&17FF !&70=3 ( !&1800=3:!&7B=&1803 2 � pass=0 � 2 � 2:P%=&A00 < [OPT pass F& .code LDA#0:STA&74:LDA#&18:STA&75 P( .product LDA#0:STA&76:STA&77:STA&78 Z .quotient STA&79:STA&7A dl .addloop CLC:LDA&76:LDY#0:ADC(&74),Y:STA&76:BCCendadd1:INC&77:BNEendadd1:INC&78:BNEendadd1:JMPnotfactor nZ .endadd1 LDA&77:CLC:LDY#1:ADC(&74),Y:STA&77:BCCendadd2:INC&78:BNEendadd2:JMPnotfactor x& .endadd2 INC&79:BNEendadd3:INC&7A �Y .endadd3 LDX#3:.checkloop LDA&75,X:CMP&6F,X:BCCaddloop:BNEnotfactor:DEX:BNEcheckloop �e .notprime CLC:LDA&70:ADC#2:STA&70:BCCnext:INC&71:BNEnext:INC&72:BNEnext:INC&73:RTS:.next JMPcode �\ .notfactor LDA&7A:LDY#1:CMP(&74),Y:BCCprime:BNEcarryon:LDA&79:LDY#0:CMP(&74),Y:BCCprime �Q .carryon CLC:LDA&74:ADC#3:STA&74:BCCnextfactor:INC&75:.nextfactor JMPproduct �� .prime LDY#0:LDX#3:.store LDA&70,Y:STA(&7B),Y:INY:DEX:BNEstore:LDA&7B:CLC:ADC#3:STA&7B:BCCend:INC&7C:LDA&7C:CMP#&60:BNEend:DEC&7C:.end RTS:] � � pass �/ � ?&73>0 � �"END" � � !&70:�notprime:�t~@ �
00000000 0d 00 0a 3e 20 f4 20 4d 61 63 68 69 6e 65 20 63 |...> . Machine c| 00000010 6f 64 65 20 70 72 69 6d 65 20 6e 75 6d 62 65 72 |ode prime number| 00000020 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |s | 00000030 20 20 20 20 20 20 28 37 2f 37 2f 39 33 29 0d 00 | (7/7/93)..| 00000040 14 0c 20 d3 3d 26 31 37 46 46 0d 00 1e 0b 20 21 |.. .=&17FF.... !| 00000050 26 37 30 3d 33 0d 00 28 18 20 21 26 31 38 30 30 |&70=3..(. !&1800| 00000060 3d 33 3a 21 26 37 42 3d 26 31 38 30 33 0d 00 32 |=3:!&7B=&1803..2| 00000070 1d 20 e3 20 70 61 73 73 3d 30 20 b8 20 32 20 88 |. . pass=0 . 2 .| 00000080 20 32 3a 50 25 3d 26 41 30 30 0d 00 3c 0e 20 5b | 2:P%=&A00..<. [| 00000090 4f 50 54 20 70 61 73 73 0d 00 46 26 20 2e 63 6f |OPT pass..F& .co| 000000a0 64 65 20 4c 44 41 23 30 3a 53 54 41 26 37 34 3a |de LDA#0:STA&74:| 000000b0 4c 44 41 23 26 31 38 3a 53 54 41 26 37 35 0d 00 |LDA#&18:STA&75..| 000000c0 50 28 20 2e 70 72 6f 64 75 63 74 20 4c 44 41 23 |P( .product LDA#| 000000d0 30 3a 53 54 41 26 37 36 3a 53 54 41 26 37 37 3a |0:STA&76:STA&77:| 000000e0 53 54 41 26 37 38 0d 00 5a 1c 20 2e 71 75 6f 74 |STA&78..Z. .quot| 000000f0 69 65 6e 74 20 53 54 41 26 37 39 3a 53 54 41 26 |ient STA&79:STA&| 00000100 37 41 0d 00 64 6c 20 2e 61 64 64 6c 6f 6f 70 20 |7A..dl .addloop | 00000110 43 4c 43 3a 4c 44 41 26 37 36 3a 4c 44 59 23 30 |CLC:LDA&76:LDY#0| 00000120 3a 41 44 43 28 26 37 34 29 2c 59 3a 53 54 41 26 |:ADC(&74),Y:STA&| 00000130 37 36 3a 42 43 43 65 6e 64 61 64 64 31 3a 49 4e |76:BCCendadd1:IN| 00000140 43 26 37 37 3a 42 4e 45 65 6e 64 61 64 64 31 3a |C&77:BNEendadd1:| 00000150 49 4e 43 26 37 38 3a 42 4e 45 65 6e 64 61 64 64 |INC&78:BNEendadd| 00000160 31 3a 4a 4d 50 6e 6f 74 66 61 63 74 6f 72 0d 00 |1:JMPnotfactor..| 00000170 6e 5a 20 2e 65 6e 64 61 64 64 31 20 4c 44 41 26 |nZ .endadd1 LDA&| 00000180 37 37 3a 43 4c 43 3a 4c 44 59 23 31 3a 41 44 43 |77:CLC:LDY#1:ADC| 00000190 28 26 37 34 29 2c 59 3a 53 54 41 26 37 37 3a 42 |(&74),Y:STA&77:B| 000001a0 43 43 65 6e 64 61 64 64 32 3a 49 4e 43 26 37 38 |CCendadd2:INC&78| 000001b0 3a 42 4e 45 65 6e 64 61 64 64 32 3a 4a 4d 50 6e |:BNEendadd2:JMPn| 000001c0 6f 74 66 61 63 74 6f 72 0d 00 78 26 20 2e 65 6e |otfactor..x& .en| 000001d0 64 61 64 64 32 20 49 4e 43 26 37 39 3a 42 4e 45 |dadd2 INC&79:BNE| 000001e0 65 6e 64 61 64 64 33 3a 49 4e 43 26 37 41 0d 00 |endadd3:INC&7A..| 000001f0 82 59 20 2e 65 6e 64 61 64 64 33 20 4c 44 58 23 |.Y .endadd3 LDX#| 00000200 33 3a 2e 63 68 65 63 6b 6c 6f 6f 70 20 4c 44 41 |3:.checkloop LDA| 00000210 26 37 35 2c 58 3a 43 4d 50 26 36 46 2c 58 3a 42 |&75,X:CMP&6F,X:B| 00000220 43 43 61 64 64 6c 6f 6f 70 3a 42 4e 45 6e 6f 74 |CCaddloop:BNEnot| 00000230 66 61 63 74 6f 72 3a 44 45 58 3a 42 4e 45 63 68 |factor:DEX:BNEch| 00000240 65 63 6b 6c 6f 6f 70 0d 00 8c 65 20 2e 6e 6f 74 |eckloop...e .not| 00000250 70 72 69 6d 65 20 43 4c 43 3a 4c 44 41 26 37 30 |prime CLC:LDA&70| 00000260 3a 41 44 43 23 32 3a 53 54 41 26 37 30 3a 42 43 |:ADC#2:STA&70:BC| 00000270 43 6e 65 78 74 3a 49 4e 43 26 37 31 3a 42 4e 45 |Cnext:INC&71:BNE| 00000280 6e 65 78 74 3a 49 4e 43 26 37 32 3a 42 4e 45 6e |next:INC&72:BNEn| 00000290 65 78 74 3a 49 4e 43 26 37 33 3a 52 54 53 3a 2e |ext:INC&73:RTS:.| 000002a0 6e 65 78 74 20 4a 4d 50 63 6f 64 65 0d 00 96 5c |next JMPcode...\| 000002b0 20 2e 6e 6f 74 66 61 63 74 6f 72 20 4c 44 41 26 | .notfactor LDA&| 000002c0 37 41 3a 4c 44 59 23 31 3a 43 4d 50 28 26 37 34 |7A:LDY#1:CMP(&74| 000002d0 29 2c 59 3a 42 43 43 70 72 69 6d 65 3a 42 4e 45 |),Y:BCCprime:BNE| 000002e0 63 61 72 72 79 6f 6e 3a 4c 44 41 26 37 39 3a 4c |carryon:LDA&79:L| 000002f0 44 59 23 30 3a 43 4d 50 28 26 37 34 29 2c 59 3a |DY#0:CMP(&74),Y:| 00000300 42 43 43 70 72 69 6d 65 0d 00 a0 51 20 2e 63 61 |BCCprime...Q .ca| 00000310 72 72 79 6f 6e 20 43 4c 43 3a 4c 44 41 26 37 34 |rryon CLC:LDA&74| 00000320 3a 41 44 43 23 33 3a 53 54 41 26 37 34 3a 42 43 |:ADC#3:STA&74:BC| 00000330 43 6e 65 78 74 66 61 63 74 6f 72 3a 49 4e 43 26 |Cnextfactor:INC&| 00000340 37 35 3a 2e 6e 65 78 74 66 61 63 74 6f 72 20 4a |75:.nextfactor J| 00000350 4d 50 70 72 6f 64 75 63 74 0d 00 aa 91 20 2e 70 |MPproduct.... .p| 00000360 72 69 6d 65 20 4c 44 59 23 30 3a 4c 44 58 23 33 |rime LDY#0:LDX#3| 00000370 3a 2e 73 74 6f 72 65 20 4c 44 41 26 37 30 2c 59 |:.store LDA&70,Y| 00000380 3a 53 54 41 28 26 37 42 29 2c 59 3a 49 4e 59 3a |:STA(&7B),Y:INY:| 00000390 44 45 58 3a 42 4e 45 73 74 6f 72 65 3a 4c 44 41 |DEX:BNEstore:LDA| 000003a0 26 37 42 3a 43 4c 43 3a 41 44 43 23 33 3a 53 54 |&7B:CLC:ADC#3:ST| 000003b0 41 26 37 42 3a 42 43 43 65 6e 64 3a 49 4e 43 26 |A&7B:BCCend:INC&| 000003c0 37 43 3a 4c 44 41 26 37 43 3a 43 4d 50 23 26 36 |7C:LDA&7C:CMP#&6| 000003d0 30 3a 42 4e 45 65 6e 64 3a 44 45 43 26 37 43 3a |0:BNEend:DEC&7C:| 000003e0 2e 65 6e 64 20 52 54 53 3a 5d 0d 00 b4 0b 20 ed |.end RTS:].... .| 000003f0 20 70 61 73 73 0d 00 be 2f 20 e7 20 3f 26 37 33 | pass.../ . ?&73| 00000400 3e 30 20 8c 20 f1 22 45 4e 44 22 20 8b 20 f1 20 |>0 . ."END" . . | 00000410 21 26 37 30 3a d6 6e 6f 74 70 72 69 6d 65 3a e5 |!&70:.notprime:.| 00000420 8d 74 7e 40 0d ff |.t~@..| 00000426