1
0
mirror of https://github.com/simh/simh.git synced 2026-02-22 07:08:21 +00:00
Files
simh.simh/I650/sw/fortransit/fortransit_example_1_src.txt
Roberto Sancho Villa 13cb294274 I650: Release 3
New Hardware support:
- IBM 653 Storage Unit: provides machine opcodes
  for Floating Point, Immediate Access Storage (IAS),
  Three Index registers, Cards Punch-read
  synchronizers 2 and 3.
New Software included:
- FORTRANSIT: version II (S), plus run time PACKAGE
  with standard Fortran functions.
- Reorganized sw directory, separating each language
  in its own folder. Each one Includes a 00_readme.txt
  file with restoration notes and comments.
New features:
- Support for SOAP opcode mnemonics in addition
  to regular IBM mnemonics
- FAST / REALTIME CPU options
- PROP pseudo register
- CARDDECK ECHOLAST command
2018-05-18 21:58:24 +02:00

35 lines
1005 B
Plaintext

c ------------------------------
c prime number generator using the sieve of eratosthenes
c converted to fortransit
c ------------------------------
c
dimension ifl(50)
c *** set ending number to be tested (must match array dimension)
isize=50
c *** mark all numbers in the sieve as prime initially, except 2
do 10 i=1,isize
10 ifl(i)=1
ifl(1)=0
c
c *** work through the list, finding the next marked number
c
do 40 num=1,isize
if (ifl(num)) 15,40,15
c *** marked number is the current prime, form its first multiple
15 iprme=num
mult=iprme+iprme
c *** unmark all multiples of the current prime
20 if (mult-isize) 25,25,40
25 do 30 i=mult,isize,iprme
30 ifl(i)=0
c *** go find next unmarked number
40 continue
c
c *** print results - all numbers that are still marked
c
do 50 num=1,isize
if (ifl(num)) 45,50,45
45 punch, num
50 continue
end