Mpm Object File Level 03: Store instruction PC ($PC) in Expression section
Mpm V1.9.12 and earlier defined the $PC (or $) during linking as the patch position of where to apply re-calculated expression with correct linking addresses. This has been a fundamental incorrect assumption and exposed the JR $ (should jump to it self). This problem was reported by vasil31@gmail.com:
MPM versions: 1.9.1 - 1.9.13
command line: mpm.exe -v -a -b -otest.bin test.asm
---- test.asm ----------
org 100h
ld hl,$ ; MPM -> hl = 0101h; Must be: hl = 0100h
ld hl,$ ; MPM -> hl = 0104h; Must be: hl = 0103h
org 100h
jp $ ; C3 00 01 (All Assemblers) -- the eternal cycle.
jp $ ; C3 01 01 (MPM) -- crash
org 100h
jr $ ; 18 FE (All Assemblers) -- the eternal cycle.
jr $ ; 18 FF (MPM) -- crash
The assembler $PC must define the position of the first opcode of the CPU instruction and first byte of a data directive (defb, defw, etc).
Edited by Bits4fun