#!/bin/sh
#amstradcpc #math #primes #Ερατοσθένης #sieve #animation
{ cat <<'EOF'
mode 1
n=320*190-1:e=sqr(n)
for i=2 to e
locate 1,1:print i:y%=int(i/320):x%=i-320*y%
if test(x%*2,y%*2) then goto 7
for j=i*i to n step i:y%=int(j/320):x%=j-320*y%:plot x%*2,y%*2,1:next j
next i
EOF
}|nl -w1|unix2dos>h.bas
iDSK test.dsk -n -i h.bas -t 0
mame cpc664 -flop1 test.dsk -skip_gameinfo -ab '\n\nrun "h\n'
#amstradcpc #math #primes #Ερατοσθένης #sieve #animation
{ cat <<'EOF'
mode 1
n=320*190-1:e=sqr(n)
for i=2 to e
locate 1,1:print i:y%=int(i/320):x%=i-320*y%
if test(x%*2,y%*2) then goto 7
for j=i*i to n step i:y%=int(j/320):x%=j-320*y%:plot x%*2,y%*2,1:next j
next i
EOF
}|nl -w1|unix2dos>h.bas
iDSK test.dsk -n -i h.bas -t 0
mame cpc664 -flop1 test.dsk -skip_gameinfo -ab '\n\nrun "h\n'