Voyager #03
19 октября 1998 |
![]() |
Laboratory - The algorithm of division and multiplication of large numbers.

* The second program (or rather two of them) implements fast algorithms for division and multiplication of large numbers. On this basis, it is easy to write the p / n decimal numbers in the registers (the conversion line in number). Designation: MUL_HLBC_DE: Registers HLBC = HLBC * DE DIV_HLBC_DE: Registers HLBC = HLBC / DE Entry point MUL16 and DIV16, as follows from names, perform the multiplication and division of 16-bit numbers. And, if multiplied by 16 bits at 16, then result is 32 bits. ;==================================== , 16-BIT MULTIPLY ;==================================== MUL16: LD HL, 0 MUL_HLBC_DE: LD A, B LD B, 11H JR L4928 L4921: JR NC, L4924 ADD HL, DE L4924: RR H RR L L4928: RRA RR C DJNZ L4921 LD B, A RET ;==================================== , 16-BIT DIVIDE ;==================================== DIV16: LD HL, 0 DIV_HLBC_DE: LD A, B LD B, 10H RL C RLA L493B: RL L RL H JR C, L494E SBC HL, DE JR NC, L4946 ADD HL, DE L4946: CCF L4947: RL C RLA DJNZ L493B LD B, A RET L494E: OR A SBC HL, DE JR L4947 * Well, like it is all for today. Yes, a little do not forget: all these applets written somewhere in the 1983 was none other than Tim Paterson, author of MSX-DOS and the first version of MS-DOS. Such are the things ...
Other articles:
Similar articles:
В этот день... 1 April
Info Guide #13,
ACNews #50,
Avro News #01,
ACNews #47,
ACNews #40,
ACNews #29,
Black Metall #01,
ACNews #16,
Adventurer #13,
Polesse #19,
Subliminal Extacy #03,
ZX Pilot #37,
Always #03,
Born Dead #0G,
Odyssey paper #08,
Optron #26,
City #08,
Zodiac #02,
Polesse #05,
Nicron #108,
X-Magazine #10,
Nicron #82,
Energy #01,
Sorrow News #03,
Sorrow News #02,
Proton #27,
Think #08,
Wallpaper #01,
Spectrum Progress #03,
Spectrum Expert #02,
Micro #01,
X-Files #02,
Gorodok #05,
Deja Vu #04,
Anecdotes #01,
X-Files #02,
Maximum #35,
Impulse #01,
Spectrofun #01,
Faultless #07,
Breeze #06,
Nicron #27,
Echo #03,
Oberon #01,
Spectrofon #19,
On-Line #30,
Sinclair Town #01,
Sinclair Classic #04,
Spectrofon #04