src/mess/video/abc800.c
| r3744 | r3745 | |
| 1 | | /*****************************************************************************
|
| 2 | | *
|
| 3 | | * video/abc800.c
|
| 4 | | *
|
| 5 | | ****************************************************************************/
|
| 6 | | |
| 7 | | /*
|
| 8 | | |
| 9 | | TODO:
|
| 10 | | |
| 11 | | - abc800c
|
| 12 | | |
| 13 | | */
|
| 14 | | |
| 15 | | #include "driver.h"
|
| 16 | | #include "includes/abc80x.h"
|
| 17 | | #include "machine/z80dart.h"
|
| 18 | | #include "video/mc6845.h"
|
| 19 | | |
| 20 | | /* Character Memory */
|
| 21 | | |
| 22 | | READ8_HANDLER( abc800_charram_r )
|
| 23 | | {
|
| 24 | | abc800_state *state = space->machine->driver_data;
|
| 25 | | |
| 26 | | return state->charram[offset];
|
| 27 | | }
|
| 28 | | |
| 29 | | WRITE8_HANDLER( abc800_charram_w )
|
| 30 | | {
|
| 31 | | abc800_state *state = space->machine->driver_data;
|
| 32 | | |
| 33 | | state->charram[offset] = data;
|
| 34 | | }
|
| 35 | | |
| 36 | | /* Palette Initialization */
|
| 37 | | |
| 38 | | static PALETTE_INIT( abc800m )
|
| 39 | | {
|
| 40 | | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black
|
| 41 | | palette_set_color_rgb(machine, 1, 0xff, 0xff, 0x00); // yellow
|
| 42 | | }
|
| 43 | | |
| 44 | | static PALETTE_INIT( abc800c )
|
| 45 | | {
|
| 46 | | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black
|
| 47 | | palette_set_color_rgb(machine, 1, 0x00, 0x00, 0xff); // blue
|
| 48 | | palette_set_color_rgb(machine, 2, 0xff, 0x00, 0x00); // red
|
| 49 | | palette_set_color_rgb(machine, 3, 0xff, 0x00, 0xff); // magenta
|
| 50 | | palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green
|
| 51 | | palette_set_color_rgb(machine, 5, 0x00, 0xff, 0xff); // cyan
|
| 52 | | palette_set_color_rgb(machine, 6, 0xff, 0xff, 0x00); // yellow
|
| 53 | | palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white
|
| 54 | | }
|
| 55 | | |
| 56 | | /* External Interface */
|
| 57 | | |
| 58 | | WRITE8_HANDLER( abc800_hrs_w )
|
| 59 | | {
|
| 60 | | abc800_state *state = space->machine->driver_data;
|
| 61 | | |
| 62 | | state->hrs = data;
|
| 63 | | }
|
| 64 | | |
| 65 | | WRITE8_HANDLER( abc800_hrc_w )
|
| 66 | | {
|
| 67 | | abc800_state *state = space->machine->driver_data;
|
| 68 | | |
| 69 | | state->fgctl = data;
|
| 70 | | }
|
| 71 | | |
| 72 | | /* MC6845 Row Update */
|
| 73 | | |
| 74 | | static MC6845_UPDATE_ROW( abc800m_update_row )
|
| 75 | | {
|
| 76 | | abc800_state *state = device->machine->driver_data;
|
| 77 | | |
| 78 | | int column;
|
| 79 | |
|
| 80 | | /* prevent wraparound */
|
| 81 | | if (y >= 240) return;
|
| 82 | |
|
| 83 | | y += 29;
|
| 84 | | |
| 85 | | for (column = 0; column < x_count; column++)
|
| 86 | | {
|
| 87 | | int bit;
|
| 88 | | |
| 89 | | UINT16 address = (state->charram[(ma + column) & 0x7ff] << 4) | (ra & 0x0f);
|
| 90 | | UINT8 data = (state->char_rom[address & 0x7ff] & 0x3f);
|
| 91 | | |
| 92 | | if (column == cursor_x)
|
| 93 | | {
|
| 94 | | data = 0x3f;
|
| 95 | | }
|
| 96 | | |
| 97 | | data <<= 2;
|
| 98 | | |
| 99 | | for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++)
|
| 100 | | {
|
| 101 | | int x = 115 + (column * ABC800_CHAR_WIDTH) + bit;
|
| 102 | | |
| 103 | | if (BIT(data, 7))
|
| 104 | | {
|
| 105 | | *BITMAP_ADDR16(bitmap, y, x) = 1;
|
| 106 | | }
|
| 107 | | |
| 108 | | data <<= 1;
|
| 109 | | }
|
| 110 | | }
|
| 111 | | }
|
| 112 | | |
| 113 | | static MC6845_ON_VSYNC_CHANGED(abc800_vsync_changed)
|
| 114 | | {
|
| 115 | | abc800_state *state = device->machine->driver_data;
|
| 116 | | |
| 117 | | z80dart_ri_w(state->z80dart, 1, vsync);
|
| 118 | | }
|
| 119 | | |
| 120 | | /* MC6845 Interfaces */
|
| 121 | | |
| 122 | | static const mc6845_interface abc800m_mc6845_interface = {
|
| 123 | | SCREEN_TAG,
|
| 124 | | ABC800_CCLK,
|
| 125 | | ABC800_CHAR_WIDTH,
|
| 126 | | NULL,
|
| 127 | | abc800m_update_row,
|
| 128 | | NULL,
|
| 129 | | NULL,
|
| 130 | | NULL,
|
| 131 | | abc800_vsync_changed
|
| 132 | | };
|
| 133 | | |
| 134 | | /* ABC 800 C */
|
| 135 | | |
| 136 | | static void abc800c_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
| 137 | | {
|
| 138 | | }
|
| 139 | | |
| 140 | | /* HR */
|
| 141 | | |
| 142 | | static void abc800m_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
| 143 | | {
|
| 144 | | abc800_state *state = machine->driver_data;
|
| 145 | | |
| 146 | | UINT16 addr = 0;
|
| 147 | | int sx, y, dot;
|
| 148 | | |
| 149 | | for (y = state->hrs + 29; y < MIN(cliprect->max_y + 1, state->hrs + 29 + 240); y++)
|
| 150 | | {
|
| 151 | | int x = 115;
|
| 152 | | |
| 153 | | for (sx = 0; sx < 64; sx++)
|
| 154 | | {
|
| 155 | | UINT8 data = state->videoram[addr++];
|
| 156 | | |
| 157 | | for (dot = 0; dot < 4; dot++)
|
| 158 | | {
|
| 159 | | UINT16 fgctl_addr = ((state->fgctl & 0x7f) << 2) | ((data >> 6) & 0x03);
|
| 160 | | int color = (state->fgctl_prom[fgctl_addr] & 0x07) ? 1 : 0;
|
| 161 | | |
| 162 | | *BITMAP_ADDR16(bitmap, y, x++) = color;
|
| 163 | | *BITMAP_ADDR16(bitmap, y, x++) = color;
|
| 164 | | |
| 165 | | data <<= 2;
|
| 166 | | }
|
| 167 | | }
|
| 168 | | }
|
| 169 | | }
|
| 170 | | |
| 171 | | static void abc800c_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
| 172 | | {
|
| 173 | | abc800_state *state = machine->driver_data;
|
| 174 | | |
| 175 | | UINT16 addr = 0;
|
| 176 | | int sx, y, dot;
|
| 177 | | |
| 178 | | for (y = state->hrs; y < MIN(cliprect->max_y + 1, state->hrs + 240); y++)
|
| 179 | | {
|
| 180 | | int x = 0;
|
| 181 | | |
| 182 | | for (sx = 0; sx < 64; sx++)
|
| 183 | | {
|
| 184 | | UINT8 data = state->videoram[addr++];
|
| 185 | | |
| 186 | | for (dot = 0; dot < 4; dot++)
|
| 187 | | {
|
| 188 | | UINT16 fgctl_addr = ((state->fgctl & 0x7f) << 2) | ((data >> 6) & 0x03);
|
| 189 | | int color = state->fgctl_prom[fgctl_addr] & 0x07;
|
| 190 | | |
| 191 | | *BITMAP_ADDR16(bitmap, y, x++) = color;
|
| 192 | | |
| 193 | | data <<= 2;
|
| 194 | | }
|
| 195 | | }
|
| 196 | | }
|
| 197 | | }
|
| 198 | | |
| 199 | | /* Video Start */
|
| 200 | | |
| 201 | | static VIDEO_START( abc800m )
|
| 202 | | {
|
| 203 | | abc800_state *state = machine->driver_data;
|
| 204 | |
|
| 205 | | /* allocate memory */
|
| 206 | | |
| 207 | | state->charram = auto_malloc(ABC800M_CHAR_RAM_SIZE);
|
| 208 | | |
| 209 | | /* find devices */
|
| 210 | | |
| 211 | | state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG);
|
| 212 | | |
| 213 | | /* find memory regions */
|
| 214 | | |
| 215 | | state->char_rom = memory_region(machine, "chargen");
|
| 216 | | state->fgctl_prom = memory_region(machine, "fgctl");
|
| 217 | | |
| 218 | | /* register for state saving */
|
| 219 | | |
| 220 | | state_save_register_global_pointer(state->charram, ABC800M_CHAR_RAM_SIZE);
|
| 221 | | state_save_register_global_pointer(state->videoram, ABC800_VIDEO_RAM_SIZE);
|
| 222 | | |
| 223 | | state_save_register_global(state->hrs);
|
| 224 | | state_save_register_global(state->fgctl);
|
| 225 | | }
|
| 226 | | |
| 227 | | static VIDEO_START( abc800c )
|
| 228 | | {
|
| 229 | | abc800_state *state = machine->driver_data;
|
| 230 | |
|
| 231 | | /* allocate memory */
|
| 232 | | |
| 233 | | state->charram = auto_malloc(ABC800C_CHAR_RAM_SIZE);
|
| 234 | | |
| 235 | | /* find memory regions */
|
| 236 | | |
| 237 | | state->char_rom = memory_region(machine, "chargen");
|
| 238 | | state->fgctl_prom = memory_region(machine, "fgctl");
|
| 239 | | |
| 240 | | /* register for state saving */
|
| 241 | | |
| 242 | | state_save_register_global_pointer(state->charram, ABC800C_CHAR_RAM_SIZE);
|
| 243 | | state_save_register_global_pointer(state->videoram, ABC800_VIDEO_RAM_SIZE);
|
| 244 | | |
| 245 | | state_save_register_global(state->hrs);
|
| 246 | | state_save_register_global(state->fgctl);
|
| 247 | | }
|
| 248 | | |
| 249 | | /* Video Update */
|
| 250 | | |
| 251 | | static VIDEO_UPDATE( abc800m )
|
| 252 | | {
|
| 253 | | abc800_state *state = screen->machine->driver_data;
|
| 254 | | |
| 255 | | /* expand visible area to workaround MC6845 */
|
| 256 | | video_screen_set_visarea(screen, 0, 767, 0, 311);
|
| 257 | | |
| 258 | | /* clear screen */
|
| 259 | | fillbitmap(bitmap, get_black_pen(screen->machine), cliprect);
|
| 260 | | |
| 261 | | /* draw HR graphics */
|
| 262 | | abc800m_hr_update(screen->machine, bitmap, cliprect);
|
| 263 | |
|
| 264 | | if (!BIT(state->fgctl, 7))
|
| 265 | | {
|
| 266 | | /* draw text */
|
| 267 | | mc6845_update(state->mc6845, bitmap, cliprect);
|
| 268 | | }
|
| 269 | |
|
| 270 | | return 0;
|
| 271 | | }
|
| 272 | | |
| 273 | | static VIDEO_UPDATE( abc800c )
|
| 274 | | {
|
| 275 | | abc800_state *state = screen->machine->driver_data;
|
| 276 | | |
| 277 | | /* clear screen */
|
| 278 | | fillbitmap(bitmap, get_black_pen(screen->machine), cliprect);
|
| 279 | | |
| 280 | | /* draw HR graphics */
|
| 281 | | abc800c_hr_update(screen->machine, bitmap, cliprect);
|
| 282 | |
|
| 283 | | if (!BIT(state->fgctl, 7))
|
| 284 | | {
|
| 285 | | /* draw text */
|
| 286 | | abc800c_update(screen->machine, bitmap, cliprect);
|
| 287 | | }
|
| 288 | |
|
| 289 | | return 0;
|
| 290 | | }
|
| 291 | | |
| 292 | | /* Machine Drivers */
|
| 293 | | |
| 294 | | MACHINE_DRIVER_START( abc800m_video )
|
| 295 | | MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
|
| 296 | | MDRV_DEVICE_CONFIG(abc800m_mc6845_interface)
|
| 297 | | |
| 298 | | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
|
| 299 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 300 | | |
| 301 | | MDRV_SCREEN_REFRESH_RATE(60)
|
| 302 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
|
| 303 | | MDRV_SCREEN_SIZE(640, 400)
|
| 304 | | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
|
| 305 | | |
| 306 | | MDRV_PALETTE_LENGTH(2)
|
| 307 | | |
| 308 | | MDRV_PALETTE_INIT(abc800m)
|
| 309 | | MDRV_VIDEO_START(abc800m)
|
| 310 | | MDRV_VIDEO_UPDATE(abc800m)
|
| 311 | | MACHINE_DRIVER_END
|
| 312 | | |
| 313 | | MACHINE_DRIVER_START( abc800c_video )
|
| 314 | | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
|
| 315 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
| 316 | | |
| 317 | | MDRV_SCREEN_REFRESH_RATE(60)
|
| 318 | | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
|
| 319 | | MDRV_SCREEN_SIZE(640, 400)
|
| 320 | | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
|
| 321 | | |
| 322 | | MDRV_PALETTE_LENGTH(8)
|
| 323 | | |
| 324 | | MDRV_PALETTE_INIT(abc800c)
|
| 325 | | MDRV_VIDEO_START(abc800c)
|
| 326 | | MDRV_VIDEO_UPDATE(abc800c)
|
| 327 | | MACHINE_DRIVER_END
|
| 1 | /***************************************************************************** |
| 2 | * |
| 3 | * video/abc800.c |
| 4 | * |
| 5 | ****************************************************************************/ |
| 6 | |
| 7 | /* |
| 8 | |
| 9 | TODO: |
| 10 | |
| 11 | - abc800c |
| 12 | |
| 13 | */ |
| 14 | |
| 15 | #include "driver.h" |
| 16 | #include "includes/abc80x.h" |
| 17 | #include "machine/z80dart.h" |
| 18 | #include "video/mc6845.h" |
| 19 | |
| 20 | /* Character Memory */ |
| 21 | |
| 22 | READ8_HANDLER( abc800_charram_r ) |
| 23 | { |
| 24 | abc800_state *state = space->machine->driver_data; |
| 25 | |
| 26 | return state->charram[offset]; |
| 27 | } |
| 28 | |
| 29 | WRITE8_HANDLER( abc800_charram_w ) |
| 30 | { |
| 31 | abc800_state *state = space->machine->driver_data; |
| 32 | |
| 33 | state->charram[offset] = data; |
| 34 | } |
| 35 | |
| 36 | /* Palette Initialization */ |
| 37 | |
| 38 | static PALETTE_INIT( abc800m ) |
| 39 | { |
| 40 | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black |
| 41 | palette_set_color_rgb(machine, 1, 0xff, 0xff, 0x00); // yellow |
| 42 | } |
| 43 | |
| 44 | static PALETTE_INIT( abc800c ) |
| 45 | { |
| 46 | palette_set_color_rgb(machine, 0, 0x00, 0x00, 0x00); // black |
| 47 | palette_set_color_rgb(machine, 1, 0x00, 0x00, 0xff); // blue |
| 48 | palette_set_color_rgb(machine, 2, 0xff, 0x00, 0x00); // red |
| 49 | palette_set_color_rgb(machine, 3, 0xff, 0x00, 0xff); // magenta |
| 50 | palette_set_color_rgb(machine, 4, 0x00, 0xff, 0x00); // green |
| 51 | palette_set_color_rgb(machine, 5, 0x00, 0xff, 0xff); // cyan |
| 52 | palette_set_color_rgb(machine, 6, 0xff, 0xff, 0x00); // yellow |
| 53 | palette_set_color_rgb(machine, 7, 0xff, 0xff, 0xff); // white |
| 54 | } |
| 55 | |
| 56 | /* External Interface */ |
| 57 | |
| 58 | WRITE8_HANDLER( abc800_hrs_w ) |
| 59 | { |
| 60 | abc800_state *state = space->machine->driver_data; |
| 61 | |
| 62 | state->hrs = data; |
| 63 | } |
| 64 | |
| 65 | WRITE8_HANDLER( abc800_hrc_w ) |
| 66 | { |
| 67 | abc800_state *state = space->machine->driver_data; |
| 68 | |
| 69 | state->fgctl = data; |
| 70 | } |
| 71 | |
| 72 | /* MC6845 Row Update */ |
| 73 | |
| 74 | static MC6845_UPDATE_ROW( abc800m_update_row ) |
| 75 | { |
| 76 | abc800_state *state = device->machine->driver_data; |
| 77 | |
| 78 | int column; |
| 79 | |
| 80 | /* prevent wraparound */ |
| 81 | if (y >= 240) return; |
| 82 | |
| 83 | y += 29; |
| 84 | |
| 85 | for (column = 0; column < x_count; column++) |
| 86 | { |
| 87 | int bit; |
| 88 | |
| 89 | UINT16 address = (state->charram[(ma + column) & 0x7ff] << 4) | (ra & 0x0f); |
| 90 | UINT8 data = (state->char_rom[address & 0x7ff] & 0x3f); |
| 91 | |
| 92 | if (column == cursor_x) |
| 93 | { |
| 94 | data = 0x3f; |
| 95 | } |
| 96 | |
| 97 | data <<= 2; |
| 98 | |
| 99 | for (bit = 0; bit < ABC800_CHAR_WIDTH; bit++) |
| 100 | { |
| 101 | int x = 115 + (column * ABC800_CHAR_WIDTH) + bit; |
| 102 | |
| 103 | if (BIT(data, 7)) |
| 104 | { |
| 105 | *BITMAP_ADDR16(bitmap, y, x) = 1; |
| 106 | } |
| 107 | |
| 108 | data <<= 1; |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | static MC6845_ON_VSYNC_CHANGED(abc800_vsync_changed) |
| 114 | { |
| 115 | abc800_state *state = device->machine->driver_data; |
| 116 | |
| 117 | z80dart_ri_w(state->z80dart, 1, vsync); |
| 118 | } |
| 119 | |
| 120 | /* MC6845 Interfaces */ |
| 121 | |
| 122 | static const mc6845_interface abc800m_mc6845_interface = { |
| 123 | SCREEN_TAG, |
| 124 | ABC800_CCLK, |
| 125 | ABC800_CHAR_WIDTH, |
| 126 | NULL, |
| 127 | abc800m_update_row, |
| 128 | NULL, |
| 129 | NULL, |
| 130 | NULL, |
| 131 | abc800_vsync_changed |
| 132 | }; |
| 133 | |
| 134 | /* ABC 800 C */ |
| 135 | |
| 136 | static void abc800c_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 137 | { |
| 138 | } |
| 139 | |
| 140 | /* HR */ |
| 141 | |
| 142 | static void abc800m_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 143 | { |
| 144 | abc800_state *state = machine->driver_data; |
| 145 | |
| 146 | UINT16 addr = 0; |
| 147 | int sx, y, dot; |
| 148 | |
| 149 | for (y = state->hrs + 29; y < MIN(cliprect->max_y + 1, state->hrs + 29 + 240); y++) |
| 150 | { |
| 151 | int x = 115; |
| 152 | |
| 153 | for (sx = 0; sx < 64; sx++) |
| 154 | { |
| 155 | UINT8 data = state->videoram[addr++]; |
| 156 | |
| 157 | for (dot = 0; dot < 4; dot++) |
| 158 | { |
| 159 | UINT16 fgctl_addr = ((state->fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); |
| 160 | int color = (state->fgctl_prom[fgctl_addr] & 0x07) ? 1 : 0; |
| 161 | |
| 162 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 163 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 164 | |
| 165 | data <<= 2; |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | static void abc800c_hr_update(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 172 | { |
| 173 | abc800_state *state = machine->driver_data; |
| 174 | |
| 175 | UINT16 addr = 0; |
| 176 | int sx, y, dot; |
| 177 | |
| 178 | for (y = state->hrs; y < MIN(cliprect->max_y + 1, state->hrs + 240); y++) |
| 179 | { |
| 180 | int x = 0; |
| 181 | |
| 182 | for (sx = 0; sx < 64; sx++) |
| 183 | { |
| 184 | UINT8 data = state->videoram[addr++]; |
| 185 | |
| 186 | for (dot = 0; dot < 4; dot++) |
| 187 | { |
| 188 | UINT16 fgctl_addr = ((state->fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); |
| 189 | int color = state->fgctl_prom[fgctl_addr] & 0x07; |
| 190 | |
| 191 | *BITMAP_ADDR16(bitmap, y, x++) = color; |
| 192 | |
| 193 | data <<= 2; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | /* Video Start */ |
| 200 | |
| 201 | static VIDEO_START( abc800m ) |
| 202 | { |
| 203 | abc800_state *state = machine->driver_data; |
| 204 | |
| 205 | /* allocate memory */ |
| 206 | |
| 207 | state->charram = auto_malloc(ABC800M_CHAR_RAM_SIZE); |
| 208 | |
| 209 | /* find devices */ |
| 210 | |
| 211 | state->mc6845 = devtag_get_device(machine, MC6845, MC6845_TAG); |
| 212 | |
| 213 | /* find memory regions */ |
| 214 | |
| 215 | state->char_rom = memory_region(machine, "chargen"); |
| 216 | state->fgctl_prom = memory_region(machine, "fgctl"); |
| 217 | |
| 218 | /* register for state saving */ |
| 219 | |
| 220 | state_save_register_global_pointer(state->charram, ABC800M_CHAR_RAM_SIZE); |
| 221 | state_save_register_global_pointer(state->videoram, ABC800_VIDEO_RAM_SIZE); |
| 222 | |
| 223 | state_save_register_global(state->hrs); |
| 224 | state_save_register_global(state->fgctl); |
| 225 | } |
| 226 | |
| 227 | static VIDEO_START( abc800c ) |
| 228 | { |
| 229 | abc800_state *state = machine->driver_data; |
| 230 | |
| 231 | /* allocate memory */ |
| 232 | |
| 233 | state->charram = auto_malloc(ABC800C_CHAR_RAM_SIZE); |
| 234 | |
| 235 | /* find memory regions */ |
| 236 | |
| 237 | state->char_rom = memory_region(machine, "chargen"); |
| 238 | state->fgctl_prom = memory_region(machine, "fgctl"); |
| 239 | |
| 240 | /* register for state saving */ |
| 241 | |
| 242 | state_save_register_global_pointer(state->charram, ABC800C_CHAR_RAM_SIZE); |
| 243 | state_save_register_global_pointer(state->videoram, ABC800_VIDEO_RAM_SIZE); |
| 244 | |
| 245 | state_save_register_global(state->hrs); |
| 246 | state_save_register_global(state->fgctl); |
| 247 | } |
| 248 | |
| 249 | /* Video Update */ |
| 250 | |
| 251 | static VIDEO_UPDATE( abc800m ) |
| 252 | { |
| 253 | abc800_state *state = screen->machine->driver_data; |
| 254 | |
| 255 | /* expand visible area to workaround MC6845 */ |
| 256 | video_screen_set_visarea(screen, 0, 767, 0, 311); |
| 257 | |
| 258 | /* clear screen */ |
| 259 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 260 | |
| 261 | /* draw HR graphics */ |
| 262 | abc800m_hr_update(screen->machine, bitmap, cliprect); |
| 263 | |
| 264 | if (!BIT(state->fgctl, 7)) |
| 265 | { |
| 266 | /* draw text */ |
| 267 | mc6845_update(state->mc6845, bitmap, cliprect); |
| 268 | } |
| 269 | |
| 270 | return 0; |
| 271 | } |
| 272 | |
| 273 | static VIDEO_UPDATE( abc800c ) |
| 274 | { |
| 275 | abc800_state *state = screen->machine->driver_data; |
| 276 | |
| 277 | /* clear screen */ |
| 278 | bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine)); |
| 279 | |
| 280 | /* draw HR graphics */ |
| 281 | abc800c_hr_update(screen->machine, bitmap, cliprect); |
| 282 | |
| 283 | if (!BIT(state->fgctl, 7)) |
| 284 | { |
| 285 | /* draw text */ |
| 286 | abc800c_update(screen->machine, bitmap, cliprect); |
| 287 | } |
| 288 | |
| 289 | return 0; |
| 290 | } |
| 291 | |
| 292 | /* Machine Drivers */ |
| 293 | |
| 294 | MACHINE_DRIVER_START( abc800m_video ) |
| 295 | MDRV_DEVICE_ADD(MC6845_TAG, MC6845) |
| 296 | MDRV_DEVICE_CONFIG(abc800m_mc6845_interface) |
| 297 | |
| 298 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 299 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 300 | |
| 301 | MDRV_SCREEN_REFRESH_RATE(60) |
| 302 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 303 | MDRV_SCREEN_SIZE(640, 400) |
| 304 | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 305 | |
| 306 | MDRV_PALETTE_LENGTH(2) |
| 307 | |
| 308 | MDRV_PALETTE_INIT(abc800m) |
| 309 | MDRV_VIDEO_START(abc800m) |
| 310 | MDRV_VIDEO_UPDATE(abc800m) |
| 311 | MACHINE_DRIVER_END |
| 312 | |
| 313 | MACHINE_DRIVER_START( abc800c_video ) |
| 314 | MDRV_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 315 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 316 | |
| 317 | MDRV_SCREEN_REFRESH_RATE(60) |
| 318 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 319 | MDRV_SCREEN_SIZE(640, 400) |
| 320 | MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1) |
| 321 | |
| 322 | MDRV_PALETTE_LENGTH(8) |
| 323 | |
| 324 | MDRV_PALETTE_INIT(abc800c) |
| 325 | MDRV_VIDEO_START(abc800c) |
| 326 | MDRV_VIDEO_UPDATE(abc800c) |
| 327 | MACHINE_DRIVER_END |
src/mess/video/border.c
| r3744 | r3745 | |
| 93 | 93 | r.max_x = TotalScreenWidth-1; |
| 94 | 94 | r.min_y = 0; |
| 95 | 95 | r.max_y = TopBorderLines-1; |
| 96 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 96 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 97 | 97 | |
| 98 | 98 | r.min_x = 0; |
| 99 | 99 | r.max_x = LeftBorderPixels-1; |
| 100 | 100 | r.min_y = TopBorderLines; |
| 101 | 101 | r.max_y = TopBorderLines+ScreenLines-1; |
| 102 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 102 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 103 | 103 | |
| 104 | 104 | r.min_x = LeftBorderPixels+ScreenPixels; |
| 105 | 105 | r.max_x = TotalScreenWidth-1; |
| 106 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 106 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 107 | 107 | |
| 108 | 108 | r.min_x = 0; |
| 109 | 109 | r.max_x = TotalScreenWidth-1; |
| 110 | 110 | r.min_y = TopBorderLines+ScreenLines; |
| 111 | 111 | r.max_y = TotalScreenHeight-1; |
| 112 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 112 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 113 | 113 | |
| 114 | 114 | // logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", CurrBorderColor, LastDisplayedBorderColor, full_refresh); |
| 115 | 115 | LastDisplayedBorderColor = CurrBorderColor; |
| r3744 | r3745 | |
| 137 | 137 | { |
| 138 | 138 | /* Single colour on line */ |
| 139 | 139 | r.max_x = TotalScreenWidth-1; |
| 140 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 140 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 141 | 141 | } |
| 142 | 142 | else |
| 143 | 143 | { |
| 144 | 144 | /* Multiple colours on a line */ |
| 145 | 145 | ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine; |
| 146 | 146 | r.max_x = ScrX-1; |
| 147 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 147 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 148 | 148 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 149 | 149 | do { |
| 150 | 150 | CurrItem++; |
| r3744 | r3745 | |
| 155 | 155 | NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine; |
| 156 | 156 | r.min_x = ScrX; |
| 157 | 157 | r.max_x = NextScrX-1; |
| 158 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 158 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 159 | 159 | ScrX = NextScrX; |
| 160 | 160 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 161 | 161 | do { |
| r3744 | r3745 | |
| 164 | 164 | } |
| 165 | 165 | r.min_x = ScrX; |
| 166 | 166 | r.max_x = TotalScreenWidth-1; |
| 167 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 167 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /* Process colour changes during horizontal retrace */ |
| r3744 | r3745 | |
| 189 | 189 | { |
| 190 | 190 | /* Single colour */ |
| 191 | 191 | r.max_x = LeftBorderPixels-1; |
| 192 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 192 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 193 | 193 | } |
| 194 | 194 | else |
| 195 | 195 | { |
| 196 | 196 | /* Multiple colours */ |
| 197 | 197 | ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles; |
| 198 | 198 | r.max_x = ScrX-1; |
| 199 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 199 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 200 | 200 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 201 | 201 | do { |
| 202 | 202 | CurrItem++; |
| r3744 | r3745 | |
| 207 | 207 | NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles; |
| 208 | 208 | r.min_x = ScrX; |
| 209 | 209 | r.max_x = NextScrX-1; |
| 210 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 210 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 211 | 211 | ScrX = NextScrX; |
| 212 | 212 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 213 | 213 | do { |
| r3744 | r3745 | |
| 216 | 216 | } |
| 217 | 217 | r.min_x = ScrX; |
| 218 | 218 | r.max_x = LeftBorderPixels-1; |
| 219 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 219 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /* Process colour changes during screen draw */ |
| r3744 | r3745 | |
| 234 | 234 | { |
| 235 | 235 | /* Single colour */ |
| 236 | 236 | r.max_x = TotalScreenWidth-1; |
| 237 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 237 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 238 | 238 | } |
| 239 | 239 | else |
| 240 | 240 | { |
| 241 | 241 | /* Multiple colours */ |
| 242 | 242 | ScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles; |
| 243 | 243 | r.max_x = ScrX-1; |
| 244 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 244 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 245 | 245 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 246 | 246 | do { |
| 247 | 247 | CurrItem++; |
| r3744 | r3745 | |
| 252 | 252 | NextScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles; |
| 253 | 253 | r.min_x = ScrX; |
| 254 | 254 | r.max_x = NextScrX-1; |
| 255 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 255 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 256 | 256 | ScrX = NextScrX; |
| 257 | 257 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 258 | 258 | do { |
| r3744 | r3745 | |
| 261 | 261 | } |
| 262 | 262 | r.min_x = ScrX; |
| 263 | 263 | r.max_x = TotalScreenWidth-1; |
| 264 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 264 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /* Process colour changes during horizontal retrace */ |
| r3744 | r3745 | |
| 284 | 284 | { |
| 285 | 285 | /* Single colour on line */ |
| 286 | 286 | r.max_x = TotalScreenWidth-1; |
| 287 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 287 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 288 | 288 | } |
| 289 | 289 | else |
| 290 | 290 | { |
| 291 | 291 | /* Multiple colours on a line */ |
| 292 | 292 | ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine; |
| 293 | 293 | r.max_x = ScrX-1; |
| 294 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 294 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 295 | 295 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 296 | 296 | do { |
| 297 | 297 | CurrItem++; |
| r3744 | r3745 | |
| 302 | 302 | NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine; |
| 303 | 303 | r.min_x = ScrX; |
| 304 | 304 | r.max_x = NextScrX-1; |
| 305 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 305 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 306 | 306 | ScrX = NextScrX; |
| 307 | 307 | CurrBorderColor = pItem[CurrItem].Event_Data; |
| 308 | 308 | do { |
| r3744 | r3745 | |
| 311 | 311 | } |
| 312 | 312 | r.min_x = ScrX; |
| 313 | 313 | r.max_x = TotalScreenWidth-1; |
| 314 | | fillbitmap(bitmap, machine->pens[CurrBorderColor], &r); |
| 314 | bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /* Process colour changes during horizontal retrace */ |