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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [primesx.mms] - Blame information for rev 49

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

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

powered by: WebSVN 2.1.0

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