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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [primes6.mms] - Blame information for rev 108

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

Line No. Rev Author Line
1 15 hellwig
% Example program ... Table of primes
2
L      IS   600          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
6H     LDWU pk,ptop,kk
28
       DIV  q,n,pk
29
       GET  r,rR
30
       BZ   r,4B
31
7H     CMP  t,q,pk
32
       BNP  t,2B
33
8H     INCL kk,2
34
       JMP  6B
35
       GREG @
36
Title  BYTE "First Six Hundred Primes"
37
NewLn  BYTE #a,0
38
Blanks BYTE "   ",0
39
2H     LDA  t,Title
40
       TRAP 0,Fputs,StdOut
41
       NEG  mm,2
42
3H     ADD  mm,mm,j0
43
       LDA  t,Blanks
44
       TRAP 0,Fputs,StdOut
45
2H     LDWU pk,ptop,mm
46
0H     GREG #2030303030000000
47
       STOU 0B,BUF
48
       LDA  t,BUF+4
49
1H     DIV  pk,pk,10
50
       GET  r,rR
51
       INCL r,'0'
52
       STBU r,t,0
53
       SUB  t,t,1
54
       PBNZ pk,1B
55
       LDA  t,BUF
56
       TRAP 0,Fputs,StdOut
57
       INCL mm,2*L/10
58
       PBN  mm,2B
59
       LDA  t,NewLn
60
       TRAP 0,Fputs,StdOut
61
       CMP  t,mm,2*(L/10-1)
62
       PBNZ t,3B
63
       TRAP 0,Halt,0

powered by: WebSVN 2.1.0

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