2016-08-19 01:25:18 +00:00
|
|
|
# Russian Peasant Multiplication
|
|
|
|
|
2016-08-19 01:33:28 +00:00
|
|
|
From Assembly to Basic to Javascript.
|
|
|
|
|
|
|
|
Here are muy implementations of Russian Peasant Multiplication implemented in various languages:
|
2016-08-19 01:25:18 +00:00
|
|
|
|
|
|
|
* 6502 Assembly Language (Both ca65 and merlin32 sources)
|
|
|
|
* Applesoft BASIC
|
|
|
|
* JavaScript (Procedural version)
|
|
|
|
* JavaScript (OOP version)
|
|
|
|
|
2016-08-19 01:33:28 +00:00
|
|
|
A .dsk image has been provided as an convenience.
|
2016-08-19 01:25:18 +00:00
|
|
|
|
|
|
|
To see how much faster the Assembly version is then the BASIC version:
|
|
|
|
|
|
|
|
```
|
|
|
|
RUN RPM.BAS
|
|
|
|
BRUN RPM.BIN
|
|
|
|
```
|
|
|
|
|
|
|
|
And enter in `123456789` * `987654321` respectively for A and B ...
|
|
|
|
|
|
|
|
| Version | Time |
|
|
|
|
|:----------|:-----|
|
|
|
|
| Applesoft | 33 s |
|
|
|
|
| Assembly | ~1 s |
|
|
|
|
|