tschak909 / platoterm64

PLATOTerm for the Commodore 64
GNU General Public License v3.0
35 stars 11 forks source link

Fix the NMI trampoline. #1

Closed greg-king5 closed 6 years ago

greg-king5 commented 6 years ago

After I read a comment by Oliver (about how the NMI trampoline works), I realized that I had written the wrong code. My original code called the serial driver's handler as though it is an ordinary subroutine. But, it really is an interrupt handler; it returns to its caller in a different way. Therefore, my bad code created an "unbalanced" hardware stack -- of course, the program crashed.

I think that this new code "simulates an interrupt" correctly.

(I also gave the trampoline a more generic name.)

tschak909 commented 6 years ago

Thanks so much for this. Your initial fix looked right at first glance, so I was pulling my hair out trying to see what was wrong. ;)