src/mess/drivers/bml3.c
| r8659 | r8660 | |
| 8 | 8 | - no documentation, the entire driver is just a bunch of educated |
| 9 | 9 | guesses ... |
| 10 | 10 | - keyboard shift key, necessary for some key commands |
| 11 | - understand how to load a tape |
| 11 | 12 | - every time that you switch with NEW ON command, there's a "device i/o error" if |
| 12 | 13 | the hres_reg bit 5 is active. |
| 13 | 14 | |
| r8659 | r8660 | |
| 34 | 35 | static UINT16 cursor_addr,cursor_raster; |
| 35 | 36 | static UINT8 attr_latch,io_latch; |
| 36 | 37 | static UINT8 hres_reg, vres_reg; |
| 38 | static UINT8 keyb_press,keyb_press_flag; |
| 37 | 39 | |
| 38 | 40 | static VIDEO_START( bml3 ) |
| 39 | 41 | { |
| r8659 | r8660 | |
| 52 | 54 | width = (hres_reg & 0x80) ? 80 : 40; |
| 53 | 55 | height = (vres_reg & 0x08) ? 1 : 0; |
| 54 | 56 | |
| 55 | | popmessage("%02x %02x",hres_reg,vres_reg); |
| 57 | // popmessage("%02x %02x",hres_reg,vres_reg); |
| 56 | 58 | |
| 57 | 59 | for(y=0;y<25;y++) |
| 58 | 60 | { |
| r8659 | r8660 | |
| 146 | 148 | |
| 147 | 149 | static READ8_HANDLER( bml3_keyboard_r ) |
| 148 | 150 | { |
| 149 | | const char* portnames[3] = { "key1","key2","key3" }; |
| 150 | | int i,port_i,scancode; |
| 151 | | scancode = 0; |
| 152 | | |
| 153 | | for(port_i=0;port_i<3;port_i++) |
| 151 | if(keyb_press_flag) |
| 154 | 152 | { |
| 155 | | for(i=0;i<32;i++) |
| 156 | | { |
| 157 | | if((input_port_read(space->machine,portnames[port_i])>>i) & 1) |
| 158 | | return scancode | 0x80; |
| 159 | | |
| 160 | | scancode++; |
| 161 | | } |
| 153 | int res; |
| 154 | res = keyb_press; |
| 155 | keyb_press = keyb_press_flag = 0; |
| 156 | return res | 0x80; |
| 162 | 157 | } |
| 163 | 158 | |
| 164 | 159 | return 0; |
| r8659 | r8660 | |
| 171 | 166 | |
| 172 | 167 | if(offset == 0x19) return io_latch; |
| 173 | 168 | if(offset == 0xc4) return 0xff; //some video modes wants this to be high |
| 174 | | //maybe 0xc4 is the status and 0xc5 the data? d7 and ea seems to be related too |
| 169 | // if(offset == 0xc5 || offset == 0xca) return mame_rand(space->machine); //tape related |
| 175 | 170 | if(offset == 0xc8) return 0; //??? checks bit 7, scrolls vertically if active high |
| 176 | 171 | if(offset == 0xc9) return 0x11; //0x01 put 320 x 200 mode, 0x07 = 640 x 375 |
| 177 | 172 | |
| r8659 | r8660 | |
| 241 | 236 | static WRITE8_HANDLER( bml3_io_w ) |
| 242 | 237 | { |
| 243 | 238 | if(offset == 0x19) { io_latch = data; } //??? |
| 239 | // else if(offset == 0xc4) { /* system latch, writes 0x53 -> 0x51 when a tape is loaded */} |
| 244 | 240 | else if(offset == 0xc6 || offset == 0xc7) { bml3_6845_w(space,offset-0xc6,data); } |
| 245 | 241 | else if(offset == 0xd0) { bml3_hres_reg_w(space,0,data); } |
| 246 | 242 | else if(offset == 0xd3) { /* every time that the user presses a key, unknown purpose */ } |
| r8659 | r8660 | |
| 376 | 372 | PORT_BIT(0xffe00000,IP_ACTIVE_HIGH,IPT_UNKNOWN) |
| 377 | 373 | INPUT_PORTS_END |
| 378 | 374 | |
| 379 | | static MACHINE_START(bml3) |
| 380 | | { |
| 381 | | beep_set_frequency(machine->device("beeper"),300); //guesswork |
| 382 | | beep_set_state(machine->device("beeper"),0); |
| 383 | | } |
| 384 | | |
| 385 | | static MACHINE_RESET(bml3) |
| 386 | | { |
| 387 | | } |
| 388 | | |
| 389 | 375 | static const mc6845_interface mc6845_intf = |
| 390 | 376 | { |
| 391 | 377 | "screen", /* screen we are acting on */ |
| r8659 | r8660 | |
| 400 | 386 | NULL /* update address callback */ |
| 401 | 387 | }; |
| 402 | 388 | |
| 389 | static TIMER_CALLBACK( keyboard_callback ) |
| 390 | { |
| 391 | const char* portnames[3] = { "key1","key2","key3" }; |
| 392 | int i,port_i,scancode; |
| 393 | scancode = 0; |
| 394 | |
| 395 | for(port_i=0;port_i<3;port_i++) |
| 396 | { |
| 397 | for(i=0;i<32;i++) |
| 398 | { |
| 399 | if((input_port_read(machine,portnames[port_i])>>i) & 1) |
| 400 | { |
| 401 | keyb_press = scancode; |
| 402 | keyb_press_flag = 1; |
| 403 | cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, HOLD_LINE); |
| 404 | return; |
| 405 | } |
| 406 | |
| 407 | scancode++; |
| 408 | } |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | #if 0 |
| 403 | 413 | static INTERRUPT_GEN( bml3_irq ) |
| 404 | 414 | { |
| 405 | 415 | cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, HOLD_LINE); |
| 406 | 416 | } |
| 407 | 417 | |
| 408 | | #if 0 |
| 409 | 418 | static INTERRUPT_GEN( bml3_firq ) |
| 410 | 419 | { |
| 420 | /* almost surely used to load the tapes */ |
| 411 | 421 | cputag_set_input_line(device->machine, "maincpu", M6809_FIRQ_LINE, HOLD_LINE); |
| 412 | 422 | } |
| 413 | 423 | #endif |
| r8659 | r8660 | |
| 420 | 430 | palette_set_color_rgb(machine, i, pal1bit(i >> 1),pal1bit(i >> 2),pal1bit(i >> 0)); |
| 421 | 431 | } |
| 422 | 432 | |
| 433 | static MACHINE_START(bml3) |
| 434 | { |
| 435 | timer_pulse(machine, ATTOTIME_IN_HZ(240/8), NULL, 0, keyboard_callback); |
| 436 | beep_set_frequency(machine->device("beeper"),300); //guesswork |
| 437 | beep_set_state(machine->device("beeper"),0); |
| 438 | } |
| 423 | 439 | |
| 440 | static MACHINE_RESET(bml3) |
| 441 | { |
| 442 | } |
| 443 | |
| 424 | 444 | static MACHINE_DRIVER_START( bml3 ) |
| 425 | 445 | /* basic machine hardware */ |
| 426 | 446 | MDRV_CPU_ADD("maincpu",M6809, XTAL_1MHz) |
| 427 | 447 | MDRV_CPU_PROGRAM_MAP(bml3_mem) |
| 428 | | MDRV_CPU_VBLANK_INT("screen", bml3_irq ) |
| 448 | // MDRV_CPU_VBLANK_INT("screen", bml3_irq ) |
| 429 | 449 | // MDRV_CPU_PERIODIC_INT(bml3_firq,45) |
| 430 | 450 | |
| 431 | 451 | MDRV_MACHINE_START(bml3) |