Subject:
|
Re: Scout's Built-In 29 Subroutines & NQC?
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Sat, 30 Sep 2000 07:20:45 GMT
|
Viewed:
|
1977 times
|
| |
| |
In article <39D58EA1.2BE55F37@akasa.bc.ca>, Dean Husby
<nntp@akasa.bc.ca> wrote:
> I've been re-reading the Scout SDK and came across the following:
>
> "Program Block Library (subroutines)
> The Scout has an extensive subroutine library of general-purpose
> functions that can help reduce the size of downloaded user
> programs. Many of the subroutines expect parameters to be passed in
> local variables as outlined below.
> The built-in subroutines are numbered 3-32 whereas user subroutines are
> numbered 0-2."
>
> I haven't seen any mention of these in NQC? Is is supported?
In the old Scout API there were two calls:
#define local(n) (@((n) + 10))
void Call(const int n) { asm { 0x17, n }; }
You can enable the API by adding -D__SCOUT_COMPAT on the command line,
or just copy the above two lines into your program.
You have to manually assign values to the appropriate local var, then
call the sub by number. Very painful. To make matters worse, NQC is
going to try to use those locals itself. "#pragma reserve" only works
well for globals. So come collision is inevitable.
I obsoleted the API at about the same time NQC started making
intelligent use of locals, but instead of just being painful, the
collision problems make the API very tedious.
Ultimately, I'd like to add support for NQC to call these subs by name
(with arguments moved into the locals as required). This requires some
non-trivial changes to the function declaration syntax and code
generation and just hasn't been a high priority.
I suppose a 'baby step' would be to extend '#pragma reserve' to locals.
That way you could at least block out the locals and use the functions.
With some good macros/inline functions it wouldn't be too painful.
Dave
--
reply to: dbaum at enteract dot com
|
|
Message is in Reply To:
| | Scout's Built-In 29 Subroutines & NQC?
|
| I've been re-reading the Scout SDK and came across the following: "Program Block Library (subroutines) The Scout has an extensive subroutine library of general-purpose functions that can help reduce the size of downloaded user programs. Many of the (...) (24 years ago, 30-Sep-00, to lugnet.robotics.rcx.nqc)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|