Closed ghost closed 3 years ago
I've just realized that keyboard also sends return value as response in some handler. It's at least consistent on MSG_ERROR
. Perhaps I could do the same with cartridge, but it feels weird returning 1 on error, which is MSG_ACK
and kind of indicate success.
@Naryosha Would you like to propose a change to the hardware spec, or are you comfortable leaving as is?
Since mentioning that R0 could be something else rather than MSG_*
would simply fix the issue, for now I'm comfortable as it is. I'll mention it in my own docs though because it's still an unofficial decision.
I see there are two ways to properly resolve this:
HWQ $02
) to match hardware specs: as written above. Hardware may write to R0, R1, and R2 with anything as defined in their specs.MSG_*
in R0. It also may not modify R1 and R2 if MSG_ERROR
is sent via R0.If I were to resolve it, it'd take some time. 😅
According to
cartridge.txt
, the cartridge puts the return value for messages in R0 register, but from the YCPU spec, R0 is reserved for message acknowledgement (MSG_ACK
,MSG_WAIT
,MSG_ERROR
).Should the return value be stored in R1 or R2 instead? (In the meantime I'll use R1 in my implementation.)