![]() |
Passing strings to assembler - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16) +---- Thread: Passing strings to assembler (/showthread.php?tid=742) |
Passing strings to assembler - Uto - 10-09-2016 Hi, I have this code: Code: ..... I need to get the string value in the ASM function, and I was expecting having a pointer to it as the second value in stack (so POP HL, POP DE, PUSH HL will keep the return adress in stack and DE as pointer to the string), but it doesn't seem to work like that, How could I get the string parameter from assembler? Re: Passing strings to assembler - boriel - 11-09-2016 Uto Wrote:Hi,I overlook this message! Sorry!! ![]() If your function only have one parameter like in your case, and you use FASTCALL, the pointer comes *already* in HL. You have to do nothing ![]() For FASTCALL the convention is: - 8 bits (Byte, UByte) -> A register - 16 bits (Integer, UInteger, STRING) -> HL - 32 Bits (LONG, FIXED) -> HL, DE (HL = Low part, DE = High Part) - 40 Bits (Float) -> HL,DE -> Mantissa. A -> Exponent For strings, better use ByVar to really get the pointer to the pointer. If not, remember to call FREE upon return or you will end UP with a memory leak. |