Improving the 6502, some ideas
Re: Improving the 6502, some ideas
Hi Mike
just wondering: is this a paper design, or do you have some way of simulating it?
I was able to cook up an online simulation of 65Org16 and 65org32 by modifying the easy6502 emulator: it just might be worth doing the same for 65m32.
Cheers
Ed
ps. see http://biged.github.io/6502js/ online and the source at https://github.com/BigEd/6502js
just wondering: is this a paper design, or do you have some way of simulating it?
I was able to cook up an online simulation of 65Org16 and 65org32 by modifying the easy6502 emulator: it just might be worth doing the same for 65m32.
Cheers
Ed
ps. see http://biged.github.io/6502js/ online and the source at https://github.com/BigEd/6502js
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Improving the 6502, some ideas
BigEd wrote:
Hi Mike
just wondering: is this a paper design, or do you have some way of simulating it?
just wondering: is this a paper design, or do you have some way of simulating it?
This is a paper design, but one that really excites me. I have an old degree in Computer Engineering from well over 20 years ago, and ideas about efficient, programmer-friendly designs have been floating around in my head since I learned 6502 assembly as a teenager. This design (especially the very flexible operand structure) is therefore deeply imbedded in my brain, and difficult to express clearly to potential audiences. I thought that my 6502-to-65m32 instruction translation teasers and code fragment teasers might generate some interest, and encourage me to finally get the full picture out of my head and onto paper.
As I mentioned in the Introduce yourself thread, I have been messing around with CPUSim, hoping to be able to get a working simulation. It's easy for a brutally simple processor like the Wombat, but much more difficult for something useful like the 6502. I'll keep trying, and hopefully come up with a mature description suitable for human (or simulator) consumption. Hardware implementation is a distant dream, although ttlworks' dearly-departed TREX is an inspirational (although sad) story. I'm not ashamed to admit that I fought back a tear or two when I read it. Many years ago, I had the same reaction when I first fully understood the PDP-11's operand structure and implementation. Yep, I'm definitely a nerd!
Sincerely,
Mike
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
Re: Improving the 6502, some ideas
Oh yes, sorry, I'd forgotten your intro... No problem with your design presently being on paper, I just wondered. I have no idea whether cpusim or easy6502 or something else would be the easiest way to get a model running.
Cheers
Ed
(TREX: http://6502.org/users/dieter/trex/trex.htm)
Cheers
Ed
(TREX: http://6502.org/users/dieter/trex/trex.htm)
Re: Improving the 6502, some ideas
The TREX concept was influenced by the architecture of some Forth CPUs.
The basic idea was, to find an architecture for a CPU core which
would be as simple as possible, while still being able to run
"some serious software"... whatever that means.
...and I admit, that I had no concrete plans for "morphing"
6502 machine code into TREX machine code in real time.
A detailed description of the TREX instruction set can be found here:
http://6502.org/users/dieter/tinst/tinst_0.htm
It's nice to hear that my old design was inspirational to others,
so the effort on building TREX wasn't wasted.
The basic idea was, to find an architecture for a CPU core which
would be as simple as possible, while still being able to run
"some serious software"... whatever that means.
...and I admit, that I had no concrete plans for "morphing"
6502 machine code into TREX machine code in real time.
A detailed description of the TREX instruction set can be found here:
http://6502.org/users/dieter/tinst/tinst_0.htm
It's nice to hear that my old design was inspirational to others,
so the effort on building TREX wasn't wasted.
Re: Improving the 6502, some ideas
Pretty cool.
The link register concept is reminiscent of the PDP-6 and other processors of that era.
The link register concept is reminiscent of the PDP-6 and other processors of that era.
Michael A.
-
teamtempest
- Posts: 443
- Joined: 08 Nov 2009
- Location: Minnesota
- Contact:
Re: Improving the 6502, some ideas
Quote:
I have been messing around with CPUSim, hoping to be able to get a working simulation. It's easy for a brutally simple processor like the Wombat, but much more difficult for something useful like the 6502.
I found CPUSim to be quite flexible once I got used to it. I might be able to answer a few questions about it. Not about register arrays, though, since I didn't use them - I just made as many discrete named ones as I wanted.
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Improving the 6502, some ideas
teamtempest wrote:
I found CPUSim to be quite flexible once I got used to it. I might be able to answer a few questions about it. Not about register arrays, though, since I didn't use them - I just made as many discrete named ones as I wanted.
Thanks,
Mike
[Edit Alert: I have tried to begin following Jeff's advice, and have started by adding several explanatory paragraphs near the end of my initial post on this thread, on Page 9.]
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
Re: Improving the 6502, some ideas
Here's the start: viewtopic.php?f=1&t=1419&start=125
I'd be happy to see you start a new 65m32 thread.
Cheers
Ed
I'd be happy to see you start a new 65m32 thread.
Cheers
Ed
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Improving the 6502, some ideas
BigEd wrote:
I'd be happy to see you start a new 65m32 thread.
Mike
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
Re: Improving the 6502, some ideas
Hmm, perhaps General - then in the programmable logic section if we get to FPGA thoughts.
A post at anycpu.org pointing back here, perhaps?
A post at anycpu.org pointing back here, perhaps?
Re: Improving the 6502, some ideas
I had thought you might suggest Emulation and Simulation as that appears to be the current thinking on how to work out the details of the CPU he has in mind.
Michael A.
Re: Improving the 6502, some ideas
Hmm,maybe there is no one right answer. The 65Org32 has a presence in several categories...
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Improving the 6502, some ideas
For where the nature of the discussion at this point, "General" would probably be best. As things progress (which I hope they do), it will get simulated, then put into programmable logic and hardware. All along, there will be programming considerations. As it gets closer to reality (which I hope it does), there will be a need for an assembler, then other software, and then maybe an SBC project... That covers a lot of categories; but we're not there yet. "General" is probably best for now.
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?
- barrym95838
- Posts: 2056
- Joined: 30 Jun 2013
- Location: Sacramento, CA, USA
Re: Improving the 6502, some ideas
GARTHWILSON wrote:
2+loop, the internal compiled by 2+LOOP, has 59 instructions by my count. It would be fun to see what that comes down to.
Code: Select all
loop:
:bd0c0000 inc ,s ; increment index on rTOS
checkend:
:410c0000 lda ,s
:c10c0001 cmp 1,s ; compare incremented index to limit
:5c5e000a bcs quitloop ; if index >= limit, loop is complete
contloop: ; else loop around:
:4d060000 ldy ,y ; load IP with loop back address
:5e060000 jmp (,y+) ; and proceed
+loop:
:410c0001 lda 1,s
:150c0000 add ,s ; update the index by the incrementer.
:810c0001 sta 1,s
:420c0000 lda ,s+ ; pull incrementer and check sign
:5caffff6 bpl checkend ; if + then do a forward compare
:410c0001 lda 1,s ; else
:c10c0000 cmp ,s ; do a reverse compare (limit >= index)
:5c4ffff6 bcc contloop ; for end-of-loop check
quitloop:
:9108???? stz LOOP_LEAVE ; show that LEAVE was not used to exit
:4d0c0002 ldy 2,s ; load IP with end addr from the rstack
:580c0003 lds #3,s ; discard index, limit, and end address
:5e060000 jmp (,y+) ; from rstack and proceed.
Mike
P.S. Regarding a normalized 65c816 vs. 65m32 code efficiency comparison: The 'm32 has only its unique operand structure (with embedded constants), while the '816 has the advantage of being able to pack up to two complete instructions in 16-bits, plus its indirect addressing modes, which are missing from the 'm32. It beats the 'm32 for fetch (@) when judging strictly by normalized code density ... how do you think it will pan out for something more complex?
P.P.S. Perhaps it would be an interesting exercise for me to try leveling the playing field the other way, by coding a 128-bit version for the 'm32? Nah, that's not a good use of my spare time ... I need to get my specs ready for a new thread A.S.A.P.
P.P.P.S. As I was drifting off to sleep last night, it occurred to me that there could be a minor bug in the above fragment; I believe that it handles negative increments properly, but will probably choke on a negative index and/or limit. Those of you with 6502 experience should be able to see it, so I'll leave it in for now ... there's no danger in it, since it has no host on which to run ... yet!
[EDIT 2013.10.07]: jmp (,y+) is not a proper ITC NEXT, since IP points to the CFA, not the actual machine code.
Code: Select all
NEXT (2 instructions, 2 machine words, 5 cycles)
ldu ,y+ ; W = (IP) , IP += 1
jmp (,u+) ; execute code @ (W) , W += 1
Last edited by barrym95838 on Tue Oct 08, 2013 5:57 am, edited 1 time in total.
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!
Mike B. (about me) (learning how to github)
Mike B. (about me) (learning how to github)
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Improving the 6502, some ideas
[Edit: Darn! I see I already brought this up, near the top of page 10 (although more briefly).
I won't delete this post however since there's already a response to it.]
For any of these improved-6502 processors-- Is it feasible to add interrupt-vector registers, so part of the job of the reset sequence (if automatic) or reset routine (if in the user's program) would be to transfer the vectors to processor registers, to eliminate the need for extra bus cycles in the interrupt sequences to read them? It's not just to save cycles, but cycles that might need wait states if left only in ROM. Then there would be no need to ever access slow (E)EPROM after the reset routine has finished. We've talked before about copying ROM to RAM and then paging out the ROM and kicking the clock speed up, but this should simplify the hardware design.
A smaller step might be to keep the interrupt vectors in RAM (instead of processor registers), but in addresses that are never ROM, even at reset. They could be the first addresses starting at 00000000 for example, and the reset routine would fill them in. Not having them in place yet at reset is no problem, because the interrupt-disable bit(s) should be set at reset, and peripherals not yet enabled to produce interrupts at that time.
Another advantage of course is being able to change them on the fly.
For any of these improved-6502 processors-- Is it feasible to add interrupt-vector registers, so part of the job of the reset sequence (if automatic) or reset routine (if in the user's program) would be to transfer the vectors to processor registers, to eliminate the need for extra bus cycles in the interrupt sequences to read them? It's not just to save cycles, but cycles that might need wait states if left only in ROM. Then there would be no need to ever access slow (E)EPROM after the reset routine has finished. We've talked before about copying ROM to RAM and then paging out the ROM and kicking the clock speed up, but this should simplify the hardware design.
A smaller step might be to keep the interrupt vectors in RAM (instead of processor registers), but in addresses that are never ROM, even at reset. They could be the first addresses starting at 00000000 for example, and the reset routine would fill them in. Not having them in place yet at reset is no problem, because the interrupt-disable bit(s) should be set at reset, and peripherals not yet enabled to produce interrupts at that time.
Another advantage of course is being able to change them on the fly.
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?