OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [harm.mms] - Blame information for rev 66

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 hellwig
* Sum of Rounded Harmonic Series
2
MaxN IS 10
3
a GREG % Accumulator
4
c GREG % $2\cdot10^n$
5
d GREG % Divisor or digit
6
r GREG % Scaled reciprocal
7
s GREG % Scaled sum
8
m GREG % $m_k$
9
mm GREG % $m_{k+1}$
10
nn GREG % $n-\.{MaxN}$
11
     LOC Data_Segment
12
dec  GREG @+3 % decimal point loc
13
     BYTE "   ."
14
%    LOC  @+MaxN+6
15
     LOC #100
16
Main NEG nn,MaxN-1
17
     SET c,20
18
1H   SET m,1
19
     SR  s,c,1
20
     JMP 2F
21
3H   SUB a,c,1
22
     SL  d,r,1
23
     SUB d,d,1
24
     DIV mm,a,d
25
4H   SUB a,mm,m
26
     MUL a,r,a
27
     ADD s,s,a
28
     SET m,mm
29
2H   ADD a,c,m
30
     2ADDU d,m,2
31
     DIV r,a,d
32
     PBNZ r,3B
33
5H   ADD a,nn,MaxN+1
34
     SET d,#a
35
     JMP 7F
36
6H   DIV s,s,10
37
     GET d,rR
38
     INCL d,'0'
39
7H   STB d,dec,a
40
     SUB a,a,1
41
     BZ  a,@-4
42
     PBNZ s,6B
43
8H   SUB $255,dec,3
44
     TRAP 0,Fputs,StdOut
45
9H   INCL nn,1
46
     MUL  c,c,10
47
     PBNP nn,1B

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.