Anonymous user
Ethiopian multiplication: Difference between revisions
→{{header|MMIX}}: replace program with a version with separate functions 'odd,'halve' & 'double'
(added MMIX example) |
(→{{header|MMIX}}: replace program with a version with separate functions 'odd,'halve' & 'double') |
||
Line 779:
LOC #1000 % locate program at address
GREG @
halve SR pliar,pliar,1
GO $127,$127,0
double SL pliand,pliand,1
GO $127,$127,0
odd DIV $77,pliar,2
GET $78,rR
GO $127,$127,0
% Main is the entry point of the program
Main SET pliar,A % initialize registers for calculation
SET pliand,B
SET acc,0
1H GO $127,odd
ADD acc,acc,pliand %
2H
PBNZ pliar,1B % repeat from 1H while pliar > 0
// result: acc = 17 x 34
|