I recently came across some undocumented opcodes for the
8051. Unfortunately I feel I should rather not disclose
where I got these from, nevertheless some (not all)
might be a valuable contribution to the SDCC compiler.
Among them are movc a,@SP and movc a,@SP++
"load acc with byte (indexed by the two topmost entries
on the stack) from code memory". (Opcodes 0x04 and 0x14)
This f.e. allows to efficiently initialize variables
from code memory:
The lcall pushes the address of the beginning of the
4 literal bytes on the stack so that a library routine
can access them:
movc a,@SP++ ; .db 0x04
ret ; return address is adjusted
As the 8051 instruction set is pretty much fully decoded,
an escape sequence enables these opcodes.
This is either the recently discussed "mov a,acc" (see
or the instruction "acall ." (both of which are not
used in real
I tried both and got the expected results!
The movc opcodes documented above are not the only ones,
though probably among the more useful.
Here is a set of branch instructions, they seem to
follow some 8051 symmetry and are mapped onto the
acall, ajmp opcodes:
Opcode Mnemonic Description
0x01 bnt branch not
0x11 bonb branch on next branch
0x21 bob branch on bug
0x31 bbw branch both ways
0x41 brl branch left
0x51 bfrm branch from
0x61 baw branch anywhere
0x71 binl branch if nobody looks
0x81 bisl branch if somebody looks
0x91 brnt branch near to
0xA1 bbnv branch beyond nirvana
0xB1 bib branch if bored
0xC1 bew branch either way
0xD1 brtl branch to late
0xE1 bopb branch on previous branch
0xF1 bsdm branch seldom
There might be more!
Log in to post a comment.