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 October
Scream #04(scl),
Bred #02,
Screamergy #01,
Bred #01,
Open Letters #08,
Millenium #01,
Body #2F,
Deja Vu #0A,
X-Magazine #17,
ZX Chart #01,
Skimer #02,
X-Magazine #12,
Body #17,
Bugs #01,
Adventurer #10,
X-Magazine #07,
Wallpaper #05,
Proton #48,
ZX Pilot #29,
Cheat #03 demo,
Proton #48,
Deja Vu #06,
Deja Vu #02,
ZX-News #41,
Spectrum Progress #01,
Nicron #01,
Maximum #18,
ZX Digest #02,
Speccy #01,
Emulate #02,
Speccy #01,
200 #B,
Spectrofon #09,
ZX Revija #01