Hey,
Curt!
Recently I discovered MESS' debug functionality. As I traced a machine language program in MC-1000 step by step, I realized something weird: Once the automatic interruption RST #38 was called, it didn't run only once, but MANY TIMES IN SEQUENCE before returning to the normal running code. It seems that once the interruption is activated, it is called again at every line that MC6847 sends to the screen. (!?!?!)
I did a little machine code program to confirm the multiple interruption calls. You can use the debugger to put it in memory:
3f00 f3 21 00 00 22 4b 3f 2a 39 00 22 49 3f 21 3c 3f
3f10 22 39 00 fb 11 00 01 d5 2a 4b 3f 7c b5 28 09 cd
3f20 8b ee 21 00 00 22 4b 3f 0e 2e cd 97 c8 d1 1b 7a
3f30 b3 20 e4 f3 2a 49 3f 22 39 00 fb c9 f3 e5 2a 4b
3f40 3f 23 22 4b 3f e1 fb ed 4d 00 00 00 00
Essentially, this program implements the following pseudo-code:
main() {
counter = 0;
set rst#38 to myint;
for (i = 256; i != 0; i--) {
if (counter != 0) {
print(counter);
counter = 0;
}
print(".");
}
set rst#38 to default;
}
myint() {
counter++;
}
The program was expected to print 256 dots, with some "1"s here and there accusing that the interruption has been called and increased the counter to 1.
BUT... what we actually see in MESS is that, instead of "1", the number "574" is displayed every now and then. The RST#38 interruption is being called
574 times in sequence before returning control to the running program!!!
CALL 16128
................................
..................574...........
.............................574
................................
.......574......................
..................574...........
............................574.
................................
......574.........
OK
Maybe this explains what is happenning to the
Music Composer program, as described in my previous message. The routine originally called by the RST#38 interruption is responsible for the timing of music. If RST#38 is being overcalled 574 times in a row, the notes are rapidly consumed, and this unexpected condition somehow crashes the program.
How could this be fixed?
(Tonight I'll run this machine code program on my real MC-1000 and see what it displays. It could give us some clues for calibrating MESS � how many times the RST#38 is called during execution and if it produces only "1"s as expected.)