Re: Elementary BASIC question - loading another file



dfevans@xxxxxxxxxxxxxxxxxx (David Evans) writes:

>>The standard manual doesn't mention this, it even states SYS does
>>not accept anything else but a decimal number.

>Correct. However, in the code pointed to by the SYS, one is of
>course free to parse as much of the following program text as one
>pleases. There are mechanisms to do this within the BASIC ROM that are
>used by the code that implements each command and function.

Couldn't have said it better myself. In this case, it's jumping directly
to the common portion of file operations in BASIC ROM that gets parameters
(accepts a filename, device and secondary address), as if it were preceded
by a LOAD keyword in this case.

>>The USR function
>>does allow to pass a parameter, although I have never seen this
>>function used.

> USR can be kind of a pain, so people often just avoid it. It's easier
>to use the scheme presented here, once you know how.

USR has its uses, um, no pun intended. I use it to implement routines where
I need to pass back data and I'd rather not use the "expense" of having to
assemble a value from PEEKs and multiplies.

For that matter, for EvW's benefit, USR() can be "made" to accept additional
values, such as X=USR(5),3,"XYZ" just by parsing additional BASIC text in
the same way. The first parameter is obligatory and placed in the floating
point accumulator, but the rest can be read in dynamically in the same way
you'd do for SYS.

--
Cameron Kaiser * ckaiser@xxxxxxxxxxxx * posting with a Commodore 128
personal page: http://www.armory.com/%7Espectre/
** Computer Workshops: games, productivity software and more for C64/128! **
** http://www.armory.com/%7Espectre/cwi/ **
.



Relevant Pages

  • Re: Performance Baseline for Solaris
    ... CPU - %usr, %sys ... Memory - Pgin Pgout ...
    (comp.unix.solaris)
  • Re: How git affects kernel.org performance
    ... Here's is a quick hack to practice the directory readahead idea. ... sys 0m4.370s ... usr 0.324, 0.284, 0.234s ... the patch applied). ...
    (Linux-Kernel)
  • Re: Search Path
    ... SYS, CUR are searched before USR. ... stops. ...
    (comp.sys.ibm.as400.misc)
  • Sar
    ... The follwoing output below the average of %usr and %sys is almost 100% and ... This is a 4 cpu box, does this look a bit high??? ...
    (SunManagers)