Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
Normally when we meet a Buf (a $EB opcode) we push its ending address, later to be popped into the PC. However this doesn't seem to work when we have nested Bufs (i.e. a Buffer imbedded within another Buffer). On return from the inner Buffer, popping the PC results in jumping into the middle of the outer Buffer, instead of returning to the controlling procedure. We think we have now fixed this buglet by also pushing the SEQ flipflop (which indicates SEQuential code execution, i.e. incrementation of the PC after each instruction fetch. We do this by ORing the SEQ flipflop into the MSB of the PC, so that the first push has its sign bit set, but nested pushes have their MSB clear.
if (SEQ) PC |= 0x8000; // and later on : PC &= 0x7FFF;
This is fine since the page size is 32K (32768), hence the PC is always in the range $0000 ... $7FFF :)