MEGA65 / mega65-rom-public

MEGA65 ROM public issue reporting
4 stars 0 forks source link

Repair BASIC calls to SETBNK (BLOAD, BSAVE) #138

Closed dansanderson closed 3 months ago

dansanderson commented 3 months ago

Starting with some unknown ROM version prior to 920398, the KERNAL SETBNK call had been disabled. DOS operations ignored the internal ba variable in favor of direct manipulation of a 28-bit address in eal-eal+3, to support 28-bit load/save addresses. In 920398, we repaired SETBNK to both honor the original 12-bit API and support a 28-bit API via an extension: if bit 7 of the bank register is set, then treat its lower bits as the megabyte and another register as the bank.

I didn't notice that calls to SETBNK from within BASIC were left intact after SETBNK was disabled. We need to audit these call sites and make sure they work with the new SETBNK definition. Ideally, we would rewrite these call sites to use the new 28-bit SETBNK API, as appropriate, and not manipulate eal directly.

At least one case of BLOAD "FILE",P(xxx),B(bbb) was noticed to be faulty. See the "C65 Notepad" demo, line 42, which does all memory operations via BASIC commands.

From a quick code review, it looks like only BLOAD and BSAVE are affected. b65.src references to _setbank: