Carte Blanche

12 bit color output - a simple modification

                                                                       

The Carte Blanche card outputs VGA which is only 6 bits wide. Good for 64 colors.  That's plenty for the Apple //e which uses at most 16 colors.  Same for any other version of the Apple II except the Apple IIgs which has a Super Hires Graphics mode that supports up to 4096 colors (12 bit output).  To get 4096 colors you would need a hardware change on the Carte Blanche.  In one of my earlier ramblings I said that I didn't think it would be too hard to do this by using the peripheral board pins or even the IDE connector pins and a few resistors.  

Recently (December, 2011) I decided to give it a try by repurposing the IDE connector.  Since I was using the Carte Blanche for just a VGA video card the IDE connector wasn't being used.  It turns out to be an easy and inexpensive modification.  I just took an old IDE hard drive ribbon cable, cut off the one end, spliced a dozen resistors in groups of four with the output ends of each group tied together and fed them (along with wires for H-sync, V-sync and Ground) into an old PC serial port ribbon cable connector which is the same as the Carte Blanche supplied connector.  I plugged that into the supplied VGA connector.  Basically that's all you need to do hardware-wise for 12 bit color VGA output.  I have to admit that the cable is ugly and takes up a lot of room in the IIgs case.  If you decide to make the cable please test each wire with an Ohm meter to make sure they are wired correctly.  Test between each wire for shorts and test each resistor for proper resistance. 

Disclaimer:  The cable I've described works well for me but I don't guarantee yours will work for you.  Wiring it incorrectly could damage your Carte Blanche card, your Apple IIgs or your monitor. 

Cable parts Re-purposed IDE connector on Carte Blanche card Resistor Diagram & 10 pin socket Finished Cable - Ugly but works well

Of course nothing comes out the connector until you write FPGA code for it.  That was pretty easy as well.  

The original JAT code doesn't define some of the IDE pin to FPGA connections because it doesn't use them so I added the following to the cb.ucf file.  D[8] to D[11] are used for 4 bits (RED) of the 12.  D[0] to D[3] (BLUE) and D[4] to D[7] (GREEN) are already defined in the cb.ucf file.  D[12] is used for HSYNC and D[13] for VSYNC.

NET "IDE_D[8]" IOSTANDARD = LVCMOS33;
NET "IDE_D[8]" LOC = P151;
NET "IDE_D[9]" IOSTANDARD = LVCMOS33;
NET "IDE_D[9]" LOC = P115;
NET "IDE_D[10]" IOSTANDARD = LVCMOS33;
NET "IDE_D[10]" LOC = P152;
NET "IDE_D[11]" IOSTANDARD = LVCMOS33;
NET "IDE_D[11]" LOC = P160;
NET "IDE_D[12]" IOSTANDARD = LVCMOS33;
NET "IDE_D[12]" LOC = P162;
NET "IDE_D[13]" IOSTANDARD = LVCMOS33;
NET "IDE_D[13]" LOC = P96;

The rest of the code is similar to the 6 bit code.  At least for the non-SHR graphics modes and text.  But those non-SHR modes don't need 12 bit color or look any different with it.  SHR was more of a challenge.  On previous bitstream versions I just used a fixed 16 color palette (the one used for low res graphics).  This looked pretty good with the desktop but one of the things you would notice right away was the striped color Apple icon in the upper left corner was solid dark red.  That was because the Finder uses several different palettes to get all the Apple icon colors.  For the Carte Blanche to do the palettes properly takes four reads to memory to draw a pixel.  One read is for the scan line control data which among other things contains the number of the palette to use,  two reads for the actual color data in the palette and one more for the pixel data that contains the color number in the palette.  The older non-SHR modes take only one read.  I don't believe the on-board SRAM is fast enough to do four reads and keep up with the VGA output, so I tried two approaches.  The palettes were buffered in the FPGA BRAM which is fast and can run simultaneously with the SRAM containing the pixel data.  Another advantage of using the BRAM was that I could set it up to read 12 bits at a time so that only one read was needed for the color data per pixel instead of two.  That left only the scan line control bytes and I was running out of BRAM.  To solve this problem I created an array of 8 bit registers.  Two hundred of them.  Ugh!

Bottom line; after some playing around with the timing I had a usable desktop, much like I had with the fixed palette but now I was using all the palettes correctly and the Apple had it's colored stripes back. 

Next I added some code to support the SHR 320 mode, something the fixed palette code couldn't do.  Many if not most Apple IIgs programs use the 320 mode so this modification significantly increases the number of graphics based programs that can be used.  I also added code to handle the SHR Fill mode.

So far most programs look good on my Samsung 940MW LCD monitor and also my HP CRT monitor. 

Finder on LCD monitor Zany Golf on LCD monitor Zany Golf on CRT monitor
Grayscale picture on CRT monitor 320 mode picture on CRT monitor Warlock on CRT monitor

There are several programs though that don't do well. 

1. Programs that display "3200 color" pictures.  These are really messed up with rolling garbage on the screen.

2. Programs that use Fill mode for fast motion.  While Fill mode works, when animated there is a rolling band through the filled part of the screen.

3. Programs that do tricks like over scanning into the borders.

And speaking of borders there are still no side borders.  This isn't really a bug since the code isn't even trying to do them.  I haven't gotten around to attempting this yet.

With the first version of the 12-bit color bitstream (9.0) I advised that you not use it if you didn't have a setup to JTAG a bitstream into the FPGA.  Without the JTAG interface, flashing the bitstream was irreversible.  This is still the recommended way to do things but now with version 9.20 I've added an interface so that flashing can be done from the Apple II.  An Applesoft BASIC program is included with the bitstream for flashing.  This method has worked for me and one other tester but it is very slow. 
There are also a couple of minor bug fixes in version 9.20.

Two newer versions are available.  A 12-bit version (9.31) and a HDMI version (9.31hdmi).  For more information see the next page.

I did all the testing on an Apple IIgs ROM 01 with 4 MB of RAM, an 8 MHz ZipGS, a 3.5" floppy drive in the smartport and an Apple High Speed SCSI card in slot #7 with a 100 MB SCSI hard drive.  The Carte Blanche card was in slot #1 (the mother board was modified by soldering a wire connecting pin #35 of slot #3 to pin #35 of slot #1).  If you don't want to make this modification you must have the Carte Blanche card in slot #3.  On a ROM 03 you can use any slot except slot #7. 

October 3, 2016