6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Nov 13, 2024 3:01 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Jul 01, 2015 8:35 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
This has been one of the reasons why I have delayed starting my 65c02 homebrew. I've always 'dreaded' the part where I have to mess with serial connections to/from my 65c02 and my Mac. I know it's probably easy for most of you.

Anyway, assuming I get started and connect the 65c02 to my Propeller (for ROM) and SRAM, I'm going to need to communicate with it.

I thought I would start with a small ROM that just blinked an LED to confirm the computer is working.

Then, I need to upload some type of BASIC or "OS" so that it understands the serial requests right?

So, what OS should I use?

And, on the hardware, are there any examples of adding a serial connection to the computer? I would like to use the serial port of the propeller if I could. And by serial port, I actually mean the USB port that is on my propeller dev board.

Any ideas on how to start this?

Thanks.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 01, 2015 8:43 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10977
Location: England
If the propeller sits on the 6502 bus, and is able to run or stall the 6502, then you should be able to intercept some chosen addresses, such that a read or write to these addresses is handled by the propeller as a read or respectively a write to its serial connection. You can get away without implementing a corresponding status register, but it would help a little to write one of those too: to see if there's an incoming byte to read, and to see if its ready to take the next outgoing byte. Beyond that, you might add interrupts, but you don't need to.

I think EhBASIC and also the early Microsoft Basics need only to be hooked up to a character input and character output routine: then you have a command line prompt and the ability to compute.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 12:43 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 589
Location: Michigan, USA
Quote:
... are there any examples of adding a serial connection to the computer? I would like to use the serial port of the propeller if I could. And by serial port, I actually mean the USB port that is on my propeller dev board.

Have you looked at any of the work by Jac Goudsmit on his ProPeddle project? It may provide some good background information and insights...

Good luck on your project.

Cheerful regards, Mike


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 5:28 pm 
Offline

Joined: Mon May 25, 2015 1:12 pm
Posts: 92
I've a fun but slightly silly idea. Why don't you hook up a centronics (parallel port) printer for output then you can pretend it's one of those machines you see in flaky black and white. On the other hand, serial ports really aren't as scary as people think, just keep it minimal. TXD, RXD, CTS, RTS and ground. Set both ends the same and you're off to a good start.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 5:59 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8483
Location: Midwestern USA
DigitalDunc wrote:
I've a fun but slightly silly idea. Why don't you hook up a centronics (parallel port) printer for output then you can pretend it's one of those machines you see in flaky black and white. On the other hand, serial ports really aren't as scary as people think, just keep it minimal. TXD, RXD, CTS, RTS and ground. Set both ends the same and you're off to a good start.

Excellent suggestion!

My POC unit talks to both the console and my UNIX software development machine via TIA-232, with both ports running at 115.2 Kbps. A TIA-232 plug-in card can be added to any PC that has a PCI, PCI-X or PCI-E slot. The idea of struggling to get a USB interface going to a hobby computer is ridiculous when proven and easily adapted interface technology like TIA-232 and Centronics (parallel) already exists.

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 6:43 pm 
Offline

Joined: Sun Jul 28, 2013 12:59 am
Posts: 235
BigDumbDinosaur wrote:
My POC unit talks to both the console and my UNIX software development machine via TIA-232, with both ports running at 115.2 Kbps. A TIA-232 plug-in card can be added to any PC that has a PCI, PCI-X or PCI-E slot. The idea of struggling to get a USB interface going to a hobby computer is ridiculous when proven and easily adapted interface technology like TIA-232 and Centronics (parallel) already exists.

Quite a few people have computers that don't have such expansion ports, though, just USB. For which, yes, USB->serial and go from there. I have yet to hear good things about any USB->Centronics adapter. And so it goes.

On my side, I just noticed within the past few minutes that the docking station for my main computer (a laptop) has a Male DB9 port on it... And it actually works, which is the really surprising part.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2015 7:07 pm 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
I have used an FTDI cable to do USB->Serial conversion for 6 or 7 projects including one with a 6502 and another for an EEPROM programmer. It's very easy to get going.

http://www.ftdichip.com/Products/Cables ... Serial.htm

Actually, FTDI sells another chip (FT2232?) that can do USB->SPI. If you are afraid of serial, this would be even simpler than that. Get a 74HC595 or 74HC164 for output and a 74HC165 for input and you can transfer data between the PC and 6502.

http://www.ftdichip.com/Products/Cables/USBMPSSE.htm


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 03, 2015 6:42 am 
Offline

Joined: Tue Feb 24, 2015 11:07 pm
Posts: 81
I use these to talk to my 6502 computer:

FTDI adapter

I especially like the arrows on the PCB showing which lines are driven by the adapter and which sensed, which helps me avoid contention, especially with RS-232. Does TX mean TX from the DTE ( computer / laptop) perspective or from DCE ( modem / peripheral device) perspective? I always have to double check.

And this is how I simulate a UART device on the 6502 bus:

UART_read() and UART_write()

This example is slightly complicated by the fact that the actual UART on my 6502 computer is provided by a second AVR which is accessed via SPI although that is transparent to the 6502.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 03, 2015 8:24 pm 
Offline
User avatar

Joined: Thu Jun 23, 2011 2:12 am
Posts: 229
Location: Rancho Cucamonga, California
cbmeeks wrote:
This has been one of the reasons why I have delayed starting my 65c02 homebrew. I've always 'dreaded' the part where I have to mess with serial connections to/from my 65c02 and my Mac. I know it's probably easy for most of you.

Anyway, assuming I get started and connect the 65c02 to my Propeller (for ROM) and SRAM, I'm going to need to communicate with it.


My "L-Star" project is based on a Propeller bitbanging the 65C02. See https://hackaday.io/project/3620 and https://github.com/jacgoudsmit/l-star. It's based on a previous project called Propeddle that used more glue logic so the Propeller also had control over interrupts and whatnot. Propeddle is more advanced but L-Star is easier to understand. Feel free to use whatever you want from my Github repo (MIT license).

I found that a very easy way to let the 65C02 communicate with the outside world is to emulate the PIA of the Apple-1. Basically it takes up 4 addresses in 6502 address space, and the 6502 reads and writes data in a parallel way by storing a byte into, or reading a byte from a reserved address. The high bit of those bytes is used for flow control so only 7 bits of each byte are usable to transfer data, but 7 bits of data is enough for an ASCII terminal (*). The Propeller takes care of catching and providing the bytes in another cog, and converting them to/from the standard serial port that you also need for programming the Propeller. L-star also lets you use a (1-pin) video output and a PS/2 keyboard.

Quote:
I thought I would start with a small ROM that just blinked an LED to confirm the computer is working.


My first program when I started dabbling with Propellers bitbanging 6502's was to run a (text) video cog and sharing the video buffer with the 6502. I just hand-assembled a ROM that would increment a memory location in the video buffer, and looped forever. The result can be seen at https://www.youtube.com/watch?v=WBdACu4OK-s.

Quote:
Then, I need to upload some type of BASIC or "OS" so that it understands the serial requests right?


With an Apple-1 PIA emulator at address $D010, you can map the Woz monitor at $FF00 and some ram at $0000 and start playing. L-star's Apple-1 emulator maps an 8K ROM with Woz mon, Ken Wessen's Krusader and Apple Integer Basic into the top of 6502 address space, and there's enough memory left over to emulate about 16K of RAM. I played Star Trek (the BASIC program) on it :-)

I also made a setup that emulates the Ohio Scientific / OSI Superboard II (also known as the OSI Challenger C1P, also known as the UK101), but I still have to finish the ACIA emulator.

Quote:
So, what OS should I use?


It should be clear to you by now that it's very easy with current-day resources to bring up a simple 6502 system that has nothing other than a microcontroller to talk to the world. Basically most things you want to do have already been invented and can be easily obtained. Parts are cheap (you can even get a 512KB SRAM chip for a few dollars) and ROMs of old 6502 machines have been dumped and can be easily found on the Internet. A lot of Parallax enthusiasts have shared code such as serial port drivers and video drivers; all you need to do is write the "glue" firmware to let the 6502 access them. And if you run out of cogs, or memory, or pins, just add another Propeller!

I'm thinking in the future I would like to implement a hobby "bring-up system" that runs on the Propeller and lets you type 6502 assembly code which is then stored in a memory area that the 6502 thinks is ROM. This would possibly be a great way for beginners to get to know the 6502 and educate themselves on machine language, without spending a lot of money and time on EPROM burners and erasers and stuff like that.

I would also like to do something like a semi-graphic interface to emulate the KIM-1 or Elektor Junior 7-segment displays and keyboard on a video screen.

===Jac

(*) There are many ways to transfer digital information from the Propeller to the 6502. The most obvious one would be what I would call "simulated direct memory access": just let the Propeller load the binary data into a hub memory area somehow (maybe by emulating a floppy disk with the EEPROM or by transferring data via the serial port) and let the 6502 access it as part of its address area. It's up to you and you have total freedom of inventing "protocols" to transfer data between 6502 and Propeller.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 06, 2015 7:36 pm 
Offline
User avatar

Joined: Sun Oct 13, 2013 2:58 pm
Posts: 491
Location: Switzerland
Hi cbmeeks,

having a 65(C)02 talk to the Mac is easy. I suggest you use a 65(C)51 to start with because then you can use many of the monitor ROMs that have been published e.g. Daryl's http://sbc.rictor.org/sbcos.html. I normally use a modified original Apple (F8) ROM that instead using built-in video and keyboard uses the 65(C)51 as default IO device. To connect to the Mac I bought some of these http://www.mouser.ch/ProductDetail/FTDI/TTL-232R-5V/?qs=sGAEpiMZZMtf8aSAtgR7DpPMdam%2fwe00. FTDI provides an official Mac OS X driver. I use SecureCRT to connect over the USB-to-Serial Adapter. Also a CMOS 6502 system draws so little power that I use the same adapter to provide 5V for the system. the USB-to-Serial Adpater has TTL levels and interfaces directly with RXD and TXD of the 65(C)51. It is a good idea to have a pull-up on RXD (1kOhm) near the 65(C)51 to avoid reflections that disturb the serial signal when running the 65C51 with 115kbaud. Just use the following code
Code:
ACIA1portset   lda   #$10            ; 115200baud/8/1
               sta   ACIA1ctl         ; control reg

instead of
Code:
ACIA1portset   lda   #$1F               ; 19.2K/8/1
               sta   ACIA1ctl           ; control reg


On the Mac I use 64tass as 6502 cross-assembler.

cheers

Peter


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

All times are UTC


Who is online

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