Previous 15994 Revisions Next

r6370 Saturday 14th November, 2009 at 05:21:50 UTC by Barry Rodewald
[FMTOWNS] Corrected text mode colours, added text brightness attribute.
[src/mess/drivers]fmtowns.c

src/mess/drivers/fmtowns.c
r6369r6370
607607/*
608608 *  Port 0x600-0x607 - Keyboard controller (8042 MCU)
609609 *
610 *  Sends two-byte code on each key press and release.
611 *  First byte has the MSB set, and contains shift/ctrl/alt/kana flags
612 *    Known bits:
613 *      bit 7 = always 1
614 *      bit 4 = key release
615 *      bit 3 = ctrl (yet to be confirmed)
616 *      bit 2 = shift (yet to be confirmed)
617 *
618 *  Second byte has the MSB reset, and contains the scancode of the key
619 *  pressed or released.
620 *      bit 7 = always 0
621 *      bits 6-0 = key scancode
610622 */
611623static void towns_kb_sendcode(running_machine* machine, UINT8 scancode, int release)
612624{
r6369r6370
16311643{
16321644   int x,y;
16331645   UINT8 colour;
1646   UINT32 colourcode;
16341647   UINT8 row;  // JIS row number
16351648   UINT16 code;
16361649   int off = 0;
r6369r6370
16571670   }   
16581671   
16591672   // draw text layer
1673/*
1674 *  Text layer format
1675 *  2 bytes per character at both 0xc8000 and 0xca000
1676 *  0xc8xxx: Byte 1: ASCII character
1677 *           Byte 2: Attributes
1678 *             bits 2-0: GRB (or is it BRG?)
1679 *             bit 3: Inverse
1680 *             bit 4: Blink
1681 *             bit 5: high brightness
1682 *             bits 7-6: Kanji high/low
1683 *
1684 *  If either bits 6 or 7 are high, then a fullwidth Kanji character is displayed
1685 *  at this location.  The character displayed is represented by a 2-byte
1686 *  JIS code at the same offset at 0xca000.
1687 */
16601688   if(towns_tvram_enable != 0)
16611689   {
16621690      for(y=0;y<40;y++)
r6369r6370
16641692         off = 160 * y;
16651693         for(x=0;x<80;x++)
16661694         {
1667            colour = towns_txtvram[off+1] & 0x0f;
1695            colour = towns_txtvram[off+1] & 0x07;
1696            if(towns_txtvram[off+1] & 0x20)
1697            {  // Bright
1698               colourcode = (((colour & 0x02) ? 0xfe : 0x00) << 16)
1699                  | (((colour & 0x04) ? 0xfe : 0x00) << 8)
1700                  | ((colour & 0x01) ? 0xfe : 0x00);
1701            }
1702            else
1703            {
1704               colourcode = (((colour & 0x02) ? 0x7f : 0x00) << 16)
1705                  | (((colour & 0x04) ? 0x7f : 0x00) << 8)
1706                  | ((colour & 0x01) ? 0x7f : 0x00);
1707            }
1708           
16681709            if((towns_txtvram[off+1] & 0xc0) != 0)
16691710            {   // double width
1670               // TODO: work out exactly how these map to the font ROM
1671               // Numbers are tiles 0x70-0x79
1672               // lowercase characters are from tile 0x160
1673               // uppercase characters are from tile 0x260
16741711               if(towns_txtvram[off+1] & 0x40)
16751712               {
16761713                  row = (towns_txtvram[off+0x2000] - 32);
r6369r6370
16911728                           + (((row-16) & 0x70) * 0x60);
16921729                  }
16931730                  drawgfx_transpen_raw(bitmap,cliprect,screen->machine->gfx[1],code,
1694                     (towns_palette_r[colour] << 16)
1695                     | (towns_palette_g[colour] << 8)
1696                     | (towns_palette_b[colour]),
1697                     0,0,x*8,y*16,0);
1731                     colourcode,   0,0,x*8,y*16,0);
16981732               }
16991733            }
17001734            else
17011735            {
17021736               drawgfx_transpen_raw(bitmap,cliprect,screen->machine->gfx[0],towns_txtvram[off],
1703                  (towns_palette_r[colour] << 16)
1704                  | (towns_palette_g[colour] << 8)
1705                  | (towns_palette_b[colour]),
1706                  0,0,x*8,y*16,0);
1737                  colourcode,   0,0,x*8,y*16,0);
17071738            }
17081739            off += 2;
17091740         }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team