6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Apr 29, 2024 1:01 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Jan 04, 2020 12:52 pm 
Offline

Joined: Tue Jun 19, 2018 8:28 am
Posts: 122
I am trying to use THIS schematic to use TMS9918 wideo chip with SRAM memory in one of my projects. It is based on 8080, but it doesn't matter because it it will work, I am also going to use it with my ongoing 6502 project.
Unfortunately I encountered some weird issue I can't debug myself.

1. There is communication between my system nad TMS9918. I can write and read to and from its wideo memory. I can also perform operation on control registers.
2. Chip generate image and reacts to register writes. I was able to initialize it in text mode, the it showed some gibberish (content of uninitialized memory). i am also able to change colors by writing to REG7.
3. I copied character patterns definitions to wideo memory (0x08000) and then I wrote simple basic loop, which was filling name table (0x0800) with incremented values from 0x00 to 0xFF. It should have resulted with complete sets of characters in order on some parts of a screen and gibberish (uninitialized part of pattern table) on the rest. Unfortunately it is not what I got.
As you can see on attached image, there are groups of eight proper characters, followed by gibberish.

Initially I thought I've swapped some address lines, but then checked my circuit with schematic, using multimeter. Everything looks fine.
Any ideas what can be the cause of this weird behavior?


Attachments:
2020-01-04 12.04.05.jpg
2020-01-04 12.04.05.jpg [ 3.73 MiB | Viewed 748 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 04, 2020 2:21 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3349
Location: Ontario, Canada
Atlantis wrote:
Initially I thought I've swapped some address lines [...]
Any ideas what can be the cause of this weird behavior?
Swapped data lines?

_________________
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: Sat Jan 04, 2020 4:36 pm 
Offline

Joined: Tue Jun 19, 2018 8:28 am
Posts: 122
Dr Jefyll wrote:
Swapped data lines?

Thanks for suggestion. Of course I will check it, but honestly - I don't think so.
In that case character definitions should also be scrambled - they are transmitted to the vram by the same data bus. However they look perfectly normal.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 06, 2020 9:31 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1207
Location: Soddy-Daisy, TN USA
Hey, someone is using my repo! :-D

One goofball thing I remember about the TMS9918 is that TI reversed the data lines. Meaning, D7 on the TMS9918 is the same as D0 on everything else in the world.

I assume you wired the databus up correctly?

Code:
6502      TMS9918
D0          D7
D1          D6
D2          D5
D3          D4
D4          D3
D5          D2
D6          D1
D7          D0

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 06, 2020 9:44 pm 
Offline

Joined: Wed Nov 18, 2015 8:36 am
Posts: 102
Location: UK
I used the very same schematic to connect the 9918 and SRAM together and it has been working for a long time now.

I agree it looks like you have managed to write to the 9918 registers properly to set up the display mode - being able to change colour in R7 further confirms that.

But I had problems when getting the 9918 up and running on my set up - some things to try / theories based on my issues..

1) The 9918 responds quicker to register read/write than memory read/write. I had a situation where I was also able to set up the screen mode and colours but still getting a lot of corruption on the screen. Turns out I wasn't giving enough time between issuing write commands. That meant sometimes I would get repeated characters, which granted is not exactly what you are seeing, but can you check how many uS you are waiting between successive writes? Even at 1.34Mhz on a 65c02 I can write faster to the 9918 than it will accept, so I started with a very generous amount of NOP instructions between writes until it worked and trimmed from there (I have since increased the 65c02 clock to 5.36Mhz and with extra NOPs it is working reliably).

2) After setting up read/write memory pointer for a particular VRAM address, successive memory accesses auto increment it which is faster than having to initialise the pointer each time. However, this can be disturbed by anything other than a read (or write - depending on which memory mode you are in). I was having all sorts of weird glitches until I realised that I was setting the 9918 up to issue vertical blank interrupts and then in my interrupt routine, reading the 9918 status register, which took it out of read/write mode. In fact this could occur anywhere where I was sending more than 1 byte to the 9918. The solution of course is to disable interrupts (or don't have interrupts running at all).

I don't think you have swapped data or address lines else you would not be able to even initialise the 9918 to a screen mode reliably... hopefully it's something related to the above and you sort it out, feels like you're pretty close..


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

All times are UTC


Who is online

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