Shop OBEX P1 Docs P2 Docs Learn Events
SxSim and the SKIP instruction — Parallax Forums

SxSim and the SKIP instruction

chuckjchuckj Posts: 1
edited 2006-06-24 12:52 in General Discussion
Gunther,

Thanks for SxSim.· It has saved me lots of time debugging on chip.·

I have found·one problem though - the SKIP instruction works when on an even address (SASM generates $702 instruction), but not on an odd address (SASM generates $602).· Try the following program...

······DEVICE··SX28,OSC4MHZ,TURBO
···· ·IRC_CAL··IRC_SLOW
···· ·FREQ··50_000_000
····· RESET··bgn

bgn:
····· clr··· ·w
···· ·skip
···· ·mov· ·w,#1······ ;· This instruction is executed - but shouldn't be!

···· ·clr···· w
···· ·skip
···· ·mov·· w,#1······ ;· This instruction is correctly skipped.
···· ·jmp··· bgn

If you load this into SxSim and step through it, you will find that the first 'mov' is executed, although it should not be...

chuck

Comments

  • BeanBean Posts: 8,129
    edited 2006-06-24 03:23
    Hmm, I tested it and it seems you are correct.
    When the SKIP is at an odd address the display shows the next instruction as "SNB PC.0", but PC.0 is 1 at an odd address, so it won't skip ???
    Might have something to do with how the hardware pipeline handle the PC register ???

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com

    "I reject my reality, and substitute yours." NOT Mythbusters
    ·
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-06-24 12:52
    Chuck,

    oops - you really found a bug!

    This made me aware that the SX does not have a SKIP specific instruction. It is the assembler that "understands" the SKIP and converts it into SB 2.0 or SNB 2.0 (SB PC.0 or SNB PC.0) depending if the SKIP is located on an odd or even program address. The problem with SXSim was that it only handled the $702 code correctly. This is fixed in the most recent version 2.08.05 that I'm going to attach to the "sticky" SXSim thread.

    Thank you for helping to improve SXSim.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
Sign In or Register to comment.