|
From: SourceForge.net <no...@so...> - 2004-04-01 07:14:53
|
Feature Requests item #927310, was opened at 2004-04-01 07:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=350599&aid=927310&group_id=599 Category: None Group: None Status: Open Priority: 1 Submitted By: Frieder Ferlemann (frief) Assigned to: Nobody/Anonymous (nobody) Summary: support for undoc'ed opcodes [mcs51] Initial Comment: Hi, 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: lcall _LD_DATA32 .db 0xfe,0xfd,0xfc,0xfb The lcall pushes the address of the beginning of the 4 literal bytes on the stack so that a library routine can access them: _LD_DATA32: movc a,@SP++ ; .db 0x04 mov r0,a movc a,@SP++ mov r1,a movc a,@SP++ mov r2,a movc a,@SP++ mov r3,a 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 bug #916294) https://sourceforge.net/tracker/?func=detail&atid=100599&aid=916294&group_id=599 or the instruction "acall ." (both of which are not used in real world applications). 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! Frieder ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=350599&aid=927310&group_id=599 |