Skip to content

Proposed enhancement FUNCTION or DEF FN #69

@marianodominguez

Description

@marianodominguez

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions