Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiuter PlotChat
#12
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!)
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?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)