Home » Archimedes archive » Acorn User » AU 1995-11.adf » !Regulars » Regulars/StarInfo/Radford/ASS_DIV
Regulars/StarInfo/Radford/ASS_DIV
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 1995-11.adf » !Regulars |
Filename: | Regulars/StarInfo/Radford/ASS_DIV |
Read OK: | ✔ |
File size: | 0F91 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10ON ERROR REPORT:PRINT;ERL:END 20DIM code% 5000 30carry=8 40accuracy%=800 :REM THIS IS THE MAXIMUM NUMBER OF DECIMAL PLACES TO BE CALCULATED 50FOR pass%=0 TO 3 STEP 3 60P%=code% 70[ 80OPT pass% 90 100.begin_division 110STMFD R13!,{R14} 120 130\A VALUE OF TEN CORRESPONDS TO TERMINATING BYTE 140 150BL get_addresses 160 170 180\find end of operand1 AND operand2 190 200MOV R3,R0 210MOV R5,#0 220.loop_get_end1b 230 LDRB R4,[R3],#1 240 ADD R5,R5,#1 250 CMP R4,#10 260BNE loop_get_end1b 270ADD R5,R5,#1 280 290MOV R3,R1 300MOV R6,#0 310.loop_get_end2b 320 LDRB R4,[R3],#1 330 ADD R6,R6,#1 340 CMP R4,#10 350BNE loop_get_end2b 360SUB R6,R6,#1 370 380\LENGTH OF OPERAND 1 IS RETURNED IN R5, LENGTH OF OPERAND 2 IS IN R6 390 400\REGISTERS AVAILABLE R3,R4,R8-R12,R14 - carry=8 410 420MOV R7,#0 \J% 430.for_loopify1b 440 ADD R3,R0,R7 \W% 450 MVN R4,#0 \V% 460 470 .repeat1 480 ADD R4,R4,#1 490 MOV carry,#1 500 SUB R9,R6,#1 \L% 510 .for_loopify2b 520 MOV R10,#0 \Q% 530 CMP R9,#0 540 LDRGEB R10,[R1,R9] 550 560 \STMFD R13!,{R0-R2} 570 \MOV R0,R10 580 \ADR R1,buffer 590 \MOV R2,#32 600 \SWI "OS_ConvertInteger1" 610 \SWI "OS_Write0" 620 \SWI "OS_NewLine" 630 \LDMFD R13!,{R0-R2} 640 650 LDRB R14,[R3,R9] 660 SUB R10,R14,R10 670 ADD R10,R10,carry 680 ADD R10,R10,#9 690 700 \ASSEMBLE MOD AND DIV FUNCTION 710 STMFD R13!,{R0-R6} 720 MOV R0,R10 730 MOV R1,#10 740 ANDS R6,R0,#1<<31 750 RSBMI R0,R0,#0 760 EOR R5,R6,R1 770 CMP R1,#0 780 RSBMI R1,R1,#0 790 800 MOV R2,#0 810 MOV R3,#0 820 MOV R4,#1<<31 830 840 .division_loop2 850 MOVS R0,R0,ASL#1 860 ADC R2,R2,R2 870 CMP R2,R1 880 SUBGE R2,R2,R1 890 ORRGE R3,R3,R4 900 MOVS R4,R4,LSR#1 910 BNE division_loop2 920 930 CMP R5,#0 940 RSBMI R3,R3,#0 950 CMP R6,#0 960 RSBMI R2,R2,#0 970 980 STR R3,divres2 990 STR R2,modres2 1000 1010 LDMFD R13!,{R0-R6} 1020 1030 LDR R14,modres2 1040 STRB R14,[R3,R9] 1050 LDR R8,divres2 1060 SUB R9,R9,#1 1070 CMN R9,R7 1080 1090 1100 BNE for_loopify2b 1110 CMP carry,#0 1120 BNE repeat1 1130 SUB R9,R6,#1 \L% 1140 .for_loopify3b 1150 MOV R10,#0 \Q% 1160 CMP R9,#0 1170 LDRGEB R10,[R1,R9] 1180 LDRB R14,[R3,R9] 1190 ADD R10,R10,R14 1200 ADD R10,R10,carry 1210 1220 \ASSEMBLE MOD AND DIV FUNCTION 1230 STMFD R13!,{R0-R6} 1240 MOV R0,R10 1250 MOV R1,#10 1260 ANDS R6,R0,#1<<31 1270 RSBMI R0,R0,#0 1280 EOR R5,R6,R1 1290 CMP R1,#0 1300 RSBMI R1,R1,#0 1310 1320 MOV R2,#0 1330 MOV R3,#0 1340 MOV R4,#1<<31 1350 1360 .division_loop3 1370 MOVS R0,R0,ASL#1 1380 ADC R2,R2,R2 1390 CMP R2,R1 1400 SUBGE R2,R2,R1 1410 ORRGE R3,R3,R4 1420 MOVS R4,R4,LSR#1 1430 BNE division_loop3 1440 1450 CMP R5,#0 1460 RSBMI R3,R3,#0 1470 CMP R6,#0 1480 RSBMI R2,R2,#0 1490 1500 STR R3,divres2 1510 STR R2,modres2 1520 1530 LDMFD R13!,{R0-R6} 1540 1550 LDR R14,modres2 1560 STRB R14,[R3,R9] 1570 LDR R8,divres2 1580 SUB R9,R9,#1 1590 CMN R9,R7 1600 BNE for_loopify3b 1610 STRB R4,[R2,R7] 1620 ADD R7,R7,#1 1630 SUB R14,R5,R6 1640 CMP R7,R14 1650BLT for_loopify1b 1660MOV R14,#10 1670STRB R14,[R2,R7] 1680 1690 1700LDMFD R13!,{PC} 1710 1720 1730.divres2 1740EQUD 0 1750.modres2 1760EQUD 0 1770.buffer 1780FNBytes(32) 1790 1800 1810.get_addresses 1820STMFD R13!,{R14} 1830ADR R0,operand1 1840ADR R1,operand2 1850ADR R2,result 1860LDMFD R13!,{PC} 1870.operand1 1880FNBytes(accuracy%) 1890.operand2 1900FNBytes(accuracy%) 1910.result 1920FNBytes(2*accuracy%) 1930 1940] 1950NEXT 1960: 1970REPEAT 1980INPUT operand1$ 1990INPUT operand2$ 2000 2010operand1?0=0 2020operand2?0=0 2030FOR A=1 TO LEN(operand1$) 2040operand1?(A)=VAL(MID$(operand1$,A,1)) 2050NEXT 2060operand1?(A)=10 2070FOR A=1 TO LEN(operand2$) 2080operand2?(A)=VAL(MID$(operand2$,A,1)) 2090NEXT 2100operand2?(A)=10 2110CALL begin_division 2120A=0 2130REPEAT 2140PRINT STR$((result?A)); 2150A+=1 2160UNTIL result?(A+1)=10 2170PRINT 2180 2190UNTIL ERR=17 2200END 2210: 2220DEFFNBytes(inc%) 2230P%+=inc% 2240=0
� � �:�;�:� � code% 5000 carry=8 (Raccuracy%=800 :� THIS IS THE MAXIMUM NUMBER OF DECIMAL PLACES TO BE CALCULATED 2� pass%=0 � 3 � 3 <P%=code% F[ P OPT pass% Z d.begin_division nSTMFD R13!,{R14} x �/\A �UE � TEN CORRESPONDS � TERMINATING BYTE � �BL get_addresses � � �$\find end of operand1 � operand2 � � MOV R3,R0 � MOV R5,#0 �.loop_get_end1b � LDRB R4,[R3],#1 � ADD R5,R5,#1 � CMP R4,#10 BNE loop_get_end1b ADD R5,R5,#1 " MOV R3,R1 , MOV R6,#0 6.loop_get_end2b @ LDRB R4,[R3],#1 J ADD R6,R6,#1 T CMP R4,#10 ^BNE loop_get_end2b hSUB R6,R6,#1 r |B\�GTH � OPERAND 1 IS RETURNED IN R5, �GTH � OPERAND 2 IS IN R6 � �3\REGISTERS AVAILABLE R3,R4,R8-R12,R14 - carry=8 � �MOV R7,#0 \J% �.for_loopify1b � ADD R3,R0,R7 \W% � MVN R4,#0 \V% � � .repeat1 � ADD R4,R4,#1 � MOV carry,#1 � SUB R9,R6,#1 \L% � .for_loopify2b MOV R10,#0 \Q% CMP R9,#0 LDRGEB R10,[R1,R9] & 0 \STMFD R13!,{R0-R2} : \MOV R0,R10 D \ADR R1,buffer N \MOV R2,#32 X# \SWI "OS_ConvertInteger1" b \SWI "OS_Write0" l \SWI "OS_NewLine" v \LDMFD R13!,{R0-R2} � � LDRB R14,[R3,R9] � SUB R10,R14,R10 � ADD R10,R10,carry � ADD R10,R10,#9 � �" \ASSEMBLE � � � FUNCTION � STMFD R13!,{R0-R6} � MOV R0,R10 � MOV R1,#10 � �S R6,R0,#1<<31 � RSBMI R0,R0,#0 � � R5,R6,R1 CMP R1,#0 RSBMI R1,R1,#0 MOV R2,#0 * MOV R3,#0 4 MOV R4,#1<<31 > H .division_loop2 R MOVS R0,R0,ASL#1 \ ADC R2,R2,R2 f CMP R2,R1 p SUBGE R2,R2,R1 z �RGE R3,R3,R4 � MOVS R4,R4,LSR#1 � BNE division_loop2 � � CMP R5,#0 � RSBMI R3,R3,#0 � CMP R6,#0 � RSBMI R2,R2,#0 � � STR R3,divres2 � STR R2,modres2 � � LDMFD R13!,{R0-R6} � LDR R14,modres2 STRB R14,[R3,R9] LDR R8,divres2 $ SUB R9,R9,#1 . CMN R9,R7 8 B L BNE for_loopify2b V CMP carry,#0 ` BNE repeat1 j SUB R9,R6,#1 \L% t .for_loopify3b ~ MOV R10,#0 \Q% � CMP R9,#0 � LDRGEB R10,[R1,R9] � LDRB R14,[R3,R9] � ADD R10,R10,R14 � ADD R10,R10,carry � � \ASSEMBLE � � � FUNCTION � STMFD R13!,{R0-R6} � MOV R0,R10 � MOV R1,#10 � �S R6,R0,#1<<31 � RSBMI R0,R0,#0 � R5,R6,R1 CMP R1,#0 RSBMI R1,R1,#0 ( MOV R2,#0 2 MOV R3,#0 < MOV R4,#1<<31 F P .division_loop3 Z MOVS R0,R0,ASL#1 d ADC R2,R2,R2 n CMP R2,R1 x SUBGE R2,R2,R1 � �RGE R3,R3,R4 � MOVS R4,R4,LSR#1 � BNE division_loop3 � � CMP R5,#0 � RSBMI R3,R3,#0 � CMP R6,#0 � RSBMI R2,R2,#0 � � STR R3,divres2 � STR R2,modres2 � � LDMFD R13!,{R0-R6} LDR R14,modres2 STRB R14,[R3,R9] " LDR R8,divres2 , SUB R9,R9,#1 6 CMN R9,R7 @ BNE for_loopify3b J STRB R4,[R2,R7] T ADD R7,R7,#1 ^ SUB R14,R5,R6 h CMP R7,R14 rBLT for_loopify1b |MOV R14,#10 �STRB R14,[R2,R7] � � �LDMFD R13!,{PC} � � �.divres2 � EQUD 0 �.modres2 � EQUD 0 �.buffer ��Bytes(32) � .get_addresses STMFD R13!,{R14} &ADR R0,operand1 0ADR R1,operand2 :ADR R2,result DLDMFD R13!,{PC} N .operand1 X�Bytes(accuracy%) b .operand2 l�Bytes(accuracy%) v.result ��Bytes(2*accuracy%) � �] �� �: �� �� operand1$ �� operand2$ � �operand1?0=0 �operand2?0=0 �� A=1 � �(operand1$) �#operand1?(A)=�(�operand1$,A,1)) � operand1?(A)=10 � A=1 � �(operand2$) #operand2?(A)=�(�operand2$,A,1)) *� 4operand2?(A)=10 >� begin_division HA=0 R� \� �((result?A)); fA+=1 p� result?(A+1)=10 z� � � � �=17 �� �: �ݤBytes(inc%) �P%+=inc% �=0 �
00000000 0d 00 0a 0f ee 20 85 20 f6 3a f1 3b 9e 3a e0 0d |..... . .:.;.:..| 00000010 00 14 10 de 20 63 6f 64 65 25 20 35 30 30 30 0d |.... code% 5000.| 00000020 00 1e 0b 63 61 72 72 79 3d 38 0d 00 28 52 61 63 |...carry=8..(Rac| 00000030 63 75 72 61 63 79 25 3d 38 30 30 20 3a f4 20 54 |curacy%=800 :. T| 00000040 48 49 53 20 49 53 20 54 48 45 20 4d 41 58 49 4d |HIS IS THE MAXIM| 00000050 55 4d 20 4e 55 4d 42 45 52 20 4f 46 20 44 45 43 |UM NUMBER OF DEC| 00000060 49 4d 41 4c 20 50 4c 41 43 45 53 20 54 4f 20 42 |IMAL PLACES TO B| 00000070 45 20 43 41 4c 43 55 4c 41 54 45 44 0d 00 32 15 |E CALCULATED..2.| 00000080 e3 20 70 61 73 73 25 3d 30 20 b8 20 33 20 88 20 |. pass%=0 . 3 . | 00000090 33 0d 00 3c 0c 50 25 3d 63 6f 64 65 25 0d 00 46 |3..<.P%=code%..F| 000000a0 05 5b 0d 00 50 0d 4f 50 54 20 70 61 73 73 25 0d |.[..P.OPT pass%.| 000000b0 00 5a 04 0d 00 64 13 2e 62 65 67 69 6e 5f 64 69 |.Z...d..begin_di| 000000c0 76 69 73 69 6f 6e 0d 00 6e 14 53 54 4d 46 44 20 |vision..n.STMFD | 000000d0 52 31 33 21 2c 7b 52 31 34 7d 0d 00 78 04 0d 00 |R13!,{R14}..x...| 000000e0 82 2f 5c 41 20 bb 55 45 20 ca 20 54 45 4e 20 43 |./\A .UE . TEN C| 000000f0 4f 52 52 45 53 50 4f 4e 44 53 20 b8 20 54 45 52 |ORRESPONDS . TER| 00000100 4d 49 4e 41 54 49 4e 47 20 42 59 54 45 0d 00 8c |MINATING BYTE...| 00000110 04 0d 00 96 14 42 4c 20 67 65 74 5f 61 64 64 72 |.....BL get_addr| 00000120 65 73 73 65 73 0d 00 a0 04 0d 00 aa 04 0d 00 b4 |esses...........| 00000130 24 5c 66 69 6e 64 20 65 6e 64 20 6f 66 20 6f 70 |$\find end of op| 00000140 65 72 61 6e 64 31 20 80 20 6f 70 65 72 61 6e 64 |erand1 . operand| 00000150 32 0d 00 be 04 0d 00 c8 0d 4d 4f 56 20 52 33 2c |2........MOV R3,| 00000160 52 30 0d 00 d2 0d 4d 4f 56 20 52 35 2c 23 30 0d |R0....MOV R5,#0.| 00000170 00 dc 13 2e 6c 6f 6f 70 5f 67 65 74 5f 65 6e 64 |....loop_get_end| 00000180 31 62 0d 00 e6 15 20 20 4c 44 52 42 20 52 34 2c |1b.... LDRB R4,| 00000190 5b 52 33 5d 2c 23 31 0d 00 f0 12 20 20 41 44 44 |[R3],#1.... ADD| 000001a0 20 52 35 2c 52 35 2c 23 31 0d 00 fa 10 20 20 43 | R5,R5,#1.... C| 000001b0 4d 50 20 52 34 2c 23 31 30 0d 01 04 16 42 4e 45 |MP R4,#10....BNE| 000001c0 20 6c 6f 6f 70 5f 67 65 74 5f 65 6e 64 31 62 0d | loop_get_end1b.| 000001d0 01 0e 10 41 44 44 20 52 35 2c 52 35 2c 23 31 0d |...ADD R5,R5,#1.| 000001e0 01 18 04 0d 01 22 0d 4d 4f 56 20 52 33 2c 52 31 |.....".MOV R3,R1| 000001f0 0d 01 2c 0d 4d 4f 56 20 52 36 2c 23 30 0d 01 36 |..,.MOV R6,#0..6| 00000200 13 2e 6c 6f 6f 70 5f 67 65 74 5f 65 6e 64 32 62 |..loop_get_end2b| 00000210 0d 01 40 15 20 20 4c 44 52 42 20 52 34 2c 5b 52 |..@. LDRB R4,[R| 00000220 33 5d 2c 23 31 0d 01 4a 12 20 20 41 44 44 20 52 |3],#1..J. ADD R| 00000230 36 2c 52 36 2c 23 31 0d 01 54 10 20 20 43 4d 50 |6,R6,#1..T. CMP| 00000240 20 52 34 2c 23 31 30 0d 01 5e 16 42 4e 45 20 6c | R4,#10..^.BNE l| 00000250 6f 6f 70 5f 67 65 74 5f 65 6e 64 32 62 0d 01 68 |oop_get_end2b..h| 00000260 10 53 55 42 20 52 36 2c 52 36 2c 23 31 0d 01 72 |.SUB R6,R6,#1..r| 00000270 04 0d 01 7c 42 5c a9 47 54 48 20 ca 20 4f 50 45 |...|B\.GTH . OPE| 00000280 52 41 4e 44 20 31 20 49 53 20 52 45 54 55 52 4e |RAND 1 IS RETURN| 00000290 45 44 20 49 4e 20 52 35 2c 20 a9 47 54 48 20 ca |ED IN R5, .GTH .| 000002a0 20 4f 50 45 52 41 4e 44 20 32 20 49 53 20 49 4e | OPERAND 2 IS IN| 000002b0 20 52 36 0d 01 86 04 0d 01 90 33 5c 52 45 47 49 | R6.......3\REGI| 000002c0 53 54 45 52 53 20 41 56 41 49 4c 41 42 4c 45 20 |STERS AVAILABLE | 000002d0 52 33 2c 52 34 2c 52 38 2d 52 31 32 2c 52 31 34 |R3,R4,R8-R12,R14| 000002e0 20 2d 20 63 61 72 72 79 3d 38 0d 01 9a 04 0d 01 | - carry=8......| 000002f0 a4 1d 4d 4f 56 20 52 37 2c 23 30 20 20 20 20 20 |..MOV R7,#0 | 00000300 20 20 20 20 20 20 20 20 5c 4a 25 0d 01 ae 12 2e | \J%.....| 00000310 66 6f 72 5f 6c 6f 6f 70 69 66 79 31 62 0d 01 b8 |for_loopify1b...| 00000320 1d 20 20 41 44 44 20 52 33 2c 52 30 2c 52 37 20 |. ADD R3,R0,R7 | 00000330 20 20 20 20 20 20 20 5c 57 25 0d 01 c2 1d 20 20 | \W%.... | 00000340 4d 56 4e 20 52 34 2c 23 30 20 20 20 20 20 20 20 |MVN R4,#0 | 00000350 20 20 20 20 5c 56 25 0d 01 cc 04 0d 01 d6 0e 20 | \V%........ | 00000360 20 2e 72 65 70 65 61 74 31 0d 01 e0 14 20 20 20 | .repeat1.... | 00000370 20 41 44 44 20 52 34 2c 52 34 2c 23 31 0d 01 ea | ADD R4,R4,#1...| 00000380 14 20 20 20 20 4d 4f 56 20 63 61 72 72 79 2c 23 |. MOV carry,#| 00000390 31 0d 01 f4 1c 20 20 20 20 53 55 42 20 52 39 2c |1.... SUB R9,| 000003a0 52 36 2c 23 31 20 20 20 20 20 5c 4c 25 0d 01 fe |R6,#1 \L%...| 000003b0 16 20 20 20 20 2e 66 6f 72 5f 6c 6f 6f 70 69 66 |. .for_loopif| 000003c0 79 32 62 0d 02 08 1c 20 20 20 20 20 20 4d 4f 56 |y2b.... MOV| 000003d0 20 52 31 30 2c 23 30 20 20 20 20 20 5c 51 25 0d | R10,#0 \Q%.| 000003e0 02 12 13 20 20 20 20 20 20 43 4d 50 20 52 39 2c |... CMP R9,| 000003f0 23 30 0d 02 1c 1c 20 20 20 20 20 20 4c 44 52 47 |#0.... LDRG| 00000400 45 42 20 52 31 30 2c 5b 52 31 2c 52 39 5d 0d 02 |EB R10,[R1,R9]..| 00000410 26 04 0d 02 30 1d 20 20 20 20 20 20 5c 53 54 4d |&...0. \STM| 00000420 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 32 7d 0d |FD R13!,{R0-R2}.| 00000430 02 3a 15 20 20 20 20 20 20 5c 4d 4f 56 20 52 30 |.:. \MOV R0| 00000440 2c 52 31 30 0d 02 44 18 20 20 20 20 20 20 5c 41 |,R10..D. \A| 00000450 44 52 20 52 31 2c 62 75 66 66 65 72 0d 02 4e 15 |DR R1,buffer..N.| 00000460 20 20 20 20 20 20 5c 4d 4f 56 20 52 32 2c 23 33 | \MOV R2,#3| 00000470 32 0d 02 58 23 20 20 20 20 20 20 5c 53 57 49 20 |2..X# \SWI | 00000480 22 4f 53 5f 43 6f 6e 76 65 72 74 49 6e 74 65 67 |"OS_ConvertInteg| 00000490 65 72 31 22 0d 02 62 1a 20 20 20 20 20 20 5c 53 |er1"..b. \S| 000004a0 57 49 20 22 4f 53 5f 57 72 69 74 65 30 22 0d 02 |WI "OS_Write0"..| 000004b0 6c 1b 20 20 20 20 20 20 5c 53 57 49 20 22 4f 53 |l. \SWI "OS| 000004c0 5f 4e 65 77 4c 69 6e 65 22 0d 02 76 1d 20 20 20 |_NewLine"..v. | 000004d0 20 20 20 5c 4c 44 4d 46 44 20 52 31 33 21 2c 7b | \LDMFD R13!,{| 000004e0 52 30 2d 52 32 7d 0d 02 80 04 0d 02 8a 1a 20 20 |R0-R2}........ | 000004f0 20 20 20 20 4c 44 52 42 20 52 31 34 2c 5b 52 33 | LDRB R14,[R3| 00000500 2c 52 39 5d 0d 02 94 19 20 20 20 20 20 20 53 55 |,R9].... SU| 00000510 42 20 52 31 30 2c 52 31 34 2c 52 31 30 0d 02 9e |B R10,R14,R10...| 00000520 1b 20 20 20 20 20 20 41 44 44 20 52 31 30 2c 52 |. ADD R10,R| 00000530 31 30 2c 63 61 72 72 79 0d 02 a8 18 20 20 20 20 |10,carry.... | 00000540 20 20 41 44 44 20 52 31 30 2c 52 31 30 2c 23 39 | ADD R10,R10,#9| 00000550 0d 02 b2 04 0d 02 bc 22 20 20 20 20 20 20 5c 41 |......." \A| 00000560 53 53 45 4d 42 4c 45 20 83 20 80 20 81 20 46 55 |SSEMBLE . . . FU| 00000570 4e 43 54 49 4f 4e 0d 02 c6 1c 20 20 20 20 20 20 |NCTION.... | 00000580 53 54 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 |STMFD R13!,{R0-R| 00000590 36 7d 0d 02 d0 14 20 20 20 20 20 20 4d 4f 56 20 |6}.... MOV | 000005a0 52 30 2c 52 31 30 0d 02 da 14 20 20 20 20 20 20 |R0,R10.... | 000005b0 4d 4f 56 20 52 31 2c 23 31 30 0d 02 e4 19 20 20 |MOV R1,#10.... | 000005c0 20 20 20 20 80 53 20 52 36 2c 52 30 2c 23 31 3c | .S R6,R0,#1<| 000005d0 3c 33 31 0d 02 ee 18 20 20 20 20 20 20 52 53 42 |<31.... RSB| 000005e0 4d 49 20 52 30 2c 52 30 2c 23 30 0d 02 f8 14 20 |MI R0,R0,#0.... | 000005f0 20 20 20 20 20 82 20 52 35 2c 52 36 2c 52 31 0d | . R5,R6,R1.| 00000600 03 02 13 20 20 20 20 20 20 43 4d 50 20 52 31 2c |... CMP R1,| 00000610 23 30 0d 03 0c 18 20 20 20 20 20 20 52 53 42 4d |#0.... RSBM| 00000620 49 20 52 31 2c 52 31 2c 23 30 0d 03 16 04 0d 03 |I R1,R1,#0......| 00000630 20 13 20 20 20 20 20 20 4d 4f 56 20 52 32 2c 23 | . MOV R2,#| 00000640 30 0d 03 2a 13 20 20 20 20 20 20 4d 4f 56 20 52 |0..*. MOV R| 00000650 33 2c 23 30 0d 03 34 17 20 20 20 20 20 20 4d 4f |3,#0..4. MO| 00000660 56 20 52 34 2c 23 31 3c 3c 33 31 0d 03 3e 04 0d |V R4,#1<<31..>..| 00000670 03 48 19 20 20 20 20 20 20 2e 64 69 76 69 73 69 |.H. .divisi| 00000680 6f 6e 5f 6c 6f 6f 70 32 0d 03 52 1a 20 20 20 20 |on_loop2..R. | 00000690 20 20 4d 4f 56 53 20 52 30 2c 52 30 2c 41 53 4c | MOVS R0,R0,ASL| 000006a0 23 31 0d 03 5c 16 20 20 20 20 20 20 41 44 43 20 |#1..\. ADC | 000006b0 52 32 2c 52 32 2c 52 32 0d 03 66 13 20 20 20 20 |R2,R2,R2..f. | 000006c0 20 20 43 4d 50 20 52 32 2c 52 31 0d 03 70 18 20 | CMP R2,R1..p. | 000006d0 20 20 20 20 20 53 55 42 47 45 20 52 32 2c 52 32 | SUBGE R2,R2| 000006e0 2c 52 31 0d 03 7a 17 20 20 20 20 20 20 84 52 47 |,R1..z. .RG| 000006f0 45 20 52 33 2c 52 33 2c 52 34 0d 03 84 1a 20 20 |E R3,R3,R4.... | 00000700 20 20 20 20 4d 4f 56 53 20 52 34 2c 52 34 2c 4c | MOVS R4,R4,L| 00000710 53 52 23 31 0d 03 8e 1c 20 20 20 20 20 20 42 4e |SR#1.... BN| 00000720 45 20 64 69 76 69 73 69 6f 6e 5f 6c 6f 6f 70 32 |E division_loop2| 00000730 0d 03 98 04 0d 03 a2 13 20 20 20 20 20 20 43 4d |........ CM| 00000740 50 20 52 35 2c 23 30 0d 03 ac 18 20 20 20 20 20 |P R5,#0.... | 00000750 20 52 53 42 4d 49 20 52 33 2c 52 33 2c 23 30 0d | RSBMI R3,R3,#0.| 00000760 03 b6 13 20 20 20 20 20 20 43 4d 50 20 52 36 2c |... CMP R6,| 00000770 23 30 0d 03 c0 18 20 20 20 20 20 20 52 53 42 4d |#0.... RSBM| 00000780 49 20 52 32 2c 52 32 2c 23 30 0d 03 ca 04 0d 03 |I R2,R2,#0......| 00000790 d4 18 20 20 20 20 20 20 53 54 52 20 52 33 2c 64 |.. STR R3,d| 000007a0 69 76 72 65 73 32 0d 03 de 18 20 20 20 20 20 20 |ivres2.... | 000007b0 53 54 52 20 52 32 2c 6d 6f 64 72 65 73 32 0d 03 |STR R2,modres2..| 000007c0 e8 04 0d 03 f2 1c 20 20 20 20 20 20 4c 44 4d 46 |...... LDMF| 000007d0 44 20 52 31 33 21 2c 7b 52 30 2d 52 36 7d 0d 03 |D R13!,{R0-R6}..| 000007e0 fc 04 0d 04 06 19 20 20 20 20 20 20 4c 44 52 20 |...... LDR | 000007f0 52 31 34 2c 6d 6f 64 72 65 73 32 0d 04 10 1a 20 |R14,modres2.... | 00000800 20 20 20 20 20 53 54 52 42 20 52 31 34 2c 5b 52 | STRB R14,[R| 00000810 33 2c 52 39 5d 0d 04 1a 18 20 20 20 20 20 20 4c |3,R9].... L| 00000820 44 52 20 52 38 2c 64 69 76 72 65 73 32 0d 04 24 |DR R8,divres2..$| 00000830 16 20 20 20 20 20 20 53 55 42 20 52 39 2c 52 39 |. SUB R9,R9| 00000840 2c 23 31 0d 04 2e 13 20 20 20 20 20 20 43 4d 4e |,#1.... CMN| 00000850 20 52 39 2c 52 37 0d 04 38 04 0d 04 42 04 0d 04 | R9,R7..8...B...| 00000860 4c 19 20 20 20 20 42 4e 45 20 66 6f 72 5f 6c 6f |L. BNE for_lo| 00000870 6f 70 69 66 79 32 62 0d 04 56 14 20 20 20 20 43 |opify2b..V. C| 00000880 4d 50 20 63 61 72 72 79 2c 23 30 0d 04 60 11 20 |MP carry,#0..`. | 00000890 20 42 4e 45 20 72 65 70 65 61 74 31 0d 04 6a 1a | BNE repeat1..j.| 000008a0 20 20 53 55 42 20 52 39 2c 52 36 2c 23 31 20 20 | SUB R9,R6,#1 | 000008b0 20 20 20 5c 4c 25 0d 04 74 16 20 20 20 20 2e 66 | \L%..t. .f| 000008c0 6f 72 5f 6c 6f 6f 70 69 66 79 33 62 0d 04 7e 1a |or_loopify3b..~.| 000008d0 20 20 20 20 4d 4f 56 20 52 31 30 2c 23 30 20 20 | MOV R10,#0 | 000008e0 20 20 20 5c 51 25 0d 04 88 11 20 20 20 20 43 4d | \Q%.... CM| 000008f0 50 20 52 39 2c 23 30 0d 04 92 1a 20 20 20 20 4c |P R9,#0.... L| 00000900 44 52 47 45 42 20 52 31 30 2c 5b 52 31 2c 52 39 |DRGEB R10,[R1,R9| 00000910 5d 0d 04 9c 18 20 20 20 20 4c 44 52 42 20 52 31 |].... LDRB R1| 00000920 34 2c 5b 52 33 2c 52 39 5d 0d 04 a6 17 20 20 20 |4,[R3,R9].... | 00000930 20 41 44 44 20 52 31 30 2c 52 31 30 2c 52 31 34 | ADD R10,R10,R14| 00000940 0d 04 b0 19 20 20 20 20 41 44 44 20 52 31 30 2c |.... ADD R10,| 00000950 52 31 30 2c 63 61 72 72 79 0d 04 ba 04 0d 04 c4 |R10,carry.......| 00000960 20 20 20 20 20 5c 41 53 53 45 4d 42 4c 45 20 83 | \ASSEMBLE .| 00000970 20 80 20 81 20 46 55 4e 43 54 49 4f 4e 0d 04 ce | . . FUNCTION...| 00000980 1a 20 20 20 20 53 54 4d 46 44 20 52 31 33 21 2c |. STMFD R13!,| 00000990 7b 52 30 2d 52 36 7d 0d 04 d8 12 20 20 20 20 4d |{R0-R6}.... M| 000009a0 4f 56 20 52 30 2c 52 31 30 0d 04 e2 12 20 20 20 |OV R0,R10.... | 000009b0 20 4d 4f 56 20 52 31 2c 23 31 30 0d 04 ec 17 20 | MOV R1,#10.... | 000009c0 20 20 20 80 53 20 52 36 2c 52 30 2c 23 31 3c 3c | .S R6,R0,#1<<| 000009d0 33 31 0d 04 f6 16 20 20 20 20 52 53 42 4d 49 20 |31.... RSBMI | 000009e0 52 30 2c 52 30 2c 23 30 0d 05 00 12 20 20 20 20 |R0,R0,#0.... | 000009f0 82 20 52 35 2c 52 36 2c 52 31 0d 05 0a 11 20 20 |. R5,R6,R1.... | 00000a00 20 20 43 4d 50 20 52 31 2c 23 30 0d 05 14 16 20 | CMP R1,#0.... | 00000a10 20 20 20 52 53 42 4d 49 20 52 31 2c 52 31 2c 23 | RSBMI R1,R1,#| 00000a20 30 0d 05 1e 04 0d 05 28 11 20 20 20 20 4d 4f 56 |0......(. MOV| 00000a30 20 52 32 2c 23 30 0d 05 32 11 20 20 20 20 4d 4f | R2,#0..2. MO| 00000a40 56 20 52 33 2c 23 30 0d 05 3c 15 20 20 20 20 4d |V R3,#0..<. M| 00000a50 4f 56 20 52 34 2c 23 31 3c 3c 33 31 0d 05 46 04 |OV R4,#1<<31..F.| 00000a60 0d 05 50 17 20 20 20 20 2e 64 69 76 69 73 69 6f |..P. .divisio| 00000a70 6e 5f 6c 6f 6f 70 33 0d 05 5a 18 20 20 20 20 4d |n_loop3..Z. M| 00000a80 4f 56 53 20 52 30 2c 52 30 2c 41 53 4c 23 31 0d |OVS R0,R0,ASL#1.| 00000a90 05 64 14 20 20 20 20 41 44 43 20 52 32 2c 52 32 |.d. ADC R2,R2| 00000aa0 2c 52 32 0d 05 6e 11 20 20 20 20 43 4d 50 20 52 |,R2..n. CMP R| 00000ab0 32 2c 52 31 0d 05 78 16 20 20 20 20 53 55 42 47 |2,R1..x. SUBG| 00000ac0 45 20 52 32 2c 52 32 2c 52 31 0d 05 82 15 20 20 |E R2,R2,R1.... | 00000ad0 20 20 84 52 47 45 20 52 33 2c 52 33 2c 52 34 0d | .RGE R3,R3,R4.| 00000ae0 05 8c 18 20 20 20 20 4d 4f 56 53 20 52 34 2c 52 |... MOVS R4,R| 00000af0 34 2c 4c 53 52 23 31 0d 05 96 1a 20 20 20 20 42 |4,LSR#1.... B| 00000b00 4e 45 20 64 69 76 69 73 69 6f 6e 5f 6c 6f 6f 70 |NE division_loop| 00000b10 33 0d 05 a0 04 0d 05 aa 11 20 20 20 20 43 4d 50 |3........ CMP| 00000b20 20 52 35 2c 23 30 0d 05 b4 16 20 20 20 20 52 53 | R5,#0.... RS| 00000b30 42 4d 49 20 52 33 2c 52 33 2c 23 30 0d 05 be 11 |BMI R3,R3,#0....| 00000b40 20 20 20 20 43 4d 50 20 52 36 2c 23 30 0d 05 c8 | CMP R6,#0...| 00000b50 16 20 20 20 20 52 53 42 4d 49 20 52 32 2c 52 32 |. RSBMI R2,R2| 00000b60 2c 23 30 0d 05 d2 04 0d 05 dc 16 20 20 20 20 53 |,#0........ S| 00000b70 54 52 20 52 33 2c 64 69 76 72 65 73 32 0d 05 e6 |TR R3,divres2...| 00000b80 16 20 20 20 20 53 54 52 20 52 32 2c 6d 6f 64 72 |. STR R2,modr| 00000b90 65 73 32 0d 05 f0 04 0d 05 fa 1a 20 20 20 20 4c |es2........ L| 00000ba0 44 4d 46 44 20 52 31 33 21 2c 7b 52 30 2d 52 36 |DMFD R13!,{R0-R6| 00000bb0 7d 0d 06 04 04 0d 06 0e 17 20 20 20 20 4c 44 52 |}........ LDR| 00000bc0 20 52 31 34 2c 6d 6f 64 72 65 73 32 0d 06 18 18 | R14,modres2....| 00000bd0 20 20 20 20 53 54 52 42 20 52 31 34 2c 5b 52 33 | STRB R14,[R3| 00000be0 2c 52 39 5d 0d 06 22 16 20 20 20 20 4c 44 52 20 |,R9]..". LDR | 00000bf0 52 38 2c 64 69 76 72 65 73 32 0d 06 2c 14 20 20 |R8,divres2..,. | 00000c00 20 20 53 55 42 20 52 39 2c 52 39 2c 23 31 0d 06 | SUB R9,R9,#1..| 00000c10 36 11 20 20 20 20 43 4d 4e 20 52 39 2c 52 37 0d |6. CMN R9,R7.| 00000c20 06 40 17 20 20 42 4e 45 20 66 6f 72 5f 6c 6f 6f |.@. BNE for_loo| 00000c30 70 69 66 79 33 62 0d 06 4a 15 20 20 53 54 52 42 |pify3b..J. STRB| 00000c40 20 52 34 2c 5b 52 32 2c 52 37 5d 0d 06 54 12 20 | R4,[R2,R7]..T. | 00000c50 20 41 44 44 20 52 37 2c 52 37 2c 23 31 0d 06 5e | ADD R7,R7,#1..^| 00000c60 13 20 20 53 55 42 20 52 31 34 2c 52 35 2c 52 36 |. SUB R14,R5,R6| 00000c70 0d 06 68 10 20 20 43 4d 50 20 52 37 2c 52 31 34 |..h. CMP R7,R14| 00000c80 0d 06 72 15 42 4c 54 20 66 6f 72 5f 6c 6f 6f 70 |..r.BLT for_loop| 00000c90 69 66 79 31 62 0d 06 7c 0f 4d 4f 56 20 52 31 34 |ify1b..|.MOV R14| 00000ca0 2c 23 31 30 0d 06 86 14 53 54 52 42 20 52 31 34 |,#10....STRB R14| 00000cb0 2c 5b 52 32 2c 52 37 5d 0d 06 90 04 0d 06 9a 04 |,[R2,R7]........| 00000cc0 0d 06 a4 13 4c 44 4d 46 44 20 52 31 33 21 2c 7b |....LDMFD R13!,{| 00000cd0 50 43 7d 0d 06 ae 04 0d 06 b8 04 0d 06 c2 0c 2e |PC}.............| 00000ce0 64 69 76 72 65 73 32 0d 06 cc 0a 45 51 55 44 20 |divres2....EQUD | 00000cf0 30 0d 06 d6 0c 2e 6d 6f 64 72 65 73 32 0d 06 e0 |0.....modres2...| 00000d00 0a 45 51 55 44 20 30 0d 06 ea 0b 2e 62 75 66 66 |.EQUD 0.....buff| 00000d10 65 72 0d 06 f4 0e a4 42 79 74 65 73 28 33 32 29 |er.....Bytes(32)| 00000d20 0d 06 fe 04 0d 07 08 04 0d 07 12 12 2e 67 65 74 |.............get| 00000d30 5f 61 64 64 72 65 73 73 65 73 0d 07 1c 14 53 54 |_addresses....ST| 00000d40 4d 46 44 20 52 31 33 21 2c 7b 52 31 34 7d 0d 07 |MFD R13!,{R14}..| 00000d50 26 13 41 44 52 20 52 30 2c 6f 70 65 72 61 6e 64 |&.ADR R0,operand| 00000d60 31 0d 07 30 13 41 44 52 20 52 31 2c 6f 70 65 72 |1..0.ADR R1,oper| 00000d70 61 6e 64 32 0d 07 3a 11 41 44 52 20 52 32 2c 72 |and2..:.ADR R2,r| 00000d80 65 73 75 6c 74 0d 07 44 13 4c 44 4d 46 44 20 52 |esult..D.LDMFD R| 00000d90 31 33 21 2c 7b 50 43 7d 0d 07 4e 0d 2e 6f 70 65 |13!,{PC}..N..ope| 00000da0 72 61 6e 64 31 0d 07 58 15 a4 42 79 74 65 73 28 |rand1..X..Bytes(| 00000db0 61 63 63 75 72 61 63 79 25 29 0d 07 62 0d 2e 6f |accuracy%)..b..o| 00000dc0 70 65 72 61 6e 64 32 0d 07 6c 15 a4 42 79 74 65 |perand2..l..Byte| 00000dd0 73 28 61 63 63 75 72 61 63 79 25 29 0d 07 76 0b |s(accuracy%)..v.| 00000de0 2e 72 65 73 75 6c 74 0d 07 80 17 a4 42 79 74 65 |.result.....Byte| 00000df0 73 28 32 2a 61 63 63 75 72 61 63 79 25 29 0d 07 |s(2*accuracy%)..| 00000e00 8a 04 0d 07 94 05 5d 0d 07 9e 05 ed 0d 07 a8 05 |......].........| 00000e10 3a 0d 07 b2 05 f5 0d 07 bc 0f e8 20 6f 70 65 72 |:.......... oper| 00000e20 61 6e 64 31 24 0d 07 c6 0f e8 20 6f 70 65 72 61 |and1$..... opera| 00000e30 6e 64 32 24 0d 07 d0 04 0d 07 da 10 6f 70 65 72 |nd2$........oper| 00000e40 61 6e 64 31 3f 30 3d 30 0d 07 e4 10 6f 70 65 72 |and1?0=0....oper| 00000e50 61 6e 64 32 3f 30 3d 30 0d 07 ee 18 e3 20 41 3d |and2?0=0..... A=| 00000e60 31 20 b8 20 a9 28 6f 70 65 72 61 6e 64 31 24 29 |1 . .(operand1$)| 00000e70 0d 07 f8 23 6f 70 65 72 61 6e 64 31 3f 28 41 29 |...#operand1?(A)| 00000e80 3d bb 28 c1 6f 70 65 72 61 6e 64 31 24 2c 41 2c |=.(.operand1$,A,| 00000e90 31 29 29 0d 08 02 05 ed 0d 08 0c 13 6f 70 65 72 |1)).........oper| 00000ea0 61 6e 64 31 3f 28 41 29 3d 31 30 0d 08 16 18 e3 |and1?(A)=10.....| 00000eb0 20 41 3d 31 20 b8 20 a9 28 6f 70 65 72 61 6e 64 | A=1 . .(operand| 00000ec0 32 24 29 0d 08 20 23 6f 70 65 72 61 6e 64 32 3f |2$).. #operand2?| 00000ed0 28 41 29 3d bb 28 c1 6f 70 65 72 61 6e 64 32 24 |(A)=.(.operand2$| 00000ee0 2c 41 2c 31 29 29 0d 08 2a 05 ed 0d 08 34 13 6f |,A,1))..*....4.o| 00000ef0 70 65 72 61 6e 64 32 3f 28 41 29 3d 31 30 0d 08 |perand2?(A)=10..| 00000f00 3e 14 d6 20 62 65 67 69 6e 5f 64 69 76 69 73 69 |>.. begin_divisi| 00000f10 6f 6e 0d 08 48 07 41 3d 30 0d 08 52 05 f5 0d 08 |on..H.A=0..R....| 00000f20 5c 14 f1 20 c3 28 28 72 65 73 75 6c 74 3f 41 29 |\.. .((result?A)| 00000f30 29 3b 0d 08 66 08 41 2b 3d 31 0d 08 70 15 fd 20 |);..f.A+=1..p.. | 00000f40 72 65 73 75 6c 74 3f 28 41 2b 31 29 3d 31 30 0d |result?(A+1)=10.| 00000f50 08 7a 05 f1 0d 08 84 04 0d 08 8e 0a fd 20 9f 3d |.z........... .=| 00000f60 31 37 0d 08 98 05 e0 0d 08 a2 05 3a 0d 08 ac 11 |17.........:....| 00000f70 dd a4 42 79 74 65 73 28 69 6e 63 25 29 0d 08 b6 |..Bytes(inc%)...| 00000f80 0c 50 25 2b 3d 69 6e 63 25 0d 08 c0 06 3d 30 0d |.P%+=inc%....=0.| 00000f90 ff |.| 00000f91