tag:blogger.com,1999:blog-17487316.post8876910093994861415..comments2024-01-13T09:14:12.131+00:00Comments on The life of a Games Programmer: Trouble ahead.Mikehttp://www.blogger.com/profile/15958965170878448339noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-17487316.post-85188669467896181312008-08-03T07:40:00.000+00:002008-08-03T07:40:00.000+00:00Thats right, BRK adds 2 to the PC address on the s...Thats right, BRK adds 2 to the PC address on the stack, but RTI pops the address directoly (unlike RTS).<BR/><BR/>http://6502.org/tutorials/6502opcodes.html#RTI<BR/><BR/>I know its returning to the correctly place because if I code up<BR/><BR/>NOP<BR/>BRK<BR/>NOP<BR/><BR/>It then kicks into the debugger on the BRK okay, and because the stack is adjusted, it never gets any further because it keeps hitting the break. I'll have to test this further, but Im pretty sure this case is right. However... I really dont know why the rest of its not working yet.Mikehttps://www.blogger.com/profile/15958965170878448339noreply@blogger.comtag:blogger.com,1999:blog-17487316.post-35285119358462306072008-08-02T23:41:00.000+00:002008-08-02T23:41:00.000+00:00Aah, stop writing its when it's it's in your blog ...Aah, stop writing its when it's it's in your blog dammit ;)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-17487316.post-26773947234780691332008-08-02T21:32:00.000+00:002008-08-02T21:32:00.000+00:00Whoops, I had that a bit wrong. 1-byte opcode, an...Whoops, I had that a bit wrong. 1-byte opcode, and the PC on stack skips a 'signature' byte.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-17487316.post-23601657527653083212008-08-02T21:25:00.000+00:002008-08-02T21:25:00.000+00:00I was pretty sure that BRK, while a 2-byte opcode ...I was pretty sure that BRK, while a 2-byte opcode (ie. BRK with immediate operand), pushes only the PC+1 onto the stack, so the interrupt service routine can have more direct access to the operand.<BR/>RTI is supposed to add the other 1, as I recall. In your case, you might have to mess with the stack to recover with a jump. This probably doesn't explain your problem though. Are interrupts still operational ? Are you replacing the original opcode (+1 byte) back when you hit the BRK ?<BR/>Not quite enough information...Anonymousnoreply@blogger.com