Carte Blanche

Notes and Ramblings (IIgs)

The problems I've had getting a stable video output for both the Apple IIGS specific modes and older Apple II and //e modes seem to be caused by the Carte Blanche video buffer RAM being unable to keep up with both the writing data from the Apple slot bus and the reading needed for the VGA output.  More likely its my inability to write efficient code to handle it.  At any rate after trying for some time to get it to work I decided to try a different approach to buffering the video data.  In this new approach I decided to use the BRAM in the FPGA chip to do some of the buffering.  Up till now all of the buffering was done in the SRAM included on the Carte Blanche card.  This is a reasonable way to do it since we have 256KBytes of SRAM and less than 28KBytes of BRAM.  But the BRAM is theoretically much faster.  The reason I have been reluctant to use the BRAM is that it's already being used.  Pretty much all of it.  The character ROM uses up about 2KBytes and the Z80 and disk code uses up the rest.  My interest has been mainly in the video so the rest had to go.

I stripped out all the Z80 and related modules, the DMA, SPI and Disk modules, etc. from the project.  Only the main module (cb1.v), the write_clk module and the video module (with its sub modules) were left.  Only the character ROM data was now using BRAM and that was untouchable.  The main module had to be stripped of all the code relating to the modules removed but the others remained pretty much the same.  I also had to rewrite the code to switch between SRAM and BRAM. 

Since the main problem I've had (dash-like flickers which I called snow previously) was most objectionable on the text screens I decided to buffer all the text data (both pages and both banks) on the BRAM.  The result was completely stable flicker free text.  This was even true on the worst cases such as Merlin 16+ (which runs under GS/OS and presumably uses the text tools).  Since the low resolution graphics mode is the same (as far as memory location) as text it too was stable.  SHR never had the problem so that left high resolution (HGR) and double high resolution (DHR) modes and they still had the flickers. 

There simply isn't enough BRAM left to buffer all the remaining data so I settled on buffering all HGR data (both pages) and the main RAM portion of the DHR since they use the same memory locations.  This meant that the DHR which switches back and forth between the main RAM and Auxiliary RAM on the Apple now also had to switch between SRAM and BRAM with each byte written and read.  However, this doesn't seem to be a problem and it eliminated the flickers from both HGR and DHR.  

Of course with this code the Carte Blanche becomes just a VGA video card.  Once this bitstream is written to the flash memory from an SD card the Carte Blanche no longer has the ability to write a new bitstream to the flash memory.  So DO NOT use this bitstream if you don't have another way to write to the Carte Blanche card such as a JTAG cable.

Some other changes:

1. Fixed a bug that caused the text, background and border colors to interfere with each other (on some monitors) so that wrong colors were displayed.  Thanks to Bill Garber for pointing this one out.  The monitors I was using at the time didn't have that problem.

2. Fixed a bug in my HGR code (when used in an 80 column program) that displayed graphics that were slightly different than the original (40 column) ones.

3. DHR now works (sort of).  The colors are not always right.  I haven't figured out an algorithm for doing it right.

4. Added monochrome support for DHR.  Again it's not exactly right but it works well in some programs such as TimeOut Paint an Appleworks add-on.

5. Fixed a bug that caused the CDA display (when accessed from DHR) to be incorrectly formatted as an 80 column screen when 40 column is selected as default in the control panel.

6. Mouse-text now uses the correct Apple IIgs characters.  Thanks to Marc S. Ressl for pointing me to the character ROM file.

7. Fixed a bug that put spurious dots and junk on the Welcome to the IIGS startup screen.

8. Fixed a bug that occasionally put a random dot on the Finder desktop.

 


Bugs:

As mentioned above, the DHR graphics mode needs work.

Still some minor "artifacts" in the mixed mode text area.

An extra vertical line is sometimes present at the right-most position of the HGR (80 column) display.

Double low-res doesn't work at all.

Strange mouse cursor display and action in MouseDesk program after returning from CDA menu.  MouseDesk is a DHR graphics program.  This problem does not appear in TimeOut Paint.

If SHR mode is turned on (without loading any new SHR data) after a DHR image has been loaded, the screen does not match what is seen with the Apple IIgs RGB output.  Only the top half of the screen contains the DHR data.  Should be the whole screen.


To do:

The bugs are a priority. 

Non-fixed palettes in SHR.  There is enough BRAM left free that I could put the palettes and scan line control data there.  Then it might be possible to access that data without interfering with the video data accessed from SRAM.  Since the Carte Blanche has only 6 bits of RGB output there would be very little gain from this (well the Apple in the menu bar would be correctly colored) but if I or someone comes up with a 12 bit add on to the Carte Blanche then the code would be there.  See the next page for my 12 bit modification.

Improved HGR.  At the present the HGR code draws filled objects as a series of vertical lines with every other line as black.  Only white is drawn as a solid.

Support double low resolution graphics mode.


Contact: 

Last update January 9, 2012