Close

Scenes from an AVR-interfaced CGA card - In the Key Of A

A project log for Improbable AVR -> 8088 substitution for PC/XT

Probability this can work: 98%, working well: 50% A LOT of work, and utterly ridiculous.

eric-hertzEric Hertz 02/04/2017 at 20:262 Comments

The above are the results of the following code:

void cga_clear(uint8_t attributes)
{
   uint32_t i;
   for(i=0; i < CGA_VRAM_SIZE; i+=2)
   {
      //Apparently it's Character, Attribute 
      //(two bytes)
      bus88_write(S20_WRITE_MEM, 
                  cga_vramAddress + i+1, 
                  attributes);
      //Thought adding a buncha nops 
      // might've allowed the
      // bus to stabilize, 
      // but they seem to have no effect
      asm("nop;");
      bus88_write(S20_WRITE_MEM, 
                  cga_vramAddress + i, 
                  'A'); //0);
      //Here too...
      asm("nop;"); 
   }
}
combined with my bus88_write() function, which attempts to interface an AVR physically socketted in place of an 8088 on a PC/XT clone motherboard.

And called with:

while(1)
{
    mode++;
    mode &= 0x7f; //don't use blinking
    cga_clear(mode);
}
from main()

(Here's bus88_write(), but it kinda relies on the physical interface, as well)

void bus88_write(uint8_t s20, 
                 uint32_t address, 
                 uint8_t data)
{
   ADDR1916_PORT   = (uint8_t)(address>>16);
   ADDR158_PORT    = (uint8_t)(address>>8);
   ADDRDATA70_PORT = (uint8_t)(address);
   S20_PORT       = s20;
   ADDRDATA70_PORT = data;
   while(!(READY_PIN & READY_MASK))  {};
   S20_PORT = S20_BUS_IDLE;
}
The AVR is inserted in the 8088's socket, with an inverter (or a few, for delay-purposes) between the 8088-clock and the AVR's clock-input.

The CGA card is... in a questionable state. And its connection via composite to an LCD-TV probably accentuates that a bit.

-------------------------

If everything worked within-specs, what I *should* get is the letter 'A' filling the screen, with changing foreground and background colors.

What I get is much more interesting!

I've got some good names for some of these... e.g. "Zelda, in the Key of A", or "Goodnight Princess, in the Key of A", or "Zebra, in the Key of A", or... ok, the key of A is wearing out. We've got "Tetris Level 9," "Donkey Kong", and more!

Discussions

Mars wrote 02/06/2017 at 19:42 point

  Are you sure? yes | no

Eric Hertz wrote 02/06/2017 at 22:17 point

Thank you, sir! I should've known to look for this document, considering how well-documented the IBM PC/XT's motherboard is!

Here's something interesting, already... Weird to think the term "pixel" hadn't been established until after this document's writing; they called 'em "PELs"!

And, wow, who'da thunk they had add-in PC-compatibility boards for Apple IIe's?!

  Are you sure? yes | no