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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [primessf.mms] - Blame information for rev 255

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

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

powered by: WebSVN 2.1.0

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