07-10-2010, 03:24 AM
Fastcall, officially, allows ONE parameter to be sent, and it arrives already in the registers in the usual format for ZX BASIC.
byte,ubyte arrive in the A register.
integer,uinteger arrive in the HL register.
fixed,long,ulong arrive in DEHL
Here's an example (untested, because I just wrote it here!)
What this should do is accept a uByte (or actually, a byte; but it will treat it as an unsigned in and out), and increment it by one (with wraparound of 255+1=0) and return it.
Since this is a fastcall function, the variable "in" arrives in the A register already. Since its return type is uByte, what's in the A register is returned to the calling code.
Does that clear it up?
byte,ubyte arrive in the A register.
integer,uinteger arrive in the HL register.
fixed,long,ulong arrive in DEHL
Here's an example (untested, because I just wrote it here!)
Code:
FUNCTION FASTCALL AddOne (in as uByte) as uByte
asm
inc A
end asm
END FUNCTION
What this should do is accept a uByte (or actually, a byte; but it will treat it as an unsigned in and out), and increment it by one (with wraparound of 255+1=0) and return it.
Since this is a fastcall function, the variable "in" arrives in the A register already. Since its return type is uByte, what's in the A register is returned to the calling code.
Does that clear it up?