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

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Fri Jan 03, 2020 4:19 pm 
Offline

Joined: Thu Jan 02, 2020 11:32 am
Posts: 19
Location: Nottingham, England
As many of you helpful people know(And you've helped a lot!), I'm working on my first 8-bit computer, but the question still remains, Should I use Serial as an output or something like VGA?

Would One Be Cheaper Over The Other?
Which Is Easier?
Does Serial Rely On As Much Graphical Hardware or Just Software and A Little Bit Of Hardware?

I'm under the assumption that using serial will limit the functionality of the computer however i am fine with this as this is my first computer and i am willing to make sacrifices for an easier design!

Thanks for the help!

_________________
Nice Little Community This Isn't It


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 5:16 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigLadWhillis wrote:
using serial will limit the functionality of the computer however i am fine with this as this is my first computer and i am willing to make sacrifices for an easier design!

For your first computer you do want an easy design. So, you're on the right track. :) Indeed, even if VGA were your goal, it'd still make sense to include serial comm to help you get the VGA up and running.

Your costs will include a UART of some kind and an oscillator for it. (If you like, the same osc can probably also supply the CPU clock.) And most folks use an inexpensive RS232-to-USB adapter for connecting to the PC whose job is to act as a terminal. Edit: BillO suggests Bluetooth.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 6:04 pm 
Offline

Joined: Thu Jan 02, 2020 11:32 am
Posts: 19
Location: Nottingham, England
Dr Jefyll wrote:
BigLadWhillis wrote:
using serial will limit the functionality of the computer however i am fine with this as this is my first computer and i am willing to make sacrifices for an easier design!

For your first computer you do want an easy design. So, you're on the right track. :) Indeed, even if VGA were your goal, it'd still make sense to include serial comm to help you get the VGA up and running.

Your costs will include a UART of some kind and an oscillator for it. (If you like, the same osc can probably also supply the CPU clock.) And most folks use an inexpensive RS232-to-USB adapter for connecting to the PC whose job is to act as a terminal. Edit: BillO suggests Bluetooth.

-- Jeff

Would USB to TTL Work In Place Of a UART? I just found out i already have one of them which includes RX TX 5v For Power & GND

_________________
Nice Little Community This Isn't It


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 6:13 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
If you want to stay "retro" then video output, of any format is generally hard these days.

Which is quite ironic, but it boils down to the old video chip (CRTC types) being hard to obtain and the resulting circuitry being tricky, or at least more complicated that it needs to be - at least for a relative newbie.

So current solutions appear to be memory mapped using a CPLD or FPGA to produce colour video (PAL/NTSC or VGA), or a separate graphics chip (e.g. FPGA or a TMS9918A or fpga emulator) or using a microcontroller - e.g. ATmega for text and/or graphics output - even colour (See Quinn Dunki's Veronica project.

Or just use serial for the first go - maybe with a character LCD display of some sorts - most seem to use 16x2, but you can get 4x20 versions too.

However, don't let serial put you off - my own Ruby system uses serial and can do colour graphics in high resolution by sending high-level commands up the serial line to say e.g. "plot a circle at x,y" and so on. e.g. https://www.youtube.com/watch?v=rPGCT0lah4Q

I had originally intended to use an ATmega to generate 320x240 monochrome video but while it worked, it was a bit too slow, so I went for a plan B which was a "smart" program running on the computer at the end of the serial line (My Linux workstation/laptop)

Cheers,

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 6:17 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
BigLadWhillis wrote:
Would USB to TTL Work In Place Of a UART? I just found out i already have one of them which includes RX TX 5v For Power & GND


You still need the UART.

The USB serial adapters give your PC a UART - so you get 2 wires from your PC to take/send data but you need another UART for this to talk to at the 6502 end. You can do it in software using 2 bits of the 6522 and software to emulate the serialisation but it's tricky and you might find the max. data rate is limited.

I power my Ruby board via a TTL serial adapter but the board still has a UART (although it's part of the ATmega 'host' processor that I'm using - see https://projects.drogon.net/6502-ruby/ if you want the boring details)

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 6:31 pm 
Offline

Joined: Thu Jan 02, 2020 11:32 am
Posts: 19
Location: Nottingham, England
I am now under the opinion of using a Serial Output due to it being easier for my first project, however, does anyone have any information on how to get started with UARTs, looking at google and youtube, they mainly show how to use it with boards like Arduino.

_________________
Nice Little Community This Isn't It


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 7:20 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
BigLadWhillis wrote:
I am now under the opinion of using a Serial Output due to it being easier for my first project, however, does anyone have any information on how to get started with UARTs, looking at google and youtube, they mainly show how to use it with boards like Arduino.


There are 2 sides to it.

One side faces the 6502. The other side goes into your PC.

You may need a UART for the PC - This is a USB Serial TTL device (typically these days) So you end up with:

6502 <-> UART <-------------------> (USB) UART <-> PC/Temrinal

You run a terminal program on the PC - If Linux, then minicom is one I use, but there are equivalents for MS Windows/Mac.

On the 6502 side, you would typically initialise the UART - put some values in a control register to control the data rate and format (use 8 data bits, 1 stop bit and no parity), then write a subroutine to output a character which typically would poll a register to see if the output register is free, then when it's free, you write the character into the output register and return.

And that's all there is to it.

You can get much more sophisticated by using interrupts on the 6502 side, but I'd not bother when you're getting started - just implement the simplest "putchar" function, then you can build everything on-top of that. You can even find code online (and here) to implement that putchar with the 6551 (or whatever UART you use). It's typically quite simple. (I don't use a 6551 in my projects, so can't directly help here)

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 7:53 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8538
Location: Southern California
The 6502 primer's displays section presents options you'll want to consider and has lots of helpful links. Especially since this is your first computer though, you'll want to go through the entire 6502 primer. Other sections will have information you might not realize the importance of yet. BTW, intelligent character LCDs are commonly available up to 4 lines of 40 characters each.

Regarding UARTs, see my RS-232 primer. Even if you want to forego the higher-voltage line drivers and receivers, the parts regarding how data is usually sent over RS-232 will still apply. Some of the video interfaces linked in the displays section of the 6502 primer linked above use SPI which is a synchronous-serial interface (not asynchronous like UARTs give you). I have a comparison of serial interface types in this forum post, with more links to more-detailed descriptions with diagrams and to source code for bit-banging SPI and I²C on a 6502 with 6522 VIA.

_________________
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: Fri Jan 03, 2020 7:57 pm 
Offline

Joined: Thu Jan 02, 2020 11:32 am
Posts: 19
Location: Nottingham, England
drogon wrote:
BigLadWhillis wrote:
I am now under the opinion of using a Serial Output due to it being easier for my first project, however, does anyone have any information on how to get started with UARTs, looking at google and youtube, they mainly show how to use it with boards like Arduino.


There are 2 sides to it.

One side faces the 6502. The other side goes into your PC.

You may need a UART for the PC - This is a USB Serial TTL device (typically these days) So you end up with:

6502 <-> UART <-------------------> (USB) UART <-> PC/Temrinal

You run a terminal program on the PC - If Linux, then minicom is one I use, but there are equivalents for MS Windows/Mac.

On the 6502 side, you would typically initialise the UART - put some values in a control register to control the data rate and format (use 8 data bits, 1 stop bit and no parity), then write a subroutine to output a character which typically would poll a register to see if the output register is free, then when it's free, you write the character into the output register and return.

And that's all there is to it.

You can get much more sophisticated by using interrupts on the 6502 side, but I'd not bother when you're getting started - just implement the simplest "putchar" function, then you can build everything on-top of that. You can even find code online (and here) to implement that putchar with the 6551 (or whatever UART you use). It's typically quite simple. (I don't use a 6551 in my projects, so can't directly help here)

-Gordon


I was originally looking at the Zilog ZDU0110RHX, but now may use the 65c51 due to it being made for the 65c02. Thanks for the recommendation!

I do have one question however, What clock do you need to use for the 65c51 for 57600 baud, as that is the baudrate for the serial to usb adaptor that i'm looking at.

_________________
Nice Little Community This Isn't It


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 7:59 pm 
Offline

Joined: Thu Jan 02, 2020 11:32 am
Posts: 19
Location: Nottingham, England
GARTHWILSON wrote:
The 6502 primer's displays section presents options you'll want to consider and has lots of helpful links. Especially since this is your first computer though, you'll want to go through the entire 6502 primer. Other sections will have information you might not realize the importance of yet. BTW, intelligent character LCDs are commonly available up to 4 lines of 40 characters each.

Regarding UARTs, see my RS-232 primer. Even if you want to forego the higher-voltage line drivers and receivers, the parts regarding how data is usually sent over RS-232 will still apply. Some of the video interfaces linked in the displays section of the 6502 primer linked above use SPI which is a synchronous-serial interface (not asynchronous like UARTs give you). I have a comparison of serial interface types in this forum post, with more links to more-detailed descriptions with diagrams and to source code for bit-banging SPI and I²C on a 6502 with 6522 VIA.


I have looked through most of the primer throughout the day. Thank you for this, It has been the most useful thing that i have looked at throughout the creation process for my computer! My favourite part was the history of programming languages link, rather humourous if i do say so myself.

_________________
Nice Little Community This Isn't It


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 8:08 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1485
Location: Scotland
BigLadWhillis wrote:
I was originally looking at the Zilog ZDU0110RHX, but now may use the 65c51 due to it being made for the 65c02. Thanks for the recommendation!

I do have one question however, What clock do you need to use for the 65c51 for 57600 baud, as that is the baudrate for the serial to usb adaptor that i'm looking at.


Note that the 65C51 has a very serious BUG that makes it somewhat hard to use. Avoid it. If you're running your system at 1 (or 2) Mhz then look for an older 6551.

You'll need to look at the data sheet for the clock/crystal frequency.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 10:11 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
BigLadWhillis wrote:
drogon wrote:
BigLadWhillis wrote:
I do have one question however, What clock do you need to use for the 65c51 for 57600 baud, as that is the baudrate for the serial to usb adaptor that i'm looking at.
The serial to USB adapters don't care what speed you run them at. It more depends on how the virtual COM port is configured on the PC and how fast your UART is set to run. Both the UART on your device and the virtual COM port on the PC need to be configured the same (BAUD rate, bits, stop bits, flow control, etc...)

The maximum speed for the 6551 is 19,000 BAUD.

I use the 6551 most of the time (because I have dozens of them) Here is the code I use to initialize it:

Code:

ACIARW   = $8000        ; Base address of ACIA
ACIAST   = ACIARW+$01   ; ACIA status register
ACIACM   = ACIARW+$02   ; ACIA command register
ACIACN   = ACIARW+$03   ; ACIA control register

         sta ACIAST                 ; Do a soft reset on the ACIA (65C51)
         lda #$0B                   ; Set it up for :
         sta ACIACM                 ;        no echo, no parity, RTS low, NO IRQ, DTR low
         lda #$1F                   ; and :
         sta ACIACN                 ;        19200, 8 bits, 1 stop bit, external Rx clock

_________________
Bill


Last edited by BillO on Fri Jan 03, 2020 10:15 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 03, 2020 10:14 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
drogon wrote:
BigLadWhillis wrote:
Note that the 65C51 has a very serious BUG
Only the WDC items. Earlier 65C51s don't have the issue.

_________________
Bill


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 04, 2020 1:11 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8538
Location: Southern California
The '51 can be run at 125kbps or even more if you use the x16 input clock option rather than the onboard BRG. I've used it this way at 31.25kbps for MIDI.

Quote:
I do have one question however, What clock do you need to use for the 65c51 for 57600 baud

57600 times 16 is 921600, so 921.6kHz.

_________________
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  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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: