In SX Microcontrollers, SX/B Compiler and SX-Key Tool, sammishal wrote: Mr. Gunther, I am wondering...... The manual says that the PC register is actually a 9 bit register, BUT in the SXSim (and IDE Debug) the PC register is showing only 2 digit hex which is 8 bits, what is happening here when PC should be for example $300 (0011 0000 0000)? Now the MostSig 3 bits 001 are stored in the Status register but the next bit 1 is nowhere to be acounted for!!!???? Also I have a puzzle.......See this code: ====================================== LIST Q = 37 DEVICE SX28L, TURBO, STACKX, OSCHS2 IRC_CAL IRC_FAST FREQ 50_000_000 RESET _Main org $1FE _Main jmp @Main Org $200 Main mov w,#$01 call @subtest mov $08,w mov $08,w jmp $ Org $600 SUbTest mov $08,w mov $08,w mov w,#10 ret END ;End of program code ========================================================== This code causes the DEbug to go to neverland after the execution of the JMP $ line and causes an error dialogue on the SXSim. This is obviously due to use of RET instead of RETP and thus the STATUS register is not restored and therefore when JMP $ is executed the Jump is made to a bad address (not as intended the current line). What I am puzzled about is this : How does the RET instruction cause the execution to go back to the line right after the Call @SubTest???????? If the RET only pops the PC off the stack and the Page is not restored, HOW??? does the execution go back to the correct page???????? It only fails on the JMP instruction due to wrong Page, but WHY does the execution resume on the correct page even though the SATUS register still shows the wrong page. Is there some shadow register that is actually used upon RET instead of the STATUS for the Top 3 three bits? As a side the RETW instruction also does not restore the Status register. IE RETW behaves exactly like RET (not RETP) but with the added action of moving a constant into the W register. Regards Samuel ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=104929 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)