You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem with functions is that, for the 6502 compiler to work, you can´t write to variables or call statements from a function - and also you could not nest USR() functions.
Having a limited DEF FN implementation could work - it has the benefit of having a standard naming convention for functions ( FN* ).
This is a thing lacking in all Atari Basic implementations, ability to define functions. (same as PROC defines rubroutines)
https://zxbasic.readthedocs.io/en/docs/function/
I propose using the stack for being able to do recursive functions, if local variables are too complex, this implementation uses only parameter copy.
That allows for shorter code. eg
160 XX=X+1:EXEC HS:HS1=V:XX=X-1:EXEC HS:HS2=V:XX=X+3:EXEC HS:HS3=V:XX=X-3:EXEC HS:HS4=V
170 YT=(H-L)*HS1+(R-H)*HS2+(L-W)*HS3+(W-R)*HS4+W
becomes
170 YT=(H-L)*HS(X+1)+(R-H)*HS(X-1)+(L-W)*HS(X+3)+(W-R)*HS(X-3)+W
The text was updated successfully, but these errors were encountered: