6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 7:20 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Nov 27, 2015 7:01 pm 
Offline
User avatar

Joined: Fri Oct 30, 2015 9:49 pm
Posts: 54
Location: San Antonio, TX
Howdy...

I wanted to have some kind of VGA and Sound output for the W65C816SXB board...
I've seen this done before with a Propeller micro controller so it looked like an obvious choice.
The plan is to have the 65C816 write data to the propeller on a dedicated address and it would produce the VGA/Sound.
Basically, LDA #10, STA $7F02 would pass the value 10 to address 2 in the propeller.

I soon realized that the previous project would not work since the the 65C816 runs at 8MHz and the previous project use a 6502 at 1 MHz...
The Propeller runs at 80MHz but each instructions takes 4 cycles. The 65c816 runs at 8 MHz so I can execute 2.5 Instructions on the propeller for each cycle on the 65c816.
If I understand the 65C816 datasheets correctly, this means I have to actually read the data from the address/data bus in two cycles on the propeller.
It also means I don't have time to check if the W65C816 want's to read or write a byte so I will only be able to read from the W65C816.
A "read" from the propeller, LDA $7F02, would be interpreted as a STA $7F02 on the propeller side and cause an unpredictable result.

It seem to work, there are some glitches here and there but I think it's a good start.
https://github.com/alamorobotics/W65c816_VGA/

I got a working VGA resolution of 100x50, some of the chars are defined as a 4x4 block so I have a "high resolution" of 200x100 pixels.
The SID emulation seem to be working, I need to write some kind of tracker to test all channels etc...
The emulation is definitly good enough for me, here is an example of what it is capable of, https://www.youtube.com/watch?v=EJcbxrdErkY.
Disclaimer, I didn't write the VGA driver, nor did I write the SID emulation. These are freely available objects for the Propeller.

To do list,
Find glitches when data is corrupted, my guess is that this happens about 1/500 times I write to the propeller...

Feedback from the propeller, currently I have to pad with a delay loop to wait for the propeller to be done before it can receive more data.
If I write data to the propeller without a delay, I will miss some of the writes since the propeller is busy finishing up the previous write so to say.

Plug in a different VGA module, the 100x50 characters are nice but the colors are limited to each row, I want to be able to select color per character.

Test the SID emulation by writing a tracker.

I'll keep you posted...


Attachments:
File comment: VGA output.
W65C816SXB_VGA_2.jpg
W65C816SXB_VGA_2.jpg [ 491.1 KiB | Viewed 1070 times ]
File comment: Propeller and W65C816SXB
W65C816SXB_Propeller_2.jpg
W65C816SXB_Propeller_2.jpg [ 464.59 KiB | Viewed 1070 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2015 3:17 pm 
Offline

Joined: Sun Aug 30, 2015 10:23 pm
Posts: 36
Very cool. I keep tossing around the idea of using the Propeller as well. What's kept me from doing it is that the Prop is a 3.3v part, the bus timing complications you mention, and the fact that even after all that fuss the Prop still only has max 32k onboard RAM to do video with, so isn't really that much more useful for this than just building my own video circuit off my own SRAM, other than the fact that it's really easy to do video off the Prop.

A few questions, I'm a bit of a newbie tho, so they may not be the best ones:

* How are you handling the fact that the Prop is not safe for 5v on its pins? Are you putting a resistor between the SBX pins and the Prop? How well does it work?
* Can you maybe use have the Prop hit RDY line on the '816 to slow down the bus while performing operations, so you can perform more Prop operations in the access time?
* Does the 816 board have a VIA/parallel I/O on it? My 265 SXB does. If so, what about having the SXB communicate with the Prop through VIA rather than memory mapping it on the bus? Then just issue sets of instructions to the Prop.


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2015 8:38 pm 
Offline
User avatar

Joined: Fri Oct 30, 2015 9:49 pm
Posts: 54
Location: San Antonio, TX
Howdy...

For input to the propeller from a 5V system, just use a 1K resistor.
The propeller is 5V tolerant but need the 1K resistor to not burn out the internal clamping diodes.
For output from the propeller, just tie it straight to the 5V device, since the propeller outputs 3.3V it should be OK.
This has been working fine for me in this project and many other...

The propeller is not really fast enough to read the Data and Address bus, I tried a faster crystal running the propeller @ 100MHz, but that didn't work either...

The RDY signal is not available on the W65C816SXB board, maybe there is some other pin available that can be used...

Anyhow, I think I might want to use the PIA to communicate with the propeller if I cannot get it to read the data and address properly...
Figure out a way of sending 8 bit of data, a 5 bit address and some kind of handshake so to say.
I would like to save the VIA for something else since it has timers and a shift register...

I don't like the VGA I plugged in and will look for a substitute, I want to be able to select colors per characters, not row.
Or maybe learn VGA and make my own driver... ;-)

Anyhow, I'll keep you updated.


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2015 8:47 pm 
Offline

Joined: Sun Aug 30, 2015 10:23 pm
Posts: 36
I never enjoyed writing for the thing in Spin. For me it was easier to use the GCC suite. I made myself up a nice makefile to flash to the board with the propplug, and a nice little C++ library for what I was doing. And I used gas for assembler rather than the Spin tool.

I'm also going to learn video output. I want to build a simple video circuit to drive from my SXB. But VGA to me is useless, almost no TVs take it anymore and less and less monitors. So it's in fact better to use component, svideo, or composite, since DVI would be way too complicated.


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 04, 2015 2:32 am 
Offline
User avatar

Joined: Fri Oct 30, 2015 9:49 pm
Posts: 54
Location: San Antonio, TX
Howdy...

It's even easier to write a TV composite driver for the Propeller than a VGA driver, due to the less resolution you can easily fit it in one cog...

I made a last futile attempt to get the Propeller read the data and address buss but it's just not stable...
If I go ahead and figure something out with the PIA, I should be able to both read and write to the Propeller and also signal that the propeller is done preocessing the data.
It might not be as fast but it will be fast enough... ;-)

I'll keep you updated...


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 14, 2015 5:36 pm 
Offline
User avatar

Joined: Fri Oct 30, 2015 9:49 pm
Posts: 54
Location: San Antonio, TX
Finally some progress during the weekend... :D

I gave up on reading the address/data bus and used the PIA chip instead to communicate with the Propeller.
Had some problems figuring out how to use this chip but got it all sorted out.
At one point I thought I burned Port A of the PIA and order some new PIAs and VIAs from Mouser.
Luckily It was just a programming error and the Original PIA is still working. 8)

The communication is done via a rudimentary protocol,

Transfer from W65C816SXB to Propeller:
1. W65C816SXB waits for PB7 (P15) to be low, $80
2. W65C816SXB puts data on PIA PA
3. W65C816SXB puts data on PIA PB with PB6 high. $40
4. Propeller waits for PB6 (P14) to go high.
5. Propeller reads PIA PA-PB and sets P15 high.
6, W65C816SXB waits for PB7 (P15)to be high, $80
7. W65C816SXB sets PIA PB6 (P14) low. $40
8. Propeller waits for PB6 (P14) to go low.
9. Propeller does it's thing...
10. Propeller sets P15 Low.

This seem to be rock solid, no problems with missing or wrong data.
At the same time, I got a wait signal from the propeller so I know if it is done or not.

The propeller is emulating the Commodore 64 SID chip for sound/noise and also outputs the VGA.
Both are out of the box objects for the propeller, I didn't write any of these.
The VGA is pretty limited, there is a palette of 64 colors that can be set for either character color or background.
However you can only set this combination per row, I will see if I can modify the driver to actually set it by character.
The resolution is 100x50 characters, the propeller does not have enough memory for High Resolution.
There seem to be characters that divided the full character into a 2x2 block, if that can be utilized, the resolution is 200x100...

Video,
https://www.youtube.com/watch?v=EaeHIbMzMec

Code n stuff,
https://github.com/alamorobotics/W65c816_VGA/


Attachments:
VGA_1.jpg
VGA_1.jpg [ 389.21 KiB | Viewed 913 times ]
Setup_2.jpg
Setup_2.jpg [ 376.15 KiB | Viewed 913 times ]
Setup_1.jpg
Setup_1.jpg [ 362.96 KiB | Viewed 913 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 36 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: