33 minutes ago, TomXP411 said:
** I figured out the difference. My first test used the READST API. The second time around, I just did an LDA FILE_STATUS, which reads directly from the system RAM location. This is unsafe, as the location may change.
What surprises me is that READST is that inefficient. It added something like 30% to the overall runtime of the routine.
4 minutes ago, TomXP411 said:
So I stepped through the KERNAL code. It's just a lot of code. I kind of lost track at 100+ steps in the KERNAL.
Woah, how'd that happen? I'm digging through disassembled code in the emulator, and if you're starting from ROM bank 0, that should be:
Quote
JSR $FFB7 ; 6 cycles, calling READST
JMP $D646 ; 3 cycles, READST jumps into the kernal implementation
LDA $0286 ; 4 cycles
ORA $0286 ; 4 cycles
STA $0286 ; 4 cycles
RTS ; 6 cycles, returning to the calling code
Edit: If you're not starting from ROM bank 0, say you're in ROM bank 4 (BASIC), there may be hoops it jumps through to trampouline into the ROM implementation. Or there may be another implementation altogether that assumes we're running a BASIC command...