Posted By
JamesD on 2017-12-06 12:09:20
| Re: Does the Plus/4 support some form of VARPTR() command?
As for $00 breaking the interpreter, that is just treated as a line terminator. The pointer to the next line will still have the original address. The only risk is that BASIC will try to compress the program and will overwrite the code starting after $00 with the next line of BASIC.
*edit* Here is the patch for CHRGOT, and the benchmark code that prompted it's creation My patch for CHRGOT speeds up the benchmark by about 4%. Technically, once the patch is installed, all these lines can be deleted until the machine is reset. This does nothing to prevent a program from extending until part of it is below ROM, so don't try to use it with large programs or the system will crash miserably.
CHRGOT patch:
0 REM012345678901234567890123456789012 5 A=4102:FORI=0 TO 30:READ T:POKE A+I,T :NEXT I:SYS A
10000 DATA 160,18,185,18,16,153,121,4,136,16,247,96 10010 DATA 160,0,177,59,201,58,144,1,96,233,47,201 10020 DATA 240,240,235,56,233,208,96
Benchmark code:
10 K=0:I=0:T=0:P=0 30 SCNCLR 100 PRINT "Prime Number Generator" 110 INPUT "Upper Limit";N
120 eTime=TIME 130 T=(N-3)/2 140 DIMA(T+1)
160 FORI=0TOT:A(I)=0:NEXT 200 FORI=0TOT:IFA(I)THENPRINT"..";:NEXT:GOTO330 210P=I+I+3:PRINTP;".";:K=I+P:IFK<=TTHENFORK=KTOTSTEPP:A(K)=1:NEXT:NEXT:GOTO330 260 NEXT
330 eTime=(TIME-eTime)/60 340 PRINT 350 PRINT "Total: ";eTime 360 END
Additional code to disable/enable screen for more speed.
115 POKE65286,PEEK(65286)AND239 335 POKE65286,PEEK(65286)OR16
Related thread on Atariage.com:
http://atariage.com/forums/topic/272023-basic-interpreter-speed-comparison-prime-number-generation/
|