SFR access
Brought to you by:
thedmd
tiny8051 v0.7.4
It seems that the instruction mov @Rx, A does not work correctly for memory address in range of 128 to 255. There are located SFR at these addresses. And tiny8051 accesses these SFRs. But the SFR can be addresses only by direct access. An indirect access should access to a shadow IRAM that is located on the same memory address.
See wikipedia:
SFR ... They cannot be accessed indirectly via @R0 or @R1 or by the stack pointer SP; indirect access to those addresses will access the second half of IRAM, instead.
So it is possible that this bug affects also other instructions.
Anonymous
Probably affected instructions:
ADD A,@Rx
ADDC A,@Rx
ANL A,@Rx
CJNE @Rx,#data,reladdr
DEC @Rx
INC @Rx
MOV @Rx,#data
MOV @Rx,A
MOV @Rx,iram addr
MOV A,@Rx
MOV iram addr,@Rx
ORL A,@Rx
SUBB A,@Rx
XCH A,@Rx
XCHD A,@Rx
XRL A,@Rx
Last edit: Petr Pazourek 2024-01-24