multi value returns with longs

This commit is contained in:
Irmen de Jong
2025-09-29 02:32:56 +02:00
parent 88c5d9783a
commit 67f7ffa52d
7 changed files with 29 additions and 35 deletions

View File

@@ -160,7 +160,7 @@ Regular subroutines
**Single arguments will often be passed in registers:**
For *single* byte, word, long, and pointer arguments, the values are simply loaded in cpu registers by the caller before calling the subroutine.
For *single* byte, word, and pointer arguments (not long or float), the values are simply loaded in cpu registers by the caller before calling the subroutine.
*The subroutine itself will take care of putting the values into the parameter variables.* This saves on code size because
otherwise all callers would have to store the values in those variables themselves.
Note that his convention is also still used for subroutines that specify parameters to be put into
@@ -179,7 +179,7 @@ Single word parameter: ``sub foo(uword bar) { ... }``
Single pointer parameter: ``sub foo(^^ubyte bar) { ... }``
gets bar in the register pair A + Y (lsb in A, msb in Y), *subroutine* stores it into parameter variable
Floating point parameter: ``sub foo(float bar) { ... }``
Long or Floating point parameter: ``sub foo(long bar) { ... }``, ``sub foo(float bar) { ... }``
value for bar gets stored into the parameter variable *by the caller*
Other: ``sub foo(ubyte bar, ubyte baz, ubyte zoo) { ... }``

View File

@@ -3,7 +3,6 @@ TODO
LONG TYPE
---------
- call convention: NEVER put LONG parameter into R0:R1 just use parameter variable (also fix convention doc)
- call convention for asmsubs: asmsubs don't have syntax for passing a long value so use explicit separate msw() and lsw() arguments... Or introduce new syntax for R0+R1 combo's?
- make sure == and != work with longs against byte and words as well signed and unsigned
- how hard is it to also implement the other comparison operators on longs?
@@ -32,6 +31,9 @@ STRUCTS and TYPED POINTERS
Future Things and Ideas
^^^^^^^^^^^^^^^^^^^^^^^
- After long variable type is completed: make all constants long by default (remove type name altogether), reduce to target type implictly if the actual value fits.
This will break some existing programs that depend on value wrap arounds, but gives more intuitive constant number handling.
Can give descriptive error message for old syntax that still includes the type name?
- improve ANTLR grammar with better error handling (as suggested by Qwen AI)
- allow memory() to occur in array initializer
- when a complete block is removed because unused, suppress all info messages about everything in the block being removed