On 4/1/2025 11:59 PM, b...@tds.net wrote:
I did some programming on the TRS-80 Model 4 back in the 80's so it has been a long time. I did add some functionality using machine code. I had a screen that displayed options to the user but took a long time to print it. So the first time it printed it dump the screen to memory. The every other time it was needed it move the info from the data to the screen. For a function, I used a subroutine. For example: 100 X=20 'argument of function 110 GOSUB 1000 'calculate y=myfunction(x) 120 R=A+B*Y 130 continue program 1000 REM this is the myfunction, input x, returns y 1010 function statements 1020 1030 1040 1050 1080 Y= .... REM Result of function 1090 RETURN Don't know if that if what you were looking for. Obviously not as clean as R=A*MYFUNCTION(X)
I knew (and tried a little bit to see how hard it would be) that method. But the catch is at this stage I am trying to convert a program from
NorthStar BASIC to TRS-80 BASIC. And all the multi-line functions are already there but, obviously, need to be replaced. Along with a lot of other conversions. Like the fact that there really are no strings in NorthStar BASIC. They are actually character arrays and bring with that some quirks that TRS-80 BASIC doesn't have. Because this is just a starting point for my long term project (really long term - I started this back when the TRS-80 was still mainline :-) I am thinking I will give up efficiency and just put the function code inline everywhere there is a call to that function. bill