|GBDK libraries documentation|
|Prev||Chapter 4. Assembly language||Next|
lcc in common with almost all C compilers prepends a '_' to any function names. For example the function printf(...) begins at the label _printf::. Note that all functions are declared global.
The parameters to a function are pushed in right to left order with no aligning - so a byte takes up a byte on the stack instead of the more natural word. So for example the function int store_byte( UWORD addr, UBYTE byte) would push 'byte' onto the stack first then addr using a total of three bytes. As the return address is also pushed, the stack would contain:
At SP+0 - the return address
At SP+2 - addr
At SP+4 - byte
The function returns in DE. I'm not sure how a FP number is returned.
|Assembly language||Up||Variables and registers|