6502 Illegal Opcodes
6502 Illegal Opcodes
Hi guys
I've been writing a BBC Basic like 6502 assembler for windows and am a good way into that.
I'm now trying to implement optional instruction files something like this::
6502 instruction file [loaded by default]
6502 illegal instruction file
65C12 instruction file
Does anyone have a comprehensive and accurate list of 6502 illegal opcodes? I used to have a list myself, but for some reason I can't seem to locate it and google is coming up blank.
Many thanks!
I've been writing a BBC Basic like 6502 assembler for windows and am a good way into that.
I'm now trying to implement optional instruction files something like this::
6502 instruction file [loaded by default]
6502 illegal instruction file
65C12 instruction file
Does anyone have a comprehensive and accurate list of 6502 illegal opcodes? I used to have a list myself, but for some reason I can't seem to locate it and google is coming up blank.
Many thanks!
Re: 6502 Illegal Opcodes
Have a look at http://visual6502.org/wiki/index.php?ti ... 56_Opcodes and the links at http://visual6502.org/wiki/index.php?ti ... ed_Opcodes
cheers
Ed
cheers
Ed
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 6502 Illegal Opcodes
I have some links to pages on them in one of the sections on my links page, at http://wilsonminesco.com/links.html#65fam .
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: 6502 Illegal Opcodes
Fantastic - thanks very much guys 
I'll be posting an alpha video demo of my assembler soon. let me kn ow what you think?
I'll be posting an alpha video demo of my assembler soon. let me kn ow what you think?
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: 6502 Illegal Opcodes
banedon wrote:
65C12 instruction file
Edit: [*] as Mike points out below, this is not so!
Last edited by BigEd on Mon Feb 10, 2014 4:22 pm, edited 1 time in total.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: 6502 Illegal Opcodes
BigEd wrote:
... without the TRB and TSB instructions (which are also missing on the 65816) ...
Mike
Re: 6502 Illegal Opcodes
Silly me - you're quite right. So, the 65C12 lacks both sets.
Thanks for the correction
Ed
Thanks for the correction
Ed
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 Illegal Opcodes
barrym95838 wrote:
It's the BBR, BBS, RMB and SMB instructions that aren't there, probably because they suck up too much opcode space.
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 6502 Illegal Opcodes
I have never used them either. It would be nice if they were there with an absolute (instead of ZP) addressing mode, to make them useful for I/O. I guess they were in ZP because a few microcontrollers had I/O there and they had so little ROM that it was important to save one byte each time one of these instructions was encountered; but that's not normal for our applications. The '816 of course has so many additional instructions and addressing modes that are more important, that keeping BBS & friends would have required using the WDM op code extension and making them 5-byte instructions taking probably 8 clocks. I probably should be always bank 0 (regardless of the data bank register) as that's where I/O would normally be.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 Illegal Opcodes
GARTHWILSON wrote:
I have never used them either. It would be nice if they were there with an absolute (instead of ZP) addressing mode, to make them useful for I/O. I guess they were in ZP because a few microcontrollers had I/O there and they had so little ROM that it was important to save one byte each time one of these instructions was encountered; but that's not normal for our applications. The '816 of course has so many additional instructions and addressing modes that are more important, that keeping BBS & friends would have required using the WDM op code extension and making them 5-byte instructions taking probably 8 clocks. I probably should be always bank 0 (regardless of the data bank register) as that's where I/O would normally be.
One of my reasons for ignoring BBR and BBS, other than their limitation to ZP addressing, is that the bit being tested is hard-coded into the instruction, making it a hassle to write a routine that can change which bit it's testing on the fly. Also, I mostly use bits 6 and 7 (or 14 and 15 if the m bit in the 65C816's status register is cleared) for flag purposes, which are easily tested with a BIT instruction. Or BIT immediate can be used...plus TRB and TSB can readily clear or set those bits. There's lots of bit-twiddling flexibility without the BBR and BBS instructions being present.
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 6502 Illegal Opcodes
Yes, and I do use TSB, TRB, and BIT (with bits 6 & 7 having a privileged place), plus putting bit-bang clocks on ports' bit 0 to produce a full pulse on them with just two instructions INC DEC; but it would still be nice to be able to set or clear any arbitrary bit in a sigle instruction without affecting processor registers, or to be able to test and conditionally branch on any arbitrary bit (regardless of position in the port), all in one instruction.
PIC16 microcontrollers may appear to have an advantage there, but that advantage kind of disappears when you consider a couple of serious drawbacks. Without resorting to an inefficient mickey-mouse bank-switching scheme, they can only address 128 combined RAM and I/O and other special-function register addresses; and with bank-switching, you only get 512 total, in four banks. To make it worse, BTFSC (bit test file skip if clear) and BTFSS (bit test file skip if set) really only let you conditionally branch forward and around a single instruction; so if you need to branch around more, or branch backward, you have to use the opposite test and follow it with a GOTO to conditionally branch. It takes 8 to 12 clocks.
PIC16 microcontrollers may appear to have an advantage there, but that advantage kind of disappears when you consider a couple of serious drawbacks. Without resorting to an inefficient mickey-mouse bank-switching scheme, they can only address 128 combined RAM and I/O and other special-function register addresses; and with bank-switching, you only get 512 total, in four banks. To make it worse, BTFSC (bit test file skip if clear) and BTFSS (bit test file skip if set) really only let you conditionally branch forward and around a single instruction; so if you need to branch around more, or branch backward, you have to use the opposite test and follow it with a GOTO to conditionally branch. It takes 8 to 12 clocks.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 Illegal Opcodes
GARTHWILSON wrote:
Yes, and I do use TSB, TRB, and BIT (with bits 6 & 7 having a privileged place), plus putting bit-bang clocks on ports' bit 0 to produce a full pulse on them with just two instructions INC DEC...
Aside from potential timing issues, I have fastidiously avoided using DEC and INC on hardware due to the non-obvious effects that such instructions can have. Way back when when I was first learning this stuff (c. 1970), we were schooled to never use R-M-W instructions on hardware, it being deemed bad programming practice that would bite you in the...er...gluteal region. I still think that way, which proves that I really am a big, dumb dinosaur.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: 6502 Illegal Opcodes
GARTHWILSON wrote:
It would be nice if they were there with an absolute (instead of ZP) addressing mode, to make them useful for I/O.
cheers
Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html