src/mess/video/rmnimbus.c
| r7262 | r7263 | |
| 76 | 76 | UINT16 vidregs[NO_VIDREGS]; |
| 77 | 77 | |
| 78 | 78 | UINT8 bpp; // Bits / pixel |
| 79 | | UINT8 ppb; // Pixels / byte |
| 80 | 79 | UINT16 pixel_mask; |
| 81 | | UINT8 border_colour; |
| 80 | UINT8 hs_count; |
| 82 | 81 | |
| 83 | 82 | int debug_on; |
| 84 | 83 | |
| r7262 | r7263 | |
| 93 | 92 | static void write_reg_01A(void); |
| 94 | 93 | static void write_reg_01C(void); |
| 95 | 94 | static void write_reg_026(void); |
| 96 | | static void change_palette(running_machine *machine, UINT8 first, UINT16 colours); |
| 95 | static void change_palette(running_machine *machine, UINT8 bank, UINT16 colours, UINT8 regno); |
| 97 | 96 | |
| 98 | 97 | static void video_debug(running_machine *machine, int ref, int params, const char *param[]); |
| 99 | 98 | static void video_regdump(running_machine *machine, int ref, int params, const char *param[]); |
| r7262 | r7263 | |
| 132 | 131 | case reg022 : result=vidregs[reg022]; break; |
| 133 | 132 | case reg024 : result=vidregs[reg024]; break; |
| 134 | 133 | case reg026 : result=vidregs[reg026]; break; |
| 135 | | case reg028 : result=vidregs[reg028]; break; |
| 134 | case reg028 : result=hs_count; break; //result=vidregs[reg028]; break; |
| 136 | 135 | case reg02A : result=vidregs[reg02A]; break; |
| 137 | 136 | case reg02C : result=vidregs[reg02C]; break; |
| 138 | 137 | case reg02E : result=vidregs[reg02E]; break; |
| r7262 | r7263 | |
| 190 | 189 | case reg022 : vidregs[reg022]=data; break; |
| 191 | 190 | case reg024 : vidregs[reg024]=data; break; |
| 192 | 191 | case reg026 : vidregs[reg026]=data; write_reg_026(); break; |
| 193 | | case reg028 : vidregs[reg028]=data; change_palette(space->machine,(IS_80COL ? 0 : 0),data); break; |
| 194 | | case reg02A : vidregs[reg02A]=data; change_palette(space->machine,(IS_80COL ? 1 : 4),data); break; |
| 195 | | case reg02C : vidregs[reg02C]=data; change_palette(space->machine,(IS_80COL ? 2 : 8),data); break; |
| 196 | | case reg02E : vidregs[reg02E]=data; change_palette(space->machine,(IS_80COL ? 3 : 12),data); break; |
| 192 | case reg028 : change_palette(space->machine,0,data,reg028); break; |
| 193 | case reg02A : change_palette(space->machine,1,data,reg02A); break; |
| 194 | case reg02C : change_palette(space->machine,2,data,reg02C); break; |
| 195 | case reg02E : change_palette(space->machine,3,data,reg02E); break; |
| 197 | 196 | |
| 198 | 197 | default : break; |
| 199 | 198 | } |
| r7262 | r7263 | |
| 282 | 281 | 011 |
| 283 | 282 | 100 4bpp, must be a 16 bit word, of which the upper byte is a mask anded with the lower byte |
| 284 | 283 | containing the pixel data for two pixels. |
| 285 | | 101 |
| 284 | 101 Move pixel data at x,reg020 to x,y, used for scrolling. |
| 286 | 285 | 110 4bpp, 16 bit word containing the pixel data for 4 pixels. |
| 287 | 286 | 111 |
| 288 | 287 | |
| r7262 | r7263 | |
| 419 | 418 | |
| 420 | 419 | static void write_reg_026(void) |
| 421 | 420 | { |
| 422 | | border_colour=vidregs[reg026] & 0x0F; |
| 423 | | |
| 424 | 421 | if(debug_on & DEBUG_TEXT) |
| 425 | | logerror("reg 026 write, border_colour=%02X\n",border_colour); |
| 422 | logerror("reg 026 write, border_colour=%02X\n",vidregs[reg026] & 0x0F); |
| 426 | 423 | } |
| 427 | 424 | |
| 428 | | static void change_palette(running_machine *machine, UINT8 first, UINT16 colours) |
| 425 | static void change_palette(running_machine *machine, UINT8 bank, UINT16 colours, UINT8 regno) |
| 429 | 426 | { |
| 430 | 427 | UINT8 colourno; |
| 431 | 428 | UINT16 mask; |
| 432 | 429 | UINT8 shifts; |
| 433 | 430 | UINT8 paletteidx; |
| 434 | 431 | UINT8 colourmax; |
| 432 | UINT8 first; |
| 435 | 433 | |
| 434 | // for the register's data has changed update it, and then update the pallette, else do nothing. |
| 435 | if(vidregs[regno]!=colours) |
| 436 | vidregs[regno]=colours; |
| 437 | else |
| 438 | return; |
| 439 | |
| 440 | // Setup parameters for pallette change |
| 441 | colourmax=IS_80COL ? 1 : 4; |
| 442 | first=IS_80COL ? bank : bank*4; |
| 443 | |
| 436 | 444 | shifts=0; |
| 437 | 445 | mask=0x000F; |
| 438 | 446 | |
| 439 | | colourmax=IS_80COL ? 1 : 4; |
| 440 | | |
| 441 | | for(colourno=first; colourno<(first+4); colourno++) |
| 447 | // loop over changing colours |
| 448 | for(colourno=first; colourno<(first+colourmax); colourno++) |
| 442 | 449 | { |
| 443 | 450 | paletteidx=(colours & mask) >> shifts; |
| 444 | 451 | palette_set_color_rgb(machine, colourno, nimbus_palette[paletteidx][RED], nimbus_palette[paletteidx][GREEN], nimbus_palette[paletteidx][BLUE]); |
| r7262 | r7263 | |
| 520 | 527 | *BITMAP_ADDR16(bitmap, YCoord, XCoord)=video_mem[XCoord][YCoord]; |
| 521 | 528 | } |
| 522 | 529 | |
| 523 | | vidregs[reg028]++; |
| 524 | | if((vidregs[reg028] & 0x000F)>0x0A) |
| 525 | | vidregs[reg028]&=0xFFF0; |
| 530 | hs_count++; |
| 531 | if((hs_count & 0x000F)>0x0A) |
| 532 | hs_count&=0xFFF0; |
| 526 | 533 | |
| 527 | 534 | return 0; |
| 528 | 535 | } |
src/mess/machine/wd17xx.c
| r7262 | r7263 | |
| 119 | 119 | |
| 120 | 120 | This should probably be considdered a minor hack but it does seem to work ! |
| 121 | 121 | |
| 122 | 2009-02-04 Phill Harvey-Smith |
| 123 | - Added multiple sector write as the RM Nimbus needs it. |
| 124 | |
| 122 | 125 | TODO: |
| 123 | 126 | - Multiple record write |
| 124 | 127 | - What happens if a track is read that doesn't have any id's on it? |
| r7262 | r7263 | |
| 1464 | 1467 | if ((data & ~FDC_MASK_TYPE_II) == FDC_READ_SEC) |
| 1465 | 1468 | { |
| 1466 | 1469 | if (VERBOSE) |
| 1470 | { |
| 1467 | 1471 | logerror("wd17xx_command_w $%02X READ_SEC\n", data); |
| 1468 | | |
| 1472 | logerror("cmd=%02X, trk=%02X, sec=%02X, dat=%02X\n",w->command,w->track,w->sector,w->data); |
| 1473 | } |
| 1469 | 1474 | w->read_cmd = data; |
| 1470 | 1475 | w->command = data & ~FDC_MASK_TYPE_II; |
| 1471 | 1476 | w->command_type = TYPE_II; |
| r7262 | r7263 | |
| 1481 | 1486 | if ((data & ~FDC_MASK_TYPE_II) == FDC_WRITE_SEC) |
| 1482 | 1487 | { |
| 1483 | 1488 | if (VERBOSE) |
| 1489 | { |
| 1484 | 1490 | logerror("wd17xx_command_w $%02X WRITE_SEC\n", data); |
| 1491 | logerror("cmd=%02X, trk=%02X, sec=%02X, dat=%02X\n",w->command,w->track,w->sector,w->data); |
| 1492 | } |
| 1485 | 1493 | |
| 1486 | 1494 | w->write_cmd = data; |
| 1487 | 1495 | w->command = data & ~FDC_MASK_TYPE_II; |
| r7262 | r7263 | |
| 1771 | 1779 | |
| 1772 | 1780 | w->data_offset = 0; |
| 1773 | 1781 | |
| 1774 | | wd17xx_complete_command(device, DELAY_DATADONE); |
| 1775 | | } |
| 1782 | |
| 1783 | /* Check we should handle the next sector for a multi record write */ |
| 1784 | if ( w->command_type == TYPE_II && w->command == FDC_WRITE_SEC && ( w->write_cmd & 0x10 ) ) |
| 1785 | { |
| 1786 | w->sector++; |
| 1787 | if (wd17xx_locate_sector(device)) |
| 1788 | { |
| 1789 | w->data_count = w->sector_length; |
| 1790 | |
| 1791 | w->status |= STA_2_BUSY; |
| 1792 | w->busy_count = 0; |
| 1793 | |
| 1794 | wd17xx_timed_data_request(device); |
| 1795 | } |
| 1796 | } |
| 1797 | else |
| 1798 | { |
| 1799 | wd17xx_complete_command(device, DELAY_DATADONE); |
| 1800 | if (VERBOSE) |
| 1801 | logerror("wd17xx_data_w(): multi data write completed\n"); |
| 1802 | } |
| 1803 | } |
| 1776 | 1804 | else |
| 1777 | 1805 | { |
| 1778 | 1806 | /* yes... setup a timed data request */ |
src/mess/machine/rmnimbus.c
| r7262 | r7263 | |
| 13 | 13 | |
| 14 | 14 | #include "emu.h" |
| 15 | 15 | #include "memory.h" |
| 16 | #include "debugger.h" |
| 16 | 17 | #include "cpu/i86/i86.h" |
| 17 | 18 | #include "debug/debugcpu.h" |
| 18 | 19 | #include "debug/debugcon.h" |
| r7262 | r7263 | |
| 53 | 54 | #define LOG_IOU 1 |
| 54 | 55 | #define LOG_SOUND 0 |
| 55 | 56 | |
| 57 | /* Debugging */ |
| 58 | |
| 59 | UINT32 debug_flags; |
| 60 | |
| 61 | #define DMA_BREAK 0x0000001 |
| 62 | |
| 56 | 63 | /* 80186 internal stuff */ |
| 57 | 64 | struct mem_state |
| 58 | 65 | { |
| r7262 | r7263 | |
| 195 | 202 | |
| 196 | 203 | static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[]); |
| 197 | 204 | static void execute_debug_intmasks(running_machine *machine, int ref, int params, const char *param[]); |
| 205 | static void nimbus_debug(running_machine *machine, int ref, int params, const char *param[]); |
| 198 | 206 | |
| 199 | 207 | static int instruction_hook(running_device *device, offs_t curpc); |
| 200 | 208 | static void decode_subbios(running_device *device,offs_t pc); |
| r7262 | r7263 | |
| 202 | 210 | static void decode_dssi_f_plot_character_string(running_device *device,UINT16 ds, UINT16 si); |
| 203 | 211 | static void decode_dssi_f_set_new_clt(running_device *device,UINT16 ds, UINT16 si); |
| 204 | 212 | static void decode_dssi_f_plonk_char(running_device *device,UINT16 ds, UINT16 si); |
| 213 | static void decode_dssi_f_rw_sectors(running_device *device,UINT16 ds, UINT16 si); |
| 205 | 214 | |
| 206 | 215 | static void fdc_reset(void); |
| 207 | 216 | static void generate_disk_int(running_machine *machine); |
| r7262 | r7263 | |
| 685 | 694 | /* check for interrupt generation */ |
| 686 | 695 | if (d->control & 0x0100) |
| 687 | 696 | { |
| 688 | | if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source); |
| 697 | if (LOG_DMA>1) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source); |
| 689 | 698 | i186.intr.request |= 0x04 << which; |
| 690 | 699 | update_interrupt_state(machine); |
| 691 | 700 | } |
| r7262 | r7263 | |
| 733 | 742 | } |
| 734 | 743 | |
| 735 | 744 | if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest); |
| 745 | if (debug_flags & DMA_BREAK) |
| 746 | debugger_break(machine); |
| 736 | 747 | |
| 737 | 748 | /* set the new control register */ |
| 738 | 749 | d->control = new_control; |
| r7262 | r7263 | |
| 751 | 762 | UINT8 dma_byte; |
| 752 | 763 | UINT8 incdec_size; |
| 753 | 764 | |
| 754 | | if (LOG_DMA) |
| 765 | if (LOG_DMA>1) |
| 755 | 766 | logerror("Control=%04X, src=%05X, dest=%05X, count=%04X\n",dma->control,dma->source,dma->dest,dma->count); |
| 756 | 767 | |
| 757 | 768 | if(!(dma->control & ST_STOP)) |
| r7262 | r7263 | |
| 812 | 823 | // Interrupt if count is zero, and interrupt flag set |
| 813 | 824 | if((dma->control & INTERRUPT_ON_ZERO) && (dma->count==0)) |
| 814 | 825 | { |
| 815 | | if (LOG_DMA) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source); |
| 826 | if (LOG_DMA>1) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source); |
| 816 | 827 | i186.intr.request |= 0x04 << which; |
| 817 | 828 | update_interrupt_state(machine); |
| 818 | 829 | } |
| r7262 | r7263 | |
| 1288 | 1299 | { |
| 1289 | 1300 | debug_console_register_command(machine, "nimbus_irq", CMDFLAG_NONE, 0, 0, 2, execute_debug_irq); |
| 1290 | 1301 | debug_console_register_command(machine, "nimbus_intmasks", CMDFLAG_NONE, 0, 0, 0, execute_debug_intmasks); |
| 1302 | debug_console_register_command(machine, "nimbus_debug", CMDFLAG_NONE, 0, 0, 1, nimbus_debug); |
| 1291 | 1303 | |
| 1292 | 1304 | /* set up the instruction hook */ |
| 1293 | 1305 | debug_cpu_set_instruction_hook(devtag_get_device(machine, MAINCPU_TAG), instruction_hook); |
| 1294 | 1306 | |
| 1295 | 1307 | } |
| 1308 | |
| 1309 | debug_flags=0; |
| 1296 | 1310 | } |
| 1297 | 1311 | |
| 1298 | 1312 | static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[]) |
| r7262 | r7263 | |
| 1333 | 1347 | debug_console_printf(machine,"i186.intr.in_service= %04X\n",i186.intr.in_service); |
| 1334 | 1348 | } |
| 1335 | 1349 | |
| 1350 | static void nimbus_debug(running_machine *machine, int ref, int params, const char *param[]) |
| 1351 | { |
| 1352 | if(params>0) |
| 1353 | { |
| 1354 | sscanf(param[0],"%d",&debug_flags); |
| 1355 | } |
| 1356 | else |
| 1357 | { |
| 1358 | debug_console_printf(machine,"Error usage : nimbus_debug <debuglevel>\n"); |
| 1359 | debug_console_printf(machine,"Current debuglevel=%02X\n",debug_flags); |
| 1360 | } |
| 1361 | } |
| 1362 | |
| 1336 | 1363 | /*----------------------------------------------- |
| 1337 | 1364 | instruction_hook - per-instruction hook |
| 1338 | 1365 | -----------------------------------------------*/ |
| r7262 | r7263 | |
| 1436 | 1463 | case 1 : set_func("f_initialise_unit"); break; |
| 1437 | 1464 | case 2 : set_func("f_pseudo_init_unit"); break; |
| 1438 | 1465 | case 3 : set_func("f_get_device_status"); break; |
| 1439 | | case 4 : set_func("f_read_n_sectors"); break; |
| 1440 | | case 5 : set_func("f_write_n_sectors"); break; |
| 1466 | case 4 : set_func("f_read_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break; |
| 1467 | case 5 : set_func("f_write_n_sectors"); dump_dssi=&decode_dssi_f_rw_sectors; break; |
| 1441 | 1468 | case 6 : set_func("f_verify_n_sectors"); break; |
| 1442 | 1469 | case 7 : set_func("f_media_check"); break; |
| 1443 | 1470 | case 8 : set_func("f_recalibrate"); break; |
| r7262 | r7263 | |
| 1770 | 1797 | logerror("plonked_char=%c\n",params[0]); |
| 1771 | 1798 | } |
| 1772 | 1799 | |
| 1800 | static void decode_dssi_f_rw_sectors(running_device *device,UINT16 ds, UINT16 si) |
| 1801 | { |
| 1802 | const address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1803 | UINT16 *params; |
| 1804 | int param_no; |
| 1805 | |
| 1806 | params=(UINT16 *)get_dssi_ptr(space,ds,si); |
| 1807 | |
| 1808 | for(param_no=0;param_no<16;param_no++) |
| 1809 | logerror("%04X ",params[param_no]); |
| 1810 | |
| 1811 | logerror("\n"); |
| 1812 | } |
| 1773 | 1813 | |
| 1774 | 1814 | READ16_HANDLER( nimbus_io_r ) |
| 1775 | 1815 | { |
| r7262 | r7263 | |
| 2054 | 2094 | break; |
| 2055 | 2095 | } |
| 2056 | 2096 | |
| 2057 | | if(LOG_DISK_FDD) |
| 2097 | if(LOG_DISK_FDD && ((offset*2)<=0x10)) |
| 2058 | 2098 | logerror("Nimbus FDCR at pc=%08X from %04X data=%02X\n",pc,(offset*2)+0x400,result); |
| 2059 | 2099 | |
| 2060 | 2100 | if((LOG_DISK_HDD) && ((offset*2)>=0x10)) |
| r7262 | r7263 | |
| 2090 | 2130 | int pc=cpu_get_pc(space->cpu); |
| 2091 | 2131 | UINT8 reg400_old = nimbus_drives.reg400; |
| 2092 | 2132 | |
| 2093 | | if(LOG_DISK_FDD) |
| 2133 | if(LOG_DISK_FDD && ((offset*2)<=0x10)) |
| 2094 | 2134 | logerror("Nimbus FDCW at %05X write of %02X to %04X\n",pc,data,(offset*2)+0x400); |
| 2095 | 2135 | |
| 2096 | 2136 | if((LOG_DISK_HDD) && (((offset*2)>=0x10) || (offset==0))) |