6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 9:46 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: 6309 computer
PostPosted: Sun Mar 25, 2012 11:21 pm 
Offline

Joined: Sun Mar 25, 2012 11:07 pm
Posts: 2
I'm slowly working towards building an all-CMOS portable computer with a 6309 CPU at its core. I've come up with some rough designs, and I was wondering if there are any bad design decisions in there. Particularly, I'm worried about speed and how much current it will take to drive various chips on the bus. The CPU is only at 1Mhz, but I hear the 6809 requires rather fast peripherals.

I've made some ASCII diagrams explaining the general design here: http://pastebin.com/kXnhqaTG


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 26, 2012 1:42 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Why not use a 65c02 or even 65816? (This is a 6502 forum after all. :D ) The bus is nearly identical and all the 65xx made today are spec'ed for at least 14MHz and will typically run quite a bit faster if the memory and peripherals are up to it. Your address decoding has a lot more propagation delay than necessary though, especially having cascaded 138's. You can get more memory and more I/O with the scheme shown in my "Tip of the Day" #23 at viewtopic.php?t=342&start=23 . (The topic starts at viewtopic.php?t=342 .) The very fastest way will include selecting RAM ASAP and just not enabling the write until φ2 rises; but I'm using the scheme shown at 5MHz. It runs up to 7MHz with 4MHz parts but I back it down for a little margin for dependability. You can do the whole thing with a single quad NAND. I'm using 32KB of ROM and 16KB of SRAM; but with a little twist, you can make it the other way around.

If you are interested in the 65816 for its 16-bit registers and additional instructions and addressing modes but the 24-bit bus looks like extra complication, remember you don't have to latch, decode, or use the high 8 bits of it if a 16-bit bus is adequate for what you want to do. You'll still get a load of benefits.

The data sheets, available at http://www.westerndesigncenter.com/wdc/ ... tation.cfm (they're on this website too at http://6502.org/documents/datasheets/wdc/ but for some reason it doesn't seem to work at the moment), say a max of 1.5mA/MHz (with tester loading) for the 65c02. The output drivers are very strong, so you definitely don't need buffers to feed the bus.

My website linked below has a ton of related links on the links page.

_________________
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:
PostPosted: Mon Mar 26, 2012 2:46 am 
Offline

Joined: Sun Mar 25, 2012 11:07 pm
Posts: 2
GARTHWILSON wrote:
Why not use a 65c02 or even 65816? (This is a 6502 forum after all. :D ) The bus is nearly identical and all the 65xx made today are spec'ed for at least 14MHz and will typically run quite a bit faster if the memory and peripherals are up to it.

Mostly because I don't need all that much speed and that the 6309 has more registers including a second stack register, supports up to 32-bit operations, and has index and stack registers that span all addressable memory. I did consider using the 65816, but it seems that there are many features added on to it that make it a bit more difficult to completely understand. Maybe the WDC datasheet isn't the most clear and I should look elsewhere. The nice thing about their chips is that they're still in production-- the 6309 is pretty obscure by comparison.

GARTHWILSON wrote:
Your address decoding has a lot more propagation delay than necessary though, especially having cascaded 138's. You can get more memory and more I/O with the scheme shown in my "Tip of the Day" #23 at viewtopic.php?t=342&start=23 . (The topic starts at viewtopic.php?t=342 .) The very fastest way will include selecting RAM ASAP and just not enabling the write until φ2 rises; but I'm using the scheme shown at 5MHz. It runs up to 7MHz with 4MHz parts but I back it down for a little margin for dependability. You can do the whole thing with a single quad NAND. I'm using 32KB of ROM and 16KB of SRAM; but with a little twist, you can make it the other way around.

Thanks a lot for that tip! I was rather irritated with my current glue logic, since it takes up a rather large amount of board space for doing rather little.

GARTHWILSON wrote:
If you are interested in the 65816 for its 16-bit registers and additional instructions and addressing modes but the 24-bit bus looks like extra complication, remember you don't have to latch, decode, or use the high 8 bits of it if a 16-bit bus is adequate for what you want to do. You'll still get a load of benefits.

That upper byte latching actually makes quite a bit of since on the '816 since there's that 8-bit banking register... But, I just feel like that CPU is rather register starved...

GARTHWILSON wrote:
The data sheets, available at http://www.westerndesigncenter.com/wdc/ ... tation.cfm (they're on this website too at http://6502.org/documents/datasheets/wdc/ but for some reason it doesn't seem to work at the moment), say a max of 1.5mA/MHz (with tester loading) for the 65c02. The output drivers are very strong, so you definitely don't need buffers to feed the bus.

Those power consumption and current driving numbers are quite nice to see... Hm...

I guess my main thought here is that the 65816 seems like a useful CPU, it's just that there are fewer registers and operations that it can perform...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 26, 2012 3:39 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
As you may know, the 6502's zero page is basically 256 bytes of processor registers. On the '816, you can have lots of sets of "zero pages," the 256-byte range being set by the 16-bit direct-page register. The 6502's hardware stack is in page 1, ie, address $100-$1FF, but on the '816, it can be tens of thousands of bytes—although I've never needed anywhere near even one whole page.

When you know you're accessing the stacks constantly but don't know what the maximum depth is you're using, the tendency is to go overboard and keep upping your estimation, "just to be sure." I did this for years myself, and finally decided to do some tests to find out. I filled the 6502 stack area with a constant value (maybe it was 00—I don't remember), ran a heavy-ish application with all the interrupts going too, did compiling, assembling, and interpreting while running other things in the background on interrupts, and after awhile looked to see how much of the stack area had been written on. It wasn't really much—less than 20% of each of page 1 (return stack) and page 0 (data stack). This was in Forth, which makes heavy use of the stacks. The IRQ interrupt handlers were in Forth too, although the software RTC (run off a timer on NMI) was not. If you use an '816 and dedicate 64 bytes of stack space and 64 bytes of DP space to each program you have running concurrently, you could have hundreds of such programs and still have plenty of room in bank 0 for ISRs, the reset routine, etc.. The individual programs themselves would go in other banks.

Even 30 years ago though, people naturally thought the Z80 for example, which has more registers, wider registers, and a higher clock speed, should vastly outperform the 6502; yet the 6502 (and 6800) routinely did better in benchmark tests. The 6502 runs Forth about 25% faster than a 6800 at a given clock speed.

You'll get a small step up from the 6502 to the 65c02, and a much bigger step up from there to the 65816. Even a 6502 outperforms an 8086 though in the Sieve of Eratosthenes benchmark in cycles required to finish the job though, in spite of number and size of registers, and all the more an 8088. For completing ten iterations of the Sieve:
Code:
 5MHz   8088    4.0  seconds
 4MHz   6502    3.1  seconds
 8MHz   8086    1.9  seconds
 4MHz   65816   1.56 seconds
 8MHz   65816    .78 seconds
 8MHz   68000    .49 seconds
16MHz   65816    .39 seconds

IOW, a 4MHz 65816 did it faster than an 8MHz 8086 which has more and wider registers, yet none of the production 65816's available off the shelf today are rated for any less than 14MHz. The fastest '816 did it faster than the fastest 68000 which had 32-bit registers and a lot more of them. I also find the '816 much easier to program than the 6502. (See an example here.) It has more instructions and addressing modes, and features that make it far better suited for code relocation, multitasking, and a lot of other things where the 6502 is either clumsy or totally inept.

Do I sound like a 65816 salesman? :lol: :lol: :lol:

_________________
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:
PostPosted: Mon Mar 26, 2012 1:53 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Hi, superbilly -- welcome to the Forum! A couple more points for you to consider regarding your project...

You mentioned wanting to build a portable computer, which implies that it should be small. So it's worth remembering that the 65C816 is available in a 44-pin PLCC package, which occupies significantly less board space than a 40-pin DIP. (Of course you can get memory chips in PLCC, too; also peripherals such as the 65C22.) As you may know, PLCCs use .050" pin spacing on the chip itself, but a PLCC socket spreads things out a bit. You still save space, and everything's on the usual .1" grid.

superbilly wrote:
the 6309 has [...] index and stack registers that span all addressable memory.
Unfortunately, addressable memory on the 6309 is only 64K! Since your plan includes a 128KB flash, you will need to contrive some scheme to extend the 6309 address range. That'll consume board space and be awkward to program. The '816, on the other hand, is built to easily handle up to 16 megabytes...

superbilly wrote:
Maybe the WDC datasheet isn't the most clear and I should look elsewhere. The nice thing about their chips is that they're still in production-- the 6309 is pretty obscure by comparison.
IMO the WDC '816 data sheet does a terrible job of describing all the address modes. Luckily, other sources of info are available -- including the helpful gang here at 6502.org! :D

I can understand your attraction to the 6309 (ie, Hitachi's CMOS version of the Motola 6809). But have you investigated its availability? It (and the 29F010 flash) may be hard to find.

Edit: in this post, nonarkitten talks the HCS08 and HCS12 processors from NXP (nee Freescale; Motorola). Although a different animal from the 6309, the NXP chips do (like the 6309) inherit many impressive features from the 6809. Plus, the NXP chips are more modern, with higher clock speeds and fewer concerns about availability.

GARTHWILSON wrote:
As you may know, the 6502's zero page is basically 256 bytes of processor registers.

Amen! And, speaking of address modes, on the '816 you can set up 24-bit indirect pointers to memory! (3 zero-page bytes each)

-- Jeff


Last edited by Dr Jefyll on Wed Apr 29, 2020 2:08 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: 6309? What for?
PostPosted: Mon Mar 26, 2012 4:11 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8513
Location: Midwestern USA
First, welcome, Superbilly, to our 6502 forum.

Second, look at the 65C816 and also read here for some info about a simple 65C816-powered computer. Also, you might be interested in Daryl Rictor's 65C816-powered SBC, which makes use of programmable logic instead of 74xx silicon.

In my opinion, about all the 6309 has going for it is more registers. In all other respects, it is (again, in my opinion) inferior to the 65xx family. The fact that the 65xx family has had overwhelming success over the years and the 6309 is an obscure, out-of-production part should tell you something.

As Garth pointed out, the 65C816 is very flexible, especially with its relocatable zero page (aka direct page) and stack. Also, it has useful stack relative addressing instructions that are tailor-made for creating fully re-entrant subroutines. With separate vectors for each interrupt type, as well as an /ABORT input for dealing with memory access violations or bus errors, it is an easy processor with which to build a surprisingly powerful computer.

Speaking of interrupts, the 65xx family has one of the lowest interrupt latency specs of any microprocessor, past or present. For example, the 65C02, using the WAI instruction and an inline IRQ service routine, can react to an interrupt in as little as two clock cycles. Even when a standard vectored IRQ service routine is used, response can occur in as few as seven clock cycles.

After fixing a simple fabrication error on my part, I was able to get my POC unit working on the first try and have progressed to where I have working SCSI connected to it. If I can do it so can you. After all, I'm just a big, dumb dinosaur.

Please reconsider your plans to use the 6309 and instead put the 65xx family to work for you.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Mar 26, 2012 4:15 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
When i wanted to build a sbc myself, i went on ebay, and i found a a cheap MC6809, so i bought it... I started making plans, setting up schematics, but after a while i figured out that i didn't have much software that could run on it. After a while i decided to get a 6502 so i bought a CM630P (Bulgarian clone). After a while, i got a sbc board that was running Basic! Also there is the cc65 c compiler, and lots of other software.
As for the MC6809 i have it sitting in a white box with some other ic, and i wonder where could i use it... Also the MC68000 has lots of software support(like the IDE68K with its c compiler), i also built a 68k based sbc, but i am now waiting for 8BIT's lcd miracle solution. At the end i chose the 6502 only because it had better software support.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Mar 27, 2012 5:45 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
Also the MC68000 has lots of software support

There's an EhBASIC for the 680x0 too.
</shameless plug>

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 05, 2012 5:42 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I'd echo Jeff's point about the possible difficulty of getting a 6309, but for a hobby SBC you only need one or two.

For questions of bus loading and timing, it might be worth referencing other 6309 and 6809 designs. For example, The 4Mhz CoCo3 Project and Grant's 6809 computer

I notice a recent victory in retrofitting a 6809 (or 6309) to Atari 6502-based computers: the Liber809 project. (Via Hackaday)

As for software, that project is aimed at, or looking at, NitrOS-9, which describes itself as "a real-time, process-based, multitasking, multi-user, Unix-like operating system" which sounds interesting enough.

(I found my 6809/6309 'research' interesting enough because of the backstory of the revelation of Hitachi's extra registers and opcodes. The above-mentioned 4MHz project is interesting for speeding up non-bus-access cycles, and comes with a handy chart of opcodes and timings. The instruction encodings are interesting too, from a perspective of those of us looking at 6502 extensions!)

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Apr 07, 2012 3:18 pm 
Offline
User avatar

Joined: Mon Aug 08, 2011 2:48 pm
Posts: 808
Location: Croatia
leeeeee wrote:
Quote:
Also the MC68000 has lots of software support

There's an EhBASIC for the 680x0 too.
</shameless plug>

Lee.


About that, it is a bit unclear how to install the 68k EhBasic to a custom sbc.
It would be great to see a tutorial on how to setup 68000 EhBasic.


Top
 Profile  
Reply with quote  
 Post subject: Re: 6309 computer
PostPosted: Fri Dec 07, 2012 12:04 pm 
Offline
User avatar

Joined: Sat Dec 01, 2012 10:31 pm
Posts: 16
Location: England.
for what it`s worth, if anyone needs one and can`t find any, I have 17x 63B09`s here all pulled from working machines.

_________________
Also on Twitter as "YT2095".


Top
 Profile  
Reply with quote  
 Post subject: Re: 6309 computer
PostPosted: Fri Jun 28, 2013 2:52 pm 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 904
6309 is in fact really interesting. 6809 was already a pretty good chip for running Forth by offering a second stack pointer. 6309's extra registers (and the ability to combine them into 16-bit and even a 32-bit register), as well as block move instructions are a really interesting lesson in Instruction Set Architecture. I will take another look at the manuals when time permits.

EBay is full of Chinese 63B09s, some under $3.00 plus shipping. I wonder how fast these go.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: 6309 computer
PostPosted: Fri Jun 28, 2013 2:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
It does look like an interesting CPU!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 57 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: