simulator quirks and assembly problems
Posted: 28 Jan 2018 18:18
Hoping that the following will be taken into account while preparing new compiler version, here's a list of software simulator quirks that cause most problems:
- DC (digital carry) is not emulated in STATUS register which precludes use of some effective BCD algorithms,
- any change to STKPTR causes simulator break,
- simulator freezes if any of STKPTR bits is set changing it,
- BRA is simulated to take 1 instead of 2 Tcy (enhanced series only),
- enhanced series ADDFSR instruction is simulated as only positive value could be added (0..63, instead of -32..31).
Some of us use assembly (especially in time-critical applications) and are hindered by the following
- GOTOs are treated by linker like CALLs, which means that unfounded 'lack of stack space' error is claimed if GOTOs lead to (harmless) function loops,
- not only use of GOTO and CALL instructions is severely limited, in enhanced series one cannot even call routines enclosed within single assembly block,
- semicolon does not act as real comment in asm block (depending on compiler, apostrophe or parenthesis, or some keywords, like 'end' are interpreted by compiler and Code Explorer),
- empty 'badram' declaration in *.mcl file causes compiler to assume that 0 is bad RAM location which causes problems with use of R0 register in PIC18s.
- DC (digital carry) is not emulated in STATUS register which precludes use of some effective BCD algorithms,
- any change to STKPTR causes simulator break,
- simulator freezes if any of STKPTR bits is set changing it,
- BRA is simulated to take 1 instead of 2 Tcy (enhanced series only),
- enhanced series ADDFSR instruction is simulated as only positive value could be added (0..63, instead of -32..31).
Some of us use assembly (especially in time-critical applications) and are hindered by the following
- GOTOs are treated by linker like CALLs, which means that unfounded 'lack of stack space' error is claimed if GOTOs lead to (harmless) function loops,
- not only use of GOTO and CALL instructions is severely limited, in enhanced series one cannot even call routines enclosed within single assembly block,
- semicolon does not act as real comment in asm block (depending on compiler, apostrophe or parenthesis, or some keywords, like 'end' are interpreted by compiler and Code Explorer),
- empty 'badram' declaration in *.mcl file causes compiler to assume that 0 is bad RAM location which causes problems with use of R0 register in PIC18s.