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

All times are UTC




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: VGA ~SPI Module
PostPosted: Sun Mar 26, 2023 6:26 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
Paganini wrote:
Here's a similar project I've been eyeing off and on for the last year:

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

Wow, nice description of character-based video display. I've been struggling to describe my own design, now I see it took multiple pages to describe it in details. The pseudo-graphic section is a particularly good reference. I also have implemented the 2x4 pseudo graphic but I'm unable to describe it.

I looked for hardware scrolling feature, but wasn't able to find it. Software scrolling can be painful.
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Thu Apr 06, 2023 10:50 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 718
Location: Texas
Update: The board came in, and I soldered it already! Look, it works! The video quality is really good and crisp.

I tried to interface with it by using those shift registers, but I don't *think* anything changed? I thought I saw something change slightly, but maybe that was my imagination.

I will be testing it a lot more tomorrow. So far so good though.

Thanks!

Chad


Attachments:
20230406_174052.jpg
20230406_174052.jpg [ 2.75 MiB | Viewed 867 times ]
20230406_174059.jpg
20230406_174059.jpg [ 2.63 MiB | Viewed 867 times ]
20230406_174135.jpg
20230406_174135.jpg [ 2.54 MiB | Viewed 867 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 2:32 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 718
Location: Texas
Alright, it works as expected! I cleared the screen and then posted a few characters to the middle of the screen. (see attached picture below) Perfect!

Some things I need to do now:

1) Adjust the visibility timing a bit, it's only showing 79 characters across right now.

2) Create an actual character ROM, not just some calculator style hex codes.

3) Post to Github for all to use!

Here is a section of the code I use to post characters:

Code:
; Assembly Example when connecting
; VCLK = PA0
; VDAT = PA1

via_pa      .EQU $BF01
via_da      .EQU $BF03

; character to be sent is already in A
; and the address is located in X (lower) and Y (higher)
; thus, the letter A ($41 in ASCII) in the top-left corner would be
; Y = %10000000, X = %00000000, A = %01000001
; must have a 1 for the very highest address location, always.
; this assumes via has already been set up with PA0 and PA1 both output low.
sendchar
   PHA
   PHX
   TYA
   LDX #$08
sendchar_loop1
   JSR sendchar_bit
   DEX
   BNE sendchar_loop1
   PLA
   PHA
   LDX #$08
sendchar_loop2
   JSR sendchar_bit
   DEX
   BNE sendchar_loop2
   PLX
   PLA
   PHA
   PHX
   LDX #$08
sendchar_loop3
   JSR sendchar_bit
   DEX
   BNE sendchar_loop3
   PLX
   PLA
   RTS ; exit
sendchar_bit
   ROL A
   PHA
   LDA via_pa
   AND #%11111100
   BCC sendchar_toggle
   ORA #%00000010
sendchar_toggle
   STA via_pa
   INC A
   STA via_pa
   DEC A
   STA via_pa
   PLA
   RTS
sendchar_init ; initializes via
   PHA
   LDA via_da
   ORA #%00000011
   STA via_da
   LDA via_pa
   AND #%11111100
   STA via_pa
   PLA
   RTS


So to put a character on the screen, you would do something like:

Code:
; Testing character
   LDY #$84
   LDX #$08
   LDA #$40
   JSR sendchar


Neato! Glad this worked on the first try without any bodges. I'm very happy about that. And, now the past Chad would love to have this module with his "V2" 6502 board.

Thanks to everyone here who has been patient and worked with me over the months, and even years now. This victory goes to you guys :D

I'll post more when I have more to show. Thank you everyone.

Chad


Attachments:
20230406_212548.jpg
20230406_212548.jpg [ 926.36 KiB | Viewed 862 times ]


Last edited by sburrow on Fri Apr 07, 2023 12:25 pm, edited 1 time in total.
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 6:21 am 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 988
Location: Potsdam, DE
Chad,

A font file I found (from Sony, via Apple, of all routes!) which you may find helpful. The font file itself is a bitmap but not in any immediately useful form, so I hacked a quick C program to make a hex file: all three are attached. The hex file is disguised as .txt - apparently one cannot attach a hex file, which seems a bit strange.

It uses an 8 by 16 bounding box for the characters, and includes some graphics/box characters too.

Hope this helps! (Why yes, I do have a VGA design (board here but still untested) and an SVGA design (still on paper) in hand :mrgreen: )

Neil


Attachments:
bitmap.txt [9.72 KiB]
Downloaded 33 times
startfont.txt [29.21 KiB]
Downloaded 25 times
font2hex.c [3.2 KiB]
Downloaded 28 times
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 12:00 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 718
Location: Texas
barnacle wrote:
A font file I found (from Sony, via Apple, of all routes!) which you may find helpful.


I appreciate the files, and I do like the font, but I am extremely picky when it comes to copyrights. I saw the copyright text at the top of the startfont.txt. Thank you though! I found a public domain "8-bit retro" font online a while ago, and have since modified it a bit to my liking.

barnacle wrote:
Why yes, I do have a VGA design (board here but still untested) and an SVGA design (still on paper) in hand


Do you have a link to your project? Or something I could take a look at? :) I don't check every post here on the forum, so I might have missed it.

Update:

I filled out the Character ROM with actual characters on one bank and tall pixels on another bank (see attached). I have 16 possible banks, so I guess it could hold other languages or something. I haven't tested the "pixels" font much, so I don't really know if I am duplicating redundantly or something. More of a proof of concept.

I then adjusted the Video ROM some, and found that my logic doesn't, um, cleanly allow for 80 column mode. I either have 80 columns but clip 16 pixels in the top-left corner of the screen (only barely affecting 2 characters), or I have 78 columns without any issues. I went with the 78 columns and my monitor resized to make it fullscreen anyways, so I guess that works. I also tested it on my VGA-to-HDMI adapter and it worked flawlessly.

One thing my monitor is picking up on is a bit of noise on about 4 vertical lines throughout the screen. I tried to take a picture up close, it is between the I and [ symbols near the center of the picture. It is barely noticeable, but I'm trying to be picky here. Otherwise the image is super crisp. The TV through HDMI looks as crisp as it possibly can through a dinky adapter.

Lastly, I removed 8x 10K resistors from the board layout and replaced it with a resistor network. That saved a lot of space! I'm running auto-router right now, looks great.

I plan on posting all of it to GitHub later today. I probably won't post another reply here, so look for "SerialVGA" on my GitHub page (here https://github.com/stevenchadburrow/).

Thanks!

Chad

EDIT: Added a more organized view of my font.


Attachments:
20230407_072153.jpg
20230407_072153.jpg [ 3.04 MiB | Viewed 829 times ]
20230407_063358.jpg
20230407_063358.jpg [ 2.4 MiB | Viewed 831 times ]
20230407_063425.jpg
20230407_063425.jpg [ 3.38 MiB | Viewed 831 times ]
20230407_063436.jpg
20230407_063436.jpg [ 3.23 MiB | Viewed 831 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 2:30 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 491
That's looking great! You might be interested in this:

https://int10h.org/oldschool-pc-fonts/fontlist/

I think some of those old fonts are in the public domain.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA ~SPI Module
PostPosted: Fri Apr 07, 2023 3:28 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
sburrow wrote:
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).

For my project that implements a 6502 in 4 CPLDs, I used the Xilinx XC9572XL, and did everything in Linux. I do have an original Xilinx JTAG programmer though, but there may be more hobbyist friendly ways to get the image into the the device. This may be useful for that: https://anastas.io/hardware/2020/09/29/ ... sprog.html


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 5:57 pm 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 988
Location: Potsdam, DE
Here's the drawing. I've just realised that I think I may have the wrong package footprint on the PCB so I'll hide my embarrassment for now :)

It's a bit of an oddball design; firstly, it generates a 1.8432MHz phase0/phase2 for my version of Grant's minimal circuit, so the dot clock is 14MHz instead of the 25MHz that VGA is supposed to be. That means there's only room for 48 characters across the active picture line; the address counting increases by 64 at each new line though so there's some wasted space in there.

As I said, as yet unbuilt let alone tested.

Neil


Attachments:
vga.pdf [1.02 MiB]
Downloaded 44 times
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 6:56 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 718
Location: Texas
barnacle wrote:
Here's the drawing.
Neil


Hm! That is quite interesting! So why do you call it "VGA" and have a D-SUB15 if it is not VGA? Am I missing something? :) I'm not super familiar with Grant's stuff.

You use a lot of 4-bit counters and logic in place of my 8-bits and Video ROM signals. Interesting. I'd have to dig in deeper to really understand the timing.

I see you are using the '32 to drive the RGB values from the shift register. That's a good idea to distribute the current. But, you could use those spare NOT gates when connected to /Q7 on the '165 to get the same effect. If you replace the logic of the last '32 gate (feeding wr_ram) with the left over '74 and 1x NOT gate, you can reduce your chip count by one. Not sure if that's entirely possible, but I'm always on the lookout to reduce chip count :)

Would like to see this in action. Thanks for sharing Neil!

Arlet wrote:
I used the Xilinx XC9572XL, and did everything in Linux


I bookmarked all of that. I took a quick look and I see you are using a Raspberry Pi. Happily, I actually own one of those, so that very good to know. Perhaps that is the ticket: Linux through the Raspberry Pi through JTAG. Thank you for that. I will look more into it soon.

Chad


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 6:58 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Quote:
I took a quick look and I see you are using a Raspberry Pi.


Just to clarify, I am not the one using the Raspberry Pi. I have an original Xilinx JTAG programmer (which is also supported in Linux, but a bit expensive for hobby use). The Raspberry PI page is someone else's that I found through google.


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 7:48 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
(I've used a Pi in this way, as have many others - in fact it's a built-in solution for a Pi+CPLD project that's very popular in many retro worlds: the RGBtoHDMI gadget... although thinking about it that's a baremetal project. But I've also used a Pi+linux for FPGA reprogramming.)


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Fri Apr 07, 2023 10:01 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 718
Location: Texas
Arlet wrote:
Quote:
I took a quick look and I see you are using a Raspberry Pi.


Just to clarify, I am not the one using the Raspberry Pi. I have an original Xilinx JTAG programmer (which is also supported in Linux, but a bit expensive for hobby use). The Raspberry PI page is someone else's that I found through google.


Oh, ok, thank you for that clarification.

BigEd wrote:
I've used a Pi in this way, as have many others


Excellent news. Yes, I guess I never considered such an option before.

Thank you both!

Chad


Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Sat Apr 08, 2023 4:40 am 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 988
Location: Potsdam, DE
sburrow wrote:
Hm! That is quite interesting! So why do you call it "VGA" and have a D-SUB15 if it is not VGA? Am I missing something? :) I'm not super familiar with Grant's stuff.


It's VGA in terms of video timing (absent a few nanoseconds here and there) and ought to drive a VGA monitor/flatscreen without issue (if I got the resistor values right; I need to recalculate those). But it doesn't meet the 640 x 480 pixels of VGA because of the lower dot clock.

sburrow wrote:
You use a lot of 4-bit counters and logic in place of my 8-bits and Video ROM signals. Interesting. I'd have to dig in deeper to really understand the timing.


Yes, I was playing with the difference between synchronous and asynchronous counters; there is some care taken to ensure that the line sync flip flop doesn't get false triggered. On the other hand, I've also got an SVGA counter chain that uses async 393 counters and a sort-of state machine to manage the syncs and line ends.

Neither design is really satisfactory because the logic continues to output data outside the active line timing; there is no blanking. It requires the software to ensure that the video memory contains 0x20 (on this version) from address 0x30 to 0x3f on each line.

sburrow wrote:
I see you are using the '32 to drive the RGB values from the shift register. That's a good idea to distribute the current. But, you could use those spare NOT gates when connected to /Q7 on the '165 to get the same effect. If you replace the logic of the last '32 gate (feeding wr_ram) with the left over '74 and 1x NOT gate, you can reduce your chip count by one. Not sure if that's entirely possible, but I'm always on the lookout to reduce chip count :)


Swings and roundabouts. I need one NOR gate anyway so I had three left over, handy for the video drive. Could have used the '14 instead... and of course, any design is subject to 'we reserve the right to improve the specifications and design' :mrgreen:

On the other hand, I'm *always* open to experimentation. I'm thinking about a Don Lancaster SVGA design using a 6502 as nothing but a scan generator... see the other thread, shortly.

Neil

EDIT: It's an OR gate, not a NOR. Mea maxima culpa!


Last edited by barnacle on Sat Apr 08, 2023 8:17 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Sat Apr 08, 2023 5:58 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 718
Location: Texas
barnacle wrote:
I need one NOR gate anyway so I had three left over


Are you sure that is NOR? I thought I saw OR? A 74HC32 is an OR gate. I think you are using it right, but just clarifying.

Update:

I have been working all morning on getting the keyboard to work through the VIA. And eventually I did! I was copying old code, and that was fine, but some of my newer code was just breaking everything. Eventually I sorted it out after about 5 hours, yay. Then I tested the audio and it worked within 5 minutes, yay.

My hookups:
PA0 = Video Clock
PA1 = Video Data
PA7 = Keyboard Data
CA1 = Keyboard Clock
PB7 = Audio Output (using free-run T1 Timer)

I need to clarify, this is NOT a terminal! When I am hooking a keyboard up to this thing, it is only the PS/2 Connector with some pull-up resistors. It acts more like a breakout board. The keyboard is NOT creating the characters on the screen directly. The keyboard clock is interrupting the 6502 which reads the keyboard data, and when a full byte has been sent, the 6502 then sends a character back to the monitor through a separate serial connection.

I posted all of my schematics and gerbers on GitHub (here https://github.com/stevenchadburrow/SerialVGA), along with my example assembly code file using all of the features. I hope to eventually make a "User's Guide" for it, though it is honestly VERY simplistic to interface. The hardest part is deciding what you the user wants to do with it. But that's also the fun part :)

This should easily interface with an Arduino, Raspberry Pi, or any particular microcontroller. The idea was to have something easy to use for newbies, particularly those who have built Garth's "Potpourri" computer (or Ben Eater's 6502 kit, which simply copies Garth's plans). Given this module, they should immediately be able to display a ton of information on the screen, use a full keyboard, and have simple audio. Though this module lacks hardware scrolling, software scrolling is very possible because the total memory used for this module is only 8KB. If the user were to store their characters to RAM and to the module, they could easily run back through RAM to re-write the characters on the screen to a different location. Slow, but effective, and still very simple.

I have no plans on making this any better, because I think it's the best it can be for it's intended purpose. If I were to do a bitmap graphics version, it would need a different way to interface it properly. I also do not plan on making this controlled with a CPLD because the idea was to have the newbie solder this themselves, and then program the ROM's themselves. If I decide to one day make a solderless version, I'll reconsider and use SMT parts instead.

Thank you everyone. Another successful project complete! So, what's next? :)

Chad


Attachments:
20230408_121525.jpg
20230408_121525.jpg [ 1.68 MiB | Viewed 706 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: VGA Serial Module
PostPosted: Sat Apr 08, 2023 6:57 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1120
Location: Albuquerque NM USA
Excellent work! The insight into VGA inner workings will benefit you for years to come. SMT CPLD can shrink the whole thing into size of a 32DIP RAM, so you can remove the existing DIP RAM, plug in the VGA/PS2 module and gain video and keyboard capabilities.

Another idea. If you have a color LED on the end of stick and know how fast the stick is moving back and forth via a spring-loaded switch, then you can modulate the LED according to its position so you can paint a one dimensional picture. Another word, an electronic sparkler. If you have an array of LED, you can paint 2D picture.

Or, VGA camera is dirt cheap, so how about interface to a VGA camera and display it on screen

Bill

Or, :D ,animation with PETSCII.


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

All times are UTC


Who is online

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