In the rare cases where using JMP () was actually a possibility, the vector has *always* sat in zero page for me, making this bug irrelevant.
6502 redundant, missed, and suggested features
Re: 6502 redundant, missed, and suggested features
Quote:
That's been my point all along. JMP (<addr>) is defective in one specific case. If there is a hole in the middle of the sidewalk you don't abandon the sidewalk. You just go around the hole.
In the rare cases where using JMP () was actually a possibility, the vector has *always* sat in zero page for me, making this bug irrelevant.
Re: 6502 redundant, missed, and suggested features
[this message is removed by its author]
Last edited by litwr on Thu Aug 25, 2016 11:50 pm, edited 4 times in total.
Re: 6502 redundant, missed, and suggested features
Since putting jmp() into use just because, I've found that it fits my application very nicely. I'm kind of upset that I never used it before. I actually have a situation where JMP() even makes more sense than JSR() would. I need to have a JMP as a return. Well, don't need, but it sure simplified things.
In the past, I would have modified a JMP abs. But this works, so I'll do it this way. I don't like to use self modifying code if I can avoid it, anyway.
I'm pretty sure my assembler will fail or at least issue a warning for a boundary vector. I could look to be certain, but I sure seem to remember implementing that. In fact, in a previous incarnation, it would insert an NOP to avoid the situation, I know that for certain. But since I reduced it to two passes, it couldn't be doing that anymore.
In the past, I would have modified a JMP abs. But this works, so I'll do it this way. I don't like to use self modifying code if I can avoid it, anyway.
I'm pretty sure my assembler will fail or at least issue a warning for a boundary vector. I could look to be certain, but I sure seem to remember implementing that. In fact, in a previous incarnation, it would insert an NOP to avoid the situation, I know that for certain. But since I reduced it to two passes, it couldn't be doing that anymore.
Re: 6502 redundant, missed, and suggested features
litwr wrote:
Klaus2m5 wrote:
Lets say you have a monitor program or a basic interpreter in ROM. You want to allow a user program in RAM to intercept essential system vectors like interrupts or standard IO. The ROM would initialize the vectors in RAM to the standard routines the ROM provides. Later you load a user program initializing the vectors to its own routines.
That is a standard technique used by ROM based 6502 computers from the KIM-1 to the C64.
That is a standard technique used by ROM based 6502 computers from the KIM-1 to the C64.
litwr wrote:
BigEd wrote:
Well, there's less than half a percent chance of hitting the bug, in normal usage.
litwr wrote:
Klaus2m5 wrote:
That is per vector. If you have 13 vectors it is 5% (26 of 256 bytes with a 50% chance of being on an odd address). If you wonder about the number - the C64 had exactly 13 vectors. When looking at the data structure of the C64 you'll find an unused byte ahead of the vectors. Obviously the C64 ROM coders were aware of the problem and aligned the vector table to an even address, although it was not even near a page boundary.
This discussion ends for me now. Believe what you want. I don't care.
6502 sources on GitHub: https://github.com/Klaus2m5
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: 6502 redundant, missed, and suggested features
litwr wrote:
... Could you provide any example of such the dynamic state? ...
Mike B.
Re: 6502 redundant, missed, and suggested features
Off topic, but just to lighten things up, anyone who says the C= 8 bits all work fine is not very familiar with the P and B series machines! :<)
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 redundant, missed, and suggested features
KC9UDX wrote:
Off topic, but just to lighten things up, anyone who says the C= 8 bits all work fine is not very familiar with the P and B series machines! :<)
All Commodore eight bit hardware had issues, sometimes due to chip errata, the 6526 CIA timer B interrupt bug present in the C-64 and C-128 being a classic case that messed up the fake RS-232 functions.
Last edited by BigDumbDinosaur on Fri Nov 14, 2025 9:38 pm, edited 1 time in total.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: 6502 redundant, missed, and suggested features
[this message is removed by its author]
Last edited by litwr on Thu Aug 25, 2016 11:51 pm, edited 1 time in total.
Re: 6502 redundant, missed, and suggested features
Quote:
I have to give up. I have to admit that Rockwell newsletter had successfully induced the new case for the meaning of a word "bug".
Quote:
The same is true for Forth programming language too.
Quote:
Anyway, thanks to all for this a bit emotional discussion and for the attempts to help.
- BigDumbDinosaur
- Posts: 9428
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 redundant, missed, and suggested features
litwr wrote:
I have to give up. I have to admit that Rockwell newsletter had successfully induced the new case for the meaning of a word "bug".
If a bug involves hardware it means there is some aspect of the hardware's behavior that doesn't follow published specifications. The 6502 and all NMOS derivatives have two distinct hardware bugs that meet that definition, one being what happens in the case of JMP ($xxFF), and the other having to do with what happens when a hardware interrupt hits just as a BRK instruction is being fetched. Asserting that these are not bugs is like insisting the sky is green.
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 redundant, missed, and suggested features
BigDumbDinosaur wrote:
If a bug involves hardware it means there is some aspect of the hardware's behavior that doesn't follow published specifications.
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 redundant, missed, and suggested features
BigDumbDinosaur wrote:
If a bug involves hardware it means there is some aspect of the hardware's behavior that doesn't follow published specifications.
IMO, anyone who has a right-vs-wrong, black-and-white perspective on this debate is being blind to some important subtlety. Arguably litwr is guilty of this, but he's not alone.
The doc does and doesn't imply a page crossing. And, for the coders out there dealing with the reality of the silicon, cases have been illustrated for the desirablility and the undesirablility of a page crossing.
(FWIW, I become more and more receptive to the notion the ambiguity in the spec was intentional, as I suspect the company was reluctant to be 100% candid regarding errata in their yet-to-be-accepted new product. But the reason for the ambiguity doesn't affect my point above.)
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
- GARTHWILSON
- Forum Moderator
- Posts: 8774
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 6502 redundant, missed, and suggested features
KC9UDX wrote:
Since putting jmp() into use just because, I've found that it fits my application very nicely. I'm kind of upset that I never used it before. I actually have a situation where JMP() even makes more sense than JSR() would.
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 redundant, missed, and suggested features
Dr Jefyll wrote:
...as I suspect the company was reluctant to be 100% candid regarding errata in their yet-to-be-accepted new product.
I've been trying to recall when I first run into the JMP ($xxFF) bug in a program that I had written. I do recall that the documentation that my employer in the 1970s was given when a prototype device was designed around the 6502 made no mention of the JMP ($xxFF) bug but did list the addressing mode in the detailed instruction description. That would have been in 1976, which was when I learned the 6502 assembly language. I do know I ran into the JMP ($xxFF) bug later on. The earliest I remember it being mentioned in any literature was in 1979 in 6502 Assembly Language Programming, by Lance A. Leventhal. My copy, which is the second edition that was published in 1986 (my original 1979 edition completely fell apart from much use) describes the problem on page 3-13. This same edition of that book also mentions that the JMP ($xxFF) bug was fixed in the 65C02.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: 6502 redundant, missed, and suggested features
Thanks BDD, that's very interesting - although we don't know exactly when Leventhal wrote the book published in 1979, there is usually a fair delay between writing and publishing, and evidently he was aware of the behaviour. (Edit: I see the book's references include one to an article from April 1979)
From page 63 of this PDF of the first edition, page 3-13 of the book:
From page 63 of this PDF of the first edition, page 3-13 of the book:
Quote:
Never let an indirect address cross a page boundary, as in JMP ($31FF). Although the high-order byte of the indirect address is in the first location of the next page (in this example, memory location 3200₁₆), the CPU will fetch the high-order byte from the first location of the same page (location 3100₁₆ in our example).