commanderx16 / x16-docs

Commander X16 Documentation (CC BY-SA)
189 stars 64 forks source link

Suggestion to fix age-old CBM Kernal bug around Listen, Talk and IOStatus #90

Closed pzembrod closed 2 years ago

pzembrod commented 2 years ago

I ran into this when adapting VolksForth from the R38 to the R41 X16 Kernal. The Kernal version dependencies were all around use of Kernal variables which, for C64 and C16 was perfectly safe but for the X16 isn't as they, for good reasons, can still move from Kernal version to Kernal version.

The right thing to do was, of course, to replace the Kernal variable references with calls to the Kernal API, and in almost all cases I was successful doing that (thanks at this point for the new keyboard API). The one exception I couldn't yet fix was a reference to IOStatus (C64: $90, X16: currently $0289), for the purpose of clearing it before calls to LISTEN and TALK, respectively. As it turns out, IOStatus is not cleared at the beginning of these two Kernal routines, so one must clear it manually before calling them, or IEC error detection won't work properly. And it turns out there's no way to clear IOStatus in a reasonable way through Kernal API calls.

I have therefore two proposals:

  1. Fix this old Kernal bug: Clear IOStatus at the beginning of LISTEN and TALK
  2. Add an API call to clear IOStatus. It seems kinda wrong that one cannot do this.

WDYT?

pzembrod commented 2 years ago

I realize I opened this in the x16-docs project; it probably rather belongs into the rom project; will re-open it there.