6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 1:27 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sun Dec 15, 2019 11:26 pm 
Offline

Joined: Sun Dec 15, 2019 11:17 pm
Posts: 3
I'm following Tom Owad's excellent book (Apple I Replica Creation: Back to the Garage), pouring over Ben Heck's videos, and googling what other guys have done before me - and I've had success building my Apple 1. It works, I can play in the Wozmon and even enter integer BASIC programs (I'm using the ROM image from Briel I found online.)

But now that it works, I want to add some functionality. One of the ideas I had was to read text files from an SD card using an Arduino, and "enter" the programs by directing the data through the PIA. I'm using a WD65C02 processor and a WD65C21 for the PIA. It seems the one thing I'm missing is a signal from the CPU, or PIA which indicates it's ready to receive another character. Data just keeps flowing from the Arduino whether the CPU is ready or not, so a lot of characters get missed.

Maybe this has been solved, but I'm just not googling the correct terms.

I'm a total newbie and I'm amazed I've even been able to get this far. Thanks for indulging me.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 16, 2019 12:15 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 180
Sounds like a nice project, and you've got a long way so far.

You should probably use another line or two on the PIA as a control lines. This can be very simple or as complex as you want. It could be polled or it could be interrupt driven.

You could have an input line as a data ready line, the Arduino changes the state of this when a byte is ready. You could have an output that tells the Arduino when a byte has been read. You could possibly use timing instead of these signals, but that is more complicated. The WDC 65C21 data sheet is very helpful here and describes exactly what you want to do, take a look at the top of page 15:

Quote:
A second output mode allows CA2 to be used in conjunction with CA1 to “handshake” between the processor and the peripheral device. On the A side, this technique allows positive control of data transfers from the peripheral device into the microprocessor. The CA1 input signals the processor that data is available by interrupting the processor. The processor reads the data and sets CA2 low. This signals the peripheral device that it can make new data available.


So you can use CA1 as an interrupt input when a byte is available, and CA2 as a signal to the Arduino to set the next byte. Then you still have a whole port left for some other use too.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 16, 2019 8:37 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
Welcome, theduke! Sounds like a good build and it has launched you on an interesting path.

As jds says, the PIA's ports have handshake lines for exactly this kind of reason. You may be able to get the PIA to do most of the work, or you might do it in software on the 6502.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 16, 2019 3:13 pm 
Offline

Joined: Sun Dec 15, 2019 11:17 pm
Posts: 3
Thanks guys, I will take a look at the 65C21 datasheet.

I can't understate how surprised I am that this thing works. Hat's off to Tom Owad, Ben Heck, and Vince Briel (and Steve Wozniack of course).


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 16, 2019 5:43 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
A quick search turned up these potentially useful previous threads - but a search for [6502 parallel port handshake] could turn up useful results elsewhere too.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 16, 2020 1:41 pm 
Offline

Joined: Sun Dec 15, 2019 11:17 pm
Posts: 3
I wanted to circle around back to this 6-month old post and show you I've got my Apple 1 clone (or more accurately, a re-imagined Apple 1) reading from the SD card: https://www.youtube.com/watch?v=nC9FKpVA9AI

If you want to hear more about my project, here's my video from the "Virtual VCF" in March: https://www.youtube.com/watch?v=a23xFbz_9GA


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 16, 2020 7:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
Thanks for the videos!


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

All times are UTC


Who is online

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