Code: Select all
void monitor_putchar(char ch);
void main() {
const char *str = "\nHello there\n";
int n;
for(n = 0; n < 5; n++)
monitor_putchar(str[n]);
}
void monitor_putchar(char ch) {
asm {
lda %%ch
jsl $00:e04b
}
}
void IRQHandler() {}
And it's not the loop either. If I unroll the loop, the first nine invocations of monitor_putchar work, the tenth breaks everything. Same if the assembly is inlined, same if it's outputting the same character each time.
Nine times it works. Ten it doesn't. I don't even know where to start.
(Except that I kind of want to smash this board with a hammer and go back to the Z80)