Home » CEEFAX disks » telesoftware2.adl » OS\BITS/B\OSB23
OS\BITS/B\OSB23
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 » CEEFAX disks » telesoftware2.adl |
Filename: | OS\BITS/B\OSB23 |
Read OK: | ✔ |
File size: | 30EC bytes |
Load address: | 1900 |
Exec address: | 8023 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- CEEFAX disks » telesoftware2.adl » OS\BITS/B\OSB23
- CEEFAX disks » telesoftware6.adl » 22-04-88/B\OSB23
File contents
10REM Osbits Module B/osb23 20REM Floating Point Arithmetic - Multiplication and Division 30REM Version 2.0 30.5.87 40 50*KEY1MO.3|M|NL.|M 60 70DIM code% &350 80zp=&80 :REM Temporary workspace of 4 bytes, preserved 90 100FOR pass%=0 TO 2 STEP 2 110P%=code% 120 130[OPT pass% 140 150\ Transfer the two numbers from the CALL block to input_1 and 2 160 170JSR enter_parameters 180 190\ Transfer numbers from input_1 and 2 into 200\ workspace for multiplication 210 220JSR transfer_in 230 240JSR fp_mult \ Multiplication subroutine 250 260\ Transfer result into 'result_mult' 270 280LDX #5 290 300.transfer_out_loop 310 320LDA fpws_1-1, X 330STA result_mult-1, X 340DEX 350BNE transfer_out_loop 360 370\ Transfer numbers from input_1 and 2 into 380\ workspace for division 390 400JSR transfer_in 410 420JSR fp_div \ Division subroutine 430 440\ Transfer result into 'result_div' 450 460LDX #5 470 480.transfer_out_loop2 490 500LDA fpws_1-1, X 510STA result_div-1, X 520DEX 530BNE transfer_out_loop2 540 550RTS 560 570\ Reservation of workspace. Note bytes for sign of fp numbers 580\ and for overflow (oflow) during calculations. 590\ Also the fpws for each number is 7 bytes, not 5. 600\ Note also that some workspace has a different name in 610\ different parts of the program. This aids conversion from 620\ the integer routines. 630 640.input_1 OPT FNEQUM(5,0) 650.input_2 OPT FNEQUM(5,0) 660.fpws_1_sign OPT FNEQUB(0) 670.multiplicand 680.dividend 690.fpws_1 OPT FNEQUM(7,0) 700.fpws_2_sign OPT FNEQUB(0) 710.multiplier 720.divisor 730.fpws_2 OPT FNEQUM(7,0) 740.ppws 750.pdws OPT FNEQUM(6,0) 760.diff_ws OPT FNEQUM(6,0) 770.result_mult OPT FNEQUM(5,0) 780.result_div OPT FNEQUM(5,0) 790 800.enter_parameters 810 820\ This subroutine takes the two fp numbers from a CALL parameter 830\ block at &600 and puts them in input_1 and input_2 840 850LDA zp \ Preserve zero page workspace on stack 860PHA 870LDA zp+1 880PHA 890LDA zp+2 900PHA 910LDA zp+3 920PHA 930 940LDA &601 \ Move addresses from &600 block to zpws 950STA zp 960LDA &602 970STA zp+1 980LDA &604 990STA zp+2 1000LDA &605 1010STA zp+3 1020 1030LDY #0 1040 1050.enter_paras_loop 1060 1070LDA (zp), Y \ First number 1080STA input_1, Y 1090LDA (zp+2), Y \ Second number 1100STA input_2, Y 1110 1120INY 1130CPY #5 1140BNE enter_paras_loop 1150 1160PLA \ Restore zpws from stack 1170STA zp+3 1180PLA 1190STA zp+2 1200PLA 1210STA zp+1 1220PLA 1230STA zp 1240RTS 1250 1260.transfer_in 1270 1280\ This subroutine takes the numbers in input_1 and 1290\ input_2 and puts them in fpws_1 and fpws_2 1300 1310LDX #5 1320 1330.transfer_in_loop 1340 1350LDA input_1-1, X 1360STA fpws_1-1, X 1370LDA input_2-1, X 1380STA fpws_2-1, X 1390DEX 1400BNE transfer_in_loop 1410 1420RTS 1430 1440.fp_mult 1450 1460\ Multiplies the numbers in fpws_1 by the number 1470\ in fpws_1 and puts the result in fpws_1 1480 1490\ First allow for zeros in the workspace 1500 1510LDA fpws_1+1 1520ORA fpws_1 \ Zero if exponent & top mantissa byte zero 1530BEQ make_zero \ If 1st no is zero then result = 0 1540 1550LDA fpws_2+1 1560ORA fpws_2 \ Zero if exponent & top mantissa byte zero 1570BEQ make_zero \ If 2nd no is zero then result = 0 1580 1590\ If result is not zero 1600 1610JSR move_sign_bit \ Move sign and restore top bit 1620 1630JSR mult_denormalise 1640 1650JSR mult_mantissae 1660 1670JSR renormalise_muldiv 1680 1690JSR replace_sign_bit 1700 1710RTS 1720 1730.fp_div 1740 1750\ Divides the number in fpws_1 by the one in fpws_2 1760\ and puts the result in fpws_1 1770 1780\ First allow for zeros in the workspace 1790 1800LDA fpws_2+1 1810ORA fpws_2 \ Zero if exponent & top mantissa byte zero 1820BEQ div_by_zero \ If 2nd no is 0 we have an error 1830 1840LDA fpws_1+1 1850ORA fpws_1 \ Zero if exponent & top mantissa byte zero 1860BEQ make_zero \ If 1st no is zero then result = 0 1870 1880JSR move_sign_bit \ Move sign and restore top bit 1890 1900JSR div_denormalise 1910 1920JSR div_mantissae 1930 1940JSR renormalise_muldiv 1950 1960JSR replace_sign_bit 1970 1980RTS 1990 2000.make_zero 2010 2020\ This routine makes fpws_1 zero 2030 2040LDA #0 2050LDX #5 2060 2070.make_zero_loop 2080 2090STA fpws_1-1, X 2100DEX 2110BNE make_zero_loop 2120 2130RTS 2140 2150.div_by_zero 2160 2170\ This is an error condition, number 18 2180 2190BRK 2200OPT FNEQUB(18) 2210OPT FNEQUS("Attempt to divide by zero") 2220OPT FNEQUB(0) 2230 2240.move_sign_bit 2250 2260\ This routine transfers the sign bit from the top of the mantissae 2270\ and puts it into a sign byte - ANDing to leave top bit only 2280\ and then restores the top bit of the mantissae 2290 2300LDA fpws_1+1 2310AND #&80 2320STA fpws_1_sign \ fpws_1_sign is -ve if number was -ve 2330LDA #&80 2340ORA fpws_1+1 2350STA fpws_1+1 \ Restores the top bit of the number 2360 2370LDA fpws_2+1 2380AND #&80 2390STA fpws_2_sign \ fpws_2_sign is -ve if number was -ve 2400LDA #&80 2410ORA fpws_2+1 2420STA fpws_2+1 \ Restores the top bit of the number 2430 2440RTS 2450 2460.mult_denormalise 2470 2480\ First, both numbers must be shifted down by 2 bytes 2490\ and exponents both increased by 16. This ensures that 2500\ the final number does not overflow. 2510 2520LDX #16 2530 2540.mult_denormalise_rotate_loop 2550 2560LSR fpws_1+1 \ Rotate mantissa right 2570ROR fpws_1+2 2580ROR fpws_1+3 2590ROR fpws_1+4 2600 2610LSR fpws_2+1 2620ROR fpws_2+2 2630ROR fpws_2+3 2640ROR fpws_2+4 2650 2660DEX 2670BNE mult_denormalise_rotate_loop 2680 2690\ Calculate exponent of result 2700 2710SEC 2720LDA fpws_1 2730SBC #&80 \ Subtract &80 factor from exponent 2740STA fpws_1 2750 2760SEC 2770LDA fpws_2 2780SBC #&80 \ This is part of BBC BASIC format 2790CLC 2800ADC fpws_1 2810BVS mult_oflow \ Overflow flag set if result sign wrong 2820CLC 2830ADC #&80 \ Convert back to BBC BASIC format 2840STA fpws_1 2850 2860RTS 2870 2880.mult_oflow 2890 2900BPL very_small 2910BRK \ An error condition, number 20 2920OPT FNEQUB(20) 2930OPT FNEQUS("Number overflow during multiplication") 2940OPT FNEQUB(0) 2950 2960.very_small 2970 2980JMP make_zero \ Answer is so small it is zero (ish) 2990 3000.div_denormalise 3010 3020\ Shift the divisor right by 2 bytes to aid division 3030 3040LDX #16 3050 3060.div_den_loop 3070 3080LSR divisor+1 3090ROR divisor+2 3100ROR divisor+3 3110ROR divisor+4 3120ROR divisor+5 3130ROR divisor+6 3140 3150DEX 3160BNE div_den_loop 3170 3180\ Calculate initial exponent of result 3190 3200SEC 3210LDA fpws_2 3220SBC #&80 \ Subtract &80 factor from exponent 3230STA fpws_2 3240 3250SEC 3260LDA fpws_1 3270SBC #&80 \ This is part of BBC BASIC format 3280SEC 3290SBC fpws_2 3300BVS div_oflow \ Overflow flag set if result sign wrong 3310CLC 3320ADC #&80 \ Convert back to BBC BASIC format 3330CLC 3340ADC #&20 \ Add 32 to compensate for denormalising 3350STA fpws_1 3360 3370RTS 3380 3390.div_oflow 3400 3410BMI too_big_div 3420JMP make_zero 3430 3440.too_big_div 3450 3460BRK 3470OPT FNEQUB(20) \ A BASIC error condition, number 20 3480OPT FNEQUS("Number overflow during division") 3490OPT FNEQUB(0) 3500 3510.mult_mantissae 3520 3530\ Assumes that numbers to be multiplied are put into 3540\ multiplicand and multiplier. ppws is used for 3550\ partial product. Result is put into multiplier 3560 3570LDA #0 3580STA ppws \ Clear partial product workspace 3590STA ppws+1 3600STA ppws+2 3610STA ppws+3 3620 3630LDX #32 \ Carry out 32 times for 32 bit arithmetic 3640 3650LSR multiplier+1 \ Rotate multiplier right 3660ROR multiplier+2 3670ROR multiplier+3 3680ROR multiplier+4 3690 3700.mbm_loop 3710 3720BCC no_add_mbm \ Is next bit of multiplier set? 3730CLC 3740LDA multiplicand+4 \ Add multiplicand 3750ADC ppws+3 3760STA ppws+3 3770LDA multiplicand+3 3780ADC ppws+2 3790STA ppws+2 3800LDA multiplicand+2 3810ADC ppws+1 3820STA ppws+1 3830LDA multiplicand+1 3840ADC ppws 3850STA ppws 3860 3870.no_add_mbm 3880 3890LSR ppws \ Rotate ppws & multiplier right 3900ROR ppws+1 3910ROR ppws+2 3920ROR ppws+3 3930ROR multiplier+1 3940ROR multiplier+2 3950ROR multiplier+3 3960ROR multiplier+4 3970DEX \ Counting down from 32 to zero 3980BNE mbm_loop 3990 4000\ Put result in multiplicand (fpws_1) 4010 4020LDX #4 4030 4040.swap_mm_loop 4050 4060LDA multiplier, X 4070STA multiplicand, X 4080DEX 4090BNE swap_mm_loop 4100 4110RTS 4120 4130.div_mantissae 4140 4150\ Dividend is in dividend, divisor is in divisor 4160\ On exit result is in dividend 4170\ pdws holds partial dividend 4180\ diff_ws is temp ws to hold pdiv-div for testing 4190 4200LDA #0 \ Set partial dividend ws to zero 4210STA pdws 4220STA pdws+1 4230STA pdws+2 4240STA pdws+3 4250STA pdws+4 4260STA pdws+5 4270 4280LDX #48 \ 48 bit dividend 4290 4300.mbd_loop 4310 4320ASL dividend+6 \ Rotate dividend left into partial dividend 4330ROL dividend+5 4340ROL dividend+4 4350ROL dividend+3 4360ROL dividend+2 4370ROL dividend+1 4380ROL pdws+5 4390ROL pdws+4 4400ROL pdws+3 4410ROL pdws+2 4420ROL pdws+1 4430ROL pdws 4440 4450SEC 4460LDA pdws+5 \ Subtract divisor from partial dividend 4470SBC divisor+6 4480STA diff_ws+5 4490LDA pdws+4 4500SBC divisor+5 4510STA diff_ws+4 4520LDA pdws+3 4530SBC divisor+4 4540STA diff_ws+3 4550LDA pdws+2 4560SBC divisor+3 4570STA diff_ws+2 4580LDA pdws+1 4590SBC divisor+2 4600STA diff_ws+1 4610LDA pdws 4620SBC divisor+1 4630STA diff_ws 4640 4650BCC no_subtract_mbd \ Carry set if diff_ws > divisor 4660 4670INC dividend+6 \ Increase result if we can subtract 4680LDY #6 4690 4700.diff_w_to_pdws_loop 4710 4720LDA diff_ws-1, Y 4730STA pdws-1, Y 4740 4750DEY 4760BNE diff_w_to_pdws_loop 4770 4780.no_subtract_mbd 4790 4800DEX \ Next bit 4810BNE mbd_loop 4820 4830RTS 4840 4850.renormalise_muldiv 4860 4870\ This routine modifies the mantissa and exponent of the result 4880\ To produce a normalised format number. 4890 4900\ First trap a zero result, or loops will run indefinately 4910 4920LDA fpws_1+1 4930ORA fpws_1+2 4940ORA fpws_1+3 4950ORA fpws_1+4 4960ORA fpws_1+5 4970ORA fpws_1+6 4980 4990BEQ zero_norm 5000 5010LDA fpws_1+1 \ Top byte of mantissa is shifted left 5020BMI normalised \ until top bit is set (i.e. -ve) 5030 5040.shift_left_loop 5050 5060DEC fpws_1 \ Decrease the exponent 5070ASL fpws_1+6 \ Shift mantissa left to compensate 5080ROL fpws_1+5 5090ROL fpws_1+4 5100ROL fpws_1+3 5110ROL fpws_1+2 5120ROL fpws_1+1 5130 5140BPL shift_left_loop 5150 5160.normalised 5170 5180RTS \ Number renormalised 5190 5200.zero_norm 5210 5220LDA #0 5230STA fpws_1 \ Clear exponent of a zero number 5240 5250RTS 5260 5270.replace_sign_bit 5280 5290LDA fpws_1_sign 5300EOR fpws_2_sign \ EOR signs together to produce result sign 5310AND #&80 \ We're only interested in the top bit 5320CLC 5330ADC #&7F \ &FF if top bit set - &7F if not 5340AND fpws_1+1 \ Top bit reflects sign 5350STA fpws_1+1 \ Replace in workspace 5360 5370RTS 5380 5390] 5400NEXT 5410 5420REPEAT 5430 5440PRINT '"Floating Point Multiplication and Division"' 5450INPUT "Enter the first number "fp1 5460INPUT "Enter the second number "fp2 5470PRINT 5480 5490CALL code%,fp1,fp2 5500 5510PRINT"Results:"' 5520PRINT "Product (code) is ";FNfp(result_mult) 5530PRINT "Product (BASIC) is ";fp1*fp2 5540 5550PRINT "Quotient (code) is ";FNfp(result_div) 5560PRINT "Quotient (BASIC) is ";fp1/fp2 5570 5580UNTIL FALSE 5590 5600END 5610 5620**** EQUate a Byte **** 5630DEF FNEQUB(N%) 5640?P%=N% MOD 256 5650IF (pass% AND 3) = 3 THEN PRINT ~?P% 5660P%=P%+1 5670=pass% 5680 5690**** EQUate a String **** 5700DEF FNEQUS(N$) 5710LOCAL N% 5720WIDTH 40 5730FOR N%=1 TO LEN(N$) 5740K%=ASC(MID$(N$,N%,1)) 5750P%?(N%-1)=K% 5760IF (pass% AND 3) = 3 THEN PRINT ~P%?(N%-1); 5770NEXT 5780IF (pass% AND 3) = 3 THEN PRINT 5790P%=P%+LEN(N$) 5800WIDTH 0 5810=pass% 5820 5830**** EQUate a section of Memory **** 5840DEF FNEQUM(number%,byte%) 5850LOCAL N% 5860WIDTH 40 5870FOR N%=0 TO number%-1 5880P%?N%=byte% 5890IF (pass% AND 3) = 3 THEN PRINT ~P%?N%; 5900NEXT 5910IF (pass% AND 3) = 3 THEN PRINT 5920P%=P%+number% 5930WIDTH 0 5940=pass% 5950 5960**** Reverse FP **** 5970Puts fp number from memory 5980into variable ` 5990DEF FNfp(mem%) 6000LOCAL M%, N% 6010`=0 6020M% = 3+(!&4C0 AND &FFFF) 6030FOR N%=0 TO 4 6040M%?N%=mem%?N% 6050NEXT 6060=`
� Osbits Module B/osb23 >� Floating Point Arithmetic - Multiplication and Division � Version 2.0 30.5.87 ( 2*KEY1MO.3|M|NL.|M < F� code% &350 P@zp=&80 :� Temporary workspace of 4 bytes, preserved Z d� pass%=0 � 2 � 2 nP%=code% x �[OPT pass% � �A\ Transfer the two numbers from the � block to input_1 and 2 � �JSR enter_parameters � �/\ Transfer numbers from input_1 and 2 into �#\ workspace for multiplication � �JSR transfer_in � �<JSR fp_mult \ Multiplication subroutine � )\ Transfer result into 'result_mult' LDX #5 " ,.transfer_out_loop 6 @LDA fpws_1-1, X JSTA result_mult-1, X TDEX ^BNE transfer_out_loop h r/\ Transfer numbers from input_1 and 2 into |\ workspace for division � �JSR transfer_in � �6JSR fp_div \ Division subroutine � �(\ Transfer result into 'result_div' � � LDX #5 � �.transfer_out_loop2 � �LDA fpws_1-1, X �STA result_div-1, X DEX BNE transfer_out_loop2 &RTS 0 :C\ Reservation of workspace. Note bytes for sign of fp numbers D4\ and for overflow (oflow) during calculations. N7\ Also the fpws for each number is 7 bytes, not 5. X<\ Note also that some workspace has a different name in bA\ different parts of the program. This aids conversion from l\ the integer routines. v � .input_1 OPT �EQUM(5,0) � .input_2 OPT �EQUM(5,0) �.fpws_1_sign OPT �EQUB(0) �.multiplicand � .dividend � .fpws_1 OPT �EQUM(7,0) �.fpws_2_sign OPT �EQUB(0) �.multiplier �.divisor � .fpws_2 OPT �EQUM(7,0) � .ppws � .pdws OPT �EQUM(6,0) � .diff_ws OPT �EQUM(6,0) .result_mult OPT �EQUM(5,0) .result_div OPT �EQUM(5,0) .enter_parameters * 4B\ This subroutine takes the two fp numbers from a � parameter >9\ block at &600 and puts them in input_1 and input_2 H RGLDA zp \ Preserve zero page workspace on stack \PHA fLDA zp+1 pPHA zLDA zp+2 �PHA �LDA zp+3 �PHA � �HLDA &601 \ Move addresses from &600 block to zpws � STA zp �LDA &602 �STA zp+1 �LDA &604 �STA zp+2 �LDA &605 �STA zp+3 � LDY #0 .enter_paras_loop $ ..LDA (zp), Y \ First number 8STA input_1, Y B/LDA (zp+2), Y \ Second number LSTA input_2, Y V `INY j CPY #5 tBNE enter_paras_loop ~ �9PLA \ Restore zpws from stack �STA zp+3 �PLA �STA zp+2 �PLA �STA zp+1 �PLA � STA zp �RTS � �.transfer_in � 7\ This subroutine takes the numbers in input_1 and 1\ input_2 and puts them in fpws_1 and fpws_2 LDX #5 ( 2.transfer_in_loop < FLDA input_1-1, X PSTA fpws_1-1, X ZLDA input_2-1, X dSTA fpws_2-1, X nDEX xBNE transfer_in_loop � �RTS � �.fp_mult � �5\ Multiplies the numbers in fpws_1 by the number �.\ in fpws_1 and puts the result in fpws_1 � �-\ First allow for zeros in the workspace � �LDA fpws_1+1 �J�A fpws_1 \ Zero if exponent & top mantissa byte zero �CBEQ make_zero \ If 1st no is zero then result = 0 LDA fpws_2+1 J�A fpws_2 \ Zero if exponent & top mantissa byte zero "CBEQ make_zero \ If 2nd no is zero then result = 0 , 6\ If result is not zero @ J?JSR move_sign_bit \ Move sign and restore top bit T ^JSR mult_denormalise h rJSR mult_mantissae | �JSR renormalise_muldiv � �JSR replace_sign_bit � �RTS � �.fp_div � �8\ Divides the number in fpws_1 by the one in fpws_2 �$\ and puts the result in fpws_1 � �-\ First allow for zeros in the workspace � LDA fpws_2+1 J�A fpws_2 \ Zero if exponent & top mantissa byte zero ABEQ div_by_zero \ If 2nd no is 0 we have an error & 0LDA fpws_1+1 :J�A fpws_1 \ Zero if exponent & top mantissa byte zero DCBEQ make_zero \ If 1st no is zero then result = 0 N X?JSR move_sign_bit \ Move sign and restore top bit b lJSR div_denormalise v �JSR div_mantissae � �JSR renormalise_muldiv � �JSR replace_sign_bit � �RTS � �.make_zero � �%\ This routine makes fpws_1 zero � � LDA #0 LDX #5 .make_zero_loop *STA fpws_1-1, X 4DEX >BNE make_zero_loop H RRTS \ f.div_by_zero p z,\ This is an error condition, number 18 � �BRK �OPT �EQUB(18) �*OPT �EQUS("Attempt to divide by zero") �OPT �EQUB(0) � �.move_sign_bit � �H\ This routine transfers the sign bit from the top of the mantissae �@\ and puts it into a sign byte - �ing to leave top bit only �5\ and then restores the top bit of the mantissae � �LDA fpws_1+1 � #&80 FSTA fpws_1_sign \ fpws_1_sign is -ve if number was -ve LDA #&80 $�A fpws_1+1 .DSTA fpws_1+1 \ Restores the top bit of the number 8 BLDA fpws_2+1 L � #&80 VFSTA fpws_2_sign \ fpws_2_sign is -ve if number was -ve `LDA #&80 j�A fpws_2+1 tDSTA fpws_2+1 \ Restores the top bit of the number ~ �RTS � �.mult_denormalise � �:\ First, both numbers must be shifted down by 2 bytes �=\ and exponents both increased by 16. This ensures that �*\ the final number does not overflow. � �LDX #16 � �!.mult_denormalise_rotate_loop � 7LSR fpws_1+1 \ Rotate mantissa right ROR fpws_1+2 ROR fpws_1+3 ROR fpws_1+4 ( 2LSR fpws_2+1 <ROR fpws_2+2 FROR fpws_2+3 PROR fpws_2+4 Z dDEX n$BNE mult_denormalise_rotate_loop x �"\ Calculate exponent of result � �SEC �LDA fpws_1 �CSBC #&80 \ Subtract &80 factor from exponent �STA fpws_1 � �SEC �LDA fpws_2 �BSBC #&80 \ This is part of BBC BASIC format �CLC �ADC fpws_1 �HBVS mult_oflow \ Overflow flag set if result sign wrong CLC BADC #&80 \ Convert back to BBC BASIC format STA fpws_1 " ,RTS 6 @.mult_oflow J TBPL very_small ^?BRK \ An error condition, number 20 hOPT �EQUB(20) r7OPT �EQUS("Number overflow during multiplication") |OPT �EQUB(0) � �.very_small � �EJMP make_zero \ Answer is so small it is zero (ish) � �.div_denormalise � �9\ Shift the divisor right by 2 bytes to aid division � �LDX #16 � �.div_den_loop � LSR divisor+1 ROR divisor+2 ROR divisor+3 &ROR divisor+4 0ROR divisor+5 :ROR divisor+6 D NDEX XBNE div_den_loop b l+\ Calculate initial exponent of result v �SEC �LDA fpws_2 �CSBC #&80 \ Subtract &80 factor from exponent �STA fpws_2 � �SEC �LDA fpws_1 �BSBC #&80 \ This is part of BBC BASIC format �SEC �SBC fpws_2 �HBVS div_oflow \ Overflow flag set if result sign wrong �CLC �BADC #&80 \ Convert back to BBC BASIC format CLC HADC #&20 \ Add 32 to compensate for denormalising STA fpws_1 *RTS 4 >.div_oflow H RBMI too_big_div \JMP make_zero f p.too_big_div z �BRK �COPT �EQUB(20) \ A BASIC error condition, number 20 �1OPT �EQUS("Number overflow during division") �OPT �EQUB(0) � �.mult_mantissae � �9\ Assumes that numbers to be multiplied are put into �5\ multiplicand and multiplier. ppws is used for �5\ partial product. Result is put into multiplier � � LDA #0 �;STA ppws \ Clear partial product workspace STA ppws+1 STA ppws+2 STA ppws+3 $ .DLDX #32 \ Carry out 32 times for 32 bit arithmetic 8 B3LSR multiplier+1 \ Rotate multiplier right LROR multiplier+2 VROR multiplier+3 `ROR multiplier+4 j t .mbm_loop ~ �:BCC no_add_mbm \ Is next bit of multiplier set? �CLC �,LDA multiplicand+4 \ Add multiplicand �ADC ppws+3 �STA ppws+3 �LDA multiplicand+3 �ADC ppws+2 �STA ppws+2 �LDA multiplicand+2 �ADC ppws+1 �STA ppws+1 �LDA multiplicand+1 ADC ppws STA ppws .no_add_mbm ( 2:LSR ppws \ Rotate ppws & multiplier right <ROR ppws+1 FROR ppws+2 PROR ppws+3 ZROR multiplier+1 dROR multiplier+2 nROR multiplier+3 xROR multiplier+4 �9DEX \ Counting down from 32 to zero �BNE mbm_loop � �*\ Put result in multiplicand (fpws_1) � � LDX #4 � �.swap_mm_loop � �LDA multiplier, X �STA multiplicand, X �DEX �BNE swap_mm_loop RTS ".div_mantissae , 65\ Dividend is in dividend, divisor is in divisor @$\ On exit result is in dividend J"\ pdws holds partial dividend T6\ diff_ws is temp ws to hold pdiv-div for testing ^ h@LDA #0 \ Set partial dividend ws to zero rSTA pdws |STA pdws+1 �STA pdws+2 �STA pdws+3 �STA pdws+4 �STA pdws+5 � �0LDX #48 \ 48 bit dividend � � .mbd_loop � �KASL dividend+6 \ Rotate dividend left into partial dividend �ROL dividend+5 �ROL dividend+4 �ROL dividend+3 ROL dividend+2 ROL dividend+1 ROL pdws+5 &ROL pdws+4 0ROL pdws+3 :ROL pdws+2 DROL pdws+1 NROL pdws X bSEC lGLDA pdws+5 \ Subtract divisor from partial dividend vSBC divisor+6 �STA diff_ws+5 �LDA pdws+4 �SBC divisor+5 �STA diff_ws+4 �LDA pdws+3 �SBC divisor+4 �STA diff_ws+3 �LDA pdws+2 �SBC divisor+3 �STA diff_ws+2 �LDA pdws+1 �SBC divisor+2 �STA diff_ws+1 LDA pdws SBC divisor+1 STA diff_ws *?BCC no_subtract_mbd \ Carry set if diff_ws > divisor 4 >CINC dividend+6 \ Increase result if we can subtract H LDY #6 R \.diff_w_to_pdws_loop f pLDA diff_ws-1, Y zSTA pdws-1, Y � �DEY �BNE diff_w_to_pdws_loop � �.no_subtract_mbd � �)DEX \ Next bit �BNE mbd_loop � �RTS � �.renormalise_muldiv � C\ This routine modifies the mantissa and exponent of the result ,\ To produce a normalised format number. $?\ First trap a zero result, or loops will run indefinately . 8LDA fpws_1+1 B�A fpws_1+2 L�A fpws_1+3 V�A fpws_1+4 `�A fpws_1+5 j�A fpws_1+6 t ~BEQ zero_norm � �FLDA fpws_1+1 \ Top byte of mantissa is shifted left �ABMI normalised \ until top bit is set (i.e. -ve) � �.shift_left_loop � �7DEC fpws_1 \ Decrease the exponent �CASL fpws_1+6 \ Shift mantissa left to compensate �ROL fpws_1+5 �ROL fpws_1+4 �ROL fpws_1+3 �ROL fpws_1+2 ROL fpws_1+1 BPL shift_left_loop (.normalised 2 <5RTS \ Number renormalised F P.zero_norm Z d LDA #0 nASTA fpws_1 \ Clear exponent of a zero number x �RTS � �.replace_sign_bit � �LDA fpws_1_sign �G� fpws_2_sign \ � signs together to produce result sign �D� #&80 \ We're only interested in the top bit �CLC �AADC #&7F \ &FF if top bit set - &7F if not �5� fpws_1+1 \ Top bit reflects sign �6STA fpws_1+1 \ Replace in workspace � �RTS ] � " ,� 6 @4� '"Floating Point Multiplication and Division"' J"� "Enter the first number "fp1 T#� "Enter the second number "fp2 ^� h r� code%,fp1,fp2 | ��"Results:"' �,� "Product (code) is ";�fp(result_mult) �#� "Product (BASIC) is ";fp1*fp2 � �,� "Quotient (code) is ";�fp(result_div) �$� "Quotient (BASIC) is ";fp1/fp2 � �� � � �� � �**** EQUate a Byte **** �� �EQUB(N%) ?P%=N% � 256 � (pass% � 3) = 3 � � ~?P% P%=P%+1 & =pass% 0 :**** EQUate a String **** D� �EQUS(N$) N� N% X� 40 b� N%=1 � �(N$) lK%=�(�N$,N%,1)) vP%?(N%-1)=K% �%� (pass% � 3) = 3 � � ~P%?(N%-1); �� �� (pass% � 3) = 3 � � �P%=P%+�(N$) �� 0 � =pass% � �(**** EQUate a section of Memory **** �� �EQUM(number%,byte%) �� N% �� 40 �� N%=0 � number%-1 �P%?N%=byte% !� (pass% � 3) = 3 � � ~P%?N%; � � (pass% � 3) = 3 � � P%=P%+number% *� 0 4 =pass% > H**** Reverse FP **** RPuts fp number from memory \into variable ` f� �fp(mem%) p� M%, N% z`=0 �M% = 3+(!&4C0 � &FFFF) �� N%=0 � 4 �M%?N%=mem%?N% �� �=` �
00000000 0d 00 0a 1c f4 20 20 4f 73 62 69 74 73 20 4d 6f |..... Osbits Mo| 00000010 64 75 6c 65 20 42 2f 6f 73 62 32 33 0d 00 14 3e |dule B/osb23...>| 00000020 f4 20 20 46 6c 6f 61 74 69 6e 67 20 50 6f 69 6e |. Floating Poin| 00000030 74 20 41 72 69 74 68 6d 65 74 69 63 20 2d 20 4d |t Arithmetic - M| 00000040 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 61 6e |ultiplication an| 00000050 64 20 44 69 76 69 73 69 6f 6e 0d 00 1e 1a f4 20 |d Division..... | 00000060 20 56 65 72 73 69 6f 6e 20 32 2e 30 20 33 30 2e | Version 2.0 30.| 00000070 35 2e 38 37 0d 00 28 05 20 0d 00 32 15 2a 4b 45 |5.87..(. ..2.*KE| 00000080 59 31 4d 4f 2e 33 7c 4d 7c 4e 4c 2e 7c 4d 0d 00 |Y1MO.3|M|NL.|M..| 00000090 3c 05 20 0d 00 46 10 de 20 63 6f 64 65 25 20 26 |<. ..F.. code% &| 000000a0 33 35 30 0d 00 50 40 7a 70 3d 26 38 30 20 20 20 |350..P@zp=&80 | 000000b0 20 20 20 20 20 20 20 3a f4 20 54 65 6d 70 6f 72 | :. Tempor| 000000c0 61 72 79 20 77 6f 72 6b 73 70 61 63 65 20 6f 66 |ary workspace of| 000000d0 20 34 20 62 79 74 65 73 2c 20 70 72 65 73 65 72 | 4 bytes, preser| 000000e0 76 65 64 0d 00 5a 05 20 0d 00 64 15 e3 20 70 61 |ved..Z. ..d.. pa| 000000f0 73 73 25 3d 30 20 b8 20 32 20 88 20 32 0d 00 6e |ss%=0 . 2 . 2..n| 00000100 0c 50 25 3d 63 6f 64 65 25 0d 00 78 05 20 0d 00 |.P%=code%..x. ..| 00000110 82 0e 5b 4f 50 54 20 70 61 73 73 25 0d 00 8c 05 |..[OPT pass%....| 00000120 20 0d 00 96 41 5c 20 20 54 72 61 6e 73 66 65 72 | ...A\ Transfer| 00000130 20 74 68 65 20 74 77 6f 20 6e 75 6d 62 65 72 73 | the two numbers| 00000140 20 66 72 6f 6d 20 74 68 65 20 d6 20 62 6c 6f 63 | from the . bloc| 00000150 6b 20 74 6f 20 69 6e 70 75 74 5f 31 20 61 6e 64 |k to input_1 and| 00000160 20 32 0d 00 a0 05 20 0d 00 aa 18 4a 53 52 20 65 | 2.... ....JSR e| 00000170 6e 74 65 72 5f 70 61 72 61 6d 65 74 65 72 73 0d |nter_parameters.| 00000180 00 b4 05 20 0d 00 be 2f 5c 20 20 54 72 61 6e 73 |... .../\ Trans| 00000190 66 65 72 20 6e 75 6d 62 65 72 73 20 66 72 6f 6d |fer numbers from| 000001a0 20 69 6e 70 75 74 5f 31 20 61 6e 64 20 32 20 69 | input_1 and 2 i| 000001b0 6e 74 6f 0d 00 c8 23 5c 20 20 77 6f 72 6b 73 70 |nto...#\ worksp| 000001c0 61 63 65 20 66 6f 72 20 6d 75 6c 74 69 70 6c 69 |ace for multipli| 000001d0 63 61 74 69 6f 6e 0d 00 d2 05 20 0d 00 dc 13 4a |cation.... ....J| 000001e0 53 52 20 74 72 61 6e 73 66 65 72 5f 69 6e 0d 00 |SR transfer_in..| 000001f0 e6 05 20 0d 00 f0 3c 4a 53 52 20 66 70 5f 6d 75 |.. ...<JSR fp_mu| 00000200 6c 74 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |lt | 00000210 20 20 20 20 5c 20 4d 75 6c 74 69 70 6c 69 63 61 | \ Multiplica| 00000220 74 69 6f 6e 20 73 75 62 72 6f 75 74 69 6e 65 0d |tion subroutine.| 00000230 00 fa 05 20 0d 01 04 29 5c 20 20 54 72 61 6e 73 |... ...)\ Trans| 00000240 66 65 72 20 72 65 73 75 6c 74 20 69 6e 74 6f 20 |fer result into | 00000250 27 72 65 73 75 6c 74 5f 6d 75 6c 74 27 0d 01 0e |'result_mult'...| 00000260 05 20 0d 01 18 0a 4c 44 58 20 23 35 0d 01 22 05 |. ....LDX #5..".| 00000270 20 0d 01 2c 16 2e 74 72 61 6e 73 66 65 72 5f 6f | ..,..transfer_o| 00000280 75 74 5f 6c 6f 6f 70 0d 01 36 05 20 0d 01 40 13 |ut_loop..6. ..@.| 00000290 4c 44 41 20 66 70 77 73 5f 31 2d 31 2c 20 58 0d |LDA fpws_1-1, X.| 000002a0 01 4a 18 53 54 41 20 72 65 73 75 6c 74 5f 6d 75 |.J.STA result_mu| 000002b0 6c 74 2d 31 2c 20 58 0d 01 54 07 44 45 58 0d 01 |lt-1, X..T.DEX..| 000002c0 5e 1a 42 4e 45 20 74 72 61 6e 73 66 65 72 5f 6f |^.BNE transfer_o| 000002d0 75 74 5f 6c 6f 6f 70 20 0d 01 68 05 20 0d 01 72 |ut_loop ..h. ..r| 000002e0 2f 5c 20 20 54 72 61 6e 73 66 65 72 20 6e 75 6d |/\ Transfer num| 000002f0 62 65 72 73 20 66 72 6f 6d 20 69 6e 70 75 74 5f |bers from input_| 00000300 31 20 61 6e 64 20 32 20 69 6e 74 6f 0d 01 7c 1d |1 and 2 into..|.| 00000310 5c 20 20 77 6f 72 6b 73 70 61 63 65 20 66 6f 72 |\ workspace for| 00000320 20 64 69 76 69 73 69 6f 6e 0d 01 86 05 20 0d 01 | division.... ..| 00000330 90 13 4a 53 52 20 74 72 61 6e 73 66 65 72 5f 69 |..JSR transfer_i| 00000340 6e 0d 01 9a 05 20 0d 01 a4 36 4a 53 52 20 66 70 |n.... ...6JSR fp| 00000350 5f 64 69 76 20 20 20 20 20 20 20 20 20 20 20 20 |_div | 00000360 20 20 20 20 20 20 20 5c 20 44 69 76 69 73 69 6f | \ Divisio| 00000370 6e 20 73 75 62 72 6f 75 74 69 6e 65 0d 01 ae 05 |n subroutine....| 00000380 20 0d 01 b8 28 5c 20 20 54 72 61 6e 73 66 65 72 | ...(\ Transfer| 00000390 20 72 65 73 75 6c 74 20 69 6e 74 6f 20 27 72 65 | result into 're| 000003a0 73 75 6c 74 5f 64 69 76 27 0d 01 c2 05 20 0d 01 |sult_div'.... ..| 000003b0 cc 0a 4c 44 58 20 23 35 0d 01 d6 05 20 0d 01 e0 |..LDX #5.... ...| 000003c0 17 2e 74 72 61 6e 73 66 65 72 5f 6f 75 74 5f 6c |..transfer_out_l| 000003d0 6f 6f 70 32 0d 01 ea 05 20 0d 01 f4 13 4c 44 41 |oop2.... ....LDA| 000003e0 20 66 70 77 73 5f 31 2d 31 2c 20 58 0d 01 fe 17 | fpws_1-1, X....| 000003f0 53 54 41 20 72 65 73 75 6c 74 5f 64 69 76 2d 31 |STA result_div-1| 00000400 2c 20 58 0d 02 08 07 44 45 58 0d 02 12 1a 42 4e |, X....DEX....BN| 00000410 45 20 74 72 61 6e 73 66 65 72 5f 6f 75 74 5f 6c |E transfer_out_l| 00000420 6f 6f 70 32 0d 02 1c 05 20 0d 02 26 07 52 54 53 |oop2.... ..&.RTS| 00000430 0d 02 30 05 20 0d 02 3a 43 5c 20 20 52 65 73 65 |..0. ..:C\ Rese| 00000440 72 76 61 74 69 6f 6e 20 6f 66 20 77 6f 72 6b 73 |rvation of works| 00000450 70 61 63 65 2e 20 20 4e 6f 74 65 20 62 79 74 65 |pace. Note byte| 00000460 73 20 66 6f 72 20 73 69 67 6e 20 6f 66 20 66 70 |s for sign of fp| 00000470 20 6e 75 6d 62 65 72 73 0d 02 44 34 5c 20 20 61 | numbers..D4\ a| 00000480 6e 64 20 66 6f 72 20 6f 76 65 72 66 6c 6f 77 20 |nd for overflow | 00000490 28 6f 66 6c 6f 77 29 20 64 75 72 69 6e 67 20 63 |(oflow) during c| 000004a0 61 6c 63 75 6c 61 74 69 6f 6e 73 2e 0d 02 4e 37 |alculations...N7| 000004b0 5c 20 20 41 6c 73 6f 20 74 68 65 20 66 70 77 73 |\ Also the fpws| 000004c0 20 66 6f 72 20 65 61 63 68 20 6e 75 6d 62 65 72 | for each number| 000004d0 20 69 73 20 37 20 62 79 74 65 73 2c 20 6e 6f 74 | is 7 bytes, not| 000004e0 20 35 2e 0d 02 58 3c 5c 20 20 4e 6f 74 65 20 61 | 5...X<\ Note a| 000004f0 6c 73 6f 20 74 68 61 74 20 73 6f 6d 65 20 77 6f |lso that some wo| 00000500 72 6b 73 70 61 63 65 20 68 61 73 20 61 20 64 69 |rkspace has a di| 00000510 66 66 65 72 65 6e 74 20 6e 61 6d 65 20 69 6e 0d |fferent name in.| 00000520 02 62 41 5c 20 20 64 69 66 66 65 72 65 6e 74 20 |.bA\ different | 00000530 70 61 72 74 73 20 6f 66 20 74 68 65 20 70 72 6f |parts of the pro| 00000540 67 72 61 6d 2e 20 20 54 68 69 73 20 61 69 64 73 |gram. This aids| 00000550 20 63 6f 6e 76 65 72 73 69 6f 6e 20 66 72 6f 6d | conversion from| 00000560 0d 02 6c 1c 5c 20 20 74 68 65 20 69 6e 74 65 67 |..l.\ the integ| 00000570 65 72 20 72 6f 75 74 69 6e 65 73 2e 0d 02 76 05 |er routines...v.| 00000580 20 0d 02 80 20 2e 69 6e 70 75 74 5f 31 20 20 20 | ... .input_1 | 00000590 20 20 20 4f 50 54 20 a4 45 51 55 4d 28 35 2c 30 | OPT .EQUM(5,0| 000005a0 29 0d 02 8a 20 2e 69 6e 70 75 74 5f 32 20 20 20 |)... .input_2 | 000005b0 20 20 20 4f 50 54 20 a4 45 51 55 4d 28 35 2c 30 | OPT .EQUM(5,0| 000005c0 29 0d 02 94 1e 2e 66 70 77 73 5f 31 5f 73 69 67 |).....fpws_1_sig| 000005d0 6e 20 20 4f 50 54 20 a4 45 51 55 42 28 30 29 0d |n OPT .EQUB(0).| 000005e0 02 9e 11 2e 6d 75 6c 74 69 70 6c 69 63 61 6e 64 |....multiplicand| 000005f0 0d 02 a8 0d 2e 64 69 76 69 64 65 6e 64 0d 02 b2 |.....dividend...| 00000600 20 2e 66 70 77 73 5f 31 20 20 20 20 20 20 20 4f | .fpws_1 O| 00000610 50 54 20 a4 45 51 55 4d 28 37 2c 30 29 0d 02 bc |PT .EQUM(7,0)...| 00000620 1e 2e 66 70 77 73 5f 32 5f 73 69 67 6e 20 20 4f |..fpws_2_sign O| 00000630 50 54 20 a4 45 51 55 42 28 30 29 0d 02 c6 0f 2e |PT .EQUB(0).....| 00000640 6d 75 6c 74 69 70 6c 69 65 72 0d 02 d0 0c 2e 64 |multiplier.....d| 00000650 69 76 69 73 6f 72 0d 02 da 20 2e 66 70 77 73 5f |ivisor... .fpws_| 00000660 32 20 20 20 20 20 20 20 4f 50 54 20 a4 45 51 55 |2 OPT .EQU| 00000670 4d 28 37 2c 30 29 0d 02 e4 09 2e 70 70 77 73 0d |M(7,0).....ppws.| 00000680 02 ee 20 2e 70 64 77 73 20 20 20 20 20 20 20 20 |.. .pdws | 00000690 20 4f 50 54 20 a4 45 51 55 4d 28 36 2c 30 29 0d | OPT .EQUM(6,0).| 000006a0 02 f8 20 2e 64 69 66 66 5f 77 73 20 20 20 20 20 |.. .diff_ws | 000006b0 20 4f 50 54 20 a4 45 51 55 4d 28 36 2c 30 29 0d | OPT .EQUM(6,0).| 000006c0 03 02 20 2e 72 65 73 75 6c 74 5f 6d 75 6c 74 20 |.. .result_mult | 000006d0 20 4f 50 54 20 a4 45 51 55 4d 28 35 2c 30 29 0d | OPT .EQUM(5,0).| 000006e0 03 0c 20 2e 72 65 73 75 6c 74 5f 64 69 76 20 20 |.. .result_div | 000006f0 20 4f 50 54 20 a4 45 51 55 4d 28 35 2c 30 29 0d | OPT .EQUM(5,0).| 00000700 03 16 05 20 0d 03 20 15 2e 65 6e 74 65 72 5f 70 |... .. ..enter_p| 00000710 61 72 61 6d 65 74 65 72 73 0d 03 2a 05 20 0d 03 |arameters..*. ..| 00000720 34 42 5c 20 20 54 68 69 73 20 73 75 62 72 6f 75 |4B\ This subrou| 00000730 74 69 6e 65 20 74 61 6b 65 73 20 74 68 65 20 74 |tine takes the t| 00000740 77 6f 20 66 70 20 6e 75 6d 62 65 72 73 20 66 72 |wo fp numbers fr| 00000750 6f 6d 20 61 20 d6 20 70 61 72 61 6d 65 74 65 72 |om a . parameter| 00000760 0d 03 3e 39 5c 20 20 62 6c 6f 63 6b 20 61 74 20 |..>9\ block at | 00000770 26 36 30 30 20 61 6e 64 20 70 75 74 73 20 74 68 |&600 and puts th| 00000780 65 6d 20 69 6e 20 69 6e 70 75 74 5f 31 20 61 6e |em in input_1 an| 00000790 64 20 69 6e 70 75 74 5f 32 0d 03 48 05 20 0d 03 |d input_2..H. ..| 000007a0 52 47 4c 44 41 20 7a 70 20 20 20 20 20 20 20 20 |RGLDA zp | 000007b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 000007c0 50 72 65 73 65 72 76 65 20 7a 65 72 6f 20 70 61 |Preserve zero pa| 000007d0 67 65 20 77 6f 72 6b 73 70 61 63 65 20 6f 6e 20 |ge workspace on | 000007e0 73 74 61 63 6b 0d 03 5c 07 50 48 41 0d 03 66 0c |stack..\.PHA..f.| 000007f0 4c 44 41 20 7a 70 2b 31 0d 03 70 07 50 48 41 0d |LDA zp+1..p.PHA.| 00000800 03 7a 0c 4c 44 41 20 7a 70 2b 32 0d 03 84 07 50 |.z.LDA zp+2....P| 00000810 48 41 0d 03 8e 0c 4c 44 41 20 7a 70 2b 33 0d 03 |HA....LDA zp+3..| 00000820 98 07 50 48 41 0d 03 a2 05 20 0d 03 ac 48 4c 44 |..PHA.... ...HLD| 00000830 41 20 26 36 30 31 20 20 20 20 20 20 20 20 20 20 |A &601 | 00000840 20 20 20 20 20 20 20 20 20 20 5c 20 4d 6f 76 65 | \ Move| 00000850 20 61 64 64 72 65 73 73 65 73 20 66 72 6f 6d 20 | addresses from | 00000860 26 36 30 30 20 62 6c 6f 63 6b 20 74 6f 20 7a 70 |&600 block to zp| 00000870 77 73 0d 03 b6 0a 53 54 41 20 7a 70 0d 03 c0 0c |ws....STA zp....| 00000880 4c 44 41 20 26 36 30 32 0d 03 ca 0c 53 54 41 20 |LDA &602....STA | 00000890 7a 70 2b 31 0d 03 d4 0c 4c 44 41 20 26 36 30 34 |zp+1....LDA &604| 000008a0 0d 03 de 0c 53 54 41 20 7a 70 2b 32 0d 03 e8 0c |....STA zp+2....| 000008b0 4c 44 41 20 26 36 30 35 0d 03 f2 0c 53 54 41 20 |LDA &605....STA | 000008c0 7a 70 2b 33 0d 03 fc 05 20 0d 04 06 0a 4c 44 59 |zp+3.... ....LDY| 000008d0 20 23 30 0d 04 10 05 20 0d 04 1a 15 2e 65 6e 74 | #0.... .....ent| 000008e0 65 72 5f 70 61 72 61 73 5f 6c 6f 6f 70 0d 04 24 |er_paras_loop..$| 000008f0 05 20 0d 04 2e 2e 4c 44 41 20 28 7a 70 29 2c 20 |. ....LDA (zp), | 00000900 59 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |Y | 00000910 20 20 5c 20 46 69 72 73 74 20 6e 75 6d 62 65 72 | \ First number| 00000920 0d 04 38 12 53 54 41 20 69 6e 70 75 74 5f 31 2c |..8.STA input_1,| 00000930 20 59 0d 04 42 2f 4c 44 41 20 28 7a 70 2b 32 29 | Y..B/LDA (zp+2)| 00000940 2c 20 59 20 20 20 20 20 20 20 20 20 20 20 20 20 |, Y | 00000950 20 20 5c 20 53 65 63 6f 6e 64 20 6e 75 6d 62 65 | \ Second numbe| 00000960 72 0d 04 4c 12 53 54 41 20 69 6e 70 75 74 5f 32 |r..L.STA input_2| 00000970 2c 20 59 0d 04 56 05 20 0d 04 60 07 49 4e 59 0d |, Y..V. ..`.INY.| 00000980 04 6a 0a 43 50 59 20 23 35 0d 04 74 18 42 4e 45 |.j.CPY #5..t.BNE| 00000990 20 65 6e 74 65 72 5f 70 61 72 61 73 5f 6c 6f 6f | enter_paras_loo| 000009a0 70 0d 04 7e 05 20 0d 04 88 39 50 4c 41 20 20 20 |p..~. ...9PLA | 000009b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000009c0 20 20 20 20 20 20 5c 20 52 65 73 74 6f 72 65 20 | \ Restore | 000009d0 7a 70 77 73 20 66 72 6f 6d 20 73 74 61 63 6b 0d |zpws from stack.| 000009e0 04 92 0c 53 54 41 20 7a 70 2b 33 0d 04 9c 07 50 |...STA zp+3....P| 000009f0 4c 41 0d 04 a6 0c 53 54 41 20 7a 70 2b 32 0d 04 |LA....STA zp+2..| 00000a00 b0 07 50 4c 41 0d 04 ba 0c 53 54 41 20 7a 70 2b |..PLA....STA zp+| 00000a10 31 0d 04 c4 07 50 4c 41 0d 04 ce 0a 53 54 41 20 |1....PLA....STA | 00000a20 7a 70 0d 04 d8 07 52 54 53 0d 04 e2 05 20 0d 04 |zp....RTS.... ..| 00000a30 ec 10 2e 74 72 61 6e 73 66 65 72 5f 69 6e 0d 04 |...transfer_in..| 00000a40 f6 05 20 0d 05 00 37 5c 20 20 54 68 69 73 20 73 |.. ...7\ This s| 00000a50 75 62 72 6f 75 74 69 6e 65 20 74 61 6b 65 73 20 |ubroutine takes | 00000a60 74 68 65 20 6e 75 6d 62 65 72 73 20 69 6e 20 69 |the numbers in i| 00000a70 6e 70 75 74 5f 31 20 61 6e 64 0d 05 0a 31 5c 20 |nput_1 and...1\ | 00000a80 20 69 6e 70 75 74 5f 32 20 61 6e 64 20 70 75 74 | input_2 and put| 00000a90 73 20 74 68 65 6d 20 69 6e 20 66 70 77 73 5f 31 |s them in fpws_1| 00000aa0 20 61 6e 64 20 66 70 77 73 5f 32 0d 05 14 05 20 | and fpws_2.... | 00000ab0 0d 05 1e 0a 4c 44 58 20 23 35 0d 05 28 05 20 0d |....LDX #5..(. .| 00000ac0 05 32 15 2e 74 72 61 6e 73 66 65 72 5f 69 6e 5f |.2..transfer_in_| 00000ad0 6c 6f 6f 70 0d 05 3c 05 20 0d 05 46 14 4c 44 41 |loop..<. ..F.LDA| 00000ae0 20 69 6e 70 75 74 5f 31 2d 31 2c 20 58 0d 05 50 | input_1-1, X..P| 00000af0 13 53 54 41 20 66 70 77 73 5f 31 2d 31 2c 20 58 |.STA fpws_1-1, X| 00000b00 0d 05 5a 14 4c 44 41 20 69 6e 70 75 74 5f 32 2d |..Z.LDA input_2-| 00000b10 31 2c 20 58 0d 05 64 13 53 54 41 20 66 70 77 73 |1, X..d.STA fpws| 00000b20 5f 32 2d 31 2c 20 58 0d 05 6e 07 44 45 58 0d 05 |_2-1, X..n.DEX..| 00000b30 78 19 42 4e 45 20 74 72 61 6e 73 66 65 72 5f 69 |x.BNE transfer_i| 00000b40 6e 5f 6c 6f 6f 70 20 0d 05 82 05 20 0d 05 8c 07 |n_loop .... ....| 00000b50 52 54 53 0d 05 96 05 20 0d 05 a0 0c 2e 66 70 5f |RTS.... .....fp_| 00000b60 6d 75 6c 74 0d 05 aa 06 20 20 0d 05 b4 35 5c 20 |mult.... ...5\ | 00000b70 20 4d 75 6c 74 69 70 6c 69 65 73 20 74 68 65 20 | Multiplies the | 00000b80 6e 75 6d 62 65 72 73 20 69 6e 20 66 70 77 73 5f |numbers in fpws_| 00000b90 31 20 62 79 20 74 68 65 20 6e 75 6d 62 65 72 0d |1 by the number.| 00000ba0 05 be 2e 5c 20 20 69 6e 20 66 70 77 73 5f 31 20 |...\ in fpws_1 | 00000bb0 61 6e 64 20 70 75 74 73 20 74 68 65 20 72 65 73 |and puts the res| 00000bc0 75 6c 74 20 69 6e 20 66 70 77 73 5f 31 0d 05 c8 |ult in fpws_1...| 00000bd0 05 20 0d 05 d2 2d 5c 20 20 46 69 72 73 74 20 61 |. ...-\ First a| 00000be0 6c 6c 6f 77 20 66 6f 72 20 7a 65 72 6f 73 20 69 |llow for zeros i| 00000bf0 6e 20 74 68 65 20 77 6f 72 6b 73 70 61 63 65 0d |n the workspace.| 00000c00 05 dc 05 20 0d 05 e6 10 4c 44 41 20 66 70 77 73 |... ....LDA fpws| 00000c10 5f 31 2b 31 0d 05 f0 4a 84 41 20 66 70 77 73 5f |_1+1...J.A fpws_| 00000c20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |1 | 00000c30 20 20 20 5c 20 5a 65 72 6f 20 69 66 20 65 78 70 | \ Zero if exp| 00000c40 6f 6e 65 6e 74 20 26 20 74 6f 70 20 6d 61 6e 74 |onent & top mant| 00000c50 69 73 73 61 20 62 79 74 65 20 7a 65 72 6f 0d 05 |issa byte zero..| 00000c60 fa 43 42 45 51 20 6d 61 6b 65 5f 7a 65 72 6f 20 |.CBEQ make_zero | 00000c70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00000c80 49 66 20 31 73 74 20 6e 6f 20 69 73 20 7a 65 72 |If 1st no is zer| 00000c90 6f 20 74 68 65 6e 20 72 65 73 75 6c 74 20 3d 20 |o then result = | 00000ca0 30 0d 06 04 06 20 20 0d 06 0e 10 4c 44 41 20 66 |0.... ....LDA f| 00000cb0 70 77 73 5f 32 2b 31 0d 06 18 4a 84 41 20 66 70 |pws_2+1...J.A fp| 00000cc0 77 73 5f 32 20 20 20 20 20 20 20 20 20 20 20 20 |ws_2 | 00000cd0 20 20 20 20 20 20 5c 20 5a 65 72 6f 20 69 66 20 | \ Zero if | 00000ce0 65 78 70 6f 6e 65 6e 74 20 26 20 74 6f 70 20 6d |exponent & top m| 00000cf0 61 6e 74 69 73 73 61 20 62 79 74 65 20 7a 65 72 |antissa byte zer| 00000d00 6f 0d 06 22 43 42 45 51 20 6d 61 6b 65 5f 7a 65 |o.."CBEQ make_ze| 00000d10 72 6f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |ro | 00000d20 20 5c 20 49 66 20 32 6e 64 20 6e 6f 20 69 73 20 | \ If 2nd no is | 00000d30 7a 65 72 6f 20 74 68 65 6e 20 72 65 73 75 6c 74 |zero then result| 00000d40 20 3d 20 30 0d 06 2c 05 20 0d 06 36 1c 5c 20 20 | = 0..,. ..6.\ | 00000d50 49 66 20 72 65 73 75 6c 74 20 69 73 20 6e 6f 74 |If result is not| 00000d60 20 7a 65 72 6f 0d 06 40 05 20 0d 06 4a 3f 4a 53 | zero..@. ..J?JS| 00000d70 52 20 6d 6f 76 65 5f 73 69 67 6e 5f 62 69 74 20 |R move_sign_bit | 00000d80 20 20 20 20 20 20 20 20 20 20 5c 20 4d 6f 76 65 | \ Move| 00000d90 20 73 69 67 6e 20 61 6e 64 20 72 65 73 74 6f 72 | sign and restor| 00000da0 65 20 74 6f 70 20 62 69 74 0d 06 54 05 20 0d 06 |e top bit..T. ..| 00000db0 5e 18 4a 53 52 20 6d 75 6c 74 5f 64 65 6e 6f 72 |^.JSR mult_denor| 00000dc0 6d 61 6c 69 73 65 0d 06 68 05 20 0d 06 72 16 4a |malise..h. ..r.J| 00000dd0 53 52 20 6d 75 6c 74 5f 6d 61 6e 74 69 73 73 61 |SR mult_mantissa| 00000de0 65 0d 06 7c 05 20 0d 06 86 1a 4a 53 52 20 72 65 |e..|. ....JSR re| 00000df0 6e 6f 72 6d 61 6c 69 73 65 5f 6d 75 6c 64 69 76 |normalise_muldiv| 00000e00 0d 06 90 05 20 0d 06 9a 18 4a 53 52 20 72 65 70 |.... ....JSR rep| 00000e10 6c 61 63 65 5f 73 69 67 6e 5f 62 69 74 0d 06 a4 |lace_sign_bit...| 00000e20 05 20 0d 06 ae 07 52 54 53 0d 06 b8 05 20 0d 06 |. ....RTS.... ..| 00000e30 c2 0b 2e 66 70 5f 64 69 76 0d 06 cc 06 20 20 0d |...fp_div.... .| 00000e40 06 d6 38 5c 20 20 44 69 76 69 64 65 73 20 74 68 |..8\ Divides th| 00000e50 65 20 6e 75 6d 62 65 72 20 69 6e 20 66 70 77 73 |e number in fpws| 00000e60 5f 31 20 62 79 20 74 68 65 20 6f 6e 65 20 69 6e |_1 by the one in| 00000e70 20 66 70 77 73 5f 32 0d 06 e0 24 5c 20 20 61 6e | fpws_2...$\ an| 00000e80 64 20 70 75 74 73 20 74 68 65 20 72 65 73 75 6c |d puts the resul| 00000e90 74 20 69 6e 20 66 70 77 73 5f 31 0d 06 ea 05 20 |t in fpws_1.... | 00000ea0 0d 06 f4 2d 5c 20 20 46 69 72 73 74 20 61 6c 6c |...-\ First all| 00000eb0 6f 77 20 66 6f 72 20 7a 65 72 6f 73 20 69 6e 20 |ow for zeros in | 00000ec0 74 68 65 20 77 6f 72 6b 73 70 61 63 65 0d 06 fe |the workspace...| 00000ed0 06 20 20 0d 07 08 10 4c 44 41 20 66 70 77 73 5f |. ....LDA fpws_| 00000ee0 32 2b 31 0d 07 12 4a 84 41 20 66 70 77 73 5f 32 |2+1...J.A fpws_2| 00000ef0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000f00 20 20 5c 20 5a 65 72 6f 20 69 66 20 65 78 70 6f | \ Zero if expo| 00000f10 6e 65 6e 74 20 26 20 74 6f 70 20 6d 61 6e 74 69 |nent & top manti| 00000f20 73 73 61 20 62 79 74 65 20 7a 65 72 6f 0d 07 1c |ssa byte zero...| 00000f30 41 42 45 51 20 64 69 76 5f 62 79 5f 7a 65 72 6f |ABEQ div_by_zero| 00000f40 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 49 | \ I| 00000f50 66 20 32 6e 64 20 6e 6f 20 69 73 20 30 20 77 65 |f 2nd no is 0 we| 00000f60 20 68 61 76 65 20 61 6e 20 65 72 72 6f 72 0d 07 | have an error..| 00000f70 26 05 20 0d 07 30 10 4c 44 41 20 66 70 77 73 5f |&. ..0.LDA fpws_| 00000f80 31 2b 31 0d 07 3a 4a 84 41 20 66 70 77 73 5f 31 |1+1..:J.A fpws_1| 00000f90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00000fa0 20 20 5c 20 5a 65 72 6f 20 69 66 20 65 78 70 6f | \ Zero if expo| 00000fb0 6e 65 6e 74 20 26 20 74 6f 70 20 6d 61 6e 74 69 |nent & top manti| 00000fc0 73 73 61 20 62 79 74 65 20 7a 65 72 6f 0d 07 44 |ssa byte zero..D| 00000fd0 43 42 45 51 20 6d 61 6b 65 5f 7a 65 72 6f 20 20 |CBEQ make_zero | 00000fe0 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 49 | \ I| 00000ff0 66 20 31 73 74 20 6e 6f 20 69 73 20 7a 65 72 6f |f 1st no is zero| 00001000 20 74 68 65 6e 20 72 65 73 75 6c 74 20 3d 20 30 | then result = 0| 00001010 0d 07 4e 05 20 0d 07 58 3f 4a 53 52 20 6d 6f 76 |..N. ..X?JSR mov| 00001020 65 5f 73 69 67 6e 5f 62 69 74 20 20 20 20 20 20 |e_sign_bit | 00001030 20 20 20 20 20 5c 20 4d 6f 76 65 20 73 69 67 6e | \ Move sign| 00001040 20 61 6e 64 20 72 65 73 74 6f 72 65 20 74 6f 70 | and restore top| 00001050 20 62 69 74 0d 07 62 05 20 0d 07 6c 17 4a 53 52 | bit..b. ..l.JSR| 00001060 20 64 69 76 5f 64 65 6e 6f 72 6d 61 6c 69 73 65 | div_denormalise| 00001070 0d 07 76 05 20 0d 07 80 15 4a 53 52 20 64 69 76 |..v. ....JSR div| 00001080 5f 6d 61 6e 74 69 73 73 61 65 0d 07 8a 05 20 0d |_mantissae.... .| 00001090 07 94 1a 4a 53 52 20 72 65 6e 6f 72 6d 61 6c 69 |...JSR renormali| 000010a0 73 65 5f 6d 75 6c 64 69 76 0d 07 9e 05 20 0d 07 |se_muldiv.... ..| 000010b0 a8 18 4a 53 52 20 72 65 70 6c 61 63 65 5f 73 69 |..JSR replace_si| 000010c0 67 6e 5f 62 69 74 0d 07 b2 05 20 0d 07 bc 07 52 |gn_bit.... ....R| 000010d0 54 53 0d 07 c6 05 20 0d 07 d0 0e 2e 6d 61 6b 65 |TS.... .....make| 000010e0 5f 7a 65 72 6f 0d 07 da 05 20 0d 07 e4 25 5c 20 |_zero.... ...%\ | 000010f0 20 54 68 69 73 20 72 6f 75 74 69 6e 65 20 6d 61 | This routine ma| 00001100 6b 65 73 20 66 70 77 73 5f 31 20 7a 65 72 6f 0d |kes fpws_1 zero.| 00001110 07 ee 05 20 0d 07 f8 0a 4c 44 41 20 23 30 0d 08 |... ....LDA #0..| 00001120 02 0a 4c 44 58 20 23 35 0d 08 0c 05 20 0d 08 16 |..LDX #5.... ...| 00001130 13 2e 6d 61 6b 65 5f 7a 65 72 6f 5f 6c 6f 6f 70 |..make_zero_loop| 00001140 0d 08 20 05 20 0d 08 2a 13 53 54 41 20 66 70 77 |.. . ..*.STA fpw| 00001150 73 5f 31 2d 31 2c 20 58 0d 08 34 07 44 45 58 0d |s_1-1, X..4.DEX.| 00001160 08 3e 16 42 4e 45 20 6d 61 6b 65 5f 7a 65 72 6f |.>.BNE make_zero| 00001170 5f 6c 6f 6f 70 0d 08 48 05 20 0d 08 52 07 52 54 |_loop..H. ..R.RT| 00001180 53 0d 08 5c 05 20 0d 08 66 10 2e 64 69 76 5f 62 |S..\. ..f..div_b| 00001190 79 5f 7a 65 72 6f 0d 08 70 05 20 0d 08 7a 2c 5c |y_zero..p. ..z,\| 000011a0 20 20 54 68 69 73 20 69 73 20 61 6e 20 65 72 72 | This is an err| 000011b0 6f 72 20 63 6f 6e 64 69 74 69 6f 6e 2c 20 6e 75 |or condition, nu| 000011c0 6d 62 65 72 20 31 38 0d 08 84 05 20 0d 08 8e 07 |mber 18.... ....| 000011d0 42 52 4b 0d 08 98 11 4f 50 54 20 a4 45 51 55 42 |BRK....OPT .EQUB| 000011e0 28 31 38 29 0d 08 a2 2a 4f 50 54 20 a4 45 51 55 |(18)...*OPT .EQU| 000011f0 53 28 22 41 74 74 65 6d 70 74 20 74 6f 20 64 69 |S("Attempt to di| 00001200 76 69 64 65 20 62 79 20 7a 65 72 6f 22 29 0d 08 |vide by zero")..| 00001210 ac 10 4f 50 54 20 a4 45 51 55 42 28 30 29 0d 08 |..OPT .EQUB(0)..| 00001220 b6 05 20 0d 08 c0 12 2e 6d 6f 76 65 5f 73 69 67 |.. .....move_sig| 00001230 6e 5f 62 69 74 0d 08 ca 05 20 0d 08 d4 48 5c 20 |n_bit.... ...H\ | 00001240 20 54 68 69 73 20 72 6f 75 74 69 6e 65 20 74 72 | This routine tr| 00001250 61 6e 73 66 65 72 73 20 74 68 65 20 73 69 67 6e |ansfers the sign| 00001260 20 62 69 74 20 66 72 6f 6d 20 74 68 65 20 74 6f | bit from the to| 00001270 70 20 6f 66 20 74 68 65 20 6d 61 6e 74 69 73 73 |p of the mantiss| 00001280 61 65 0d 08 de 40 5c 20 20 61 6e 64 20 70 75 74 |ae...@\ and put| 00001290 73 20 69 74 20 69 6e 74 6f 20 61 20 73 69 67 6e |s it into a sign| 000012a0 20 62 79 74 65 20 2d 20 80 69 6e 67 20 74 6f 20 | byte - .ing to | 000012b0 6c 65 61 76 65 20 74 6f 70 20 62 69 74 20 6f 6e |leave top bit on| 000012c0 6c 79 0d 08 e8 35 5c 20 20 61 6e 64 20 74 68 65 |ly...5\ and the| 000012d0 6e 20 72 65 73 74 6f 72 65 73 20 74 68 65 20 74 |n restores the t| 000012e0 6f 70 20 62 69 74 20 6f 66 20 74 68 65 20 6d 61 |op bit of the ma| 000012f0 6e 74 69 73 73 61 65 0d 08 f2 06 20 20 0d 08 fc |ntissae.... ...| 00001300 10 4c 44 41 20 66 70 77 73 5f 31 2b 31 0d 09 06 |.LDA fpws_1+1...| 00001310 0a 80 20 23 26 38 30 0d 09 10 46 53 54 41 20 66 |.. #&80...FSTA f| 00001320 70 77 73 5f 31 5f 73 69 67 6e 20 20 20 20 20 20 |pws_1_sign | 00001330 20 20 20 20 20 20 20 5c 20 66 70 77 73 5f 31 5f | \ fpws_1_| 00001340 73 69 67 6e 20 69 73 20 2d 76 65 20 69 66 20 6e |sign is -ve if n| 00001350 75 6d 62 65 72 20 77 61 73 20 2d 76 65 0d 09 1a |umber was -ve...| 00001360 0c 4c 44 41 20 23 26 38 30 0d 09 24 0f 84 41 20 |.LDA #&80..$..A | 00001370 66 70 77 73 5f 31 2b 31 0d 09 2e 44 53 54 41 20 |fpws_1+1...DSTA | 00001380 66 70 77 73 5f 31 2b 31 20 20 20 20 20 20 20 20 |fpws_1+1 | 00001390 20 20 20 20 20 20 20 20 5c 20 52 65 73 74 6f 72 | \ Restor| 000013a0 65 73 20 74 68 65 20 74 6f 70 20 62 69 74 20 6f |es the top bit o| 000013b0 66 20 74 68 65 20 6e 75 6d 62 65 72 0d 09 38 05 |f the number..8.| 000013c0 20 0d 09 42 10 4c 44 41 20 66 70 77 73 5f 32 2b | ..B.LDA fpws_2+| 000013d0 31 0d 09 4c 0a 80 20 23 26 38 30 0d 09 56 46 53 |1..L.. #&80..VFS| 000013e0 54 41 20 66 70 77 73 5f 32 5f 73 69 67 6e 20 20 |TA fpws_2_sign | 000013f0 20 20 20 20 20 20 20 20 20 20 20 5c 20 66 70 77 | \ fpw| 00001400 73 5f 32 5f 73 69 67 6e 20 69 73 20 2d 76 65 20 |s_2_sign is -ve | 00001410 69 66 20 6e 75 6d 62 65 72 20 77 61 73 20 2d 76 |if number was -v| 00001420 65 0d 09 60 0c 4c 44 41 20 23 26 38 30 0d 09 6a |e..`.LDA #&80..j| 00001430 0f 84 41 20 66 70 77 73 5f 32 2b 31 0d 09 74 44 |..A fpws_2+1..tD| 00001440 53 54 41 20 66 70 77 73 5f 32 2b 31 20 20 20 20 |STA fpws_2+1 | 00001450 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 52 65 | \ Re| 00001460 73 74 6f 72 65 73 20 74 68 65 20 74 6f 70 20 62 |stores the top b| 00001470 69 74 20 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 |it of the number| 00001480 0d 09 7e 05 20 0d 09 88 07 52 54 53 0d 09 92 05 |..~. ....RTS....| 00001490 20 0d 09 9c 15 2e 6d 75 6c 74 5f 64 65 6e 6f 72 | .....mult_denor| 000014a0 6d 61 6c 69 73 65 0d 09 a6 05 20 0d 09 b0 3a 5c |malise.... ...:\| 000014b0 20 20 46 69 72 73 74 2c 20 62 6f 74 68 20 6e 75 | First, both nu| 000014c0 6d 62 65 72 73 20 6d 75 73 74 20 62 65 20 73 68 |mbers must be sh| 000014d0 69 66 74 65 64 20 64 6f 77 6e 20 62 79 20 32 20 |ifted down by 2 | 000014e0 62 79 74 65 73 0d 09 ba 3d 5c 20 20 61 6e 64 20 |bytes...=\ and | 000014f0 65 78 70 6f 6e 65 6e 74 73 20 62 6f 74 68 20 69 |exponents both i| 00001500 6e 63 72 65 61 73 65 64 20 62 79 20 31 36 2e 20 |ncreased by 16. | 00001510 20 54 68 69 73 20 65 6e 73 75 72 65 73 20 74 68 | This ensures th| 00001520 61 74 0d 09 c4 2a 5c 20 20 74 68 65 20 66 69 6e |at...*\ the fin| 00001530 61 6c 20 6e 75 6d 62 65 72 20 64 6f 65 73 20 6e |al number does n| 00001540 6f 74 20 6f 76 65 72 66 6c 6f 77 2e 0d 09 ce 05 |ot overflow.....| 00001550 20 0d 09 d8 0b 4c 44 58 20 23 31 36 0d 09 e2 05 | ....LDX #16....| 00001560 20 0d 09 ec 21 2e 6d 75 6c 74 5f 64 65 6e 6f 72 | ...!.mult_denor| 00001570 6d 61 6c 69 73 65 5f 72 6f 74 61 74 65 5f 6c 6f |malise_rotate_lo| 00001580 6f 70 0d 09 f6 05 20 0d 0a 00 37 4c 53 52 20 66 |op.... ...7LSR f| 00001590 70 77 73 5f 31 2b 31 20 20 20 20 20 20 20 20 20 |pws_1+1 | 000015a0 20 20 20 20 20 20 20 5c 20 52 6f 74 61 74 65 20 | \ Rotate | 000015b0 6d 61 6e 74 69 73 73 61 20 72 69 67 68 74 0d 0a |mantissa right..| 000015c0 0a 10 52 4f 52 20 66 70 77 73 5f 31 2b 32 0d 0a |..ROR fpws_1+2..| 000015d0 14 10 52 4f 52 20 66 70 77 73 5f 31 2b 33 0d 0a |..ROR fpws_1+3..| 000015e0 1e 10 52 4f 52 20 66 70 77 73 5f 31 2b 34 0d 0a |..ROR fpws_1+4..| 000015f0 28 05 20 0d 0a 32 10 4c 53 52 20 66 70 77 73 5f |(. ..2.LSR fpws_| 00001600 32 2b 31 0d 0a 3c 10 52 4f 52 20 66 70 77 73 5f |2+1..<.ROR fpws_| 00001610 32 2b 32 0d 0a 46 10 52 4f 52 20 66 70 77 73 5f |2+2..F.ROR fpws_| 00001620 32 2b 33 0d 0a 50 10 52 4f 52 20 66 70 77 73 5f |2+3..P.ROR fpws_| 00001630 32 2b 34 0d 0a 5a 05 20 0d 0a 64 07 44 45 58 0d |2+4..Z. ..d.DEX.| 00001640 0a 6e 24 42 4e 45 20 6d 75 6c 74 5f 64 65 6e 6f |.n$BNE mult_deno| 00001650 72 6d 61 6c 69 73 65 5f 72 6f 74 61 74 65 5f 6c |rmalise_rotate_l| 00001660 6f 6f 70 0d 0a 78 05 20 0d 0a 82 22 5c 20 43 61 |oop..x. ..."\ Ca| 00001670 6c 63 75 6c 61 74 65 20 65 78 70 6f 6e 65 6e 74 |lculate exponent| 00001680 20 6f 66 20 72 65 73 75 6c 74 0d 0a 8c 05 20 0d | of result.... .| 00001690 0a 96 07 53 45 43 0d 0a a0 0e 4c 44 41 20 66 70 |...SEC....LDA fp| 000016a0 77 73 5f 31 0d 0a aa 43 53 42 43 20 23 26 38 30 |ws_1...CSBC #&80| 000016b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000016c0 20 20 20 20 5c 20 53 75 62 74 72 61 63 74 20 26 | \ Subtract &| 000016d0 38 30 20 66 61 63 74 6f 72 20 66 72 6f 6d 20 65 |80 factor from e| 000016e0 78 70 6f 6e 65 6e 74 0d 0a b4 0e 53 54 41 20 66 |xponent....STA f| 000016f0 70 77 73 5f 31 0d 0a be 05 20 0d 0a c8 07 53 45 |pws_1.... ....SE| 00001700 43 0d 0a d2 0e 4c 44 41 20 66 70 77 73 5f 32 0d |C....LDA fpws_2.| 00001710 0a dc 42 53 42 43 20 23 26 38 30 20 20 20 20 20 |..BSBC #&80 | 00001720 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c | \| 00001730 20 54 68 69 73 20 69 73 20 70 61 72 74 20 6f 66 | This is part of| 00001740 20 42 42 43 20 42 41 53 49 43 20 66 6f 72 6d 61 | BBC BASIC forma| 00001750 74 0d 0a e6 07 43 4c 43 0d 0a f0 0e 41 44 43 20 |t....CLC....ADC | 00001760 66 70 77 73 5f 31 0d 0a fa 48 42 56 53 20 6d 75 |fpws_1...HBVS mu| 00001770 6c 74 5f 6f 66 6c 6f 77 20 20 20 20 20 20 20 20 |lt_oflow | 00001780 20 20 20 20 20 20 5c 20 4f 76 65 72 66 6c 6f 77 | \ Overflow| 00001790 20 66 6c 61 67 20 73 65 74 20 69 66 20 72 65 73 | flag set if res| 000017a0 75 6c 74 20 73 69 67 6e 20 77 72 6f 6e 67 0d 0b |ult sign wrong..| 000017b0 04 07 43 4c 43 0d 0b 0e 42 41 44 43 20 23 26 38 |..CLC...BADC #&8| 000017c0 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |0 | 000017d0 20 20 20 20 20 5c 20 43 6f 6e 76 65 72 74 20 62 | \ Convert b| 000017e0 61 63 6b 20 74 6f 20 42 42 43 20 42 41 53 49 43 |ack to BBC BASIC| 000017f0 20 66 6f 72 6d 61 74 0d 0b 18 0e 53 54 41 20 66 | format....STA f| 00001800 70 77 73 5f 31 0d 0b 22 05 20 0d 0b 2c 07 52 54 |pws_1..". ..,.RT| 00001810 53 0d 0b 36 05 20 0d 0b 40 0f 2e 6d 75 6c 74 5f |S..6. ..@..mult_| 00001820 6f 66 6c 6f 77 0d 0b 4a 05 20 0d 0b 54 12 42 50 |oflow..J. ..T.BP| 00001830 4c 20 76 65 72 79 5f 73 6d 61 6c 6c 0d 0b 5e 3f |L very_small..^?| 00001840 42 52 4b 20 20 20 20 20 20 20 20 20 20 20 20 20 |BRK | 00001850 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 41 6e | \ An| 00001860 20 65 72 72 6f 72 20 63 6f 6e 64 69 74 69 6f 6e | error condition| 00001870 2c 20 6e 75 6d 62 65 72 20 32 30 0d 0b 68 12 4f |, number 20..h.O| 00001880 50 54 20 20 a4 45 51 55 42 28 32 30 29 0d 0b 72 |PT .EQUB(20)..r| 00001890 37 4f 50 54 20 20 a4 45 51 55 53 28 22 4e 75 6d |7OPT .EQUS("Num| 000018a0 62 65 72 20 6f 76 65 72 66 6c 6f 77 20 64 75 72 |ber overflow dur| 000018b0 69 6e 67 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 |ing multiplicati| 000018c0 6f 6e 22 29 0d 0b 7c 11 4f 50 54 20 20 a4 45 51 |on")..|.OPT .EQ| 000018d0 55 42 28 30 29 0d 0b 86 05 20 0d 0b 90 0f 2e 76 |UB(0).... .....v| 000018e0 65 72 79 5f 73 6d 61 6c 6c 0d 0b 9a 05 20 0d 0b |ery_small.... ..| 000018f0 a4 45 4a 4d 50 20 6d 61 6b 65 5f 7a 65 72 6f 20 |.EJMP make_zero | 00001900 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00001910 41 6e 73 77 65 72 20 69 73 20 73 6f 20 73 6d 61 |Answer is so sma| 00001920 6c 6c 20 69 74 20 69 73 20 7a 65 72 6f 20 28 69 |ll it is zero (i| 00001930 73 68 29 0d 0b ae 05 20 0d 0b b8 14 2e 64 69 76 |sh).... .....div| 00001940 5f 64 65 6e 6f 72 6d 61 6c 69 73 65 0d 0b c2 05 |_denormalise....| 00001950 20 0d 0b cc 39 5c 20 20 53 68 69 66 74 20 74 68 | ...9\ Shift th| 00001960 65 20 64 69 76 69 73 6f 72 20 72 69 67 68 74 20 |e divisor right | 00001970 62 79 20 32 20 62 79 74 65 73 20 74 6f 20 61 69 |by 2 bytes to ai| 00001980 64 20 64 69 76 69 73 69 6f 6e 0d 0b d6 05 20 0d |d division.... .| 00001990 0b e0 0b 4c 44 58 20 23 31 36 0d 0b ea 05 20 0d |...LDX #16.... .| 000019a0 0b f4 11 2e 64 69 76 5f 64 65 6e 5f 6c 6f 6f 70 |....div_den_loop| 000019b0 0d 0b fe 05 20 0d 0c 08 11 4c 53 52 20 64 69 76 |.... ....LSR div| 000019c0 69 73 6f 72 2b 31 0d 0c 12 12 52 4f 52 20 64 69 |isor+1....ROR di| 000019d0 76 69 73 6f 72 2b 32 20 0d 0c 1c 11 52 4f 52 20 |visor+2 ....ROR | 000019e0 64 69 76 69 73 6f 72 2b 33 0d 0c 26 11 52 4f 52 |divisor+3..&.ROR| 000019f0 20 64 69 76 69 73 6f 72 2b 34 0d 0c 30 11 52 4f | divisor+4..0.RO| 00001a00 52 20 64 69 76 69 73 6f 72 2b 35 0d 0c 3a 11 52 |R divisor+5..:.R| 00001a10 4f 52 20 64 69 76 69 73 6f 72 2b 36 0d 0c 44 05 |OR divisor+6..D.| 00001a20 20 0d 0c 4e 07 44 45 58 0d 0c 58 14 42 4e 45 20 | ..N.DEX..X.BNE | 00001a30 64 69 76 5f 64 65 6e 5f 6c 6f 6f 70 0d 0c 62 05 |div_den_loop..b.| 00001a40 20 0d 0c 6c 2b 5c 20 20 43 61 6c 63 75 6c 61 74 | ..l+\ Calculat| 00001a50 65 20 69 6e 69 74 69 61 6c 20 65 78 70 6f 6e 65 |e initial expone| 00001a60 6e 74 20 6f 66 20 72 65 73 75 6c 74 0d 0c 76 05 |nt of result..v.| 00001a70 20 0d 0c 80 07 53 45 43 0d 0c 8a 0e 4c 44 41 20 | ....SEC....LDA | 00001a80 66 70 77 73 5f 32 0d 0c 94 43 53 42 43 20 23 26 |fpws_2...CSBC #&| 00001a90 38 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |80 | 00001aa0 20 20 20 20 20 20 5c 20 53 75 62 74 72 61 63 74 | \ Subtract| 00001ab0 20 26 38 30 20 66 61 63 74 6f 72 20 66 72 6f 6d | &80 factor from| 00001ac0 20 65 78 70 6f 6e 65 6e 74 0d 0c 9e 0e 53 54 41 | exponent....STA| 00001ad0 20 66 70 77 73 5f 32 0d 0c a8 05 20 0d 0c b2 07 | fpws_2.... ....| 00001ae0 53 45 43 0d 0c bc 0e 4c 44 41 20 66 70 77 73 5f |SEC....LDA fpws_| 00001af0 31 0d 0c c6 42 53 42 43 20 23 26 38 30 20 20 20 |1...BSBC #&80 | 00001b00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001b10 20 5c 20 54 68 69 73 20 69 73 20 70 61 72 74 20 | \ This is part | 00001b20 6f 66 20 42 42 43 20 42 41 53 49 43 20 66 6f 72 |of BBC BASIC for| 00001b30 6d 61 74 0d 0c d0 07 53 45 43 0d 0c da 0e 53 42 |mat....SEC....SB| 00001b40 43 20 66 70 77 73 5f 32 0d 0c e4 48 42 56 53 20 |C fpws_2...HBVS | 00001b50 64 69 76 5f 6f 66 6c 6f 77 20 20 20 20 20 20 20 |div_oflow | 00001b60 20 20 20 20 20 20 20 20 5c 20 4f 76 65 72 66 6c | \ Overfl| 00001b70 6f 77 20 66 6c 61 67 20 73 65 74 20 69 66 20 72 |ow flag set if r| 00001b80 65 73 75 6c 74 20 73 69 67 6e 20 77 72 6f 6e 67 |esult sign wrong| 00001b90 0d 0c ee 07 43 4c 43 0d 0c f8 42 41 44 43 20 23 |....CLC...BADC #| 00001ba0 26 38 30 20 20 20 20 20 20 20 20 20 20 20 20 20 |&80 | 00001bb0 20 20 20 20 20 20 20 5c 20 43 6f 6e 76 65 72 74 | \ Convert| 00001bc0 20 62 61 63 6b 20 74 6f 20 42 42 43 20 42 41 53 | back to BBC BAS| 00001bd0 49 43 20 66 6f 72 6d 61 74 0d 0d 02 07 43 4c 43 |IC format....CLC| 00001be0 0d 0d 0c 48 41 44 43 20 23 26 32 30 20 20 20 20 |...HADC #&20 | 00001bf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00001c00 5c 20 41 64 64 20 33 32 20 74 6f 20 63 6f 6d 70 |\ Add 32 to comp| 00001c10 65 6e 73 61 74 65 20 66 6f 72 20 64 65 6e 6f 72 |ensate for denor| 00001c20 6d 61 6c 69 73 69 6e 67 0d 0d 16 0e 53 54 41 20 |malising....STA | 00001c30 66 70 77 73 5f 31 0d 0d 20 05 20 0d 0d 2a 07 52 |fpws_1.. . ..*.R| 00001c40 54 53 0d 0d 34 05 20 0d 0d 3e 0e 2e 64 69 76 5f |TS..4. ..>..div_| 00001c50 6f 66 6c 6f 77 0d 0d 48 05 20 0d 0d 52 13 42 4d |oflow..H. ..R.BM| 00001c60 49 20 74 6f 6f 5f 62 69 67 5f 64 69 76 0d 0d 5c |I too_big_div..\| 00001c70 11 4a 4d 50 20 6d 61 6b 65 5f 7a 65 72 6f 0d 0d |.JMP make_zero..| 00001c80 66 05 20 0d 0d 70 10 2e 74 6f 6f 5f 62 69 67 5f |f. ..p..too_big_| 00001c90 64 69 76 0d 0d 7a 05 20 0d 0d 84 07 42 52 4b 0d |div..z. ....BRK.| 00001ca0 0d 8e 43 4f 50 54 20 20 a4 45 51 55 42 28 32 30 |..COPT .EQUB(20| 00001cb0 29 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 |) \ | 00001cc0 41 20 42 41 53 49 43 20 65 72 72 6f 72 20 63 6f |A BASIC error co| 00001cd0 6e 64 69 74 69 6f 6e 2c 20 6e 75 6d 62 65 72 20 |ndition, number | 00001ce0 32 30 0d 0d 98 31 4f 50 54 20 20 a4 45 51 55 53 |20...1OPT .EQUS| 00001cf0 28 22 4e 75 6d 62 65 72 20 6f 76 65 72 66 6c 6f |("Number overflo| 00001d00 77 20 64 75 72 69 6e 67 20 64 69 76 69 73 69 6f |w during divisio| 00001d10 6e 22 29 0d 0d a2 11 4f 50 54 20 20 a4 45 51 55 |n")....OPT .EQU| 00001d20 42 28 30 29 0d 0d ac 05 20 0d 0d b6 13 2e 6d 75 |B(0).... .....mu| 00001d30 6c 74 5f 6d 61 6e 74 69 73 73 61 65 0d 0d c0 05 |lt_mantissae....| 00001d40 20 0d 0d ca 39 5c 20 20 41 73 73 75 6d 65 73 20 | ...9\ Assumes | 00001d50 74 68 61 74 20 6e 75 6d 62 65 72 73 20 74 6f 20 |that numbers to | 00001d60 62 65 20 6d 75 6c 74 69 70 6c 69 65 64 20 61 72 |be multiplied ar| 00001d70 65 20 70 75 74 20 69 6e 74 6f 0d 0d d4 35 5c 20 |e put into...5\ | 00001d80 20 6d 75 6c 74 69 70 6c 69 63 61 6e 64 20 61 6e | multiplicand an| 00001d90 64 20 6d 75 6c 74 69 70 6c 69 65 72 2e 20 20 70 |d multiplier. p| 00001da0 70 77 73 20 69 73 20 75 73 65 64 20 66 6f 72 0d |pws is used for.| 00001db0 0d de 35 5c 20 20 70 61 72 74 69 61 6c 20 70 72 |..5\ partial pr| 00001dc0 6f 64 75 63 74 2e 20 52 65 73 75 6c 74 20 69 73 |oduct. Result is| 00001dd0 20 70 75 74 20 69 6e 74 6f 20 6d 75 6c 74 69 70 | put into multip| 00001de0 6c 69 65 72 0d 0d e8 05 20 0d 0d f2 0a 4c 44 41 |lier.... ....LDA| 00001df0 20 23 30 0d 0d fc 3b 53 54 41 20 70 70 77 73 20 | #0...;STA ppws | 00001e00 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 43 | \ C| 00001e10 6c 65 61 72 20 70 61 72 74 69 61 6c 20 70 72 6f |lear partial pro| 00001e20 64 75 63 74 20 77 6f 72 6b 73 70 61 63 65 0d 0e |duct workspace..| 00001e30 06 0e 53 54 41 20 70 70 77 73 2b 31 0d 0e 10 0e |..STA ppws+1....| 00001e40 53 54 41 20 70 70 77 73 2b 32 0d 0e 1a 0e 53 54 |STA ppws+2....ST| 00001e50 41 20 70 70 77 73 2b 33 0d 0e 24 05 20 0d 0e 2e |A ppws+3..$. ...| 00001e60 44 4c 44 58 20 23 33 32 20 20 20 20 20 20 20 20 |DLDX #32 | 00001e70 20 20 20 20 20 20 20 5c 20 43 61 72 72 79 20 6f | \ Carry o| 00001e80 75 74 20 33 32 20 74 69 6d 65 73 20 66 6f 72 20 |ut 32 times for | 00001e90 33 32 20 62 69 74 20 61 72 69 74 68 6d 65 74 69 |32 bit arithmeti| 00001ea0 63 0d 0e 38 05 20 0d 0e 42 33 4c 53 52 20 6d 75 |c..8. ..B3LSR mu| 00001eb0 6c 74 69 70 6c 69 65 72 2b 31 20 20 20 20 20 20 |ltiplier+1 | 00001ec0 5c 20 52 6f 74 61 74 65 20 6d 75 6c 74 69 70 6c |\ Rotate multipl| 00001ed0 69 65 72 20 72 69 67 68 74 0d 0e 4c 14 52 4f 52 |ier right..L.ROR| 00001ee0 20 6d 75 6c 74 69 70 6c 69 65 72 2b 32 0d 0e 56 | multiplier+2..V| 00001ef0 14 52 4f 52 20 6d 75 6c 74 69 70 6c 69 65 72 2b |.ROR multiplier+| 00001f00 33 0d 0e 60 14 52 4f 52 20 6d 75 6c 74 69 70 6c |3..`.ROR multipl| 00001f10 69 65 72 2b 34 0d 0e 6a 05 20 0d 0e 74 0d 2e 6d |ier+4..j. ..t..m| 00001f20 62 6d 5f 6c 6f 6f 70 0d 0e 7e 05 20 0d 0e 88 3a |bm_loop..~. ...:| 00001f30 42 43 43 20 6e 6f 5f 61 64 64 5f 6d 62 6d 20 20 |BCC no_add_mbm | 00001f40 20 20 20 20 20 20 5c 20 49 73 20 6e 65 78 74 20 | \ Is next | 00001f50 62 69 74 20 6f 66 20 6d 75 6c 74 69 70 6c 69 65 |bit of multiplie| 00001f60 72 20 73 65 74 3f 0d 0e 92 07 43 4c 43 0d 0e 9c |r set?....CLC...| 00001f70 2c 4c 44 41 20 6d 75 6c 74 69 70 6c 69 63 61 6e |,LDA multiplican| 00001f80 64 2b 34 20 20 20 20 5c 20 41 64 64 20 6d 75 6c |d+4 \ Add mul| 00001f90 74 69 70 6c 69 63 61 6e 64 0d 0e a6 0e 41 44 43 |tiplicand....ADC| 00001fa0 20 70 70 77 73 2b 33 0d 0e b0 0e 53 54 41 20 70 | ppws+3....STA p| 00001fb0 70 77 73 2b 33 0d 0e ba 16 4c 44 41 20 6d 75 6c |pws+3....LDA mul| 00001fc0 74 69 70 6c 69 63 61 6e 64 2b 33 0d 0e c4 0e 41 |tiplicand+3....A| 00001fd0 44 43 20 70 70 77 73 2b 32 0d 0e ce 0e 53 54 41 |DC ppws+2....STA| 00001fe0 20 70 70 77 73 2b 32 0d 0e d8 16 4c 44 41 20 6d | ppws+2....LDA m| 00001ff0 75 6c 74 69 70 6c 69 63 61 6e 64 2b 32 0d 0e e2 |ultiplicand+2...| 00002000 0e 41 44 43 20 70 70 77 73 2b 31 0d 0e ec 0e 53 |.ADC ppws+1....S| 00002010 54 41 20 70 70 77 73 2b 31 0d 0e f6 16 4c 44 41 |TA ppws+1....LDA| 00002020 20 6d 75 6c 74 69 70 6c 69 63 61 6e 64 2b 31 0d | multiplicand+1.| 00002030 0f 00 0c 41 44 43 20 70 70 77 73 0d 0f 0a 0c 53 |...ADC ppws....S| 00002040 54 41 20 70 70 77 73 0d 0f 14 05 20 0d 0f 1e 0f |TA ppws.... ....| 00002050 2e 6e 6f 5f 61 64 64 5f 6d 62 6d 0d 0f 28 05 20 |.no_add_mbm..(. | 00002060 0d 0f 32 3a 4c 53 52 20 70 70 77 73 20 20 20 20 |..2:LSR ppws | 00002070 20 20 20 20 20 20 20 20 20 20 5c 20 52 6f 74 61 | \ Rota| 00002080 74 65 20 70 70 77 73 20 26 20 6d 75 6c 74 69 70 |te ppws & multip| 00002090 6c 69 65 72 20 72 69 67 68 74 0d 0f 3c 0e 52 4f |lier right..<.RO| 000020a0 52 20 70 70 77 73 2b 31 0d 0f 46 0e 52 4f 52 20 |R ppws+1..F.ROR | 000020b0 70 70 77 73 2b 32 0d 0f 50 0e 52 4f 52 20 70 70 |ppws+2..P.ROR pp| 000020c0 77 73 2b 33 0d 0f 5a 14 52 4f 52 20 6d 75 6c 74 |ws+3..Z.ROR mult| 000020d0 69 70 6c 69 65 72 2b 31 0d 0f 64 14 52 4f 52 20 |iplier+1..d.ROR | 000020e0 6d 75 6c 74 69 70 6c 69 65 72 2b 32 0d 0f 6e 14 |multiplier+2..n.| 000020f0 52 4f 52 20 6d 75 6c 74 69 70 6c 69 65 72 2b 33 |ROR multiplier+3| 00002100 0d 0f 78 14 52 4f 52 20 6d 75 6c 74 69 70 6c 69 |..x.ROR multipli| 00002110 65 72 2b 34 0d 0f 82 39 44 45 58 20 20 20 20 20 |er+4...9DEX | 00002120 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 | \ | 00002130 43 6f 75 6e 74 69 6e 67 20 64 6f 77 6e 20 66 72 |Counting down fr| 00002140 6f 6d 20 33 32 20 74 6f 20 7a 65 72 6f 0d 0f 8c |om 32 to zero...| 00002150 10 42 4e 45 20 6d 62 6d 5f 6c 6f 6f 70 0d 0f 96 |.BNE mbm_loop...| 00002160 05 20 0d 0f a0 2a 5c 20 20 50 75 74 20 72 65 73 |. ...*\ Put res| 00002170 75 6c 74 20 69 6e 20 6d 75 6c 74 69 70 6c 69 63 |ult in multiplic| 00002180 61 6e 64 20 28 66 70 77 73 5f 31 29 0d 0f aa 05 |and (fpws_1)....| 00002190 20 0d 0f b4 0a 4c 44 58 20 23 34 0d 0f be 05 20 | ....LDX #4.... | 000021a0 0d 0f c8 11 2e 73 77 61 70 5f 6d 6d 5f 6c 6f 6f |.....swap_mm_loo| 000021b0 70 0d 0f d2 05 20 0d 0f dc 15 4c 44 41 20 6d 75 |p.... ....LDA mu| 000021c0 6c 74 69 70 6c 69 65 72 2c 20 58 0d 0f e6 17 53 |ltiplier, X....S| 000021d0 54 41 20 6d 75 6c 74 69 70 6c 69 63 61 6e 64 2c |TA multiplicand,| 000021e0 20 58 0d 0f f0 07 44 45 58 0d 0f fa 14 42 4e 45 | X....DEX....BNE| 000021f0 20 73 77 61 70 5f 6d 6d 5f 6c 6f 6f 70 0d 10 04 | swap_mm_loop...| 00002200 05 20 0d 10 0e 07 52 54 53 0d 10 18 05 20 0d 10 |. ....RTS.... ..| 00002210 22 12 2e 64 69 76 5f 6d 61 6e 74 69 73 73 61 65 |"..div_mantissae| 00002220 0d 10 2c 05 20 0d 10 36 35 5c 20 20 44 69 76 69 |..,. ..65\ Divi| 00002230 64 65 6e 64 20 69 73 20 69 6e 20 64 69 76 69 64 |dend is in divid| 00002240 65 6e 64 2c 20 64 69 76 69 73 6f 72 20 69 73 20 |end, divisor is | 00002250 69 6e 20 64 69 76 69 73 6f 72 0d 10 40 24 5c 20 |in divisor..@$\ | 00002260 20 4f 6e 20 65 78 69 74 20 72 65 73 75 6c 74 20 | On exit result | 00002270 69 73 20 69 6e 20 64 69 76 69 64 65 6e 64 0d 10 |is in dividend..| 00002280 4a 22 5c 20 20 70 64 77 73 20 68 6f 6c 64 73 20 |J"\ pdws holds | 00002290 70 61 72 74 69 61 6c 20 64 69 76 69 64 65 6e 64 |partial dividend| 000022a0 0d 10 54 36 5c 20 20 64 69 66 66 5f 77 73 20 69 |..T6\ diff_ws i| 000022b0 73 20 74 65 6d 70 20 77 73 20 74 6f 20 68 6f 6c |s temp ws to hol| 000022c0 64 20 70 64 69 76 2d 64 69 76 20 66 6f 72 20 74 |d pdiv-div for t| 000022d0 65 73 74 69 6e 67 0d 10 5e 05 20 0d 10 68 40 4c |esting..^. ..h@L| 000022e0 44 41 20 23 30 20 20 20 20 20 20 20 20 20 20 20 |DA #0 | 000022f0 20 20 20 20 20 20 20 20 20 20 5c 20 53 65 74 20 | \ Set | 00002300 70 61 72 74 69 61 6c 20 64 69 76 69 64 65 6e 64 |partial dividend| 00002310 20 77 73 20 74 6f 20 7a 65 72 6f 0d 10 72 0c 53 | ws to zero..r.S| 00002320 54 41 20 70 64 77 73 0d 10 7c 0e 53 54 41 20 70 |TA pdws..|.STA p| 00002330 64 77 73 2b 31 0d 10 86 0e 53 54 41 20 70 64 77 |dws+1....STA pdw| 00002340 73 2b 32 0d 10 90 0e 53 54 41 20 70 64 77 73 2b |s+2....STA pdws+| 00002350 33 0d 10 9a 0e 53 54 41 20 70 64 77 73 2b 34 0d |3....STA pdws+4.| 00002360 10 a4 0e 53 54 41 20 70 64 77 73 2b 35 0d 10 ae |...STA pdws+5...| 00002370 05 20 0d 10 b8 30 4c 44 58 20 23 34 38 20 20 20 |. ...0LDX #48 | 00002380 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002390 20 5c 20 34 38 20 62 69 74 20 64 69 76 69 64 65 | \ 48 bit divide| 000023a0 6e 64 0d 10 c2 05 20 0d 10 cc 0d 2e 6d 62 64 5f |nd.... .....mbd_| 000023b0 6c 6f 6f 70 0d 10 d6 05 20 0d 10 e0 4b 41 53 4c |loop.... ...KASL| 000023c0 20 64 69 76 69 64 65 6e 64 2b 36 20 20 20 20 20 | dividend+6 | 000023d0 20 20 20 20 20 20 20 20 5c 20 52 6f 74 61 74 65 | \ Rotate| 000023e0 20 64 69 76 69 64 65 6e 64 20 6c 65 66 74 20 69 | dividend left i| 000023f0 6e 74 6f 20 70 61 72 74 69 61 6c 20 64 69 76 69 |nto partial divi| 00002400 64 65 6e 64 0d 10 ea 12 52 4f 4c 20 64 69 76 69 |dend....ROL divi| 00002410 64 65 6e 64 2b 35 0d 10 f4 12 52 4f 4c 20 64 69 |dend+5....ROL di| 00002420 76 69 64 65 6e 64 2b 34 0d 10 fe 12 52 4f 4c 20 |vidend+4....ROL | 00002430 64 69 76 69 64 65 6e 64 2b 33 0d 11 08 12 52 4f |dividend+3....RO| 00002440 4c 20 64 69 76 69 64 65 6e 64 2b 32 0d 11 12 12 |L dividend+2....| 00002450 52 4f 4c 20 64 69 76 69 64 65 6e 64 2b 31 0d 11 |ROL dividend+1..| 00002460 1c 0e 52 4f 4c 20 70 64 77 73 2b 35 0d 11 26 0e |..ROL pdws+5..&.| 00002470 52 4f 4c 20 70 64 77 73 2b 34 0d 11 30 0e 52 4f |ROL pdws+4..0.RO| 00002480 4c 20 70 64 77 73 2b 33 0d 11 3a 0e 52 4f 4c 20 |L pdws+3..:.ROL | 00002490 70 64 77 73 2b 32 0d 11 44 0e 52 4f 4c 20 70 64 |pdws+2..D.ROL pd| 000024a0 77 73 2b 31 0d 11 4e 0c 52 4f 4c 20 70 64 77 73 |ws+1..N.ROL pdws| 000024b0 0d 11 58 05 20 0d 11 62 07 53 45 43 0d 11 6c 47 |..X. ..b.SEC..lG| 000024c0 4c 44 41 20 70 64 77 73 2b 35 20 20 20 20 20 20 |LDA pdws+5 | 000024d0 20 20 20 20 20 20 20 20 20 20 20 5c 20 53 75 62 | \ Sub| 000024e0 74 72 61 63 74 20 64 69 76 69 73 6f 72 20 66 72 |tract divisor fr| 000024f0 6f 6d 20 70 61 72 74 69 61 6c 20 64 69 76 69 64 |om partial divid| 00002500 65 6e 64 0d 11 76 11 53 42 43 20 64 69 76 69 73 |end..v.SBC divis| 00002510 6f 72 2b 36 0d 11 80 11 53 54 41 20 64 69 66 66 |or+6....STA diff| 00002520 5f 77 73 2b 35 0d 11 8a 0e 4c 44 41 20 70 64 77 |_ws+5....LDA pdw| 00002530 73 2b 34 0d 11 94 11 53 42 43 20 64 69 76 69 73 |s+4....SBC divis| 00002540 6f 72 2b 35 0d 11 9e 11 53 54 41 20 64 69 66 66 |or+5....STA diff| 00002550 5f 77 73 2b 34 0d 11 a8 0e 4c 44 41 20 70 64 77 |_ws+4....LDA pdw| 00002560 73 2b 33 0d 11 b2 11 53 42 43 20 64 69 76 69 73 |s+3....SBC divis| 00002570 6f 72 2b 34 0d 11 bc 11 53 54 41 20 64 69 66 66 |or+4....STA diff| 00002580 5f 77 73 2b 33 0d 11 c6 0e 4c 44 41 20 70 64 77 |_ws+3....LDA pdw| 00002590 73 2b 32 0d 11 d0 11 53 42 43 20 64 69 76 69 73 |s+2....SBC divis| 000025a0 6f 72 2b 33 0d 11 da 11 53 54 41 20 64 69 66 66 |or+3....STA diff| 000025b0 5f 77 73 2b 32 0d 11 e4 0e 4c 44 41 20 70 64 77 |_ws+2....LDA pdw| 000025c0 73 2b 31 0d 11 ee 11 53 42 43 20 64 69 76 69 73 |s+1....SBC divis| 000025d0 6f 72 2b 32 0d 11 f8 11 53 54 41 20 64 69 66 66 |or+2....STA diff| 000025e0 5f 77 73 2b 31 0d 12 02 0c 4c 44 41 20 70 64 77 |_ws+1....LDA pdw| 000025f0 73 0d 12 0c 11 53 42 43 20 64 69 76 69 73 6f 72 |s....SBC divisor| 00002600 2b 31 0d 12 16 0f 53 54 41 20 64 69 66 66 5f 77 |+1....STA diff_w| 00002610 73 0d 12 20 05 20 0d 12 2a 3f 42 43 43 20 6e 6f |s.. . ..*?BCC no| 00002620 5f 73 75 62 74 72 61 63 74 5f 6d 62 64 20 20 20 |_subtract_mbd | 00002630 20 20 20 20 20 5c 20 43 61 72 72 79 20 73 65 74 | \ Carry set| 00002640 20 69 66 20 64 69 66 66 5f 77 73 20 3e 20 64 69 | if diff_ws > di| 00002650 76 69 73 6f 72 0d 12 34 05 20 0d 12 3e 43 49 4e |visor..4. ..>CIN| 00002660 43 20 64 69 76 69 64 65 6e 64 2b 36 20 20 20 20 |C dividend+6 | 00002670 20 20 20 20 20 20 20 20 20 5c 20 49 6e 63 72 65 | \ Incre| 00002680 61 73 65 20 72 65 73 75 6c 74 20 69 66 20 77 65 |ase result if we| 00002690 20 63 61 6e 20 73 75 62 74 72 61 63 74 0d 12 48 | can subtract..H| 000026a0 0a 4c 44 59 20 23 36 0d 12 52 05 20 0d 12 5c 18 |.LDY #6..R. ..\.| 000026b0 2e 64 69 66 66 5f 77 5f 74 6f 5f 70 64 77 73 5f |.diff_w_to_pdws_| 000026c0 6c 6f 6f 70 0d 12 66 05 20 0d 12 70 14 4c 44 41 |loop..f. ..p.LDA| 000026d0 20 64 69 66 66 5f 77 73 2d 31 2c 20 59 0d 12 7a | diff_ws-1, Y..z| 000026e0 11 53 54 41 20 70 64 77 73 2d 31 2c 20 59 0d 12 |.STA pdws-1, Y..| 000026f0 84 05 20 0d 12 8e 07 44 45 59 0d 12 98 1b 42 4e |.. ....DEY....BN| 00002700 45 20 64 69 66 66 5f 77 5f 74 6f 5f 70 64 77 73 |E diff_w_to_pdws| 00002710 5f 6c 6f 6f 70 0d 12 a2 05 20 0d 12 ac 14 2e 6e |_loop.... .....n| 00002720 6f 5f 73 75 62 74 72 61 63 74 5f 6d 62 64 0d 12 |o_subtract_mbd..| 00002730 b6 05 20 0d 12 c0 29 44 45 58 20 20 20 20 20 20 |.. ...)DEX | 00002740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002750 20 20 5c 20 4e 65 78 74 20 62 69 74 0d 12 ca 10 | \ Next bit....| 00002760 42 4e 45 20 6d 62 64 5f 6c 6f 6f 70 0d 12 d4 05 |BNE mbd_loop....| 00002770 20 0d 12 de 07 52 54 53 0d 12 e8 05 20 0d 12 f2 | ....RTS.... ...| 00002780 17 2e 72 65 6e 6f 72 6d 61 6c 69 73 65 5f 6d 75 |..renormalise_mu| 00002790 6c 64 69 76 0d 12 fc 05 20 0d 13 06 43 5c 20 54 |ldiv.... ...C\ T| 000027a0 68 69 73 20 72 6f 75 74 69 6e 65 20 6d 6f 64 69 |his routine modi| 000027b0 66 69 65 73 20 74 68 65 20 6d 61 6e 74 69 73 73 |fies the mantiss| 000027c0 61 20 61 6e 64 20 65 78 70 6f 6e 65 6e 74 20 6f |a and exponent o| 000027d0 66 20 74 68 65 20 72 65 73 75 6c 74 0d 13 10 2c |f the result...,| 000027e0 5c 20 54 6f 20 70 72 6f 64 75 63 65 20 61 20 6e |\ To produce a n| 000027f0 6f 72 6d 61 6c 69 73 65 64 20 66 6f 72 6d 61 74 |ormalised format| 00002800 20 6e 75 6d 62 65 72 2e 0d 13 1a 05 20 0d 13 24 | number..... ..$| 00002810 3f 5c 20 20 46 69 72 73 74 20 74 72 61 70 20 61 |?\ First trap a| 00002820 20 7a 65 72 6f 20 72 65 73 75 6c 74 2c 20 6f 72 | zero result, or| 00002830 20 6c 6f 6f 70 73 20 77 69 6c 6c 20 72 75 6e 20 | loops will run | 00002840 69 6e 64 65 66 69 6e 61 74 65 6c 79 0d 13 2e 05 |indefinately....| 00002850 20 0d 13 38 10 4c 44 41 20 66 70 77 73 5f 31 2b | ..8.LDA fpws_1+| 00002860 31 0d 13 42 0f 84 41 20 66 70 77 73 5f 31 2b 32 |1..B..A fpws_1+2| 00002870 0d 13 4c 0f 84 41 20 66 70 77 73 5f 31 2b 33 0d |..L..A fpws_1+3.| 00002880 13 56 0f 84 41 20 66 70 77 73 5f 31 2b 34 0d 13 |.V..A fpws_1+4..| 00002890 60 0f 84 41 20 66 70 77 73 5f 31 2b 35 0d 13 6a |`..A fpws_1+5..j| 000028a0 0f 84 41 20 66 70 77 73 5f 31 2b 36 0d 13 74 05 |..A fpws_1+6..t.| 000028b0 20 0d 13 7e 11 42 45 51 20 7a 65 72 6f 5f 6e 6f | ..~.BEQ zero_no| 000028c0 72 6d 0d 13 88 05 20 0d 13 92 46 4c 44 41 20 66 |rm.... ...FLDA f| 000028d0 70 77 73 5f 31 2b 31 20 20 20 20 20 20 20 20 20 |pws_1+1 | 000028e0 20 20 20 20 20 20 20 5c 20 54 6f 70 20 62 79 74 | \ Top byt| 000028f0 65 20 6f 66 20 6d 61 6e 74 69 73 73 61 20 69 73 |e of mantissa is| 00002900 20 73 68 69 66 74 65 64 20 6c 65 66 74 0d 13 9c | shifted left...| 00002910 41 42 4d 49 20 6e 6f 72 6d 61 6c 69 73 65 64 20 |ABMI normalised | 00002920 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 75 | \ u| 00002930 6e 74 69 6c 20 74 6f 70 20 62 69 74 20 69 73 20 |ntil top bit is | 00002940 73 65 74 20 28 69 2e 65 2e 20 2d 76 65 29 0d 13 |set (i.e. -ve)..| 00002950 a6 05 20 0d 13 b0 14 2e 73 68 69 66 74 5f 6c 65 |.. .....shift_le| 00002960 66 74 5f 6c 6f 6f 70 0d 13 ba 05 20 0d 13 c4 37 |ft_loop.... ...7| 00002970 44 45 43 20 66 70 77 73 5f 31 20 20 20 20 20 20 |DEC fpws_1 | 00002980 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 44 65 | \ De| 00002990 63 72 65 61 73 65 20 74 68 65 20 65 78 70 6f 6e |crease the expon| 000029a0 65 6e 74 0d 13 ce 43 41 53 4c 20 66 70 77 73 5f |ent...CASL fpws_| 000029b0 31 2b 36 20 20 20 20 20 20 20 20 20 20 20 20 20 |1+6 | 000029c0 20 20 20 5c 20 53 68 69 66 74 20 6d 61 6e 74 69 | \ Shift manti| 000029d0 73 73 61 20 6c 65 66 74 20 74 6f 20 63 6f 6d 70 |ssa left to comp| 000029e0 65 6e 73 61 74 65 0d 13 d8 10 52 4f 4c 20 66 70 |ensate....ROL fp| 000029f0 77 73 5f 31 2b 35 0d 13 e2 10 52 4f 4c 20 66 70 |ws_1+5....ROL fp| 00002a00 77 73 5f 31 2b 34 0d 13 ec 10 52 4f 4c 20 66 70 |ws_1+4....ROL fp| 00002a10 77 73 5f 31 2b 33 0d 13 f6 10 52 4f 4c 20 66 70 |ws_1+3....ROL fp| 00002a20 77 73 5f 31 2b 32 0d 14 00 10 52 4f 4c 20 66 70 |ws_1+2....ROL fp| 00002a30 77 73 5f 31 2b 31 0d 14 0a 05 20 0d 14 14 17 42 |ws_1+1.... ....B| 00002a40 50 4c 20 73 68 69 66 74 5f 6c 65 66 74 5f 6c 6f |PL shift_left_lo| 00002a50 6f 70 0d 14 1e 05 20 0d 14 28 0f 2e 6e 6f 72 6d |op.... ..(..norm| 00002a60 61 6c 69 73 65 64 0d 14 32 05 20 0d 14 3c 35 52 |alised..2. ..<5R| 00002a70 54 53 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |TS | 00002a80 20 20 20 20 20 20 20 20 20 20 20 5c 20 4e 75 6d | \ Num| 00002a90 62 65 72 20 72 65 6e 6f 72 6d 61 6c 69 73 65 64 |ber renormalised| 00002aa0 0d 14 46 05 20 0d 14 50 0e 2e 7a 65 72 6f 5f 6e |..F. ..P..zero_n| 00002ab0 6f 72 6d 0d 14 5a 05 20 0d 14 64 0a 4c 44 41 20 |orm..Z. ..d.LDA | 00002ac0 23 30 0d 14 6e 41 53 54 41 20 66 70 77 73 5f 31 |#0..nASTA fpws_1| 00002ad0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002ae0 20 20 5c 20 43 6c 65 61 72 20 65 78 70 6f 6e 65 | \ Clear expone| 00002af0 6e 74 20 6f 66 20 61 20 7a 65 72 6f 20 6e 75 6d |nt of a zero num| 00002b00 62 65 72 0d 14 78 05 20 0d 14 82 07 52 54 53 0d |ber..x. ....RTS.| 00002b10 14 8c 05 20 0d 14 96 15 2e 72 65 70 6c 61 63 65 |... .....replace| 00002b20 5f 73 69 67 6e 5f 62 69 74 0d 14 a0 05 20 0d 14 |_sign_bit.... ..| 00002b30 aa 13 4c 44 41 20 66 70 77 73 5f 31 5f 73 69 67 |..LDA fpws_1_sig| 00002b40 6e 0d 14 b4 47 82 20 66 70 77 73 5f 32 5f 73 69 |n...G. fpws_2_si| 00002b50 67 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 5c |gn \| 00002b60 20 82 20 73 69 67 6e 73 20 74 6f 67 65 74 68 65 | . signs togethe| 00002b70 72 20 74 6f 20 70 72 6f 64 75 63 65 20 72 65 73 |r to produce res| 00002b80 75 6c 74 20 73 69 67 6e 0d 14 be 44 80 20 23 26 |ult sign...D. #&| 00002b90 38 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |80 | 00002ba0 20 20 20 20 20 20 5c 20 57 65 27 72 65 20 6f 6e | \ We're on| 00002bb0 6c 79 20 69 6e 74 65 72 65 73 74 65 64 20 69 6e |ly interested in| 00002bc0 20 74 68 65 20 74 6f 70 20 62 69 74 0d 14 c8 07 | the top bit....| 00002bd0 43 4c 43 0d 14 d2 41 41 44 43 20 23 26 37 46 20 |CLC...AADC #&7F | 00002be0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00002bf0 20 20 20 5c 20 26 46 46 20 69 66 20 74 6f 70 20 | \ &FF if top | 00002c00 62 69 74 20 73 65 74 20 2d 20 26 37 46 20 69 66 |bit set - &7F if| 00002c10 20 6e 6f 74 0d 14 dc 35 80 20 66 70 77 73 5f 31 | not...5. fpws_1| 00002c20 2b 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |+1 | 00002c30 20 20 5c 20 54 6f 70 20 62 69 74 20 72 65 66 6c | \ Top bit refl| 00002c40 65 63 74 73 20 73 69 67 6e 0d 14 e6 36 53 54 41 |ects sign...6STA| 00002c50 20 66 70 77 73 5f 31 2b 31 20 20 20 20 20 20 20 | fpws_1+1 | 00002c60 20 20 20 20 20 20 20 20 20 5c 20 52 65 70 6c 61 | \ Repla| 00002c70 63 65 20 69 6e 20 77 6f 72 6b 73 70 61 63 65 0d |ce in workspace.| 00002c80 14 f0 05 20 0d 14 fa 07 52 54 53 0d 15 04 05 20 |... ....RTS.... | 00002c90 0d 15 0e 05 5d 0d 15 18 05 ed 0d 15 22 05 20 0d |....].......". .| 00002ca0 15 2c 05 f5 0d 15 36 05 20 0d 15 40 34 f1 20 27 |.,....6. ..@4. '| 00002cb0 22 46 6c 6f 61 74 69 6e 67 20 50 6f 69 6e 74 20 |"Floating Point | 00002cc0 4d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 61 |Multiplication a| 00002cd0 6e 64 20 44 69 76 69 73 69 6f 6e 22 27 0d 15 4a |nd Division"'..J| 00002ce0 22 e8 20 22 45 6e 74 65 72 20 74 68 65 20 66 69 |". "Enter the fi| 00002cf0 72 73 74 20 6e 75 6d 62 65 72 20 22 66 70 31 0d |rst number "fp1.| 00002d00 15 54 23 e8 20 22 45 6e 74 65 72 20 74 68 65 20 |.T#. "Enter the | 00002d10 73 65 63 6f 6e 64 20 6e 75 6d 62 65 72 20 22 66 |second number "f| 00002d20 70 32 0d 15 5e 05 f1 0d 15 68 05 20 0d 15 72 13 |p2..^....h. ..r.| 00002d30 d6 20 63 6f 64 65 25 2c 66 70 31 2c 66 70 32 0d |. code%,fp1,fp2.| 00002d40 15 7c 05 20 0d 15 86 10 f1 22 52 65 73 75 6c 74 |.|. ....."Result| 00002d50 73 3a 22 27 0d 15 90 2c f1 20 22 50 72 6f 64 75 |s:"'...,. "Produ| 00002d60 63 74 20 28 63 6f 64 65 29 20 69 73 20 20 22 3b |ct (code) is ";| 00002d70 a4 66 70 28 72 65 73 75 6c 74 5f 6d 75 6c 74 29 |.fp(result_mult)| 00002d80 0d 15 9a 23 f1 20 22 50 72 6f 64 75 63 74 20 28 |...#. "Product (| 00002d90 42 41 53 49 43 29 20 69 73 20 22 3b 66 70 31 2a |BASIC) is ";fp1*| 00002da0 66 70 32 0d 15 a4 05 20 0d 15 ae 2c f1 20 22 51 |fp2.... ...,. "Q| 00002db0 75 6f 74 69 65 6e 74 20 28 63 6f 64 65 29 20 69 |uotient (code) i| 00002dc0 73 20 20 22 3b a4 66 70 28 72 65 73 75 6c 74 5f |s ";.fp(result_| 00002dd0 64 69 76 29 0d 15 b8 24 f1 20 22 51 75 6f 74 69 |div)...$. "Quoti| 00002de0 65 6e 74 20 28 42 41 53 49 43 29 20 69 73 20 22 |ent (BASIC) is "| 00002df0 3b 66 70 31 2f 66 70 32 0d 15 c2 05 20 0d 15 cc |;fp1/fp2.... ...| 00002e00 07 fd 20 a3 0d 15 d6 05 20 0d 15 e0 05 e0 0d 15 |.. ..... .......| 00002e10 ea 05 20 0d 15 f4 1b 2a 2a 2a 2a 20 45 51 55 61 |.. ....**** EQUa| 00002e20 74 65 20 61 20 42 79 74 65 20 2a 2a 2a 2a 0d 15 |te a Byte ****..| 00002e30 fe 0f dd 20 a4 45 51 55 42 28 4e 25 29 0d 16 08 |... .EQUB(N%)...| 00002e40 10 3f 50 25 3d 4e 25 20 83 20 32 35 36 0d 16 12 |.?P%=N% . 256...| 00002e50 1e e7 20 28 70 61 73 73 25 20 80 20 33 29 20 3d |.. (pass% . 3) =| 00002e60 20 33 20 8c 20 f1 20 7e 3f 50 25 0d 16 1c 0b 50 | 3 . . ~?P%....P| 00002e70 25 3d 50 25 2b 31 0d 16 26 0a 3d 70 61 73 73 25 |%=P%+1..&.=pass%| 00002e80 0d 16 30 05 20 0d 16 3a 1d 2a 2a 2a 2a 20 45 51 |..0. ..:.**** EQ| 00002e90 55 61 74 65 20 61 20 53 74 72 69 6e 67 20 2a 2a |Uate a String **| 00002ea0 2a 2a 0d 16 44 0f dd 20 a4 45 51 55 53 28 4e 24 |**..D.. .EQUS(N$| 00002eb0 29 0d 16 4e 08 ea 20 4e 25 0d 16 58 08 fe 20 34 |)..N.. N%..X.. 4| 00002ec0 30 0d 16 62 12 e3 20 4e 25 3d 31 20 b8 20 a9 28 |0..b.. N%=1 . .(| 00002ed0 4e 24 29 0d 16 6c 13 4b 25 3d 97 28 c1 4e 24 2c |N$)..l.K%=.(.N$,| 00002ee0 4e 25 2c 31 29 29 0d 16 76 10 50 25 3f 28 4e 25 |N%,1))..v.P%?(N%| 00002ef0 2d 31 29 3d 4b 25 0d 16 80 25 e7 20 28 70 61 73 |-1)=K%...%. (pas| 00002f00 73 25 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 |s% . 3) = 3 . . | 00002f10 7e 50 25 3f 28 4e 25 2d 31 29 3b 0d 16 8a 05 ed |~P%?(N%-1);.....| 00002f20 0d 16 94 19 e7 20 28 70 61 73 73 25 20 80 20 33 |..... (pass% . 3| 00002f30 29 20 3d 20 33 20 8c 20 f1 0d 16 9e 0f 50 25 3d |) = 3 . .....P%=| 00002f40 50 25 2b a9 28 4e 24 29 0d 16 a8 07 fe 20 30 0d |P%+.(N$)..... 0.| 00002f50 16 b2 0a 3d 70 61 73 73 25 0d 16 bc 05 20 0d 16 |...=pass%.... ..| 00002f60 c6 28 2a 2a 2a 2a 20 45 51 55 61 74 65 20 61 20 |.(**** EQUate a | 00002f70 73 65 63 74 69 6f 6e 20 6f 66 20 4d 65 6d 6f 72 |section of Memor| 00002f80 79 20 2a 2a 2a 2a 0d 16 d0 1a dd 20 a4 45 51 55 |y ****..... .EQU| 00002f90 4d 28 6e 75 6d 62 65 72 25 2c 62 79 74 65 25 29 |M(number%,byte%)| 00002fa0 0d 16 da 08 ea 20 4e 25 0d 16 e4 08 fe 20 34 30 |..... N%..... 40| 00002fb0 0d 16 ee 16 e3 20 4e 25 3d 30 20 b8 20 6e 75 6d |..... N%=0 . num| 00002fc0 62 65 72 25 2d 31 0d 16 f8 0f 50 25 3f 4e 25 3d |ber%-1....P%?N%=| 00002fd0 62 79 74 65 25 0d 17 02 21 e7 20 28 70 61 73 73 |byte%...!. (pass| 00002fe0 25 20 80 20 33 29 20 3d 20 33 20 8c 20 f1 20 7e |% . 3) = 3 . . ~| 00002ff0 50 25 3f 4e 25 3b 0d 17 0c 05 ed 0d 17 16 19 e7 |P%?N%;..........| 00003000 20 28 70 61 73 73 25 20 80 20 33 29 20 3d 20 33 | (pass% . 3) = 3| 00003010 20 8c 20 f1 0d 17 20 11 50 25 3d 50 25 2b 6e 75 | . ... .P%=P%+nu| 00003020 6d 62 65 72 25 0d 17 2a 07 fe 20 30 0d 17 34 0a |mber%..*.. 0..4.| 00003030 3d 70 61 73 73 25 0d 17 3e 05 20 0d 17 48 18 2a |=pass%..>. ..H.*| 00003040 2a 2a 2a 20 52 65 76 65 72 73 65 20 46 50 20 2a |*** Reverse FP *| 00003050 2a 2a 2a 0d 17 52 1e 50 75 74 73 20 66 70 20 6e |***..R.Puts fp n| 00003060 75 6d 62 65 72 20 66 72 6f 6d 20 6d 65 6d 6f 72 |umber from memor| 00003070 79 0d 17 5c 13 69 6e 74 6f 20 76 61 72 69 61 62 |y..\.into variab| 00003080 6c 65 20 60 0d 17 66 0f dd 20 a4 66 70 28 6d 65 |le `..f.. .fp(me| 00003090 6d 25 29 0d 17 70 0c ea 20 4d 25 2c 20 4e 25 0d |m%)..p.. M%, N%.| 000030a0 17 7a 07 60 3d 30 0d 17 84 1a 4d 25 20 3d 20 33 |.z.`=0....M% = 3| 000030b0 2b 28 21 26 34 43 30 20 80 20 26 46 46 46 46 29 |+(!&4C0 . &FFFF)| 000030c0 0d 17 8e 0e e3 20 4e 25 3d 30 20 b8 20 34 0d 17 |..... N%=0 . 4..| 000030d0 98 11 4d 25 3f 4e 25 3d 6d 65 6d 25 3f 4e 25 0d |..M%?N%=mem%?N%.| 000030e0 17 a2 05 ed 0d 17 ac 06 3d 60 0d ff |........=`..| 000030ec