home:software:picasm
Differences
This shows you the differences between two versions of the page.
home:software:picasm [2009/01/21 01:41] – created this | home:software:picasm [2009/01/21 02:20] (current) – this | ||
---|---|---|---|
Line 18: | Line 18: | ||
VAR2 RES 1 | VAR2 RES 1 | ||
- | This will put _VAR1 / VAR1 at the same memory position. Never put the _VAR1 RES 0 *after* VAR1 RES 1! This would cause the assembler to give _VAR1 an address, but would not reserve any memory for it! | + | This will put _VAR1 / VAR1 at the same memory position. Never put the _VAR1 RES 0 **after** VAR1 RES 1! This would cause the assembler to give _VAR1 an address, but would not reserve any memory for it! |
Also refer this discussion in the forum: http:// | Also refer this discussion in the forum: http:// | ||
+ | ===== How does the SDCC compiler push function parameters to the stack? ===== | ||
+ | unsigned char FRAM_WriteBuf(unsigned char device_addr, | ||
+ | * If the function is defined with the __WPARAM directive, the first byte of the first parameter will be moved to WREG. | ||
+ | * All the other paramteres will be pushed to the stack in reverse direction (last parameter first). | ||
+ | * If a parameter is more than one byte long, always the most significant byte will be pushed first. | ||
+ | * Pointer types can have different sizes (depends on the target device, maybe also configuarble). When I compiled the code with the above function call for a PIC18F452, the pointer parameter was 3 bytes long. (**Update this info if you know more**) | ||
+ | * If the first parameter is more than one byte long, the MSB goes to WREG, the other bytes will be pushed to the stack **last** (also MSB to LSB). | ||
+ | |||
+ | The reverse direction makes sense when popping the parameters from the stack. The first byte popped will be the first parameter' |
home/software/picasm.1232502089.txt.gz · Last modified: 2009/01/21 01:41 by this