Jump to content
IGNORED

6502 not technically RISC, but sure looks like it sometimes


Recommended Posts

Some people consider the zeropage as 256 registers, not me though.

Why not?

It is used in a very special way and almost all instructions handle it (not so for the full address mode instead).

In a way I consider A,X,Y as special cases of very fast architectural registers that are also exposed directly to the programmer for even faster and more compact routines (the x64 for example has hundreds of architectural registers internally but it only exposes 16 64bit addressable ones).

 

That is obviously only my opinion and you don't have to agree also page0 reminds me a little of the registers-in-ram of TMS9900 design.

Link to comment
Share on other sites

Why not?

It is used in a very special way and almost all instructions handle it (not so for the full address mode instead).

In a way I consider A,X,Y as special cases of very fast architectural registers that are also exposed directly to the programmer for even faster and more compact routines (the x64 for example has hundreds of architectural registers internally but it only exposes 16 64bit addressable ones).

 

That is obviously only my opinion and you don't have to agree also page0 reminds me a little of the registers-in-ram of TMS9900 design.

 

Reminiscent perhaps, but not the same. In the 9900 you can load a value directly into memory designated as workspace, and you can also address that same memory directly. You can do some neat stuff that way but that workspace RAM is still accessed in a single instruction when addressed as a register. For example, if your workspace is >8300, loading a value into R0 (register 0) puts that value in >8300, LI R1 into >8302, etc. Conversely you can pre-stage a register workspace in RAM at some other location then change the workspace to that location. For example, set up 16 words at >A300 then set the workspace to >A300 giving an instant change of all registers.

 

Zero-page RAM takes multiple instructions, albeit short 2-byte instructions versus 3-bytes for non-zero-page. If you want to put a value into, say $0E, you have to LoaD the value into A, X, or Y, then STore that register into $0E.

 

From my limited perspective that does not a register make though I do find it an advantage in its own way. For that matter being able to manipulate RAM in the second page ($01xx area) via the stack pointer can be quite handy, as well.

Link to comment
Share on other sites

Why not?

It is used in a very special way and almost all instructions handle it (not so for the full address mode instead).

In a way I consider A,X,Y as special cases of very fast architectural registers that are also exposed directly to the programmer for even faster and more compact routines (the x64 for example has hundreds of architectural registers internally but it only exposes 16 64bit addressable ones).

 

That is obviously only my opinion and you don't have to agree also page0 reminds me a little of the registers-in-ram of TMS9900 design.

Page 0 isn't used in a very special way, it's used exactly like extended addressing but the high byte is assumed to be 0.

Nothing more.

 

Dunno even Wikipedia agrees on considering page0 for the 6502 as an "extended pool of extra registers".

 

https://en.wikipedia.org/wiki/Zero_page

 

Everyone knows that Wikipedia can't be wrong!!!! :grin:

Ah Wiki... edited by anyone that wants to.

 

https://en.wikipedia.org/wiki/Addressing_mode#Simple_addressing_modes_for_code

Link to comment
Share on other sites

Page 0 isn't used in a very special way, it's used exactly like extended addressing but the high byte is assumed to be 0.

Nothing more.

 

Ah Wiki... edited by anyone that wants to.

 

https://en.wikipedia.org/wiki/Addressing_mode#Simple_addressing_modes_for_code

Not sure your link meant to be sarcastic but on the same page a few paragraphs below:

https://en.wikipedia.org/wiki/Addressing_mode#Zero_page

 

"As a result, the zero page was used similarly to a register file."

 

It seems that section it's been there unchallenged since 2006 .... one would think that if many people would take objection to that statement by now it would have been redacted/softened.

 

Anyhow we are digressing, as already stated there was no RISC defined per se in 1975, the rest discussed is largely a matter of opinion.

In specific my opinion is that page0 does resemble a register file (it is not a full fledged register file), your opinion seems different.... neither of us wins anything attempting to convince the other of his own blatantly obviously superior point of view .... just saying.

Link to comment
Share on other sites

Speaking of RISC, in my computer organization classes we programmed in MIPS. Not directly, we used SPIM to emulate a MIPS. IIRC one of the things MIPS does which is rather RISC-ey is eschews variable sized instructions. No one, two, or three byte instructions, they are all 32-bit instructions including any arguments.

 

In the 6502 instructions are all single-byte but arguments can be one or two bytes. LDA #$08 is two bytes, STA $DD01 is three bytes, JMP ($0008),Y is three bytes, BNE/BEQ are two bytes, TAX, RTS, ROL are one byte, and so on.

 

In one class project we had to write a MIPS program which did some tasks without stalling the pipeline. If you stalled the pipeline at all you failed the assignment. I loved that class, even installed SPIM on my Solaris box to play with.

  • Like 1
Link to comment
Share on other sites

I think as a Wiki Editor you can "subscribe" to a page to get notification when it gets updated. It is possible someone is watching the page for that particular information and changing it back. Such activity has caused pages to be locked before, usually I have seen it involving a societal or political hot-topic or person. But then I tend not to cruise Wikipedia.

Link to comment
Share on other sites

Would't those edit be in the history anyway?

When I looked at the history I didn't see any edit/revert ... given I didn't put that info there to begin with and I am not sure if zzip meant to say he edited it or if JamesD did it or someone else, whatever it is I'd say let it be.

 

In the end I liked this article:

http://ethw.org/Why_Instruction_Sets_No_Longer_Matter

 

it wasn't really CISC vs RISC but fast integrated caches and in general memory hierarchy that mattered and still does and can explain why the x64 is still so competitive with its CISC ISA.

  • Like 1
Link to comment
Share on other sites

Would't those edit be in the history anyway?

When I looked at the history I didn't see any edit/revert ... given I didn't put that info there to begin with and I am not sure if zzip meant to say he edited it or if JamesD did it or someone else, whatever it is I'd say let it be.

 

In the end I liked this article:

http://ethw.org/Why_Instruction_Sets_No_Longer_Matter

 

it wasn't really CISC vs RISC but fast integrated caches and in general memory hierarchy that mattered and still does and can explain why the x64 is still so competitive with its CISC ISA.

 

Excellent link! Caches (L1,L2,L3,L4) and their coherency schemes matter most when it comes to performance.

Link to comment
Share on other sites

I've never edited a Wiki article and have no desire to do so.
The person that did, clearly based the entry on their opinion.


Good article, but the article overlooks code density. It's about presenting the code to the ALU as fast as possible with the least amount of stalls to the pipeline. A more CISC like instruction set uses less RAM and reduces the amount of memory bandwidth required to keep the cache loaded. Branch prediction is essential to keep the cache loaded and prevent stalls.
CISC vs RISC is largely irrelevant now, but a more efficient CISC or regular RISC design requires a smaller die, is much cheaper, and more power efficient.
It depends on what you want to do.

What that has to do with the 6502 I don't know.

Link to comment
Share on other sites

  • 2 weeks later...

The inventor of MIPS, Hennessy did a very mathematical analysis of RISC vs. CISC. On average the CISC processors of the day took 6 times as long as a RISC processor to fully fetch, execute, and resolve an instruction. The code density of the available CISC processors were twice as efficient (required half the number of instructions) as RISC. This still have the RISC processors a 3x inherent advantage over CISC processors.

 

This is true of mid-80s CISC processors, but as their busses widened you see that gap narrow already. Suddenly instead of taking 6 times as long, they only take 4 times and long or 3 times as long, and so the advantage starts to thin.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...