6502 redundant, missed, and suggested features
Re: 6502 redundant, missed, and suggested features
[this message is removed by its author]
Last edited by litwr on Thu Aug 25, 2016 11:48 pm, edited 1 time in total.
Re: 6502 redundant, missed, and suggested features
I think more about the example provided and begin to have doubts in it. Let's see the general code of a complex structure
We have to calculate the absolute address of a jmp_field in order to use it then we should place these address to the JMP (). IMHO we may place the ADDRESS in JMP abs instead... I can also add that it is more common to keep addresses for JSR not for JMP... So I can imagine that it is very uneasy to create a practical example which shows the usefulness of CMOS JMP (xxFF)...
Code: Select all
base_of_structure
VARIOUS UNALIGNED DATA
jmp_fiels .word ADDRESS
Last edited by litwr on Tue Aug 23, 2016 9:41 am, edited 1 time in total.
Re: 6502 redundant, missed, and suggested features
litwr wrote:
So NMOS 6502 JMP (xxFF) has the disadvantage for programs which use very complex data structures.
litwr wrote:
My example shows that it also has the advantages.
litwr wrote:
Excuse me, how is it possible to call [...]
BigEd wrote:
(But I'm not sure if it's even interesting to keep arguing about what we call something. Much more interesting to talk about how things work and how to program them.)
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
Re: 6502 redundant, missed, and suggested features
Re. JMP ($xxFF), also see http://6502.org/documents/publications/ ... tive_2.pdf page 12 (page 16 in the PDF), this is Rockwell International's newsletter for the AIM-65 and related products.
Edit/addendum: And also Bob Sander-Cederlof's take on it (he refers to the same notice from Rockwell, although he names the magazine as 'Interface' - there may of course have been several Rockwell newsletters at the time). His favourite method for avoiding the problem? Staying away from the instruction altogether! http://www.txbobsc.com/aal/1980/aal8010.html, scroll to the bottom (or go there directly, with http://www.txbobsc.com/aal/1980/aal8010.html#6502bug)
-Tor
Edit/addendum: And also Bob Sander-Cederlof's take on it (he refers to the same notice from Rockwell, although he names the magazine as 'Interface' - there may of course have been several Rockwell newsletters at the time). His favourite method for avoiding the problem? Staying away from the instruction altogether! http://www.txbobsc.com/aal/1980/aal8010.html, scroll to the bottom (or go there directly, with http://www.txbobsc.com/aal/1980/aal8010.html#6502bug)
-Tor
Last edited by Tor on Tue Aug 23, 2016 10:22 am, edited 2 times in total.
Re: 6502 redundant, missed, and suggested features
litwr wrote:
I think more about the example provided and begin to have doubts in it. Let's see the general code of a complex structure
We have to calculate the absolute address of a jmp_field in order to use it then we should place these address to the JMP (). IMHO we may place the ADDRESS in JMP abs instead... I can also add that it is more common to keep addresses for JSR not for JMP... So I can imagine that it is very uneasy to create a practical example which shows the usefulness of CMOS JMP (xxFF)...
Code: Select all
base_of_structure
VARIOUS UNALIGNED DATA
jmp_fiels .word ADDRESS
That is a standard technique used by ROM based 6502 computers from the KIM-1 to the C64.
6502 sources on GitHub: https://github.com/Klaus2m5
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 redundant, missed, and suggested features
litwr wrote:
I think more about the example provided and begin to have doubts in it. Let's see the general code of a complex structure
We have to calculate the absolute address of a jmp_field in order to use it then we should place these address to the JMP (). IMHO we may place the ADDRESS in JMP abs instead... I can also add that it is more common to keep addresses for JSR not for JMP... So I can imagine that it is very uneasy to create a practical example which shows the usefulness of CMOS JMP (xxFF)...
Code: Select all
base_of_structure
VARIOUS UNALIGNED DATA
jmp_fiels .word ADDRESS
- There is a error in the JUMP INDIRECT instruction of ALL 6500 family CPU chips, no matter who they were made by. This fatal error occurs only when the low byte of the indirect pointer location happens to be $FF, as in JMP ($03FF).
JMP (<addr>) is useful in many situations—I routinely use JMP (<addr>) and JMP (<addr>,X) in my software. JMP (<addr>,X) is analogous to the switch statement in ANSI C. In fact, POC V1.1's firmware routes the interrupt handlers and the SCSI bus phase dispatch code through indirect vectors. As a matter of tradition, I page-aligned these vectors, although it is unnecessary with the 65C816. However, long ago when I was writing for the NMOS versions, I didn't shy away from JMP (<addr>) just because it was buggy. I merely stayed aware of where jump vectors ended up in my code.
If working with an NMOS part and using JMP (<addr>) there's no magic to it: just page-align your vector tables. However, we consistently advise those interested in building hardware to not use the NMOS 6502, not only due to the JMP ($xxFF) bug, but due to weak fanout, low clock speeds and the inability of RDY to halt the MPU during a write operation, the latter a characteristic which could, I suppose, also be considered a bug.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: 6502 redundant, missed, and suggested features
litwr wrote:
kakemoms wrote:
26 cycles. One 256 byte table. If you had a swap function you could shave off 6 cycles, but it would still be faster with the extra table.
Re: 6502 redundant, missed, and suggested features
@litwr : So what ? Because you find *one* possible way of clearly exploit a bug, it doesn't make it any less a bug. Bug exploit is not something new either, so having something that is exploitable doesn't mean it is not a bug. I agree "fixing" the bug might not be a good idea as it breaks compatibility with programs that does bug exploit - but that doesn't make the bug any less a bug.
Again, I never use jmp indirect myself so I don't care.
Again, I never use jmp indirect myself so I don't care.
Re: 6502 redundant, missed, and suggested features
I used JMP (ind) today just to say I did. I don't know if I've ever used it before.
I assume I must have when I was developing my assembler. But probably nothing more than a simple test to make sure the code came out correct. If memory serves, it was one of the few op codes that for years didn't work and I never noticed.
I assume I must have when I was developing my assembler. But probably nothing more than a simple test to make sure the code came out correct. If memory serves, it was one of the few op codes that for years didn't work and I never noticed.
Last edited by KC9UDX on Wed Aug 24, 2016 1:42 pm, edited 1 time in total.
Re: 6502 redundant, missed, and suggested features
Well, there's less than half a percent chance of hitting the bug, in normal usage.
Re: 6502 redundant, missed, and suggested features
BigEd wrote:
Well, there's less than half a percent chance of hitting the bug, in normal usage.
-
White Flame
- Posts: 704
- Joined: 24 Jul 2012
Re: 6502 redundant, missed, and suggested features
That depends on if "normal usage" involves self-modification of the JMP (xxxx) operand bytes.
I would think "normal usage" uses fixed-location indirection vectors as Klaus2m5 mentions. Those have 0% chance of bugging in a dynamic state. Though the static state of the assembler dropping a vector at $xxFF could exist, it would bug all the time and be caught & fixed. It's only the dynamic state where the vector address changes at runtime that would hide an unpredictable bug.
I would think "normal usage" uses fixed-location indirection vectors as Klaus2m5 mentions. Those have 0% chance of bugging in a dynamic state. Though the static state of the assembler dropping a vector at $xxFF could exist, it would bug all the time and be caught & fixed. It's only the dynamic state where the vector address changes at runtime that would hide an unpredictable bug.
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 6502 redundant, missed, and suggested features
BigEd wrote:
Well, there's less than half a percent chance of hitting the bug, in normal usage.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: 6502 redundant, missed, and suggested features
BigDumbDinosaur wrote:
BigEd wrote:
Well, there's less than half a percent chance of hitting the bug, in normal usage.
Re: 6502 redundant, missed, and suggested features
BigEd wrote:
Well, there's less than half a percent chance of hitting the bug, in normal usage.
6502 sources on GitHub: https://github.com/Klaus2m5