6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Sep 23, 2024 4:27 pm

All times are UTC




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: 65ORG16.c Core
PostPosted: Sat Apr 14, 2012 12:33 am 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
teamtempest wrote:
...Not to be too picky, but shouldn't there also be PHB and PLB, PHC and PLC, etc!...

This is not a problem. I've proven it on the .b core.

teamtempest wrote:
... (and maybe BRA, although maybe that should be re-named)!

I'm not very familiar with this, is it WDC65C02?

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sat Apr 14, 2012 12:51 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8512
Location: Southern California
All of the CMOS 6502's ever made had it-- Branch Relative Always, or BRanch Always-- along with STZ (store zero) and a bunch of others.

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sat Apr 14, 2012 5:36 am 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
ElEctric_EyE wrote:
teamtempest wrote:
...Still, that 64K "zero page" is an awful lot of "fast" registers already.

Ever since I got into FPGA's I've wondered about this. It was known that programs that could fit in 'zero page' ran faster. I'm not sure this applies to 6502 Cores within FPGAs because the delays in the higher addresses were due to delays in the silicon... Maybe someone more knowlegdeable can confirm or deny this?


Zeropage is faster because the instructions are 1 byte shorter. For absolute addresses, the core has to read an extra address byte, which takes an extra cycle. Unrelated to this, the system designer could also decide to put fast memory in the zero page, and slower memory in the higher addresses, but that's a completely separate issue.

Also note the zeropage advantage isn't that big. An INC ZP takes 5 cycles, compared to 6 cycles for INC ABS. Everything in the core is the same, except for fetching the extra MSB for the ABS address.


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sat Apr 14, 2012 4:16 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigEd wrote:
So, my idea is:
    16 registers, including A, X, Y and S
    all can function as accumulators (for logic and arithmetic operations)
    all can function as index registers
    Perhaps name them A, B, C, D, E, F, G, H, I, J, K, V, W, X, Y, S
    Long distance shift
[...]

As for the instruction encoding, it's simple: two 4-bit fields in the top of the instruction. One selects the destination register for those opcodes which need it. The other selects the index register for those opcodes which need it.
Hi, Ed! I like the notion of destination and index fields in the top of the instruction. It seems a tidy way to add functionality to the design: extra registers, and (via the alternative indexes) extra address modes. Then I got thinking...

If the PLA and PHA instructions are among those that get destination and index fields, then that means you could (for example) Push or Pull register G using register K as the SP, is that right?

And... if the RTS instruction is among those that get destination and index fields, then that means you could RTS using register L (for example) as the SP, is that right?

My observation is that this is shaping up to be a very powerful processor for running FORTH -- far more so than the 6502 or even the 65816! FORTH is stack-oriented, of course, so the benefits of PHA/PLA variants are pretty obvious. For starters, you could have an implementation that was free to use dedicated registers for the Parameter Stack pointer, the Return Stack pointer and/or the Interpretive Pointer.

Even more exciting, the benefit of RTS variants is that you could base the FORTH threaded interpreter on dclxvi's six-cycle NEXT. This is a super-fast scheme that unfortunately, on 65816, is problematic with regard to interrupts (which make use of SP in a conflicting way). But your proposed 65ORG16.c core avoids the difficulty because it allows various registers to act as SP, eliminating the conflict.

Here I have posted a simple illustration of how RTS can thread together a list of subroutines. (This is part of a topic I created regarding a hardware work-around for the interrupt problem. The threading illustration is the only part relevant to 65ORG16.c.)

cheers,

Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sat Apr 14, 2012 5:59 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Hi Jeff
well... I do think it's right to put S into the register set. But I hadn't thought so far as to think of the stack pointer as one of the configurable registers for stack operations, although as an implementation choice it's probably quite easy.
Code:
  PHB
is really a synonym for
Code:
  PHB.S
or some similar syntax, allowing for
Code:
  PHB.E
and offering the mental challenge of remembering which letter is the thing being pushed and which is the stack pointer.

A possible sticking point with your idea is the implicit upper 'byte' of the stack pointer. All these stacks would live together in the same page 1, which is 64k words in the 65Org16. (In the 65Org32 that doesn't happen.) Does that cause any problem or is that fine?

(To answer TT's earlier question: yes, all registers in this discussion should be pushable and poppable, which I neglected to mention, but I was commenting on the base machine which has only A, X, Y and only has the traditional PHA, PLA.)

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sat Apr 14, 2012 11:58 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Dr Jefyll wrote:
...Even more exciting, the benefit of RTS variants...
cheers,

Jeff

This idea is very interesting... An RTS suited for each register. Wouldn't this idea be most useful if the software didn't have to keep track of the stack? Meaning, maybe the 64K stack 'page' should be divided by 16 for each of the registers...

I'm not saying I can do this, or have the time right now to attempt this, but I'm sure it's not extremely difficult...

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sun Apr 15, 2012 12:35 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8512
Location: Southern California
Quote:
Wouldn't this idea be most useful if the software didn't have to keep track of the stack? Meaning, maybe the 64K stack 'page' should be divided by 16 for each of the registers...

Every register should be able to cover the entire range, so you don't have to switch registers (and watch for when to do so-- what a pain that would be!) as the program advances. (Again, this stack pointer becomes a program pointer.) The software doesn't have to keep track of the stack, because for example RTS.G would do the same thing as RTS does now on S, but it would be on register G. It would load the program pointer from the the address pointed to by the address pointed to by register G (yes, double indirection), and increment G automatically as the RTS instruction does already to S.

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sun Apr 15, 2012 6:53 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigEd wrote:
A possible sticking point with your idea is the implicit upper 'byte' of the stack pointer. All these stacks would live together in the same page 1, which is 64k words in the 65Org16. (In the 65Org32 that doesn't happen.) Does that cause any problem or is that fine?
Hmmm.. I did overlook the fact that SP is only 16 bits. That's a disappointment, but hardly a show-stopper. Heck, FIG Forth for 6502 uses 8-bit addresses for stacks! (The Parameter stack is in Z-pg, addressed by X, and the Return stack is in pg 1, addressed by SP).

As for the 65ORG16.c core, I think if you give other registers the same abilities as SP then the implications are very promising -- profound, even. The 6500 family has many advantages but it suffers, performance-wise, from all the bus cycles spent fetching zero-page pointers for memory addressing. So, in my opinion, anything you do that lets memory addressing occur via on-chip registers is a real advantage. Using other regs as X and Y is a bonus in this regard. But with SP the icing on the cake is the built-in auto-increment -- a real cycle-saver for searches and list processing. Moreover, SP is a reg that can be used to load the PC, so there are intriguing possibilities there.

cheers,

Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sun Apr 15, 2012 7:45 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8512
Location: Southern California
Quote:
The 6500 family has many advantages but it suffers, performance-wise, from all the bus cycles spent fetching zero-page pointers for memory addressing. So, in my opinion, anything you do that lets memory addressing occur via on-chip registers is a real advantage.

The answer for that is a stack processsor, which has virtually no processor registers except that the stacks are in the processor itself, not out on the bus. Its machine language really is Forth. Stack processors usually do more MIPS than MHz, IOW, finish more than one Forth "primitive" per clock, without really having any pipelining. As long as we don't go that route however (which is no longer a 65-family processor at all), making the data bus the same width as the address bus means a complete address fetch takes only one clock, regardless of whether it's zero page or anywhere else in memory.

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sun Apr 15, 2012 8:15 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Quote:
The answer for that is a stack processsor [...] Its machine language really is Forth.
Yes, these are fascinating machines. (Example: the J1 processor)
Quote:
making the data bus the same width as the address bus means a complete address fetch takes only one clock, regardless of whether it's zero page or anywhere else in memory
I'm in favor of that. But that's the 65ORG32 project, isn't it? Maybe I'm confused :roll:

I wasn't trying to turn the 65ORG16.c into something it's not. But I did want to draw attention to the favorable implications of destination and index fields in the top of the instruction.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Sun Apr 15, 2012 8:26 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: 65ORG16.c Core
PostPosted: Sun Apr 15, 2012 8:20 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
As and when we have a one-byte address version of the core, it would do service both as a 65Org16 variation and as a 65Org32. So if 64k words is enough for you, or if you favour external banking schemes, that might be of interest.

Cheers
Ed


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: