src/mess/video/ql.c
| r0 | r1258 | |
| 1 | #include "video/ql.h"
|
| 2 | |
| 3 | static int mode4_colors[] = { 0, 2, 4, 7 };
|
| 4 | |
| 5 | PALETTE_INIT( ql )
|
| 6 | {
|
| 7 | palette_set_color_rgb(machine, 0x00, 0x00, 0x00, 0x00 );
|
| 8 | palette_set_color_rgb(machine, 0x01, 0x00, 0x00, 0xff );
|
| 9 | palette_set_color_rgb(machine, 0x02, 0x00, 0xff, 0x00 );
|
| 10 | palette_set_color_rgb(machine, 0x03, 0x00, 0xff, 0xff );
|
| 11 | palette_set_color_rgb(machine, 0x04, 0xff, 0x00, 0x00 );
|
| 12 | palette_set_color_rgb(machine, 0x05, 0xff, 0x00, 0xff );
|
| 13 | palette_set_color_rgb(machine, 0x06, 0xff, 0xff, 0x00 );
|
| 14 | palette_set_color_rgb(machine, 0x07, 0xff, 0xff, 0xff );
|
| 15 | }
|
| 16 | |
| 17 | WRITE8_HANDLER( ql_videoram_w )
|
| 18 | {
|
| 19 | int i, x, y, r, g, color, byte0, byte1;
|
| 20 | int offs;
|
| 21 | |
| 22 | videoram[offset] = data;
|
| 23 | |
| 24 | offs = offset / 2;
|
| 25 | |
| 26 | byte0 = videoram[offs];
|
| 27 | byte1 = videoram[offs + 1];
|
| 28 | |
| 29 | x = (offs % 64) << 3;
|
| 30 | y = offs / 64;
|
| 31 | |
| 32 | // logerror("ofs %u data %u x %u y %u\n", offset, data, x, y);
|
| 33 | |
| 34 | /*
|
| 35 | |
| 36 | # Note: QL video is encoded as 2-byte chunks
|
| 37 | # msb->lsb (Green Red)
|
| 38 | # mode 4: GGGGGGGG RRRRRRRR
|
| 39 | # R+G=White
|
| 40 | |
| 41 | */
|
| 42 | |
| 43 | for (i = 0; i < 8; i++)
|
| 44 | {
|
| 45 | r = (byte1 & 0x80) >> 6;
|
| 46 | g = (byte0 & 0x80) >> 7;
|
| 47 | |
| 48 | color = r | g;
|
| 49 |
|
| 50 | // logerror("x %u y %u color %u\n", x, y, color);
|
| 51 | |
| 52 | *BITMAP_ADDR16(tmpbitmap, y, x++) = Machine->pens[mode4_colors[color]];
|
| 53 | |
| 54 | byte0 <<= 1;
|
| 55 | byte1 <<= 1;
|
| 56 | |
| 57 | }
|
| 58 | |
| 59 | /*
|
| 60 | |
| 61 | # Note: QL video is encoded as 2-byte chunks
|
| 62 | # msb->lsb (Green Flash Red Blue)
|
| 63 | # mode 8: GFGFGFGF RBRBRBRB
|
| 64 | |
| 65 | */
|
| 66 | |
| 67 | /*
|
| 68 | for (i = 0; i < 8; i++)
|
| 69 | {
|
| 70 | r = (data & 0x0080) >> 5;
|
| 71 | g = (data & 0x8000) >> 14;
|
| 72 | b = (data & 0x0040) >> 6;
|
| 73 | f = (data & 0x4000) >> 14;
|
| 74 | |
| 75 | color = r | g | b;
|
| 76 | |
| 77 | plot_pixel(tmpbitmap, x++, y, Machine->pens[color]);
|
| 78 | plot_pixel(tmpbitmap, x++, y, Machine->pens[color]);
|
| 79 | |
| 80 | data <<= 2;
|
| 81 | }
|
| 82 | */
|
| 83 | }
|
| 84 | |
| 85 | WRITE8_HANDLER( ql_video_ctrl_w )
|
| 86 | {
|
| 87 | /*
|
| 88 | 18063 is write only (Quasar p.618)
|
| 89 | bit 1: 0: screen on, 1: screen off
|
| 90 | bit 3: 0: mode 512, 1: mode 256
|
| 91 | bit 7: 0: base=0x20000, 1: base=0x28000
|
| 92 | */
|
| 93 | }
|
src/mess/drivers/ql.c
| r1257 | r1258 | |
| 1 | 1 | #include "driver.h" |
| 2 | #include "cpu/i8039/i8039.h" |
| 2 | 3 | #include "video/generic.h" |
| 4 | #include "video/ql.h" |
| 3 | 5 | #include "inputx.h" |
| 4 | 6 | |
| 5 | 7 | /* |
| r1257 | r1258 | |
| 15 | 17 | |
| 16 | 18 | */ |
| 17 | 19 | |
| 18 | | /* video */ |
| 19 | | |
| 20 | | static int mode4_colors[] = { 0, 2, 4, 7 }; |
| 21 | | |
| 22 | | PALETTE_INIT( ql ) |
| 23 | | { |
| 24 | | palette_set_color_rgb(machine, 0x00, 0x00, 0x00, 0x00 ); |
| 25 | | palette_set_color_rgb(machine, 0x01, 0x00, 0x00, 0xff ); |
| 26 | | palette_set_color_rgb(machine, 0x02, 0x00, 0xff, 0x00 ); |
| 27 | | palette_set_color_rgb(machine, 0x03, 0x00, 0xff, 0xff ); |
| 28 | | palette_set_color_rgb(machine, 0x04, 0xff, 0x00, 0x00 ); |
| 29 | | palette_set_color_rgb(machine, 0x05, 0xff, 0x00, 0xff ); |
| 30 | | palette_set_color_rgb(machine, 0x06, 0xff, 0xff, 0x00 ); |
| 31 | | palette_set_color_rgb(machine, 0x07, 0xff, 0xff, 0xff ); |
| 32 | | } |
| 33 | | |
| 34 | | WRITE8_HANDLER( ql_videoram_w ) |
| 35 | | { |
| 36 | | int i, x, y, r, g, color, byte0, byte1; |
| 37 | | int offs; |
| 38 | | |
| 39 | | videoram[offset] = data; |
| 40 | | |
| 41 | | offs = offset / 2; |
| 42 | | |
| 43 | | byte0 = videoram[offs]; |
| 44 | | byte1 = videoram[offs + 1]; |
| 45 | | |
| 46 | | x = (offs % 64) << 3; |
| 47 | | y = offs / 64; |
| 48 | | |
| 49 | | // logerror("ofs %u data %u x %u y %u\n", offset, data, x, y); |
| 50 | | |
| 51 | | /* |
| 52 | | |
| 53 | | # Note: QL video is encoded as 2-byte chunks |
| 54 | | # msb->lsb (Green Red) |
| 55 | | # mode 4: GGGGGGGG RRRRRRRR |
| 56 | | # R+G=White |
| 57 | | |
| 58 | | */ |
| 59 | | |
| 60 | | for (i = 0; i < 8; i++) |
| 61 | | { |
| 62 | | r = (byte1 & 0x80) >> 6; |
| 63 | | g = (byte0 & 0x80) >> 7; |
| 64 | | |
| 65 | | color = r | g; |
| 66 | | |
| 67 | | // logerror("x %u y %u color %u\n", x, y, color); |
| 68 | | |
| 69 | | *BITMAP_ADDR16(tmpbitmap, y, x++) = Machine->pens[mode4_colors[color]]; |
| 70 | | |
| 71 | | byte0 <<= 1; |
| 72 | | byte1 <<= 1; |
| 73 | | |
| 74 | | } |
| 75 | | |
| 76 | | /* |
| 77 | | |
| 78 | | # Note: QL video is encoded as 2-byte chunks |
| 79 | | # msb->lsb (Green Flash Red Blue) |
| 80 | | # mode 8: GFGFGFGF RBRBRBRB |
| 81 | | |
| 82 | | */ |
| 83 | | |
| 84 | | /* |
| 85 | | for (i = 0; i < 8; i++) |
| 86 | | { |
| 87 | | r = (data & 0x0080) >> 5; |
| 88 | | g = (data & 0x8000) >> 14; |
| 89 | | b = (data & 0x0040) >> 6; |
| 90 | | f = (data & 0x4000) >> 14; |
| 91 | | |
| 92 | | color = r | g | b; |
| 93 | | |
| 94 | | plot_pixel(tmpbitmap, x++, y, Machine->pens[color]); |
| 95 | | plot_pixel(tmpbitmap, x++, y, Machine->pens[color]); |
| 96 | | |
| 97 | | data <<= 2; |
| 98 | | } |
| 99 | | */ |
| 100 | | } |
| 101 | | |
| 102 | 20 | /* Read/Write Handlers */ |
| 103 | 21 | |
| 104 | | WRITE8_HANDLER( video_ctrl_w ) |
| 105 | | { |
| 106 | | /* |
| 107 | | 18063 is write only (Quasar p.618) |
| 108 | | bit 1: 0: screen on, 1: screen off |
| 109 | | bit 3: 0: mode 512, 1: mode 256 |
| 110 | | bit 7: 0: base=0x20000, 1: base=0x28000 |
| 111 | | */ |
| 112 | | } |
| 113 | | |
| 114 | 22 | static int ZXmode, ZXbps; |
| 115 | 23 | |
| 116 | | WRITE8_HANDLER( zx8302_w ) |
| 24 | static WRITE8_HANDLER( zx8302_w ) |
| 117 | 25 | { |
| 118 | 26 | ZXmode = data & 0x18; |
| 119 | 27 | |
| r1257 | r1258 | |
| 138 | 46 | } |
| 139 | 47 | } |
| 140 | 48 | |
| 141 | | WRITE8_HANDLER( i8049_w ) |
| 49 | static WRITE8_HANDLER( i8049_w ) |
| 142 | 50 | { |
| 143 | 51 | /* |
| 144 | 52 | process 8049 commands (p92) |
| r1257 | r1258 | |
| 172 | 80 | */ |
| 173 | 81 | } |
| 174 | 82 | |
| 175 | | WRITE8_HANDLER( mdv_ctrl_w ) |
| 83 | static WRITE8_HANDLER( mdv_ctrl_w ) |
| 176 | 84 | { |
| 177 | 85 | /* |
| 178 | 86 | MDV control |
| r1257 | r1258 | |
| 201 | 109 | */ |
| 202 | 110 | } |
| 203 | 111 | |
| 204 | | WRITE8_HANDLER( mdv_data_w ) |
| 112 | static WRITE8_HANDLER( mdv_data_w ) |
| 205 | 113 | { |
| 206 | 114 | } |
| 207 | 115 | |
| 208 | | READ8_HANDLER( mdv_status_r ) |
| 116 | static READ8_HANDLER( mdv_status_r ) |
| 209 | 117 | { |
| 210 | 118 | return 0x0; |
| 211 | 119 | } |
| 212 | 120 | |
| 213 | | WRITE8_HANDLER( clock_w ) |
| 121 | static WRITE8_HANDLER( clock_w ) |
| 214 | 122 | { |
| 215 | 123 | } |
| 216 | 124 | |
| 125 | /* Intelligent Peripheral Controller (IPC) */ |
| 126 | |
| 127 | static UINT8 ipc_keylatch; |
| 128 | |
| 129 | static WRITE8_HANDLER( ipc_port1_w ) |
| 130 | { |
| 131 | /* |
| 132 | |
| 133 | bit description |
| 134 | |
| 135 | 0 Keyboard column output (KBD0) |
| 136 | 1 Keyboard column output (KBD1) |
| 137 | 2 Keyboard column output (KBD2) |
| 138 | 3 Keyboard column output (KBD3) |
| 139 | 4 Keyboard column output (KBD4) |
| 140 | 5 Keyboard column output (KBD5) |
| 141 | 6 Keyboard column output (KBD6) |
| 142 | 7 Keyboard column output (KBD7) |
| 143 | |
| 144 | */ |
| 145 | |
| 146 | ipc_keylatch = data; |
| 147 | } |
| 148 | |
| 149 | static WRITE8_HANDLER( ipc_port2_w ) |
| 150 | { |
| 151 | /* |
| 152 | |
| 153 | bit description |
| 154 | |
| 155 | 0 IPC INT (pin 6) |
| 156 | 1 Speaker output |
| 157 | 2 CPU IPL 0-2 (pin 42) |
| 158 | 3 ULA IPLIL (pin 26), CPU IPL 1 (pin 41) |
| 159 | 4 J6 CTS (pin 5) |
| 160 | 5 J5 DTR (pin 4) |
| 161 | 6 N/C |
| 162 | 7 ULA COMDATA (pin 35) |
| 163 | |
| 164 | */ |
| 165 | |
| 166 | } |
| 167 | |
| 168 | static READ8_HANDLER( ipc_port2_r ) |
| 169 | { |
| 170 | /* |
| 171 | |
| 172 | bit description |
| 173 | |
| 174 | 0 IPC INT (pin 6) |
| 175 | 1 Speaker output |
| 176 | 2 CPU IPL 0-2 (pin 42) |
| 177 | 3 ULA IPLIL (pin 26), CPU IPL 1 (pin 41) |
| 178 | 4 J6 CTS (pin 5) |
| 179 | 5 J5 DTR (pin 4) |
| 180 | 6 N/C |
| 181 | 7 ULA COMDATA (pin 35) |
| 182 | |
| 183 | */ |
| 184 | |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | static READ8_HANDLER( ipc_t1_r ) |
| 189 | { |
| 190 | /* |
| 191 | |
| 192 | bit description |
| 193 | |
| 194 | 0 ULA BAUDK4 (pin 5) |
| 195 | |
| 196 | */ |
| 197 | |
| 198 | return 0; |
| 199 | } |
| 200 | |
| 201 | static READ8_HANDLER( ipc_bus_r ) |
| 202 | { |
| 203 | /* |
| 204 | |
| 205 | bit description |
| 206 | |
| 207 | 0 Keyboard row input (KBI0) |
| 208 | 1 Keyboard row input (KBI1) |
| 209 | 2 Keyboard row input (KBI2) |
| 210 | 3 Keyboard row input (KBI3) |
| 211 | 4 Keyboard row input (KBI4) |
| 212 | 5 Keyboard row input (KBI5) |
| 213 | 6 Keyboard row input (KBI6) |
| 214 | 7 Keyboard row input (KBI7) |
| 215 | |
| 216 | */ |
| 217 | |
| 218 | if (ipc_keylatch & 0x01) return readinputportbytag("ROW0"); |
| 219 | if (ipc_keylatch & 0x02) return readinputportbytag("ROW1"); |
| 220 | if (ipc_keylatch & 0x04) return readinputportbytag("ROW2"); |
| 221 | if (ipc_keylatch & 0x08) return readinputportbytag("ROW3"); |
| 222 | if (ipc_keylatch & 0x10) return readinputportbytag("ROW4"); |
| 223 | if (ipc_keylatch & 0x20) return readinputportbytag("ROW5"); |
| 224 | if (ipc_keylatch & 0x40) return readinputportbytag("ROW6"); |
| 225 | if (ipc_keylatch & 0x80) return readinputportbytag("ROW7"); |
| 226 | |
| 227 | return 0xff; |
| 228 | } |
| 229 | |
| 217 | 230 | /* Memory Maps */ |
| 218 | 231 | |
| 219 | 232 | static ADDRESS_MAP_START( ql_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| r1257 | r1258 | |
| 226 | 239 | AM_RANGE(0x018021, 0x018021) AM_WRITENOP // ??? |
| 227 | 240 | AM_RANGE(0x018022, 0x018022) AM_WRITE(mdv_data_w) |
| 228 | 241 | AM_RANGE(0x018023, 0x018023) AM_WRITENOP // ??? |
| 229 | | AM_RANGE(0x018063, 0x018063) AM_WRITE(video_ctrl_w) |
| 242 | AM_RANGE(0x018063, 0x018063) AM_WRITE(ql_video_ctrl_w) |
| 230 | 243 | AM_RANGE(0x020000, 0x027fff) AM_RAM AM_WRITE(ql_videoram_w) AM_BASE(&videoram) |
| 231 | 244 | AM_RANGE(0x028000, 0x02ffff) AM_RAM // videoram 2 |
| 232 | 245 | AM_RANGE(0x030000, 0x03ffff) AM_RAM // onboard RAM |
| r1257 | r1258 | |
| 239 | 252 | AM_RANGE(0x000, 0x7ff) AM_ROM |
| 240 | 253 | ADDRESS_MAP_END |
| 241 | 254 | |
| 255 | static ADDRESS_MAP_START( ipc_io_map, ADDRESS_SPACE_IO, 8 ) |
| 256 | AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(ipc_port1_w) |
| 257 | AM_RANGE(I8039_p2, I8039_p2) AM_READWRITE(ipc_port2_r, ipc_port2_w) |
| 258 | AM_RANGE(I8039_t1, I8039_t1) AM_READ(ipc_t1_r) |
| 259 | AM_RANGE(I8039_bus, I8039_bus) AM_READ(ipc_bus_r) |
| 260 | ADDRESS_MAP_END |
| 261 | |
| 242 | 262 | /* Input Ports */ |
| 243 | 263 | |
| 244 | 264 | static INPUT_PORTS_START( ql ) |
| r1257 | r1258 | |
| 340 | 360 | MDRV_CPU_ADD(M68008, 15000000/2) // 7.5 MHz |
| 341 | 361 | MDRV_CPU_PROGRAM_MAP(ql_map, 0) |
| 342 | 362 | |
| 343 | | MDRV_CPU_ADD(I8039, 11000000) // 11 MHz (i8049 IPC) |
| 363 | MDRV_CPU_ADD(I8048, 11000000) // 11 MHz (i8049 IPC) |
| 344 | 364 | MDRV_CPU_PROGRAM_MAP(ipc_map, 0) |
| 365 | MDRV_CPU_IO_MAP(ipc_io_map, 0) |
| 345 | 366 | |
| 346 | 367 | MDRV_SCREEN_REFRESH_RATE(50) |
| 347 | 368 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) |
| r1257 | r1258 | |
| 400 | 421 | |
| 401 | 422 | ROM_REGION( 0x800, REGION_CPU2, 0 ) |
| 402 | 423 | ROM_LOAD( "ipc8049.ic24", 0x0000, 0x0800, CRC(6a0d1f20) SHA1(fcb1c97ee7c66e5b6d8fbb57c06fd2f6509f2e1b) ) |
| 403 | | ROM_LOAD( "v07.ic24", 0x0000, 0x0800, CRC(051111f9) SHA1(83ed562464df89b9fdd9740db51d45884a512696) ) // V0.7 |
| 424 | // ROM_LOAD( "v07.ic24", 0x0000, 0x0800, CRC(051111f9) SHA1(83ed562464df89b9fdd9740db51d45884a512696) ) // V0.7 |
| 404 | 425 | ROM_END |
| 405 | 426 | |
| 406 | 427 | ROM_START( ql_jsu ) |