src/mess/video/fm7.c
| r0 | r5052 | |
| 1 | /* |
| 2 | * |
| 3 | * Fujitsu Micro 7 Video functions |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | #include "driver.h" |
| 8 | #include "cpu/m6809/m6809.h" |
| 9 | #include "includes/fm7.h" |
| 10 | |
| 11 | struct fm7_video_flags fm7_video; |
| 12 | |
| 13 | extern UINT8* fm7_video_ram; |
| 14 | extern emu_timer* fm7_subtimer; |
| 15 | |
| 16 | /* |
| 17 | * Main CPU: Sub-CPU interface (port 0xfd05) |
| 18 | * |
| 19 | * Read: |
| 20 | * bit 7: Sub-CPU busy (or halted) |
| 21 | * bit 0: EXTDET (?) |
| 22 | * Write: |
| 23 | * bit 7: Sub-CPU halt |
| 24 | * bit 6: Sub-CPU cancel IRQ |
| 25 | */ |
| 26 | |
| 27 | READ8_HANDLER( fm7_subintf_r ) |
| 28 | { |
| 29 | UINT8 ret = 0x00; |
| 30 | |
| 31 | if(fm7_video.sub_busy != 0 || fm7_video.sub_halt != 0) |
| 32 | ret |= 0x80; |
| 33 | |
| 34 | ret |= 0x7e; |
| 35 | //ret |= 0x01; // EXTDET (not implemented yet) |
| 36 | |
| 37 | return ret; |
| 38 | } |
| 39 | |
| 40 | WRITE8_HANDLER( fm7_subintf_w ) |
| 41 | { |
| 42 | fm7_video.sub_halt = data & 0x80; |
| 43 | if(data & 0x80) |
| 44 | fm7_video.sub_busy = data & 0x80; |
| 45 | |
| 46 | cputag_set_input_line(space->machine,"sub",INPUT_LINE_HALT,(data & 0x80) ? ASSERT_LINE : CLEAR_LINE); |
| 47 | if(data & 0x40) |
| 48 | cputag_set_input_line(space->machine,"sub",M6809_IRQ_LINE,ASSERT_LINE); |
| 49 | //popmessage("Sub CPU Interface write: %02x\n",data); |
| 50 | } |
| 51 | |
| 52 | READ8_HANDLER( fm7_sub_busyflag_r ) |
| 53 | { |
| 54 | if(fm7_video.sub_halt == 0) |
| 55 | fm7_video.sub_busy = 0x00; |
| 56 | return 0x00; |
| 57 | } |
| 58 | |
| 59 | WRITE8_HANDLER( fm7_sub_busyflag_w ) |
| 60 | { |
| 61 | fm7_video.sub_busy = 0x80; |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | * Sub-CPU port 0xd402 |
| 66 | * Read-only: Acknowledge Cancel IRQ |
| 67 | */ |
| 68 | READ8_HANDLER( fm7_cancel_ack ) |
| 69 | { |
| 70 | cputag_set_input_line(space->machine,"sub",M6809_IRQ_LINE,CLEAR_LINE); |
| 71 | return 0x00; |
| 72 | } |
| 73 | |
| 74 | /* |
| 75 | * Reading from 0xd404 (sub-CPU) causes an "Attention" FIRQ on the main CPU |
| 76 | */ |
| 77 | READ8_HANDLER( fm7_attn_irq_r ) |
| 78 | { |
| 79 | fm7_video.attn_irq = 1; |
| 80 | cputag_set_input_line(space->machine,"maincpu",M6809_FIRQ_LINE,ASSERT_LINE); |
| 81 | return 0xff; |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | * Sub CPU: I/O port 0xd409 |
| 86 | * |
| 87 | * On read, enables VRAM access |
| 88 | * On write, disables VRAM access |
| 89 | */ |
| 90 | READ8_HANDLER( fm7_vram_access_r ) |
| 91 | { |
| 92 | fm7_video.vram_access = 1; |
| 93 | return 0xff; |
| 94 | } |
| 95 | |
| 96 | WRITE8_HANDLER( fm7_vram_access_w ) |
| 97 | { |
| 98 | fm7_video.vram_access = 0; |
| 99 | } |
| 100 | |
| 101 | READ8_HANDLER( fm7_vram_r ) |
| 102 | { |
| 103 | int offs; |
| 104 | |
| 105 | offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff); |
| 106 | return fm7_video_ram[offs]; |
| 107 | } |
| 108 | |
| 109 | WRITE8_HANDLER( fm7_vram_w ) |
| 110 | { |
| 111 | int offs; |
| 112 | |
| 113 | offs = (offset & 0xc000) | ((offset + fm7_video.vram_offset) & 0x3fff); |
| 114 | if(fm7_video.vram_access != 0) |
| 115 | fm7_video_ram[offs] = data; |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | * Sub CPU: I/O port 0xd408 |
| 120 | * |
| 121 | * On read, enables the CRT display |
| 122 | * On write, disables the CRT display |
| 123 | */ |
| 124 | READ8_HANDLER( fm7_crt_r ) |
| 125 | { |
| 126 | fm7_video.crt_enable = 1; |
| 127 | return 0xff; |
| 128 | } |
| 129 | |
| 130 | WRITE8_HANDLER( fm7_crt_w ) |
| 131 | { |
| 132 | fm7_video.crt_enable = 0; |
| 133 | } |
| 134 | |
| 135 | /* |
| 136 | * Sub CPU: I/O ports 0xd40e - 0xd40f |
| 137 | * |
| 138 | * 0xd40e: bits 0-6 - offset in bytes (high byte) (bit 6 is used for 400 line video only) |
| 139 | * 0xd40f: bits 0-7 - offset in bytes (low byte) |
| 140 | */ |
| 141 | WRITE8_HANDLER( fm7_vram_offset_w ) |
| 142 | { |
| 143 | UINT16 new_offset = 0; |
| 144 | |
| 145 | switch(offset) |
| 146 | { |
| 147 | case 0: |
| 148 | new_offset = (data << 8) | (fm7_video.vram_offset & 0x00ff); |
| 149 | break; |
| 150 | case 1: // low 5 bits are used on FM-77AV and later only |
| 151 | new_offset = (fm7_video.vram_offset & 0xff00) | (data & 0xe0); |
| 152 | break; |
| 153 | } |
| 154 | |
| 155 | fm7_video.vram_offset = new_offset; |
| 156 | } |
| 157 | |
| 158 | /* |
| 159 | * Main CPU: I/O ports 0xfd38-0xfd3f |
| 160 | * Colour palette. |
| 161 | * Each port represents one of eight colours. Palette is 3-bit. |
| 162 | * bit 2 = Green |
| 163 | * bit 1 = Red |
| 164 | * bit 0 = Blue |
| 165 | */ |
| 166 | READ8_HANDLER( fm7_palette_r ) |
| 167 | { |
| 168 | return fm7_video.fm7_pal[offset]; |
| 169 | } |
| 170 | |
| 171 | WRITE8_HANDLER( fm7_palette_w ) |
| 172 | { |
| 173 | UINT8 r = 0,g = 0,b = 0; |
| 174 | |
| 175 | if(data & 0x04) |
| 176 | g = 0xff; |
| 177 | if(data & 0x02) |
| 178 | r = 0xff; |
| 179 | if(data & 0x01) |
| 180 | b = 0xff; |
| 181 | |
| 182 | palette_set_color(space->machine,offset,MAKE_RGB(r,g,b)); |
| 183 | fm7_video.fm7_pal[offset] = data & 0x07; |
| 184 | } |
| 185 | |
| 186 | VIDEO_START( fm7 ) |
| 187 | { |
| 188 | } |
| 189 | |
| 190 | VIDEO_UPDATE( fm7 ) |
| 191 | { |
| 192 | UINT8 code_r,code_g,code_b; |
| 193 | UINT8 col; |
| 194 | int y, x, b; |
| 195 | |
| 196 | if(fm7_video.crt_enable == 0) |
| 197 | return 0; |
| 198 | |
| 199 | for (y = 0; y < 200; y++) |
| 200 | { |
| 201 | for (x = 0; x < 80; x++) |
| 202 | { |
| 203 | code_r = fm7_video_ram[0x8000 + ((y*80 + x + fm7_video.vram_offset) & 0x3fff)]; |
| 204 | code_g = fm7_video_ram[0x4000 + ((y*80 + x + fm7_video.vram_offset) & 0x3fff)]; |
| 205 | code_b = fm7_video_ram[0x0000 + ((y*80 + x + fm7_video.vram_offset) & 0x3fff)]; |
| 206 | for (b = 0; b < 8; b++) |
| 207 | { |
| 208 | col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); |
| 209 | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = col; |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | return 0; |
| 214 | } |
| 215 | |
| 216 | static const rgb_t fm7_initial_palette[8] = { |
| 217 | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 218 | MAKE_RGB(0x00, 0x00, 0xff), // 1 |
| 219 | MAKE_RGB(0xff, 0x00, 0x00), // 2 |
| 220 | MAKE_RGB(0xff, 0x00, 0xff), // 3 |
| 221 | MAKE_RGB(0x00, 0xff, 0x00), // 4 |
| 222 | MAKE_RGB(0x00, 0xff, 0xff), // 5 |
| 223 | MAKE_RGB(0xff, 0xff, 0x00), // 6 |
| 224 | MAKE_RGB(0xff, 0xff, 0xff), // 7 |
| 225 | }; |
| 226 | |
| 227 | PALETTE_INIT( fm7 ) |
| 228 | { |
| 229 | int x; |
| 230 | |
| 231 | palette_set_colors(machine, 0, fm7_initial_palette, ARRAY_LENGTH(fm7_initial_palette)); |
| 232 | for(x=0;x<8;x++) |
| 233 | fm7_video.fm7_pal[x] = x; |
| 234 | } |
| 235 | |
src/mess/drivers/fm7.c
| r5051 | r5052 | |
| 39 | 39 | #include "formats/fm7_dsk.h" |
| 40 | 40 | #include "machine/ctronics.h" |
| 41 | 41 | |
| 42 | | // Interrupt flags |
| 43 | | #define IRQ_FLAG_KEY 0x01 |
| 44 | | #define IRQ_FLAG_PRINTER 0x02 |
| 45 | | #define IRQ_FLAG_TIMER 0x04 |
| 46 | | #define IRQ_FLAG_UNKNOWN 0x08 |
| 47 | | // the following are not read in port 0xfd03 |
| 48 | | #define IRQ_FLAG_MFD 0x10 |
| 49 | | #define IRQ_FLAG_TXRDY 0x20 |
| 50 | | #define IRQ_FLAG_RXRDY 0x40 |
| 51 | | #define IRQ_FLAG_SYNDET 0x80 |
| 42 | #include "includes/fm7.h" |
| 52 | 43 | |
| 53 | | UINT8* shared_ram; |
| 54 | 44 | UINT8* fm7_video_ram; |
| 45 | UINT8* shared_ram; |
| 55 | 46 | static UINT8 irq_flags; // active IRQ flags |
| 56 | 47 | static UINT8 irq_mask; // IRQ mask |
| 57 | | emu_timer* fm7_timer; // main timer, triggered every 2.0345ms? |
| 58 | | emu_timer* fm7_subtimer; // sub-CPU timer, every 1 second? |
| 48 | emu_timer* fm7_timer; // main timer, triggered every 2.0345ms |
| 49 | emu_timer* fm7_subtimer; // sub-CPU timer, triggered every 20ms |
| 59 | 50 | emu_timer* fm7_keyboard_timer; |
| 60 | | static UINT8 sub_busy; |
| 61 | | static UINT8 sub_halt; |
| 62 | 51 | static UINT8 basic_rom_en; |
| 63 | | static UINT8 attn_irq; |
| 64 | | static UINT8 vram_access; // VRAM access flag |
| 65 | | static UINT8 crt_enable; |
| 66 | 52 | unsigned int key_delay; |
| 67 | 53 | unsigned int key_repeat; |
| 68 | 54 | static UINT16 current_scancode; |
| 69 | 55 | static UINT32 key_data[4]; |
| 70 | | static UINT16 vram_offset; |
| 71 | 56 | static UINT8 break_flag; |
| 72 | | static UINT8 fm7_pal[8]; |
| 73 | 57 | static UINT8 fm7_psg_regsel; |
| 74 | 58 | static UINT8 psg_data; |
| 75 | 59 | static UINT8 fdc_side; |
| r5051 | r5052 | |
| 77 | 61 | static UINT8 fdc_irq_flag; |
| 78 | 62 | static UINT8 fdc_drq_flag; |
| 79 | 63 | |
| 64 | extern struct fm7_video_flags fm7_video; |
| 65 | |
| 80 | 66 | /* key scancode conversion table |
| 81 | 67 | * The FM-7 expects different scancodes when shift,ctrl or graph is held, or |
| 82 | 68 | * when kana is active. |
| r5051 | r5052 | |
| 251 | 237 | { |
| 252 | 238 | UINT8 ret = 0xff; |
| 253 | 239 | |
| 254 | | if(attn_irq != 0) |
| 240 | if(fm7_video.attn_irq != 0) |
| 255 | 241 | { |
| 256 | 242 | ret &= ~0x01; |
| 257 | | attn_irq = 0; |
| 243 | fm7_video.attn_irq = 0; |
| 258 | 244 | } |
| 259 | 245 | if(break_flag != 0) |
| 260 | 246 | { |
| r5051 | r5052 | |
| 263 | 249 | return ret; |
| 264 | 250 | } |
| 265 | 251 | |
| 266 | | /* |
| 267 | | * Main CPU: Sub-CPU interface (port 0xfd05) |
| 268 | | * |
| 269 | | * Read: |
| 270 | | * bit 7: Sub-CPU busy (or halted) |
| 271 | | * bit 0: EXTDET (?) |
| 272 | | * Write: |
| 273 | | * bit 7: Sub-CPU halt |
| 274 | | * bit 6: Sub-CPU cancel IRQ |
| 275 | | */ |
| 276 | | |
| 277 | | READ8_HANDLER( fm7_subintf_r ) |
| 278 | | { |
| 279 | | UINT8 ret = 0x00; |
| 280 | | |
| 281 | | if(sub_busy != 0 || sub_halt != 0) |
| 282 | | ret |= 0x80; |
| 283 | | |
| 284 | | ret |= 0x7e; |
| 285 | | //ret |= 0x01; // EXTDET (not implemented yet) |
| 286 | | |
| 287 | | return ret; |
| 288 | | } |
| 289 | | |
| 290 | | WRITE8_HANDLER( fm7_subintf_w ) |
| 291 | | { |
| 292 | | sub_halt = data & 0x80; |
| 293 | | if(data & 0x80) |
| 294 | | sub_busy = data & 0x80; |
| 295 | | |
| 296 | | cputag_set_input_line(space->machine,"sub",INPUT_LINE_HALT,(data & 0x80) ? ASSERT_LINE : CLEAR_LINE); |
| 297 | | if(data & 0x40) |
| 298 | | cputag_set_input_line(space->machine,"sub",M6809_IRQ_LINE,ASSERT_LINE); |
| 299 | | //popmessage("Sub CPU Interface write: %02x\n",data); |
| 300 | | } |
| 301 | | |
| 302 | | READ8_HANDLER( fm7_sub_busyflag_r ) |
| 303 | | { |
| 304 | | if(sub_halt == 0) |
| 305 | | sub_busy = 0x00; |
| 306 | | return 0x00; |
| 307 | | } |
| 308 | | |
| 309 | | WRITE8_HANDLER( fm7_sub_busyflag_w ) |
| 310 | | { |
| 311 | | sub_busy = 0x80; |
| 312 | | } |
| 313 | | |
| 314 | 252 | /* |
| 315 | 253 | * Main CPU: I/O port 0xfd0f |
| 316 | 254 | * |
| r5051 | r5052 | |
| 337 | 275 | } |
| 338 | 276 | |
| 339 | 277 | /* |
| 340 | | * Sub-CPU port 0xd402 |
| 341 | | * Read-only: Acknowledge Cancel IRQ |
| 342 | | */ |
| 343 | | READ8_HANDLER( fm7_cancel_ack ) |
| 344 | | { |
| 345 | | cputag_set_input_line(space->machine,"sub",M6809_IRQ_LINE,CLEAR_LINE); |
| 346 | | return 0x00; |
| 347 | | } |
| 348 | | |
| 349 | | /* |
| 350 | | * Reading from 0xd404 (sub-CPU) causes an "Attention" FIRQ on the main CPU |
| 351 | | */ |
| 352 | | READ8_HANDLER( fm7_attn_irq_r ) |
| 353 | | { |
| 354 | | attn_irq = 1; |
| 355 | | cputag_set_input_line(space->machine,"maincpu",M6809_FIRQ_LINE,ASSERT_LINE); |
| 356 | | return 0xff; |
| 357 | | } |
| 358 | | |
| 359 | | /* |
| 360 | | * Sub CPU: I/O port 0xd409 |
| 361 | | * |
| 362 | | * On read, enables VRAM access |
| 363 | | * On write, disables VRAM access |
| 364 | | */ |
| 365 | | READ8_HANDLER( fm7_vram_access_r ) |
| 366 | | { |
| 367 | | vram_access = 1; |
| 368 | | return 0xff; |
| 369 | | } |
| 370 | | |
| 371 | | WRITE8_HANDLER( fm7_vram_access_w ) |
| 372 | | { |
| 373 | | vram_access = 0; |
| 374 | | } |
| 375 | | |
| 376 | | READ8_HANDLER( fm7_vram_r ) |
| 377 | | { |
| 378 | | int offs; |
| 379 | | |
| 380 | | offs = (offset & 0xc000) | ((offset + vram_offset) & 0x3fff); |
| 381 | | return fm7_video_ram[offs]; |
| 382 | | } |
| 383 | | |
| 384 | | WRITE8_HANDLER( fm7_vram_w ) |
| 385 | | { |
| 386 | | int offs; |
| 387 | | |
| 388 | | offs = (offset & 0xc000) | ((offset + vram_offset) & 0x3fff); |
| 389 | | if(vram_access != 0) |
| 390 | | fm7_video_ram[offs] = data; |
| 391 | | } |
| 392 | | |
| 393 | | /* |
| 394 | | * Sub CPU: I/O port 0xd408 |
| 395 | | * |
| 396 | | * On read, enables the CRT display |
| 397 | | * On write, disables the CRT display |
| 398 | | */ |
| 399 | | READ8_HANDLER( fm7_crt_r ) |
| 400 | | { |
| 401 | | crt_enable = 1; |
| 402 | | return 0xff; |
| 403 | | } |
| 404 | | |
| 405 | | WRITE8_HANDLER( fm7_crt_w ) |
| 406 | | { |
| 407 | | crt_enable = 0; |
| 408 | | } |
| 409 | | |
| 410 | | /* |
| 411 | 278 | * Main CPU: I/O ports 0xfd18 - 0xfd1f |
| 412 | 279 | * Floppy Disk Controller (MB8877A) |
| 413 | 280 | */ |
| r5051 | r5052 | |
| 512 | 379 | } |
| 513 | 380 | |
| 514 | 381 | /* |
| 515 | | * Sub CPU: I/O ports 0xd40e - 0xd40f |
| 516 | | * |
| 517 | | * 0xd40e: bits 0-6 - offset in bytes (high byte) (bit 6 is used for 400 line video only) |
| 518 | | * 0xd40f: bits 0-7 - offset in bytes (low byte) |
| 519 | | */ |
| 520 | | WRITE8_HANDLER( fm7_vram_offset_w ) |
| 521 | | { |
| 522 | | UINT16 new_offset = 0; |
| 523 | | |
| 524 | | switch(offset) |
| 525 | | { |
| 526 | | case 0: |
| 527 | | new_offset = (data << 8) | (vram_offset & 0x00ff); |
| 528 | | break; |
| 529 | | case 1: // low 5 bits are used on FM-77AV and later only |
| 530 | | new_offset = (vram_offset & 0xff00) | (data & 0xe0); |
| 531 | | break; |
| 532 | | } |
| 533 | | |
| 534 | | vram_offset = new_offset; |
| 535 | | } |
| 536 | | |
| 537 | | /* |
| 538 | 382 | * Main CPU: I/O ports 0xfd00-0xfd01 |
| 539 | 383 | * Sub CPU: I/O ports 0xd400-0xd401 |
| 540 | 384 | * |
| r5051 | r5052 | |
| 651 | 495 | } |
| 652 | 496 | |
| 653 | 497 | /* |
| 654 | | * Main CPU: I/O ports 0xfd38-0xfd3f |
| 655 | | * Colour palette. |
| 656 | | * Each port represents one of eight colours. Palette is 3-bit. |
| 657 | | * bit 2 = Green |
| 658 | | * bit 1 = Red |
| 659 | | * bit 0 = Blue |
| 660 | | */ |
| 661 | | static READ8_HANDLER( fm7_palette_r ) |
| 662 | | { |
| 663 | | return fm7_pal[offset]; |
| 664 | | } |
| 665 | | |
| 666 | | static WRITE8_HANDLER( fm7_palette_w ) |
| 667 | | { |
| 668 | | UINT8 r = 0,g = 0,b = 0; |
| 669 | | |
| 670 | | if(data & 0x04) |
| 671 | | g = 0xff; |
| 672 | | if(data & 0x02) |
| 673 | | r = 0xff; |
| 674 | | if(data & 0x01) |
| 675 | | b = 0xff; |
| 676 | | |
| 677 | | palette_set_color(space->machine,offset,MAKE_RGB(r,g,b)); |
| 678 | | fm7_pal[offset] = data & 0x07; |
| 679 | | } |
| 680 | | |
| 681 | | /* |
| 682 | 498 | * Main CPU: I/O ports 0xfd0d-0xfd0e |
| 683 | 499 | * PSG (AY-3-891x) |
| 684 | 500 | * 0xfd0d - function select (bit 1 = BDIR, bit 0 = BC1) |
| r5051 | r5052 | |
| 735 | 551 | // Shared RAM is only usable on the main CPU if the sub CPU is halted |
| 736 | 552 | static READ8_HANDLER( fm7_main_shared_r ) |
| 737 | 553 | { |
| 738 | | if(sub_halt != 0) |
| 554 | if(fm7_video.sub_halt != 0) |
| 739 | 555 | return shared_ram[offset]; |
| 740 | 556 | else |
| 741 | 557 | return 0xff; |
| r5051 | r5052 | |
| 743 | 559 | |
| 744 | 560 | static WRITE8_HANDLER( fm7_main_shared_w ) |
| 745 | 561 | { |
| 746 | | if(sub_halt != 0) |
| 562 | if(fm7_video.sub_halt != 0) |
| 747 | 563 | shared_ram[offset] = data; |
| 748 | 564 | } |
| 749 | 565 | |
| r5051 | r5052 | |
| 1123 | 939 | timer_adjust_periodic(fm7_keyboard_timer,attotime_zero,0,ATTOTIME_IN_MSEC(10)); |
| 1124 | 940 | irq_mask = 0xff; |
| 1125 | 941 | irq_flags = 0x00; |
| 1126 | | attn_irq = 0; |
| 1127 | | sub_busy = 0x80; // busy at reset |
| 942 | fm7_video.attn_irq = 0; |
| 943 | fm7_video.sub_busy = 0x80; // busy at reset |
| 1128 | 944 | basic_rom_en = 1; // enabled at reset |
| 1129 | | vram_access = 0; |
| 1130 | | crt_enable = 0; |
| 945 | fm7_video.vram_access = 0; |
| 946 | fm7_video.crt_enable = 0; |
| 1131 | 947 | memory_set_bankptr(machine,1,RAM+0x38000); |
| 1132 | 948 | key_delay = 700; // 700ms on FM-7 |
| 1133 | 949 | key_repeat = 70; // 70ms on FM-7 |
| 1134 | | vram_offset = 0x0000; |
| 950 | fm7_video.vram_offset = 0x0000; |
| 1135 | 951 | break_flag = 0; |
| 1136 | 952 | fm7_psg_regsel = 0; |
| 1137 | 953 | fdc_side = 0; |
| r5051 | r5052 | |
| 1148 | 964 | } |
| 1149 | 965 | } |
| 1150 | 966 | |
| 1151 | | static VIDEO_START( fm7 ) |
| 1152 | | { |
| 1153 | | } |
| 1154 | | |
| 1155 | | static VIDEO_UPDATE( fm7 ) |
| 1156 | | { |
| 1157 | | UINT8 code_r,code_g,code_b; |
| 1158 | | UINT8 col; |
| 1159 | | int y, x, b; |
| 1160 | | |
| 1161 | | if(crt_enable == 0) |
| 1162 | | return 0; |
| 1163 | | |
| 1164 | | for (y = 0; y < 200; y++) |
| 1165 | | { |
| 1166 | | for (x = 0; x < 80; x++) |
| 1167 | | { |
| 1168 | | code_r = fm7_video_ram[0x8000 + ((y*80 + x + vram_offset) & 0x3fff)]; |
| 1169 | | code_g = fm7_video_ram[0x4000 + ((y*80 + x + vram_offset) & 0x3fff)]; |
| 1170 | | code_b = fm7_video_ram[0x0000 + ((y*80 + x + vram_offset) & 0x3fff)]; |
| 1171 | | for (b = 0; b < 8; b++) |
| 1172 | | { |
| 1173 | | col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); |
| 1174 | | *BITMAP_ADDR16(bitmap, y, x*8+(7-b)) = col; |
| 1175 | | } |
| 1176 | | } |
| 1177 | | } |
| 1178 | | return 0; |
| 1179 | | } |
| 1180 | | |
| 1181 | | static const rgb_t fm7_initial_palette[8] = { |
| 1182 | | MAKE_RGB(0x00, 0x00, 0x00), // 0 |
| 1183 | | MAKE_RGB(0x00, 0x00, 0xff), // 1 |
| 1184 | | MAKE_RGB(0xff, 0x00, 0x00), // 2 |
| 1185 | | MAKE_RGB(0xff, 0x00, 0xff), // 3 |
| 1186 | | MAKE_RGB(0x00, 0xff, 0x00), // 4 |
| 1187 | | MAKE_RGB(0x00, 0xff, 0xff), // 5 |
| 1188 | | MAKE_RGB(0xff, 0xff, 0x00), // 6 |
| 1189 | | MAKE_RGB(0xff, 0xff, 0xff), // 7 |
| 1190 | | }; |
| 1191 | | |
| 1192 | | PALETTE_INIT( fm7 ) |
| 1193 | | { |
| 1194 | | int x; |
| 1195 | | |
| 1196 | | palette_set_colors(machine, 0, fm7_initial_palette, ARRAY_LENGTH(fm7_initial_palette)); |
| 1197 | | for(x=0;x<8;x++) |
| 1198 | | fm7_pal[x] = x; |
| 1199 | | } |
| 1200 | | |
| 1201 | | //static DEVICE_IMAGE_LOAD( fm7_floppy ) |
| 1202 | | //{ |
| 1203 | | // if (device_load_basicdsk_floppy(image)==INIT_PASS) |
| 1204 | | // { |
| 1205 | | /* drive, tracks, heads, sectors per track, sector length, first sector id */ |
| 1206 | | // basicdsk_set_geometry(image, 40, 2, 16, 256, 0x01, 0x2c0, FALSE); |
| 1207 | | // return INIT_PASS; |
| 1208 | | // } |
| 1209 | | |
| 1210 | | // return INIT_FAIL; |
| 1211 | | //} |
| 1212 | | |
| 1213 | 967 | static const wd17xx_interface fm7_mb8877a_interface = |
| 1214 | 968 | { |
| 1215 | 969 | fm7_fdc_irq, |