6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Jun 28, 2024 6:31 am

All times are UTC




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Aug 10, 2017 9:42 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10836
Location: England
Nearby I mention a cheap dev board[1] with 32k Flash (ROM) and 4k RAM. My initial reaction was that 4k RAM is a bit limiting. But on reflection, if making a 6502 board to solve a real world problem - control something, or monitor something, or act as a handheld terminal or calculator or chess machine - it seems to me that 4k of RAM might actually be plenty, so long as the application fits in the 32k of ROM.

It's also true that many early 6502 machines had relatively little RAM, even when sold as computers. (PET, Apple II, VIC-20)

I'd be interested to hear from others - is 4k RAM plenty?

[1] As noted below, that's an ARM board, but see also below for why it still has some relevance.


Last edited by BigEd on Thu Aug 10, 2017 11:30 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 11:21 am 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 360
Well, the VIC-20 only had 5KiB of RAM, 3.5KiB accessible to BASIC, and there wasn't any shortage of applications for it...

I've also seen embedded systems with only 256 bytes of RAM, or less, which are mirrored across Zero Page and the Stack Page (so you can use the same 256 bytes for both).

I would say how much RAM you need is entirely down to your application requirements, but if you're happy with VIC-20 level programs then yes, 4KiB is plenty. Personally I would say that the main culprit for using up lots of RAM on a 6502 system (where its not actual data you're working on) are video frame buffers - 128x64 monochrome, with one pixel per bit, is already 1KiB!

Having said that, the board you linked to is ARM not 6502, and I think that as a general idiom ARM code tends to use more RAM than 6502 because its a 32-bit architecture.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 11:27 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10836
Location: England
(Quite so, the dev board I mentioned is ARM, and I should have somehow[1] made it clear that I was thinking there about embedded emulation, where the ARM would emulate a 6502 entirely within its registers, needing no RAM for itself, and so leaving all 4k RAM for the 6502 application. A little of the Flash would be needed for the emulator code.)

[1] I added a footnote!


Last edited by BigEd on Thu Aug 10, 2017 11:35 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 11:32 am 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 360
Squeezing a 6502 emulator into sixteen 32-bit registers, of which fourteen are general purpose, without using any RAM at all - not even stack.... That would be a challenge, I think, but not impossible. You'd need to write a very flat program because you could only do one level of subroutine call before you'd need to start saving return addresses somewhere. Interrupts shouldn't be an issue though, if you use only FIQ they get their own set of registers negating the need to push anything.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 11:37 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10836
Location: England
It can be done - it has been done! (Very nearly: there's a little C in there because I'm lazy and so a little stack is needed.) See also this project.


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 2:27 pm 
Offline

Joined: Tue Jun 08, 2004 11:51 pm
Posts: 213
How small are the partitions of the flash? It would
be best if you can update the flash with code in the RAM or
a block of the flash.
If you can't get a small enough block size, I'd recommend using
a 28C256. Writing is slower but it can be done randomly. The only
thing is to make sure to have a switch to disable the update. A runaway
program can make a mess.
If you do a ROM Forth, 4K of RAM is plenty. You won't be as tied down
as a BASIC will do and it will use the available resources better.
With Forth, it will use about 8K of the 32K. You can top it off with a
Forth based assembler for about another 1K to 1.5K.
You'd still have most of the 28C256 for what ever you wanted.
Dwight


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 3:15 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 360
I think the RAM/ROM in this case is built into the ARM microcontroller, accessing an external parallel RAM like the 28C256, whilst not impossible, would be considerably slower and use up a lot of GPIO.

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 4:03 pm 
Offline

Joined: Tue Jun 08, 2004 11:51 pm
Posts: 213
I see that from other post. I'd thought you were going to use a real 6502.
Dwight


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 5:17 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10836
Location: England
For sure, I'd intended this thread to be talking about 6502 designs!


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 10, 2017 5:55 pm 
Offline
User avatar

Joined: Tue Oct 25, 2016 8:56 pm
Posts: 360
I'm not an experienced 6502-user like you lot, but my gut tells me that for embedded control applications 4K is plenty. You need the extra RAM if you're working with lots of data (spreadsheets) or pushing pixels on a screen (games).

_________________
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 12, 2017 10:04 pm 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 217
Location: Kent, UK
BigEd wrote:
It can be done - it has been done!
Splendid work, Ed. Just splendid.


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 12, 2017 10:31 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8460
Location: Southern California
For embedded control, often just a few dozen bytes of ZP and of page 1 are plenty. That assumes you don't need much data and the user won't be writing programs that go in RAM.

4KB however is not an available SRAM size. It goes from 2KB to 8KB.

_________________
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  
PostPosted: Sun Aug 13, 2017 6:06 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10836
Location: England
sark02 wrote:
BigEd wrote:
It can be done - it has been done!
Splendid work, Ed. Just splendid.

Cheers! It's untidy code, but it does the job. I'm glad I put it out there without waiting until the day that I'd made it presentable - that day was never going to arrive!


Top
 Profile  
Reply with quote  
PostPosted: Sun Aug 13, 2017 6:22 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10836
Location: England
I've realised today that my original question more or less answers itself: if there are mass-market chips with only 4k of RAM, and there are, it shows that this is a useful amount of RAM for some applications. And that's regardless of what CPU is in those chips, because in these cases RAM is for data - programs are in flash.


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 17, 2017 6:38 pm 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
Also, the W65C265 chip has only 576 bytes of on board ram to support the 8K mask ROM. As someone else commented how all micro controllers need to do is "flip some bits every now and then", it suggests that even this small amount is useful for some applications.

You can also consider, for example, TI's MSP series. They have devices with as low as 128 bytes of RAM.

I mean, think about something like a lawn sprinkler timer. They're reasonably sophisticated, but how much data do you really need to store and work with?


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

All times are UTC


Who is online

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