Carte Blanche

Notes and Ramblings (IIgs)

                           

Carte Blanche bitstream modified for a ROM 01 Apple IIgs.

The following includes some information I have learned from playing with the code for a Carte Blanche (CB) bitstream modified for a ROM 01 Apple IIgs.  It should not be considered as gospel and is offered here only in the interest of explaining where I'm at with this project and maybe helping someone who is trying to do the same (or better yet maybe you can help me).  You should also note that the vast majority of the work was done by Alex Freed and Steve Howell.  I have only modified their code.  Most of my modifications are to the video module. 


Added Mousetext, color text, background and  border.

Click on them to enlarge.

Characters

AppleWorks 3.0

Samsung Syncmaster940MW 19" LCD TV/Monitor using the 4:3 aspect ratio mode. 
The colors set in the control panel were: Text & Border - Light Blue and Background - Medium Blue.


BYE bug fix:

While testing the //e mousetext version bitstream, Bill Garber noticed that when the jumper is removed from the IDE connector on the Carte Blanche card and the ProDOS "BYE" command is invoked the computer hangs.  This can be fixed by adding one line (see high-lighted line below) in the cb1.v module.  When the jumper is removed the CB card functions only as a VGA card.

always @(clk50, wr_clk, mem2k_data, disk_mode, N_BUS_IO_SEL, bus_a_s)
    begin
    if(wr_clk)
        begin
        if (~jumper) // added to fix BYE bug
            begin
            mem2k_data_reg <= mem2k_data;
            BRAM_addr <= (disk_mode[7] || N_BUS_IO_SEL ) ?
            { ~bus_a_s[10], bus_a_s[9:0]}:
            { disk_mode[2:0], bus_a_s[7:0]};
            end
        end
    end


Spurious Characters

From the beginning I had a curious instability in the 80 column text mode.  I would get spurious characters on the screen or occasional dropped (missing) characters.  The 40 column screen was stable.  This was much less a problem on the //e.

This problem dogged me for a long time.  Some things I would do while working with some seemingly unrelated part of the code would suddenly stabilize it, only to have something else cause it to de-stabilize again.  Baffled, I took the tried and true tactic of just ignoring it.  Eventually, though I couldn't take it anymore.  I found I could fix the problem by synchronizing all the signals from the Apple IIgs to the 50MHz FPGA clock.  After that everything was rock solid.  Here is a Verilog example of synchronizing the Apple Q3 clock to the 50 MHz clock used in the Carte Blanche code:

input clk50
input Q3
reg Q3_s; // Q3 synchronized
reg Q3_1; 
always @(posedge clk50)
    begin
    Q3_1 <= Q3;
    Q3_s <= Q3_1;
    end

Resulting synthesized hardware:


Disabled /INH

The Apple IIgs maps the logical RAM addresses to physical RAM in an interleaving scheme that is different than that in an Apple //e.  The result of this is that a card that is designed for a //e and brings the /INH line low can cause a bus contention when used on a IIgs.  This is potentially damaging to the Mega II (see Apple IIgs Tech note #32).  The original bitstream code for the Carte Blanche card has a line in the code that can pull the /INH line low.  To avoid any problems on the IIgs I changed the following line in cb1.v from:  

assign BUS_INH = breakpoint_hit ? 1'b0 :1'bz;

to:

assign BUS_INH = 1'bz;

This fix is ugly because it simply removes the function without any regard for what it does instead of using a mask as is recommended in the Apple IIgs Tech note #32.


Super Hires Graphics (SHR)   

To test the possibility of having the CarteBlanche card support SHR graphics, I've added some SHR code.  It doesn't faithfully represent what you see on the IIgs monitor.  The main differences are:

It uses only 16 colorsThe Carte Blanche card can display 64 colors.  It wouldn't be hard to change the code to use all 64.  I just took the easy way out by using the same colors as lores graphics.  Still even 64 colors is a long way from the 4096 available from a IIgs.  To get 4096 colors you would need a hardware change on the CB.  I believe it wouldn't be too hard to do this by using the peripheral board pins or even the IDE connector pins and a few resistors.  

I used a Fixed palette which means 16 colors is all we've got,  not any 16 of the 64 the CB card is capable of.  The code doesn't even look at the GS palettes.  With the real IIgs video each line can have a palette (up to 16 palettes per screen) and each palette has 16 of 4096 colors in 320 mode or 4 of 4096 in 640 mode.  Even if you made a 12 bit (4096 colors) output on the CB card you would still have to make four reads to the on-board SRAM to figure what color dot to output (1 for the pixel data, 1 for the palette and 2 for the color itself).  The video output frequency is 25 MHz and the CB's main clock is 50 MHz so you might be able to make two reads to the SRAM but not four.  You could increase the CB's clock beyond 50 MHz but I believe the SRAM won't work over 66 MHz or so.  Clearly not enough.  One way around this may be to use the FPGA RAM for the palette data.  Unfortunately at this time the RAM is full.

There are no side borders if you are using a monitor that doesn't over scan. I've tested it on two LCD monitors and one CRT monitor.  The CRT was the only one that showed the side borders.  The Carte Blanche video output has a resolution of 640 x 480.  Plenty for the //e that it was intended for but not enough width for the IIgs SHR mode and the side borders.  To get the side borders you could have a faster second clock for the SHR that would give you 800 x 600 resolution or you could use a single fast clock and scale the non-SHR modes accordingly. 

Colors don't dither correctly.  Dithering is a technique of placing two different colors next to each other so that the eye perceives them as a third color.  Dithering is used in the 640 mode desktop to obtain colors that would not normally be available.  If it works correctly you should not see vertical lines of different colors when a dithered area is displayed.  Whether it is the limited colors used or the large size and sharpness of the output, dithering (on the CarteBlanche) doesn't work well.  The vertical lines are clearly visible.  Check out the color areas on the picture below.  Please note that some browsers make the picture worse than it really is, making some vertical lines darker than they should be.  The actual output from the Carte Blanche has every other dithered line of identical brightness as it should be.    The best viewing of the picture below is at the picture's full size.  Also note that my Finder desktop has a gray background, not the normal periwinkle blue one. 

The SHR 320 mode not implemented yet, so when 320 mode is enabled my code just continues to output 640.  Ugly...

No fill mode.

Still you do get a usable desktop and I was just trying to prove to myself that SHR would work.

Finder desktop

Note the lack of side borders, poor dithering and un-colorful apple in menu bar.

Click here to see screen shots with a IIGS to SCART cable for comparison.

One more thing to note about the SHR code, it is slot dependent.  The code for SHR relies on the M2B0 signal.  This signal is found only on pin 35 of slot #3 on a ROM 01 Apple IIgs and slots # 1 to 6 on a ROM 03.  I'm not sure if it is available on a ROM 00.  Slot # 7 has a different signal on pin 35.  This leads to a problem if you have a ROM 01 and want both the VGA video and the Carte Blanche functions that require the slot memory since the 80 column firmware uses that slot.  As I see it you have three choices if you have a ROM 01:

  1. Put the Carte Blanche card in Slot #3, remove the IDE jumper and leave the slot set to the default "Built-in Text Display". Of course you will then only have a VGA card.
  2. Solder wires connecting pin 35 on slot # 3 to an un-used slot (not slot # 7).  I soldered wires to slots # 1,2,4,5 & 6.
  3. Get a ROM 03 IIgs.    

Known Bugs:

Some garbage appears on the "Welcome to the IIgs" screen.

Returning to ProDOS 80 column text mode results in 40 column text (as if slot 3 ROM disabled).

The inverse line cursor used to select disk images in the JAT menu moves two lines at a time in the up direction.   This does not happen in an Apple //e.

There is some minor "artifacts" in the mixed mode text area.

Double-hires graphics (DHR)  does not work.  The DHR can be "turned on" but the display is wrong.  Switching to the CDA menu from DHR (or double-lores) displays an incorrectly formatted 80 column screen when 40 column is selected as default in the control panel.

If no legal disk image (.nib) is selected in the JAT menu the Finder hangs when trying to read the Carte Blanche slot.

The mousetext is the "running man" style.  It shouldn't be on an Apple IIgs.

In some video modes there is some "snow-like" effects.  This bug was introduced by me while fixing several other bugs.  For now this bug is preferable to the other bugs.


The next page contains information about a different approach to solving the video problems above.

 

Last update January 9, 2012