Home » Archimedes archive » Acorn User » AU 1993-06.adf » !ArmCode_ArmCode » Arm3
Arm3
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-06.adf » !ArmCode_ArmCode |
Filename: | Arm3 |
Read OK: | ✔ |
File size: | 02E8 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM >Arm3 20REM Square root 30REM By Dave Lawrence 40REM For 32-bit machines 50REM (c) BAU June 1993 60: 70DIM code 1000 80x=0:a=1:c=2:sum=3 90link=14:pc=15 100FOR pass=0 TO 2 STEP 2:P%=code 110[OPT pass 120.sqr 130 MOV a,#1 140 MOV c,#0 150 B cmp 160.loop 170 MOV a,a,ASL #2 180.cmp 190 CMP a,x 200 BLT loop 210.loop2 220 ADD sum,a,c 230 MOV c,c,LSR #1 240 CMP x,sum 250 SUBGE x,x,sum 260 ADDGE c,c,a 270 MOVS a,a,LSR #2 280 BNE loop2 290 300 CMP c,x 310 ADDLT R0,c,#1 320 MOVGE R0,c 330 340 MOV pc,link 350]NEXT 360FOR A%=1 TO 8000 370PRINT A%,USR(sqr),INT(SQR(A%)+.5) 380NEXT
� >Arm3 � Square root � By Dave Lawrence (� For 32-bit machines 2� (c) BAU June 1993 <: F� code 1000 Px=0:a=1:c=2:sum=3 Zlink=14:pc=15 d� pass=0 � 2 � 2:P%=code n [OPT pass x.sqr � MOV a,#1 � MOV c,#0 � B cmp � .loop � MOV a,a,ASL #2 �.cmp � CMP a,x � BLT loop � .loop2 � ADD sum,a,c � MOV c,c,LSR #1 � CMP x,sum � SUBGE x,x,sum ADDGE c,c,a MOVS a,a,LSR #2 BNE loop2 " , CMP c,x 6 ADDLT R0,c,#1 @ MOVGE R0,c J T MOV pc,link ^]� h� A%=1 � 8000 r� A%,�(sqr),�(�(A%)+.5) |� �
00000000 0d 00 0a 0f f4 20 20 20 20 20 3e 41 72 6d 33 0d |..... >Arm3.| 00000010 00 14 15 f4 20 20 20 20 20 53 71 75 61 72 65 20 |.... Square | 00000020 72 6f 6f 74 0d 00 1e 17 f4 20 42 79 20 20 44 61 |root..... By Da| 00000030 76 65 20 4c 61 77 72 65 6e 63 65 0d 00 28 19 f4 |ve Lawrence..(..| 00000040 20 46 6f 72 20 33 32 2d 62 69 74 20 6d 61 63 68 | For 32-bit mach| 00000050 69 6e 65 73 0d 00 32 17 f4 20 28 63 29 20 42 41 |ines..2.. (c) BA| 00000060 55 20 4a 75 6e 65 20 31 39 39 33 0d 00 3c 05 3a |U June 1993..<.:| 00000070 0d 00 46 0f de 20 63 6f 64 65 20 31 30 30 30 0d |..F.. code 1000.| 00000080 00 50 15 78 3d 30 3a 61 3d 31 3a 63 3d 32 3a 73 |.P.x=0:a=1:c=2:s| 00000090 75 6d 3d 33 0d 00 5a 11 6c 69 6e 6b 3d 31 34 3a |um=3..Z.link=14:| 000000a0 70 63 3d 31 35 0d 00 64 1c e3 20 70 61 73 73 3d |pc=15..d.. pass=| 000000b0 30 20 b8 20 32 20 88 20 32 3a 50 25 3d 63 6f 64 |0 . 2 . 2:P%=cod| 000000c0 65 0d 00 6e 0d 5b 4f 50 54 20 70 61 73 73 0d 00 |e..n.[OPT pass..| 000000d0 78 08 2e 73 71 72 0d 00 82 18 20 20 20 20 20 20 |x..sqr.... | 000000e0 20 20 4d 4f 56 20 20 20 20 20 61 2c 23 31 0d 00 | MOV a,#1..| 000000f0 8c 18 20 20 20 20 20 20 20 20 4d 4f 56 20 20 20 |.. MOV | 00000100 20 20 63 2c 23 30 0d 00 96 17 20 20 20 20 20 20 | c,#0.... | 00000110 20 20 42 20 20 20 20 20 20 20 63 6d 70 0d 00 a0 | B cmp...| 00000120 09 2e 6c 6f 6f 70 0d 00 aa 1e 20 20 20 20 20 20 |..loop.... | 00000130 20 20 4d 4f 56 20 20 20 20 20 61 2c 61 2c 41 53 | MOV a,a,AS| 00000140 4c 20 23 32 0d 00 b4 08 2e 63 6d 70 0d 00 be 17 |L #2.....cmp....| 00000150 20 20 20 20 20 20 20 20 43 4d 50 20 20 20 20 20 | CMP | 00000160 61 2c 78 0d 00 c8 18 20 20 20 20 20 20 20 20 42 |a,x.... B| 00000170 4c 54 20 20 20 20 20 6c 6f 6f 70 0d 00 d2 0a 2e |LT loop.....| 00000180 6c 6f 6f 70 32 0d 00 dc 1b 20 20 20 20 20 20 20 |loop2.... | 00000190 20 41 44 44 20 20 20 20 20 73 75 6d 2c 61 2c 63 | ADD sum,a,c| 000001a0 0d 00 e6 1e 20 20 20 20 20 20 20 20 4d 4f 56 20 |.... MOV | 000001b0 20 20 20 20 63 2c 63 2c 4c 53 52 20 23 31 0d 00 | c,c,LSR #1..| 000001c0 f0 19 20 20 20 20 20 20 20 20 43 4d 50 20 20 20 |.. CMP | 000001d0 20 20 78 2c 73 75 6d 0d 00 fa 1b 20 20 20 20 20 | x,sum.... | 000001e0 20 20 20 53 55 42 47 45 20 20 20 78 2c 78 2c 73 | SUBGE x,x,s| 000001f0 75 6d 0d 01 04 19 20 20 20 20 20 20 20 20 41 44 |um.... AD| 00000200 44 47 45 20 20 20 63 2c 63 2c 61 0d 01 0e 1e 20 |DGE c,c,a.... | 00000210 20 20 20 20 20 20 20 4d 4f 56 53 20 20 20 20 61 | MOVS a| 00000220 2c 61 2c 4c 53 52 20 23 32 0d 01 18 19 20 20 20 |,a,LSR #2.... | 00000230 20 20 20 20 20 42 4e 45 20 20 20 20 20 6c 6f 6f | BNE loo| 00000240 70 32 0d 01 22 04 0d 01 2c 17 20 20 20 20 20 20 |p2.."...,. | 00000250 20 20 43 4d 50 20 20 20 20 20 63 2c 78 0d 01 36 | CMP c,x..6| 00000260 1b 20 20 20 20 20 20 20 20 41 44 44 4c 54 20 20 |. ADDLT | 00000270 20 52 30 2c 63 2c 23 31 0d 01 40 18 20 20 20 20 | R0,c,#1..@. | 00000280 20 20 20 20 4d 4f 56 47 45 20 20 20 52 30 2c 63 | MOVGE R0,c| 00000290 0d 01 4a 04 0d 01 54 1b 20 20 20 20 20 20 20 20 |..J...T. | 000002a0 4d 4f 56 20 20 20 20 20 70 63 2c 6c 69 6e 6b 0d |MOV pc,link.| 000002b0 01 5e 06 5d ed 0d 01 68 11 e3 20 41 25 3d 31 20 |.^.]...h.. A%=1 | 000002c0 b8 20 38 30 30 30 0d 01 72 1b f1 20 41 25 2c ba |. 8000..r.. A%,.| 000002d0 28 73 71 72 29 2c a8 28 b6 28 41 25 29 2b 2e 35 |(sqr),.(.(A%)+.5| 000002e0 29 0d 01 7c 05 ed 0d ff |)..|....| 000002e8