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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [primesf.mms] - Blame information for rev 239

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

Line No. Rev Author Line
1 15 hellwig
% Example program ... Table of primes (floating point version)
2
L      IS   500          The number of primes to find
3
t      IS   $255         Temporary storage
4
n      GREG
5
q      GREG
6
r      GREG
7
jj     GREG
8
kk     GREG
9
pk     GREG
10
mm     IS   kk
11
 
12
       LOC  Data_Segment
13
PRIME1 WYDE 2
14
       LOC  PRIME1+2*L
15
ptop   GREG @
16
j0     GREG PRIME1+2-@
17
BUF    OCTA
18
 
19
       LOC  #100
20
Main   SET  n,3
21
       SET  jj,j0
22
2H     STWU n,ptop,jj
23
       INCL jj,2
24
3H     BZ   jj,2F
25
4H     INCL n,2
26
5H     SET  kk,j0
27
fn    GREG 0
28
sqrtn GREG 0
29
      FLOT fn,n
30
      FSQRT sqrtn,fn
31
6H     LDWU pk,ptop,kk
32
      FLOT t,pk
33
      FREM r,fn,t
34
       BZ   r,4B
35
7H    FCMP t,t,sqrtn
36
       BNN  t,2B
37
8H     INCL kk,2
38
       JMP  6B
39
       GREG @
40
Title  BYTE "First Five Hundred Primes"
41
NewLn  BYTE #a,0
42
Blanks BYTE "   ",0
43
2H     LDA  t,Title
44
       TRAP 0,Fputs,StdOut
45
       NEG  mm,2
46
3H     ADD  mm,mm,j0
47
       LDA  t,Blanks
48
       TRAP 0,Fputs,StdOut
49
2H     LDWU pk,ptop,mm
50
0H     GREG #2030303030000000
51
       STOU 0B,BUF
52
       LDA  t,BUF+4
53
1H     DIV  pk,pk,10
54
       GET  r,rR
55
       INCL r,'0'
56
       STBU r,t,0
57
       SUB  t,t,1
58
       PBNZ pk,1B
59
       LDA  t,BUF
60
       TRAP 0,Fputs,StdOut
61
       INCL mm,2*L/10
62
       PBN  mm,2B
63
       LDA  t,NewLn
64
       TRAP 0,Fputs,StdOut
65
       CMP  t,mm,2*(L/10-1)
66
       PBNZ t,3B
67
       TRAP 0,Halt,0

powered by: WebSVN 2.1.0

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