8-Bit Software Online Conversion
:0.$.PrimeSc - Listing
10REM Net Scanner
20REM Early Version
21REM (Prime Number Background)
22REM Run program while connected
23REM to Net, enjoy the maths!
24REM ESCAPE to save data
30S%=&2000:E%=&7B00
40M%=&70:!M%=S%
50FOR Z%=0TO 2STEP2
60P%=&900
70[OPTZ%
80.NMI BIT &FE18:PHP:PHA:TYA:PHA
90LDA &FEA2
100CMP #ASC"I":BNE CONT
110LDY#0:STA(M%),Y:LDA #20:STA &75:JMP
PASS
120.CONT
130STA &76:LDA &75:BEQ NMIEND:LDA &76:
LDY#0:STA(M%),Y:DEC &75
140.PASS
150INCM%:BNE NMIEND
160INC M%+1:LDA #E%DIV256:CMPM%+1:BNE
NMIEND
170.RES LDA #S%MOD256:STAM%
180LDA #S%DIV256:STAM%+1
190.NMIEND PLA:TAY:PLA:PLP
200JMP &D03
210]
211PRINT""
220NEXT Z%
230?&D00=&4C:?&D01=0:?&D02=9
240A%=S%
250GOTO280
260IF INKEY(-1)=-1THENA%=!M%
270GOTO 250
280ON ERROR IF ERR=17 GOTO 470 ELSE RE
PORT:PRINT" at line ";ERL:END
290D%=0
300PRINT;" ";
310MODE7
320CLS
330PRINT'"Prime Numbers:1,2,";
340N%=1
350REPEAT
360N%=N%+2
370C%=1
380T%=0
390REPEAT
400C%=C%+1
410IF (N% MOD C%)=0 THEN T%=1
420UNTIL ((C%>SQR(N%)) OR (T%=1))
430IF T%=0 PRINT;N%;",";
440REM MEGA OR WHAT?..
450REM
460UNTIL (!M% AND &FFFF)>&7A00
470D%=D%+1:OSCLI"SAVE DATA"+STR$D%+" 2
000 7A00"
480IF ERR=17 END
490?M%=&0:M%?1=&20
500GOTO350
510REM ..
520UNTIL FALSE