Date : Sat, 17 Dec 2011 13:24:17 +0100
From : kortink@... (John Kortink)
Subject: 32016 + 32082
On Sat, 17 Dec 2011 06:37:25 +0100, Rick Murray <rick@...>
wrote:
>On 16/12/2011 17:43, John Kortink wrote:
>
>> extent, unbound. You could probably crash BASIC in a single call
>> if you gave the relevant PROC or FN enough parameters.
>
>L.
>
> 10 X% = 0
> 20 DIM C% 2
> 30 P%=C%
> 40 [ OPT 2 : TSX : RTS : ]
> 50 PROCA(a%,b%,c%,d%,e%,f%,g%,h%,i%,j%,k%,l%,m%,n%,o%,p%,q%,r%,s%,t%,
>u%,v%,w%,x%,y%,z%,aa%,ab%,ac%,ad%,ae%,af%,ag%,ah%,ai%,aj%,ak%,al%,
>am%,an%,ao%,ap%,aq%,ar%,as%,at%,au%,av%,aw%,ax%,ay%,az%)
> 60 END
> 70 :
> 80 DEFPROCA(a%,b%,c%,d%,e%,f%,g%,h%,i%,j%,k%,l%,m%,n%,o%,p%,q%,r%,s%,t%,
>u%,v%,w%,x%,y%,z%,aa%,ab%,ac%,ad%,ae%,af%,ag%,ah%,ai%,aj%,ak%,al%,am%,
>an%,ao%,ap%,aq%,ar%,as%,at%,au%,av%,aw%,ax%,ay%,az%)
> 90 X% = X% + 1
>100 IF X% < 5 THEN GOTO 50
>110 VDU 7
>120 PRINT ~USR(C%)
>130 ENDPROC
>
>Grotty, icky, nasty. And works, but stack appears to be... &E3, as
>opposed to &ED if I call without the function.
You can't measure it like that. The 6502 stack is no longer
in use when the body of the PROC/FN is executed. It is in
use while it's evaluating actual parameters. So you need to
measure it via an actual parameter evaluation, and you can't
use FN.
So, you can basically only do it like this :
==========================================================
>LIST
10P% = &80:[OPT 0:TSX:TXA:RTS:]
20PRINT "High ";~USR(&80) AND &FF
30PROCdeep(1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,USR(&80))
40END
50DEFPROCdeep(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9)
60PRINT "Deep ";~a9 AND &FF
70ENDPROC
>RUN
High ED
Deep 2F
==========================================================
That's getting pretty close to the bottom, isn't it ...
>[...]
So, go ahead, make its day, and add even a few more.
John Kortink
--
Email : kortink@...
Homepage : http://www.inter.nl.net/users/J.Kortink