Login
Back to forumReply to this topicGo to last reply

Posted By

AaronGale
on 2002-10-23
 Illegal Instructions

I was checking out the AAY link and looking at the 6510 instructions and noticed the illegal instructions. Just out of curiosity why do these exist and are they/were they used?

I guess they probably exist on the C16/+4 as well?

Oh, and do the Op-code police come and get you if you did use them?

Aaron

Posted By

Csabo
on 2002-10-23
 Opcodes

While I can't give you a proper explanations on WHY they exist (I have my ideas, but they are probably not 100% right), I do know that these work on the C16/Plus4 as well. Some demos used them, possibly even some games (but that's rare). One area where they were used extensively was "protectors" or "coders" (take a look at GOTU, Terrorists and Methabolix demos/games). They used these coders to "protect" their work. Since these instructions cannot be read by the built in monitor, the average user wouldn't understand the actual code (but you could use one of the several more advanced monitors like Kalimon).

"Illegal instructions" is a very unfortunate and inappropriate name. "Undocumented instructions" would be much better. Most of them have very well defined behavior, but some of them are extremely obscure (and therefore useless). The Op-code police won't mind if you use them at all happy

Posted By

bubis
on 2002-10-24
 why do these exist

Why? Is is just a side-effect as I know! The CPU has been designed to work with the standard instructions but it works with other opcodes or sometimes just locks up the machine.

Are they used? Well, I often use them to optimize my codes and many coder do this. My favorits are LAX and ASR.

Posted By

SVS
on 2002-10-24
 The instructions of a 6502 uP family are about 150,

but a byte can have 256 different values. This is why if you *force* the micro to execute a non-standard code, it tries to do something...
Most of the times, it "partially" executes some works (since a legal instruction has many steps), some bits-patterns are able to start some steps.
Other times you simply obtain a processor crash. For example I found that all the codes with "2" as low nibble (02, 52, F2, etc.) crash the micro (except A2).
Greetz

P.S. - MegAssember recognized 4 non-standard instructions wink

Posted By

bubis
on 2002-10-24
 rather two instructions

> Most of the times, it "partially" executes some works

Partialy? Undocumented instructions rather execute two normal instructions.

Posted By

SVS
on 2002-10-24
 I mean: if a legal instruction need some (steps) works to complete its process,

maybe a non-standard instruction performs *some* steps and not *some* other. Or maybe some bypass steps (temp storing, or so...). Only if these partial steps have a logical completion, it can be useful (for example LAX load .A and load .X). But if the step sequence is stopped in a not logical point, it can be not-useful or near impossible useful (as the grat parto of not-standard works does).

For example WHEN could you use an instruction that does:
(load .A ORed with zeropage-indirectX-addressed, then store result into indirectY-addressed) ?

Or perhaps you have to write a code *planned* TO USE this instruction (to insert not-deassemblying code, for example).

Posted By

JamesC
on 2002-10-24
 Illegal Instructions

Please reference the following articles that appeared in "The Transactor" magazine, a Canadian Commodore support publication:

http://www.csbruce.com/~csbruce/cbm/transactor/v6/i5/index.html
http://www.csbruce.com/~csbruce/cbm/transactor/v6/i3/index.html

Summary: don't mess with undocumented instructions unless you know 100%, for sure, completely, undeniably what you are doing.

Just as SVS and I experienced with Plus/Extra and some other 'old' software, someone may come looking at YOUR code 15 years later and wonder just what in the heck you were thinking.....

Posted By

TLC
on 2002-10-26
 Undocumented instructions

Christian Bauer and Marko Mäkelä did an excellent job investigating these undocumented opcodes. You're probably better reading "64doc", downloadable from Funet ( http://www.funet.fi/pub/cbm/documents/chipdata/64doc ).

L.

Posted By

someone
on 2002-10-26
 Why do illegal opcodes exist on this old 8-bit processors?

Well, that's simple to explain:
Because of the optimization of the opcode decoding and sequencing logic contained in every processor. This logic is "hardwired" (opposite to the microcoded instructions of the newer processor generations) and to minimize the number of logical gates needed for the CPU the logical terms, which describe the functions of the hardware, were heavily optimized (also for cost reasons, of course: smaller chip=more chips on every wafer=higher yield rate=MORE PROFIT!).
The side effect of this internal optimization is that some opcode bitfields are not fully decoded and therefore some bit combinations do two or more (or maybe only a part) of the internal actions a CPU does while executing an opcode.

Posted By

JamesC
on 2002-10-28
 Illegal Instructions

There is an entry in the Plus/4 World Database for Illegal Instructions. Maybe Csabo or another with understanding of Hungarian can translate this title for us?



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024