trunk/src/mess/video/sapi1.c
| r25492 | r25493 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | SAPI-1 driver by Miodrag Milanovic |
| 4 | | |
| 5 | | 09/09/2008 Preliminary driver. |
| 6 | | |
| 7 | | ****************************************************************************/ |
| 8 | | |
| 9 | | |
| 10 | | #include "includes/sapi1.h" |
| 11 | | |
| 12 | | static const UINT8 MHB2501[] = { |
| 13 | | 0x0c,0x11,0x13,0x15,0x17,0x10,0x0e,0x00, // @ |
| 14 | | 0x04,0x0a,0x11,0x11,0x1f,0x11,0x11,0x00, // A |
| 15 | | 0x1e,0x11,0x11,0x1e,0x11,0x11,0x1e,0x00, // B |
| 16 | | 0x0e,0x11,0x10,0x10,0x10,0x11,0x0e,0x00, // C |
| 17 | | 0x1e,0x09,0x09,0x09,0x09,0x09,0x1e,0x00, // D |
| 18 | | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x1f,0x00, // E |
| 19 | | 0x1f,0x10,0x10,0x1e,0x10,0x10,0x10,0x00, // F |
| 20 | | 0x0e,0x11,0x10,0x10,0x13,0x11,0x0f,0x00, // G |
| 21 | | |
| 22 | | 0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00, // H |
| 23 | | 0x0e,0x04,0x04,0x04,0x04,0x04,0x0e,0x00, // I |
| 24 | | 0x01,0x01,0x01,0x01,0x11,0x11,0x0e,0x00, // J |
| 25 | | 0x11,0x12,0x14,0x18,0x14,0x12,0x11,0x00, // K |
| 26 | | 0x10,0x10,0x10,0x10,0x10,0x10,0x1f,0x00, // L |
| 27 | | 0x11,0x1b,0x15,0x15,0x11,0x11,0x11,0x00, // M |
| 28 | | 0x11,0x11,0x19,0x15,0x13,0x11,0x11,0x00, // N |
| 29 | | 0x0e,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // O |
| 30 | | |
| 31 | | 0x1e,0x11,0x11,0x1e,0x10,0x10,0x10,0x00, // P |
| 32 | | 0x0e,0x11,0x11,0x11,0x15,0x12,0x0d,0x00, // Q |
| 33 | | 0x1e,0x11,0x11,0x1e,0x14,0x12,0x11,0x00, // R |
| 34 | | 0x0e,0x11,0x10,0x0e,0x01,0x11,0x0e,0x00, // S |
| 35 | | 0x1f,0x04,0x04,0x04,0x04,0x04,0x04,0x00, // T |
| 36 | | 0x11,0x11,0x11,0x11,0x11,0x11,0x0e,0x00, // U |
| 37 | | 0x11,0x11,0x11,0x0a,0x0a,0x04,0x04,0x00, // V |
| 38 | | 0x11,0x11,0x11,0x15,0x15,0x15,0x0a,0x00, // W |
| 39 | | |
| 40 | | 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11,0x00, // X |
| 41 | | 0x11,0x11,0x0a,0x04,0x04,0x04,0x04,0x00, // Y |
| 42 | | 0x1f,0x01,0x02,0x04,0x08,0x10,0x1f,0x00, // Z |
| 43 | | 0x1c,0x10,0x10,0x10,0x10,0x10,0x1c,0x00, // [ |
| 44 | | 0x00,0x10,0x08,0x04,0x02,0x01,0x00,0x00, // backslash |
| 45 | | 0x07,0x01,0x01,0x01,0x01,0x01,0x07,0x00, // ] |
| 46 | | 0x0e,0x11,0x00,0x00,0x00,0x00,0x00,0x00, // ^ |
| 47 | | 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x00, // _ |
| 48 | | |
| 49 | | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // |
| 50 | | 0x04,0x04,0x04,0x04,0x04,0x00,0x04,0x00, // ! |
| 51 | | 0x0a,0x0a,0x0a,0x00,0x00,0x00,0x00,0x00, // " |
| 52 | | 0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00, // # |
| 53 | | 0x00,0x11,0x0e,0x0a,0x0e,0x11,0x00,0x00, // |
| 54 | | 0x18,0x19,0x02,0x04,0x08,0x13,0x03,0x00, // % |
| 55 | | 0x04,0x0a,0x0a,0x0c,0x15,0x12,0x0d,0x00, // & |
| 56 | | 0x04,0x04,0x08,0x00,0x00,0x00,0x00,0x00, // ' |
| 57 | | |
| 58 | | 0x02,0x04,0x08,0x08,0x08,0x04,0x02,0x00, // ( |
| 59 | | 0x08,0x04,0x02,0x02,0x02,0x04,0x08,0x00, // ) |
| 60 | | 0x00,0x04,0x15,0x0e,0x15,0x04,0x00,0x00, // * |
| 61 | | 0x00,0x04,0x04,0x1f,0x04,0x04,0x00,0x00, // + |
| 62 | | 0x00,0x00,0x00,0x00,0x08,0x08,0x10,0x00, // , |
| 63 | | 0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x00, // - |
| 64 | | 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, // . |
| 65 | | 0x00,0x01,0x02,0x04,0x08,0x10,0x00,0x00, // / |
| 66 | | |
| 67 | | 0x0e,0x11,0x13,0x15,0x19,0x11,0x0e,0x00, // 0 |
| 68 | | 0x04,0x0c,0x04,0x04,0x04,0x04,0x0e,0x00, // 1 |
| 69 | | 0x0e,0x11,0x01,0x06,0x08,0x10,0x1f,0x00, // 2 |
| 70 | | 0x1f,0x01,0x02,0x06,0x01,0x11,0x0e,0x00, // 3 |
| 71 | | 0x02,0x06,0x0a,0x12,0x1f,0x02,0x02,0x00, // 4 |
| 72 | | 0x1f,0x10,0x1e,0x01,0x01,0x11,0x0e,0x00, // 5 |
| 73 | | 0x07,0x08,0x10,0x1e,0x11,0x11,0x0e,0x00, // 6 |
| 74 | | 0x1f,0x01,0x02,0x04,0x08,0x08,0x08,0x00, // 7 |
| 75 | | |
| 76 | | 0x0e,0x11,0x11,0x0e,0x11,0x11,0x0e,0x00, // 8 |
| 77 | | 0x0e,0x11,0x11,0x0f,0x01,0x02,0x1c,0x00, // 9 |
| 78 | | 0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, // : |
| 79 | | 0x00,0x00,0x04,0x00,0x04,0x04,0x08,0x00, // ; |
| 80 | | 0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x00, // < |
| 81 | | 0x00,0x00,0x1f,0x00,0x1f,0x00,0x00,0x00, // = |
| 82 | | 0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00, // > |
| 83 | | 0x0e,0x11,0x01,0x02,0x04,0x00,0x04,0x00 // ? |
| 84 | | }; |
| 85 | | |
| 86 | | |
| 87 | | VIDEO_START_MEMBER(sapi1_state,sapi1) |
| 88 | | { |
| 89 | | m_refresh_counter = 0; |
| 90 | | } |
| 91 | | |
| 92 | | UINT32 sapi1_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 93 | | { |
| 94 | | int x,y,j,b; |
| 95 | | UINT16 addr; |
| 96 | | int xpos; |
| 97 | | |
| 98 | | for(y = 0; y < 24; y++ ) |
| 99 | | { |
| 100 | | addr = y*64; |
| 101 | | xpos = 0; |
| 102 | | for(x = 0; x < 40; x++ ) |
| 103 | | { |
| 104 | | UINT8 code = m_sapi_video_ram[addr + x]; |
| 105 | | UINT8 attr = (code >> 6) & 3; |
| 106 | | code &= 0x3f; |
| 107 | | for(j = 0; j < 9; j++ ) |
| 108 | | { |
| 109 | | for(b = 0; b < 6; b++ ) |
| 110 | | { |
| 111 | | UINT8 val; |
| 112 | | if (j==8) { |
| 113 | | if (attr==2) { |
| 114 | | val = (m_refresh_counter & 0x20) ? 1 : 0; |
| 115 | | } else { |
| 116 | | val = 0; |
| 117 | | } |
| 118 | | } else { |
| 119 | | val = (MHB2501[code*8 + j] >> (5-b)) & 1; |
| 120 | | if (attr==1) { |
| 121 | | val = (m_refresh_counter & 0x20) ? val : 0; |
| 122 | | } |
| 123 | | } |
| 124 | | if(attr==3) { |
| 125 | | bitmap.pix16(y*9+j, xpos+2*b ) = val; |
| 126 | | bitmap.pix16(y*9+j, xpos+2*b+1 ) = val; |
| 127 | | } else { |
| 128 | | bitmap.pix16(y*9+j, xpos+b ) = val; |
| 129 | | } |
| 130 | | } |
| 131 | | } |
| 132 | | xpos+= (attr==3) ? 12 : 6; |
| 133 | | if (xpos>=6*40) break; |
| 134 | | } |
| 135 | | } |
| 136 | | m_refresh_counter++; |
| 137 | | return 0; |
| 138 | | } |
| 139 | | |
| 140 | | |
| 141 | | VIDEO_START_MEMBER(sapi1_state,sapizps3) |
| 142 | | { |
| 143 | | } |
| 144 | | |
| 145 | | UINT32 sapi1_state::screen_update_sapizps3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 146 | | { |
| 147 | | return 0; |
| 148 | | } |