6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 7:44 am

All times are UTC




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Sep 27, 2017 8:04 am 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
Hi guys, I started working on a 6502 graphing calculator a few years ago and I have been thinking about it again lately. I had an ATF1508 setup working at the time, so I can work on a little more complicated memory map. What would you think about this kind of set up?

RAM: 512k
ROM: 2k

0000 - 00FF = banked zero-page
0100 - 01FF = banked stack
0200 - 03FF = scratch memory (unbanked)
0400 - 7FFF = banked lower window for data
8000 - F7FF = banked upper window for data/program
F800 - FFFF = ROM (unbanked)

My idea was to have independent 3 bit counter chips for the zero page and stack so I would have 8 of each in the 512k RAM. For a lot of tasks I know I can just reuse counters and scratch variables in the zero page, but if I want a few hundred bytes to work with in a function or I run out of zero page, I can advance to a new one when I call a new function. Each function can also have its own temporary stack if needed. The downside is that functions that use a new zero page won't have access to the old zero page, so I would have to push any values I need onto the stack first and then copy them back off after I advanced to the new zero page. I know that would be slow, so I would only use a new zero page for functions where I really need the extra memory and can take the speed hit.

I would like to use an SD card to hold the firmware, so the ROM would just need to load that into the appropriate RAM banks, which shouldn't take up much space. Either the CPLD or two buffer chips would control the upper 4 bits of the 512k of RAM to give me two 32k windows (minus the few kb listed above.) I would put any bank switching code in the ROM. Jumping to code in another bank would work by pushing the return and destination banks and addresses onto a stack in the scratch area (which is not banked), then jumping to a function in the ROM that changes the bank and jumps to that address. If there is room, I could also put code in ROM to copy data between banks by setting the one window to the destination range and the other to the source range. If there is not enough room in ROM and I have to run the copy code from the upper window, I could advance to a new zero page, fill it up from the source bank then switch to the destination bank and empty the zero page, which would reduce the amount of time I spend switching banks. I would only run code from the upper bank since jump addresses would have to be reassigned to run the same code from the lower window (unless I only use indirect jumps, which seems like a bad idea.)

I know jumping to another bank to execute code then jumping back complicates things but I do think I will need to be able to do that. Some of the nicer calculators can solve symbolically, so doing "solve(2x=y,x)" returns "x=y/2" rather than just complaining that it can't find y. I think that kind of functionality, for example, should be available at any time to any program running, but I don't think that kind of solver, along with a GUI, graphing, trig tables, and a simple BASIC-like programming language could fit into 32k (but let me know if you disagree). I also thought it would be a good idea to map the LCD into the zero page since there will be a lot of data to dump to it.

The other idea I had was somehow getting debug information out of the calculator over serial to be able to single step the processor and see what it is doing every cycle. If there is room, I thought about putting some kind of 32-bit wide memory with a counter on there that would record the data bus, address lines, and some control signals every cycle. Then, in debug mode the interrupt would be called every single instruction. The CPLD would monitor the interrupt line and stop the counter when the interrupt was called. The interrupt code would read the data from the 32-bit memory and send it out over serial, so you could see the address and data lines for the last few cycles. Another way might be to divide the clock by 8 and store that information in the main RAM instead but only pulse the 6502 every eighth cycle. That would lower the max speed of the system though I think.

What do you guys think? Please tell your suggestions (other than switch to a 65816 :P )


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 27, 2017 8:29 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Druzyek wrote:
(other than switch to a 65816 :P )

It sounds like you know what to do. I played with various ideas years ago about bank switching and multiple ZPs and so on on the '02, and always had to come back to how much simpler it would be on the '816. It's just not worth it on the '02. I know Hewlett-Packard has sold 65c02-based calculators, but I don't know which ones. I'm very sure they weren't this complex though. Their more-complex ones had the Nut processor, then the Saturn, then ARM.

_________________
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: Wed Sep 27, 2017 8:51 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I think having code in several banks and jumping between them can be fine especially if you use an API.

Likewise having data spread over several banks.

And that's also all fine whether you're running native or interpreted code.

But swapping zero page and stacks sounds much harder unless you've arranged your software as a set of communicating tasks. In which case you'd probably pass messages in RAM rather than on the stack. Or you might define your own big stack in RAM with a full-sized pointer.

(The HP35s has a 6502 and is coded in C. I think I read that the C compiler was awful. )


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 27, 2017 9:34 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
BigEd wrote:
(The HP35s has a 6502 and is coded in C. I think I read that the C compiler was awful. )

I don't know anything about the 35s but I always thought it was very attractive in terms of styling! A good C compiler is something the '02 sorely needs. As far as I'm aware, there aren't any good ones for the '02.

_________________
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: Wed Sep 27, 2017 1:38 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
I know this isn't very helpful but I for one love the idea of seeing a graphing calculator being made. It's nice to see something different than a computer or console. I used to have so much fun on my TI-89.

What kind of display are you thinking? Or, is it going to be serial out?

I've always wanted to make a retro-inspired pixie tube calculator (or even old-school red 7-segment) based on a 6502. Just a basic calculator. I mean, that's what the 6502 was originally designed for right? Calculators and washing machines? :-D

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 27, 2017 6:48 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
cbmeeks wrote:
I've always wanted to make a retro-inspired pixie tube calculator (or even old-school red 7-segment) based on a 6502.


Image

:D
(from the HP Museum post at http://hpmuseum.org/forum/thread-8629-p ... l#pid78038 )

_________________
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: Wed Sep 27, 2017 7:09 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
Beautiful!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 28, 2017 4:22 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
cbmeeks wrote:
I've always wanted to make a retro-inspired pixie tube calculator (or even old-school red 7-segment)

I have not been able to find a source for this type of calculator LED displays recently (this one is 4-digit, and end-to-end stackable):

Image

Even for non-calcs, I think this might be useful for displaying status on an SBC for example while taking hardly any board space.

Slightly bigger, and dot-matrix (hence alphanumeric-capable), and serial-interfaced (bonus!), are the Broadcom (formerly Avago Technologies) displays. They are quite expensive though. See http://www.mouser.com/Broadcom-Limited/ ... fzZ1yzugs8 . This picture shows up much bigger than actual size on my screen:

Image

The one in the lower-left corner is about the size of a 14-pin DIP.

If you want one any bigger, you might as well go to an LCD. Unfortunately there aren't really any intelligent character LCDs that are tiny and hardly take any board space. I remember a German company that supposedly offered some 20 years ago, but it seemed like it was only vaporware.

Edit: My apologies Druzyek—I forgot you said "graphing calculator."

_________________
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: Thu Sep 28, 2017 5:18 am 
Offline

Joined: Sat Jun 04, 2016 10:22 pm
Posts: 483
Location: Australia
SparkFun had a serial graphical display a while back, but they discontinued the one I have. They still have the display itself and the serial backpack, though. They also have a much larger white-on-blue display that can also work with that backpack, and quite a few character-based serial displays here: https://www.sparkfun.com/categories/148
The display
The backpack


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2017 2:10 am 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
BigEd wrote:
But swapping zero page and stacks sounds much harder unless you've arranged your software as a set of communicating tasks. In which case you'd probably pass messages in RAM rather than on the stack.
I thought it would only work if the zero page and stack were able to be swapped separately so you could use the old stack to copy passed values into the new zero page but setting aside a chunk of RAM that is not swappable sounds like it would work too. I think it would save me time since I wouldn't have to worry about managing zero page memory when it started to get full. I would just switch to a new page for a new function and switch back when the function ends. I think keeping multiple pages going in the same function would be too complicated though.

Quote:
Or you might define your own big stack in RAM with a full-sized pointer.
I thought about that too. I also thought about setting aside one zero page address with a 16 bit hardware counter that would increase and decrease with reads and writes. I think it would be faster but I couldn't index into the stack any more.

cbmeeks wrote:
I know this isn't very helpful but I for one love the idea of seeing a graphing calculator being made. It's nice to see something different than a computer or console. I used to have so much fun on my TI-89.
I got started in a TI-89 too and really loved it (I know that makes me spoiled :P)

Quote:
What kind of display are you thinking? Or, is it going to be serial out?
I had this 3.2 inch 320x240 display going (briefly) with an MSP430 to use for the project but I think it might be better to find something that takes less RAM to double buffer.
Attachment:
DSCN3786.JPG
DSCN3786.JPG [ 22.54 KiB | Viewed 1366 times ]

Quote:
I've always wanted to make a retro-inspired pixie tube calculator (or even old-school red 7-segment) based on a 6502. Just a basic calculator. I mean, that's what the 6502 was originally designed for right? Calculators and washing machines? :-D
That would be awesome :) I got really lucky and got a free 5v Noritake Vfd display when they were giving 500 of them away. I used it for a programmable RPN calculator I made (not 6502) instead of the $5 4x20 LCD I was planning on using (not realizing how expensive those Vfd displays are!)
Attachment:
DSCN3768.JPG
DSCN3768.JPG [ 92.13 KiB | Viewed 1366 times ]


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2017 5:41 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
cbmeeks wrote:
I've always wanted to make a retro-inspired pixie tube calculator...

You mean a Nixie tube? :D

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2017 1:00 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
BigDumbDinosaur wrote:
cbmeeks wrote:
I've always wanted to make a retro-inspired pixie tube calculator...

You mean a Nixie tube? :D


What did I say? Pixie? LOL!!

Hey, I have an 8 year old granddaughter living with me...I'm sure I picked that word up somewhere. Hahaha.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2017 2:03 pm 
Offline

Joined: Sat May 02, 2015 6:59 pm
Posts: 134
cbmeeks wrote:
What did I say? Pixie? LOL!!

Hey, I have an 8 year old granddaughter living with me...I'm sure I picked that word up somewhere. Hahaha.

Of course, you could have gotten away with it just fine. Pixie tubes are/were a thing.
I think a Pixie tube calculator would be rather novel.
http://www.decadecounter.com/vta/articl ... ?item=1108
https://everything2.com/title/Pixie+tube

Image


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2017 2:05 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
I like!


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 29, 2017 2:42 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
AH! I didn't know those existed. Yeah, an 8 digit calculator with those would be pretty awesome.

Anyway, didn't mean to hijack the thread. Sorry about that.

_________________
Cat; the other white meat.


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

All times are UTC


Who is online

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