6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 8:58 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: VDP Madness
PostPosted: Sun Sep 22, 2019 11:46 pm 
Offline

Joined: Sun Sep 22, 2019 11:43 pm
Posts: 3
I'm working on designing my first homebrew computer, and I have a good handle on most every component- except for the VDP.

I could live without video and go for serial/term output, but my goal is to have composite output. Additionally, I'm trying to avoid using an FPGA, AVR, Gameduino, or Propeller.

My goal is to use a TMS9918. It's well documented, but there are a few problems:

- It needs a specialized 10.738633MHz clock for NTSC sync, which I can't find on eBay or AliExpress
- It's built for DRAM, and while there's a SRAM glue logic solution that I'm trying to wrap my head around, I'm having a fair amount of trouble understanding it
- There are some timing differences between the 6502 and the VDP which I'm not sure how to handle
- I don't know if interrupts are required to make good use of the chip, and I'm not sure how interrupts work

Basically, I can understand the "instantaneous" components of the design, like the RAM, ROM, CPU, I/O chips, glue logic, etc... I can probably even handle a sound chip. However, the VDP portion of the design seems unusually complex.

I'm a little lost! I have an incomplete schematic right now, with the RAM, CPU, reset circuitry, etc. implemented.... but that VDP has me toast! :|

Am I in over my head? Thanks, guys.


Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Sun Sep 22, 2019 11:56 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
I would recommend searching for the CRT Controller Handbook by Gerry Kane. You can find a download for certain. It doesn’t cover the 9918 controller, but several others and covers the basics of video generation very well. This would give you a solid background on video and perhaps persuade you to a different controller as well.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Mon Sep 23, 2019 1:48 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Welcome, ramblecube! :)

ramblecube wrote:
I could live without video and go for serial/term output, but my goal is to have composite output.
Since it's your first homebrew, it might be wise to make operation with serial your first goal, then let video be Step Two of the plan. What construction technique do you have in mind? PCB maybe isn't the best option, compared with wirewrap, soldered point-to-point, and solderless breadboard. These latter choices have more flexibility for fixing design errors and adding features.

That crystal frequency you mention needn't be 100% exact, btw -- video monitors (especially the old CRT type) have a degree of tolerance regarding scan frequencies. And the DRAM and other issues you cite don't seem to me like deal breakers, especially if you already have a working computer before you begin the video phase.

-- 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  
 Post subject: Re: VDP Madness
PostPosted: Mon Sep 23, 2019 6:12 am 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1431
Welcome to the forum.

Since it's your first computer, I would suggest to add an UART to the design, and to go with the address decoding of Daryl Rictor's SBC-2
This would give you the chance to test with a RS232 connection if your computer works as intended.
Then to add the TMS9918 as a second step.

When using the 'search' function, it appears that the TMS9918 already went mentioned in our forum quite a few times.
Edit: searching HaD for TMS9918 might be helpful, too.


Last edited by ttlworks on Mon Sep 23, 2019 10:55 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Mon Sep 23, 2019 7:56 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Welcome! As others have said, it's best to first build something simple and work your way up. Things you don't understand at present will become more clear.

For the crystal, it looks like you should be able to find one at 21.47727 MHZ and then divide by two.

If you don't have an electronics reference, I'd recommend Horowitz and Hill's Art of Electronics, and I'd also recommend searching https://electronics.stackexchange.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Mon Sep 23, 2019 5:12 pm 
Offline

Joined: Sat Jan 02, 2016 10:22 am
Posts: 197
The 9918/28/29 uses a crystal directly between pins 39 and 40. A quick check on Mouser shows they have a couple of thousand in stock. If you use a 21.7mhz crystal divided by 2, the data sheet says both Xtal1 and Xtal2 need to be driven.

The VDP's usual ram chips while being fairly easy to find on ebay etch, are something of a pain to use, since the 4116 needs 3 supplies.


Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Mon Sep 23, 2019 6:19 pm 
Offline

Joined: Sun Sep 22, 2019 11:43 pm
Posts: 3
floobydust wrote:
I would recommend searching for the CRT Controller Handbook by Gerry Kane. You can find a download for certain. It doesn’t cover the 9918 controller, but several others and covers the basics of video generation very well. This would give you a solid background on video and perhaps persuade you to a different controller as well.


I read first part, as well as the parts for the DP83520. I think I finally understand video generation- through my past in Genesis disassembles, I understood the software end, but the clouds are clearing on the hardware side of things.

Thank you so so much for the suggestion!


Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Mon Sep 23, 2019 6:34 pm 
Offline

Joined: Sun Sep 22, 2019 11:43 pm
Posts: 3
BigEd wrote:
Welcome! As others have said, it's best to first build something simple and work your way up. Things you don't understand at present will become more clear.

For the crystal, it looks like you should be able to find one at 21.47727 MHZ and then divide by two.

If you don't have an electronics reference, I'd recommend Horowitz and Hill's Art of Electronics, and I'd also recommend searching https://electronics.stackexchange.com/


Martin A wrote:
The 9918/28/29 uses a crystal directly between pins 39 and 40. A quick check on Mouser shows they have a couple of thousand in stock. If you use a 21.7mhz crystal divided by 2, the data sheet says both Xtal1 and Xtal2 need to be driven.

The VDP's usual ram chips while being fairly easy to find on ebay etch, are something of a pain to use, since the 4116 needs 3 supplies.


I didn't know about clock divisions until now. That could save me from buying a crystal, too!


Top
 Profile  
Reply with quote  
 Post subject: Re: VDP Madness
PostPosted: Fri Oct 04, 2019 10:42 am 
Offline

Joined: Wed Nov 18, 2015 8:36 am
Posts: 102
Location: UK
Your project is very similar to mine - I have built a 65c02 computer with TMS9918 as the VDP.

As recommended by others, I would also say get it working through serial first and build from there. This is what I did too.

The next step for interfacing a TMS9918 is a bit fiddly but rewarding and works well once done - the capabilities are pretty good for late 1970s and the composite video output is easy to connect to a monitor.

On the clock for the VDP
- I also had difficulty in sourcing a 10.738635Mhz crystal, but as noted by BigEd and others, you can use a 21.47727Mhz crystal which are easier to find
- I use the 21.7 crystal as the clock for a 4-bit counter (74xx161) then use the Q0 output to drive the VDP at 10.738635Mhz to XTAL1 and XTAL2 (remembering to invert one of them of course)
- Indeed I also used the Q1 output to drive the 65c02 at 5.36Mhz and Q3 to drive my keyboard strobe and sound chip at 1.34Mhz

On the interface to the 65c02
- More glue is needed as the VDP needs /CSW and /CSR with MODE to be asserted properly
- MODE in mine is A0 from the CPU address bus i.e. I access VDP RAM on even address (A0=0) and VDP status/control register on odd (A0=1)
- /CSW and /CSR need to be derived from your address decoding scheme and CPU R/W

On the SRAM interface
- There is an excellent article which shows how to wire up the VDP to a regular SRAM - without this it would have been a non-starter for me
- Again it's a fair bit of building to do, but not highly complex and works well

On the software side, I had to put in some delays (NOP instructions) between writing a command to the VDP (e.g. to read VRAM) and reading the result - this is for a 5.36Mhz 65c02, but I think even at 1Mhz one or two NOPs were needed.

Hope this helps in your decisions! I definitely recommend getting board to work over serial first so that you have some way to communicate with the computer whilst you get the VDP working..

More outline details on hackaday - https://hackaday.io/project/5789-6502-homebrew-computer


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

All times are UTC


Who is online

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