Date : Fri, 20 Nov 2009 00:31:38 +0000
From : rs423@... (Mick Champion)
Subject: Quine
Steve Fewell wrote:
> E5 is followed by 0 or more spaces, followed by #&8D (the Line number token),
followed by the line number encoded into the next 3-bytes.
> See this link for more details:
> http://bbcmicro.net/old-8bs/basic/basic4-9b1c.htm#9B1E
>
Thanks Steve. In that case here is another Quine. I hope I typed it
correctly AND it is actually a Quine this time.
10 A%=PAGE:REPEAT
20 IF ?A%=13 PROCNEWL:GOTO 70
30 IF ?A%=141 PROCGOTO:GOTO 70
40 IF ?A%>126 PROCTAG:GOTO70
50 IF ?A%<127 AND ?A% >31PRINT;CHR$?A%;
60 A%=A%+1
70 UNTIL ?A%=TOP-1
80 END
100 DEFPROCNEWL
110 PRINT
120 A%=A%+1
130 IF ?A%=255 PRINT"":ENDPROC
140 B%=?A%*256+A%?1:A%=A%+2:PRINT B%;
150 ENDPROC
200 DEFPROCGOTO
210 B%=TOP+1
220 ?B%=A%?1*4:B%?1=?B%
230 ?B%=?B% AND&C0
240 ?B%=A%?2 EOR?B%
250 B%?1=B%?1*4
260 B%?1=A%?3 EOR B%?1
270 PRINT ?B%-B%?1
280 A%=A%+4
290 E.
300 DEFPROCTAG
310 RESTORE:REPEAT:READ A,A$:UNTIL A=?A% OR A=0
320 IF A%="*" A$="<*"+STR$?A%+"*>"
330 PRINT;A$;:A%=A%+1
340 ENDPROC
400 DATA 128,"AND"
410 DATA 130,"EOR"
420 DATA 132,"OR"
430 DATA 144,"PAGE"
440 DATA 184,"TO"
450 DATA 195,"STR$"
460 DATA 220,"DATA"
470 DATA 221,"DEF"
480 DATA 224,"END"
490 DATA 225,"ENDPROC"
500 DATA 229,"GOTO"
510 DATA 231,"IF"
520 DATA 234,"FOR"
530 DATA 241,"PRINT"
540 DATA 242,"PROC"
550 DATA 243,"READ"
560 DATA 245,"REPEAT"
570 DATA 247,"REPEAT"
580 DATA 253,"UNTIL"
590 DATA 0,"*"
I notice that the the token for TOP is the same a TO. So really TOP is
TO P? You learn something every day! I must have too much time on my
hands :-P <tongue out for those with no smilies>
Cheers,
Mick.