I don't know if I am doing something completely wrong here, but if I write an assembly function that uses the new __sdcccall(1)
calling convention and accepts 3 uint8_t parameters (in A, L and stack according to the manual) and OUTs them to debugdevice like this:
func.z80:
.globl _func _func:: out (#0x02f), a ld a, l out (#0x02f), a ld hl, #2 add hl, sp ld a, (hl) out (#0x02f), a ret
And I call it like this:
extern void func(uint8_t i, uint8_t j, uint8_t k) __sdcccall(1); /* just to be sure */ void call_func() { uint8_t i; for (i = 0; i < 10; ++i) { func(11 + i, 6, 32 + i); func(11 + i, 7, 64 + i); func(11 + i, 8, 96 + i); } }
Running it through openmsx-debugger,
- on first call, A = 0x0B, L = 06 and stack contains 0x20 right before
call _func
, which is correct. - on second call, A = 0x0, L = 07 and stack contains 0x60, which is wrong (both A and stack are wrong).
Am I forgetting something? What's going on here? It used to work in 4.1.0...
Login or register to post comments