6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed May 15, 2024 11:24 pm

All times are UTC




Post new topic Reply to topic  [ 34 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: VGA Serial Module
PostPosted: Sat Mar 25, 2023 2:28 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 704
Location: Texas
Hey everyone!

Back when I started in 6502-land, I had built a system very similar to Garth's Potpourri design. It was capable of I/O through the 6522 VIA, but the actual I/O devices were lacking. I eventually learned how to hook up a 16x2 LCD, and get some SPST buttons detected. But my dream was always to get something displayed on a monitor and with a full keyboard.

The PS/2 Keyboard is super easy to connect directly to the VIA, but VGA video display takes MUCH more effort. When I was fresh at this, I wanted some pre-built module that I could use similar to the 16x2 LCD, but would display on the monitor instead. I found some things out there, but they were either discontinued, or required CPLD's which I myself could not program.

Now that I've gotten more experience with video display, I am now working on a VGA I2C (or SPI?) Module (see attached schematics). You interface with the device through the CLOCK and DATA pins. Send 22 bits sequentially and you get a character on the screen! This module would display 8x8 characters, with a total of 80x60 on-screen characters. It allows for 256 different characters, with 16 character banks available. 8K of RAM, 2x 32K of ROM, some shift registers, some counters, and some glue logic.

The picture of the board is from KiCad, and it definitely not completed. Lots of silkscreen to fill in! But the basic layout works, and auto-router finished within a few minutes.

I haven't had it printed yet, mainly because I'd like some feedback from y'all. Not to see if you find anything wrong (though I wouldn't mind that), but just to have some overall design insight. What would be helpful to a newbie? Should there be a different placement of components/connectors? Should I go with something more 'parallel' instead of I2C? Should I assume that they have access to a EEPROM programmer, given that they are playing with 6502 to begin with? Would character-only graphics be sufficient, or should I go with bitmap graphics instead (slower but more customizable)? Anything you can think of that would be better or more useful?

Any thoughts are appreciated. Thank you!

Chad

EDIT: Changed the tag name to SPI instead of I2C, thank you Gordon.


Attachments:
Board.png
Board.png [ 124.48 KiB | Viewed 1144 times ]
Schematics-Mono.pdf [180.78 KiB]
Downloaded 34 times
Schematics-Color.pdf [183.72 KiB]
Downloaded 34 times


Last edited by sburrow on Thu Apr 06, 2023 10:43 pm, edited 2 times in total.
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA I2C Module
PostPosted: Sat Mar 25, 2023 3:32 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1412
Location: Scotland
From a protocol point of view SPI is much easier than I2C - assuming you're doing I2C correctly....

... which It looks like you're not as clock + data just go into a shift-register, so it's effectively SPI with a weird bit length. That's fine.

So it's actually a 24-bit 'register' with the bottom 8 bits being the character data and the upper 13 bits (? 0:6 + 10:15 ?) being the address (screen location?) and another bit for 'clear' ..

If you gated clock with another input signal (via that spare NAND gate?) then it could be more like SPI with the other input signal being the enable line, so you then open up the possibility to it being a more generic SPI device and allowing the host to have multiple SPI devices using the same clock+data output pins, just different enable outputs?

But without pouring over it for more time - I guess what have have is now the VGA version of Don Lancasters TV typewriter - well the video side if not the keyboard.

It's so tempting to use something else - CPLD or even something like a Pi/Pico/ESP32 - even an ATmega but without anything programmable, really hard to add in "smart" stuff like attributes, partial screen clearing and so on.

Parallel vs. Serial? Go either way. I have a 115200 baud serial interface from my Ruby system to it's "smart" terminal (A Linux application that interprets commands in much the same way as terminals of old did, but has fancy facilities for graphics, sprites, sound, ...) however it's more than fast enough for some simple games/animations.

I am moving to parallel for another project but I'm also moving to a faster MCU type of thing - but just for graphics & keyboard.

Could you make the Font ROM a RAM? Then an extra bit in the output stream to select where the data is being written? A down-side is that at power on, the first thing you need to do is download the font... Which will require ROM storage at the host side... But might allow for programmable characters..

And there's always "PETSCII" style graphics if you wanted to go that route...

Hope it works well!

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA I2C Module
PostPosted: Sat Mar 25, 2023 5:05 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 704
Location: Texas
drogon wrote:
From a protocol point of view SPI is much easier than I2C - assuming you're doing I2C correctly....

... which It looks like you're not as clock + data just go into a shift-register, so it's effectively SPI with a weird bit length. That's fine.



Thank you Gordon, just changed the tag name.

Quote:

So it's actually a 24-bit 'register' with the bottom 8 bits being the character data and the upper 13 bits (? 0:6 + 10:15 ?) being the address (screen location?) and another bit for 'clear' ..



It's a little odd :) So, the A address lines are actually for the VGA signal ROM. Because the character RAM/ROM do not use the exact same addresses, they look mixed up on the shift register side.

Quote:

If you gated clock with another input signal (via that spare NAND gate?) then it could be more like SPI with the other input signal being the enable line, so you then open up the possibility to it being a more generic SPI device and allowing the host to have multiple SPI devices using the same clock+data output pins, just different enable outputs?



Awesome idea! I think I'll do that!

Quote:

Could you make the Font ROM a RAM? Then an extra bit in the output stream to select where the data is being written? A down-side is that at power on, the first thing you need to do is download the font... Which will require ROM storage at the host side... But might allow for programmable characters..

And there's always "PETSCII" style graphics if you wanted to go that route...



Another good idea. I don't know if I will implement that though, since I'm allowing for banked character ROM. If I used the last two bits on the shift register to latch which bank it is using, that would be interesting.

Thank you Gordon, good feedback, making a few alterations now!

Chad


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 5:31 pm 
Offline

Joined: Wed Jun 23, 2021 8:02 am
Posts: 165
I don't know if you've seen this:

https://www.retrobrewcomputers.org/doku ... vgarc1home

2 chips (+a crystal oscillator) gives you text mode VGA output with modifiable font, plus PS2 keyboard input.
It has a parallel interface. If you really want serial, maybe you could modify it to replace the dual port RAM with a single port RAM and add an SPI interface to the CPLD.


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA I2C Module
PostPosted: Sat Mar 25, 2023 6:05 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1412
Location: Scotland
sburrow wrote:
Quote:

Could you make the Font ROM a RAM? Then an extra bit in the output stream to select where the data is being written? A down-side is that at power on, the first thing you need to do is download the font... Which will require ROM storage at the host side... But might allow for programmable characters..

And there's always "PETSCII" style graphics if you wanted to go that route...



Another good idea. I don't know if I will implement that though, since I'm allowing for banked character ROM. If I used the last two bits on the shift register to latch which bank it is using, that would be interesting.

Thank you Gordon, good feedback, making a few alterations now!

Chad


You could have separate "graphics" and "text" modes. So text, as is now, but graphics - each font entry is 8x8 (I presume), but that's too much for full resolution, but if you were to create characters that represented a 4x4 pixel character then with clever software you could have 80*4 x 60*4 pixels, or 320x240 pixels. It would completely fill the 256 character font but might give an alternative. (Also note the HGR vs TEXT mode in the Apple II).

You might also have to keep a soft copy in RAM of the host though, so you can OR pixels in and resend them when you plot points inside an existing 4x4 cell when plotting in white, or AND them out when plotting in black.

I did something almost exactly like that for the Cerberus 2020 when I did some 6502 code for that, but only 2x2 pixels which then worked with the existing font but half the resolution again.

and so on..

-Gordon

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


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 6:06 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1412
Location: Scotland
kernelthread wrote:
I don't know if you've seen this:

https://www.retrobrewcomputers.org/doku ... vgarc1home

2 chips (+a crystal oscillator) gives you text mode VGA output with modifiable font, plus PS2 keyboard input.
It has a parallel interface. If you really want serial, maybe you could modify it to replace the dual port RAM with a single port RAM and add an SPI interface to the CPLD.


Chad suggested no CPLDs - however there is always the "VERA" display modules from the Commander X16 project which (I think) is available separately...

-Gordon

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


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 7:04 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 704
Location: Texas
drogon wrote:
kernelthread wrote:
I don't know if you've seen this:

https://www.retrobrewcomputers.org/doku ... vgarc1home

2 chips (+a crystal oscillator) gives you text mode VGA output with modifiable font, plus PS2 keyboard input.
It has a parallel interface. If you really want serial, maybe you could modify it to replace the dual port RAM with a single port RAM and add an SPI interface to the CPLD.


Chad suggested no CPLDs - however there is always the "VERA" display modules from the Commander X16 project which (I think) is available separately...

-Gordon


Answering both of you:

Yep, I've seen that, it's Bill's (plasmo) design. I once asked him for a copy, but he said, "This uses the RC2014 bus, you wouldn't want it." And I'm happy for that, because it spurred me on to keep learning on my own.

I'm not against CPLD's, but I am against Windows. And as of right now, nobody can give me an affordable, hobbyist-friendly CPLD that I can program in Linux. Plus, if I were to put this online for newbies to copy or get printed, they wouldn't have the means to program a CPLD anyways, though a EEPROM programmer should be within their reach (since they are building in 6502-land, they pretty much need one for their ROM's anyways).

Thanks!

Chad


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA I2C Module
PostPosted: Sat Mar 25, 2023 7:07 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 704
Location: Texas
drogon wrote:

You could have separate "graphics" and "text" modes. So text, as is now, but graphics - each font entry is 8x8 (I presume), but that's too much for full resolution, but if you were to create characters that represented a 4x4 pixel character then with clever software you could have 80*4 x 60*4 pixels, or 320x240 pixels. It would completely fill the 256 character font but might give an alternative. (Also note the HGR vs TEXT mode in the Apple II).


Hm, interesting. So, with this in mind, I think I will make the character banks software switchable, so they will now be on pin headers also. That way the user can switch it to 'pixel characters', which would be a lot of block variations to make it *look* like bitmap graphics. And yes, it is 8x8 characters at 640x480 resolution, so I could easily group them to make it appear like bitmap graphics, though chunkier.

Thanks!

Chad


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 7:19 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
> hobbyist-friendly CPLD that I can program in Linux

There might be an answer to that, although there might be a learning curve.
https://github.com/hoglet67/atf15xx_yosys#readme
(and you need to be OK with running WINE, but I don't see why you wouldn't be.)


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 7:23 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1076
Location: Albuquerque NM USA
VGARC only support monochrome text 64 columns and 48 lines. The font is RAM based which needs to be loaded every power cycle. It does have hardware scrolling function and programmable 60Hz interrupt. VGARC is indeed designed for Z*80 but my efforts lately is running it on 6502 and 680x0 with few modifications. I am mostly successful in that aspect. So I’ll re-spin the board to have an universal text/keyboard card that allow most of my Z*80, 6502/65816, and 680x0 to become standalone computers.
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 7:33 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 704
Location: Texas
BigEd wrote:
> hobbyist-friendly CPLD that I can program in Linux

There might be an answer to that, although there might be a learning curve.
https://github.com/hoglet67/atf15xx_yosys#readme
(and you need to be OK with running WINE, but I don't see why you wouldn't be.)


I am ok with WINE, when it actually works :/ But thank you Ed! I bookmarked it and will check that out soon.

plasmo wrote:
VGARC only support monochrome text 64 columns and 48 lines. The font is RAM based which needs to be loaded every power cycle. It does have hardware scrolling function and programmable 60Hz interrupt. VGARC is indeed designed for Z*80 but my efforts lately is running it on 6502 and 680x0 with few modifications. I am mostly successful in that aspect. So I’ll re-spin the board to have an universal text/keyboard card that allow most of my Z*80, 6502/65816, and 680x0 to become standalone computers.
Bill


Neat! Good to hear from you Bill.

Updates:

I've been messing around with it a bit this afternoon. Attached are some updated schematics and a picture of the board layout. I put the VCC/GND traces on the board, and auto-router finished the signal traces in under 2 minutes.

Some things that I said I would look into implementing, I haven't yet done. The main things are the addition of a PS/2 Keyboard connector, and the 3.5mm audio jack. The keyboard connector has NO LOGIC attached to it, it is only the connector. Think of it more like a breakout board. The audio has a polarized cap and some resistors to turn 0V to 5V into -1V to +1V basically. It will not oscillate by itself.

These are just handy things I think will help. As in, if someone were to plug this into a breadboard, they could chose to use this as a type of 'breakout board' for some other features, if they choose.

Thanks for the suggestions everyone! I'm looking forward to testing this, and then posting it on my GitHub and having the gerbers available for anyone to print their own.

Chad


Attachments:
Board.png
Board.png [ 167.15 KiB | Viewed 1107 times ]
Schematics-Mono.pdf [211.17 KiB]
Downloaded 21 times
Schematics-Color.pdf [214.15 KiB]
Downloaded 13 times
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 8:47 pm 
Offline

Joined: Wed Jun 23, 2021 8:02 am
Posts: 165
BigEd wrote:
> hobbyist-friendly CPLD that I can program in Linux

There might be an answer to that, although there might be a learning curve.
https://github.com/hoglet67/atf15xx_yosys#readme
(and you need to be OK with running WINE, but I don't see why you wouldn't be.)

That uses the fitters from Pro Chip Designer. Is there a free version of that? I didn't think it was available without paying an extortionate licence fee.


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 9:25 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
The bits you need do seem to have a free license, according to http://ww1.microchip.com/downloads/en/d ... erview.pdf


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sat Mar 25, 2023 10:12 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
an SPI Video Card is a pretty interesting project! i honestly didn't expect you to use 74 logic to handle all of it. i thought it have it's own 65c02 to handle the interface and communication, similar to my first try at a VGA Card (which failed horribly, but the idea was good).
a while after my failure i created this monster:
Attachment:
20230325_221335.jpg
20230325_221335.jpg [ 2.72 MiB | Viewed 1092 times ]

a Raspberry Pi pico connected to a resistor DAC and a level shifter.
the thought behind this was to have a very cheap and easy to construct video card that would be powerful enough for basically any system that can drive an SPI interface. with a target resolution of 320x240 @ 256 colors, and using mainly commands rather than directly accessing memory through the SPI interface.
examples for commands would be: scrolling or moving parts of the screen, placing tiles/sprites, drawing pixels/lines/shapes, filling areas, moving chunks of data into or out of the Pico's Memory (like tile sets), or even some non graphical functions like floating point math, accessing an SD Card, or some kind of sound output (maybe?)

sadly the project never made it far as i ran into issues just getting a VGA signal out of it. it would generate the right Sync signals, but never draw pixels correctly.
specifically the colors are only correct near the top of the screen and fall off further down, which is confusing as i would assume a broken DAC would make the colors consistently wrong across the whole screen... but anything analog is black magic to me so i just stopped questioning it.
i'm just glad the DAC on my second VGA Card works perfectly fine.

anyways, of course not everyone would want some non-retro ultra powerful microcontroller just for a video output. but on the other hand a lot of younger people getting into the 65xx/Z80 world likely wouldn't care and just want a cheap way to draw things on a screen without having to make their own line drawing routines and such.

either way, i wish you the best of luck with your project as it sounds way simplier and more achievable than what i had planned.


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Sun Mar 26, 2023 4:59 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 443
Hi Chad,

I think it's a cool idea, and I probably would want one. Here's a similar project I've been eyeing off and on for the last year:

http://debuginnovations.com/TTL_Terminal/home.html

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


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

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: