Monday, November 28, 2022

🪲 Subroutine invocation without the CALL statement : NOW IT REALLY WORKS !!!

In an earlier post,  I describe undoing a problem I introduced into wwwBASIC.  I had broken wwwBASIC's ability to handle subroutine invocation without using the CALL statement.

Just when I got it working again, I discover that wwwBASIC's code for handling subroutine invocations without the use of CALL is broken: if the subroutine has more than one parameter, none of the parameters beyond the first one actually get passed to the subroutine.

Now, BAM's embedded version of wwwBASIC can handle subroutine invocations without CALL just as well as subroutine invocations with CALL.

Sample code used to discover the issue:

sub hey(a$, d%, c$)

    print "a$: " + a$

    print "d%: " + d%

    print "c$: " + c$

end sub

 

call hey("howdy", 5, "later") ' this works no problem

hey("hello", 6, "bye-bye")    ' this, all parameters except the first are "lost"

Before today's fix, the subroutine invocation without CALL would only pass a value for the first parameter, and ignore all parameters beyond the first one.


No comments:

Post a Comment

🖥 Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...