irmen/prog8

Fix definition of `cx16.fetch()` function

Closed this issue · 3 comments

The definition of fetch in cx16's syslib is incorrect:

romsub $ff74 = fetch(ubyte bank @X, ubyte index @Y) clobbers(X) -> ubyte @A

this kernal function also takes @A as an address of the zeropage address, that holds the address. quoting docs:

This function performs an LDA (ZP),Y from any RAM or ROM bank. The the zero page address containing the base address is passed in .A, the bank in .X and the offset from the vector in .Y.

what an awkward function to use

I guess stash() is also wrong? In the doc it says it doesn't pass the address in A but instead uses a fixed location somewhere else?

🤷‍♂️

I guess stash() is also wrong? In the doc it says it doesn't pass the address in A but instead uses a fixed location somewhere else?

stash is correct, although prog8 doesn't have a definition of the memory location, which is specified somewhere in the docs