Returning to the original topic...
NollKollTroll, I have a few further suggestions:
1. NOPs
There are several different NOP opcodes that have differing instruction lengths and cycle counts.
These are summarised here:
http://6502.org/tutorials/65c02opcodes.html#8
It would be good to include these in your document, as they form part of the defined behaviour.
2. Manufacturer specific variations
Even if your document is specific to the W65C02, it might be helpful to indicate which instructions are:
- Rockwell and WDC additions (BBR, BBS, RMB, SMB)
- WDC only additions (STP and WAI)
The CMS/GTE G65SC02 doesn't implement either of these groupings. Neither does the NCR 65C02.
3. Register Naming
There was some debate eariler about register naming.
I've very much with Ed on this:
- use S for the Stack Pointer (as in TXS and TSX)
- use P for the Process Status Register (as in PHP and PLP)
Western Design Centre would seem to agree with this:
I'll certainly be using your document as a handy reference.
Dave
65C02 instruction timings
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 65C02 instruction timings
hoglet wrote:
Returning to the original topic...
NollKollTroll, I have a few further suggestions:
1. NOPs
There are several different NOP opcodes that have differing instruction lengths and cycle counts.
These are summarised here:
http://6502.org/tutorials/65c02opcodes.html#8
It would be good to include these in your document, as they form part of the defined behaviour.
NollKollTroll, I have a few further suggestions:
1. NOPs
There are several different NOP opcodes that have differing instruction lengths and cycle counts.
These are summarised here:
http://6502.org/tutorials/65c02opcodes.html#8
It would be good to include these in your document, as they form part of the defined behaviour.
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?
-
nollkolltroll
- Posts: 14
- Joined: 07 Jan 2021
Re: 65C02 instruction timings
I've updated the doc:
- Use SP for Stack Pointer, SR for Status Register.
- Changed the wording on BIT.
- Changed to a compact text-document, 78 chars wide.
A text document was what I really wanted in the end, but it was so much simpler to edit text in a spreadsheet. If anyone wants a pdf or the spreadsheet, tell me.
I will not insert comments on variants from other manufacturers. I really want to keep this a simple doc with less chance to misinterpret anything. I think it would be better to make separate documents with info pertaining to other CPUs.
EDIT: latest version available at first post
- Use SP for Stack Pointer, SR for Status Register.
- Changed the wording on BIT.
- Changed to a compact text-document, 78 chars wide.
A text document was what I really wanted in the end, but it was so much simpler to edit text in a spreadsheet. If anyone wants a pdf or the spreadsheet, tell me.
I will not insert comments on variants from other manufacturers. I really want to keep this a simple doc with less chance to misinterpret anything. I think it would be better to make separate documents with info pertaining to other CPUs.
EDIT: latest version available at first post
Last edited by nollkolltroll on Thu Jun 03, 2021 8:23 am, edited 1 time in total.
/NollKollTroll
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: 65C02 instruction timings
nollkolltroll wrote:
I've updated the doc:
- Use SP for Stack Pointer, SR for Status Register.
- Changed the wording on BIT.
- Changed to a compact text-document, 78 chars wide.
A text document was what I really wanted in the end, but it was so much simpler to edit text in a spreadsheet. If anyone wants a pdf or the spreadsheet, tell me.
I will not insert comments on variants from other manufacturers. I really want to keep this a simple doc with less chance to misinterpret anything. I think it would be better to make separate documents with info pertaining to other CPUs.
- Use SP for Stack Pointer, SR for Status Register.
- Changed the wording on BIT.
- Changed to a compact text-document, 78 chars wide.
A text document was what I really wanted in the end, but it was so much simpler to edit text in a spreadsheet. If anyone wants a pdf or the spreadsheet, tell me.
I will not insert comments on variants from other manufacturers. I really want to keep this a simple doc with less chance to misinterpret anything. I think it would be better to make separate documents with info pertaining to other CPUs.
Code: Select all
------------------------------------------------------------------------------
BRA addressing syntax op b cyc NV*BDIZC
Branch always imp BRA $12 80 2 3 --------
------------------------------------------------------------------------------
BRA addressing syntax op b cyc NV*BDIZC
Break rel BRK 00 1 7 ---101--
Interrupt, push PC+2, push SR
------------------------------------------------------------------------------The second one should be BRK instead of BRA. Formally, BRK is a software interrupt that takes an 8-bit operand (the "signature"), like SWI in the MC6800 or INT in x86. Most assemblers do not enforce the signature, but technically it should be there. Although BRK is most often for debugging purposes, the instruction can also be used to call an operating system API (e.g., BRK $21 to call routine $21 in the API)—or in a historical role, to patch PROMs when a bug is discovered.
Also, it should be noted that the B(reak) bit's state exists only in the stack copy of SR, not in SR itself. Doing PHP - PLA - AND #%00010000 in the IRQ handler will not work as expected. This is why IRQ handlers will push registers and then "sniff" the stack to determine if the interrupt was hard or soft.
Code: Select all
------------------------------------------------------------------------------
DEA addressing syntax op b cyc NV*BDIZC
Decrement accumulator by one imp DEA 3A 1 2 +-----+-
A - 1 -> A
------------------------------------------------------------------------------
INA addressing syntax op b cyc NV*BDIZC
Increment accumulator by one imp INA 1A 1 2 +-----+-
A + 1 -> A
------------------------------------------------------------------------------DEA is a non-standard alias for what is formally DEC A, the A meaning the accumulator. Similarly, INA is non-standard for INC A. In MOS Technology/WDC assembly language standard syntax, instructions that can operate on the accumulator or memory use this distinction (the reason is historical and has to do with parsing the operand field). However, many assemblers don't require it, in which case DEC or INC is used without an operand to tell the assembler it is the accumulator that is being decremented or incremented.
Regarding the Rockwell extensions BBR, BBS, RMB and SMB, there has been historical disagreement on the correct assembly language syntax for them. The 65C02 assemblers I have used treat the bit number as one of three fields of the operand, not part of the mnemonic. For example, BBR0 $12,$34 would be written as BBR 0,$12,$34. The primary reason for doing so is the first method makes the mnemonic a non-standard four characters, which means the assembler's parser has to treat the mnemonic field specially by checking for a fourth character and processing it as though it is an operand. In contrast, the second method doesn't require the assembler to do anything special with the mnemonic field, other than look it up in a table to determine what the instruction is. With the bit number being an operand field, parsing, checking and assembling is much simpler.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: 65C02 instruction timings
GARTHWILSON wrote:
Jeff Laughton has made extensive use of these [different NOP opcodes], and has a handy table at viewtopic.php?p=36187#p36187
The stuff about incrementing or decrementing an op code is admittedly pretty far out, and clearly won't be widely applicable. But Self-Modifying Code is a powerful way to solve some otherwise impossible problems, and it helps to brainstorm lots of different ideas. I would recommend reading Garth's entire article (rather than focusing on this particular tidbit).
BigDumbDinosaur wrote:
WDC says in the data sheet that all memory and I/O accesses should be qualified by VDA and VPA. I'm merely doing what they recommend.
- it means IO is enabled during code accesses. But most of us don't wish to fetch code from IO devices.
- it means memory is disabled during dead cycles. But memory usually doesn't require this protection. Are there any exceptions? Certain specialized memory devices have paging features built in, and it may be that access to those features involves a specific "knock" sequence -- accesses to certain addresses as a means to unlock the feature. But AFAIK the knock sequence involves writes, and dead cycles are always reads. Edit: except the one in the Modify cycle of an '02/'816 R-M-W, but as I said these attempted theories do seem awfully tenuous.
BigDumbDinosaur wrote:
I don't believe the prop time of a single OR gate is an issue at any speed at which the 65C816 will be usable.
-- 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
-
nollkolltroll
- Posts: 14
- Joined: 07 Jan 2021
Re: 65C02 instruction timings
Thanks for your sharp eyes BDD! I've mixed and matched way too many sources to be sure what way is up 
Updated doc with:
- BRA -> BRK
- BBR, BBS, RMB and SMB uses official syntax
- INA, DEA -> INC A, DEC A
New version 0.2.1 available in first post.
Updated doc with:
- BRA -> BRK
- BBR, BBS, RMB and SMB uses official syntax
- INA, DEA -> INC A, DEC A
New version 0.2.1 available in first post.
/NollKollTroll