src/mess/machine/rmnimbus.c
| r9973 | r9974 | |
| 104 | 104 | |
| 105 | 105 | #define DEBUG_SET(flags) ((state->debug_machine & (flags))==(flags)) |
| 106 | 106 | |
| 107 | #define DEBUG_NONE 0x0000000 |
| 107 | 108 | #define DMA_BREAK 0x0000001 |
| 108 | 109 | #define DECODE_BIOS 0x0000002 |
| 109 | | #define DECODE_DOS21 0x0000004 |
| 110 | #define DECODE_BIOS_RAW 0x0000004 |
| 111 | #define DECODE_DOS21 0x0000008 |
| 110 | 112 | |
| 113 | |
| 111 | 114 | /* Z80 SIO */ |
| 112 | 115 | |
| 113 | 116 | const z80sio_interface nimbus_sio_intf = |
| r9973 | r9974 | |
| 157 | 160 | static void nimbus_debug(running_machine *machine, int ref, int params, const char *param[]); |
| 158 | 161 | |
| 159 | 162 | static int instruction_hook(device_t &device, offs_t curpc); |
| 160 | | static void decode_subbios(device_t *device,offs_t pc); |
| 163 | static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag); |
| 161 | 164 | static void decode_dos21(device_t *device,offs_t pc); |
| 162 | | static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si); |
| 163 | | static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si); |
| 164 | | static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si); |
| 165 | | static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si); |
| 166 | | static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si); |
| 165 | static void decode_dssi_generic(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); |
| 166 | static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); |
| 167 | static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); |
| 168 | static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); |
| 169 | static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); |
| 170 | static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag); |
| 167 | 171 | |
| 168 | 172 | static void nimbus_bank_memory(running_machine *machine); |
| 169 | 173 | static void memory_reset(running_machine *machine); |
| r9973 | r9974 | |
| 1287 | 1291 | machine->device(MAINCPU_TAG)->debug()->set_instruction_hook(instruction_hook); |
| 1288 | 1292 | } |
| 1289 | 1293 | |
| 1290 | | state->debug_machine=DECODE_BIOS; |
| 1294 | state->debug_machine=DEBUG_NONE; |
| 1291 | 1295 | } |
| 1292 | 1296 | |
| 1293 | 1297 | static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[]) |
| r9973 | r9974 | |
| 1346 | 1350 | |
| 1347 | 1351 | static int instruction_hook(device_t &device, offs_t curpc) |
| 1348 | 1352 | { |
| 1349 | | rmnimbus_state *state = device.machine->driver_data<rmnimbus_state>(); |
| 1350 | | address_space *space = cpu_get_address_space(&device, ADDRESS_SPACE_PROGRAM); |
| 1351 | | UINT8 *addr_ptr; |
| 1353 | rmnimbus_state *state = device.machine->driver_data<rmnimbus_state>(); |
| 1354 | address_space *space = cpu_get_address_space(&device, ADDRESS_SPACE_PROGRAM); |
| 1355 | UINT8 *addr_ptr; |
| 1352 | 1356 | |
| 1353 | 1357 | addr_ptr = (UINT8*)space->get_read_ptr(curpc); |
| 1354 | 1358 | |
| 1355 | 1359 | if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD)) |
| 1356 | 1360 | { |
| 1357 | 1361 | if(DEBUG_SET(DECODE_BIOS) && (addr_ptr[1]==0xF0)) |
| 1358 | | decode_subbios(&device,curpc); |
| 1359 | | |
| 1362 | { |
| 1363 | if(DEBUG_SET(DECODE_BIOS_RAW)) |
| 1364 | decode_subbios(&device,curpc,1); |
| 1365 | else |
| 1366 | decode_subbios(&device,curpc,0); |
| 1367 | } |
| 1368 | |
| 1360 | 1369 | if(DEBUG_SET(DECODE_DOS21) && (addr_ptr[1]==0x21)) |
| 1361 | 1370 | decode_dos21(&device,curpc); |
| 1362 | 1371 | } |
| r9973 | r9974 | |
| 1368 | 1377 | #define set_drv(drv_name) sprintf(drv_str,drv_name) |
| 1369 | 1378 | #define set_func(func_name) sprintf(func_str,func_name) |
| 1370 | 1379 | |
| 1371 | | static void decode_subbios(device_t *device,offs_t pc) |
| 1380 | static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag) |
| 1372 | 1381 | { |
| 1373 | 1382 | char type_str[80]; |
| 1374 | 1383 | char drv_str[80]; |
| 1375 | 1384 | char func_str[80]; |
| 1376 | 1385 | |
| 1377 | | void (*dump_dssi)(device_t *,UINT16, UINT16) = NULL; |
| 1386 | void (*dump_dssi)(device_t *,UINT16, UINT16 ,UINT8) = NULL; |
| 1378 | 1387 | |
| 1379 | 1388 | device_t *cpu = device->machine->device(MAINCPU_TAG); |
| 1380 | 1389 | |
| r9973 | r9974 | |
| 1384 | 1393 | UINT16 ds = cpu_get_reg(cpu,I8086_DS); |
| 1385 | 1394 | UINT16 si = cpu_get_reg(cpu,I8086_SI); |
| 1386 | 1395 | |
| 1387 | | logerror("=======================================================================\n"); |
| 1388 | | logerror("Sub-bios call at %08X, AX=%04X, BX=%04X, CX=%04X, DS:SI=%04X:%04X\n",pc,ax,bx,cx,ds,si); |
| 1396 | // *** TEMP Don't show f_enquire_display_line calls ! |
| 1397 | if((cx==6) && (ax==43)) |
| 1398 | return; |
| 1399 | // *** END TEMP |
| 1389 | 1400 | |
| 1401 | if(!raw_flag) |
| 1402 | { |
| 1403 | logerror("=======================================================================\n"); |
| 1404 | logerror("Sub-bios call at %08X, AX=%04X, BX=%04X, CX=%04X, DS:SI=%04X:%04X\n",pc,ax,bx,cx,ds,si); |
| 1405 | } |
| 1406 | |
| 1390 | 1407 | set_type("invalid"); |
| 1391 | 1408 | set_drv("invalid"); |
| 1392 | 1409 | set_func("invalid"); |
| 1393 | 1410 | |
| 1394 | | |
| 1395 | 1411 | switch (cx) |
| 1396 | 1412 | { |
| 1397 | 1413 | case 0 : |
| r9973 | r9974 | |
| 1618 | 1634 | case 2 : set_func("f_plonk_cursor"); break; |
| 1619 | 1635 | case 3 : set_func("f_kill_cursor"); break; |
| 1620 | 1636 | case 4 : set_func("f_scroll"); break; |
| 1621 | | case 5 : set_func("f_width"); break; |
| 1637 | case 5 : set_func("f_width"); dump_dssi=decode_dssi_generic;break; |
| 1622 | 1638 | case 6 : set_func("f_get_char_set"); break; |
| 1623 | 1639 | case 7 : set_func("f_set_char_set"); break; |
| 1624 | 1640 | case 8 : set_func("f_reset_char_set"); break; |
| r9973 | r9974 | |
| 1687 | 1703 | }; break; |
| 1688 | 1704 | } |
| 1689 | 1705 | |
| 1690 | | logerror("Type=%s, Driver=%s, Function=%s\n",type_str,drv_str,func_str); |
| 1706 | if(raw_flag) |
| 1707 | { |
| 1708 | if(dump_dssi!=NULL) |
| 1709 | dump_dssi(device,ds,si,raw_flag); |
| 1710 | } |
| 1711 | else |
| 1712 | { |
| 1713 | logerror("Type=%s, Driver=%s, Function=%s\n",type_str,drv_str,func_str); |
| 1691 | 1714 | |
| 1692 | | if(dump_dssi!=NULL) |
| 1693 | | dump_dssi(device,ds,si); |
| 1694 | | logerror("=======================================================================\n"); |
| 1715 | if(dump_dssi!=NULL) |
| 1716 | dump_dssi(device,ds,si,raw_flag); |
| 1717 | logerror("=======================================================================\n"); |
| 1718 | } |
| 1695 | 1719 | } |
| 1696 | 1720 | |
| 1697 | 1721 | static void *get_dssi_ptr(address_space *space, UINT16 ds, UINT16 si) |
| r9973 | r9974 | |
| 1699 | 1723 | int addr; |
| 1700 | 1724 | |
| 1701 | 1725 | addr=((ds<<4)+si); |
| 1702 | | OUTPUT_SEGOFS("DS:SI",ds,si); |
| 1726 | // OUTPUT_SEGOFS("DS:SI",ds,si); |
| 1703 | 1727 | |
| 1704 | 1728 | return space->get_read_ptr(addr); |
| 1705 | 1729 | } |
| 1706 | 1730 | |
| 1707 | | static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si) |
| 1731 | static void decode_dssi_generic(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) |
| 1708 | 1732 | { |
| 1733 | address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1734 | UINT16 *params; |
| 1735 | int count; |
| 1736 | |
| 1737 | if(raw_flag) |
| 1738 | return; |
| 1739 | |
| 1740 | params=(UINT16 *)get_dssi_ptr(space,ds,si); |
| 1741 | |
| 1742 | for(count=0; count<10; count++) |
| 1743 | logerror("%04X ",params[count]); |
| 1744 | |
| 1745 | logerror("\n"); |
| 1746 | } |
| 1747 | |
| 1748 | |
| 1749 | static void decode_dssi_f_fill_area(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) |
| 1750 | { |
| 1709 | 1751 | address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1710 | 1752 | |
| 1711 | 1753 | UINT16 *addr_ptr; |
| r9973 | r9974 | |
| 1715 | 1757 | |
| 1716 | 1758 | area_params = (t_area_params *)get_dssi_ptr(space,ds,si); |
| 1717 | 1759 | |
| 1718 | | OUTPUT_SEGOFS("SegBrush:OfsBrush",area_params->seg_brush,area_params->ofs_brush); |
| 1719 | | brush=(t_nimbus_brush *)space->get_read_ptr(LINEAR_ADDR(area_params->seg_brush,area_params->ofs_brush)); |
| 1760 | if (!raw_flag) |
| 1761 | OUTPUT_SEGOFS("SegBrush:OfsBrush",area_params->seg_brush,area_params->ofs_brush); |
| 1762 | |
| 1763 | brush=(t_nimbus_brush *)space->get_read_ptr(LINEAR_ADDR(area_params->seg_brush,area_params->ofs_brush)); |
| 1720 | 1764 | |
| 1721 | | logerror("Brush params\n"); |
| 1722 | | logerror("Style=%04X, StyleIndex=%04X\n",brush->style,brush->style_index); |
| 1723 | | logerror("Colour1=%04X, Colour2=%04X\n",brush->colour1,brush->colour2); |
| 1724 | | logerror("transparency=%04X, boundry_spec=%04X\n",brush->transparency,brush->boundary_spec); |
| 1725 | | logerror("boundry colour=%04X, save colour=%04X\n",brush->boundary_colour,brush->save_colour); |
| 1765 | if(raw_flag) |
| 1766 | { |
| 1767 | logerror("\tdw\t%04X, %04X, %04X, %04X, %04X, %04X, %04X, %04X, %04X, ", |
| 1768 | brush->style,brush->style_index,brush->colour1,brush->colour2, |
| 1769 | brush->transparency,brush->boundary_spec,brush->boundary_colour,brush->save_colour, |
| 1770 | area_params->count); |
| 1771 | } |
| 1772 | else |
| 1773 | { |
| 1774 | logerror("Brush params\n"); |
| 1775 | logerror("Style=%04X, StyleIndex=%04X\n",brush->style,brush->style_index); |
| 1776 | logerror("Colour1=%04X, Colour2=%04X\n",brush->colour1,brush->colour2); |
| 1777 | logerror("transparency=%04X, boundry_spec=%04X\n",brush->transparency,brush->boundary_spec); |
| 1778 | logerror("boundry colour=%04X, save colour=%04X\n",brush->boundary_colour,brush->save_colour); |
| 1726 | 1779 | |
| 1727 | 1780 | |
| 1728 | | OUTPUT_SEGOFS("SegData:OfsData",area_params->seg_data,area_params->ofs_data); |
| 1729 | | |
| 1781 | OUTPUT_SEGOFS("SegData:OfsData",area_params->seg_data,area_params->ofs_data); |
| 1782 | } |
| 1783 | |
| 1730 | 1784 | addr_ptr = (UINT16 *)space->get_read_ptr(LINEAR_ADDR(area_params->seg_data,area_params->ofs_data)); |
| 1731 | 1785 | for(cocount=0; cocount < area_params->count; cocount++) |
| 1732 | 1786 | { |
| 1733 | | logerror("x=%d y=%d\n",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); |
| 1787 | if(raw_flag) |
| 1788 | { |
| 1789 | if(cocount!=(area_params->count-1)) |
| 1790 | logerror("%04X, %04X, ",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); |
| 1791 | else |
| 1792 | logerror("%04X, %04X ",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); |
| 1793 | } |
| 1794 | else |
| 1795 | logerror("x=%d y=%d\n",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]); |
| 1734 | 1796 | } |
| 1797 | |
| 1798 | if(raw_flag) |
| 1799 | logerror("\n"); |
| 1735 | 1800 | } |
| 1736 | 1801 | |
| 1737 | | static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si) |
| 1802 | static void decode_dssi_f_plot_character_string(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) |
| 1738 | 1803 | { |
| 1739 | 1804 | address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1740 | 1805 | |
| 1741 | | UINT8 *char_ptr; |
| 1742 | | t_plot_string_params *plot_string_params; |
| 1743 | | int charno; |
| 1806 | UINT8 *char_ptr; |
| 1807 | t_plot_string_params *plot_string_params; |
| 1808 | int charno; |
| 1744 | 1809 | |
| 1810 | if(raw_flag) |
| 1811 | return; |
| 1812 | |
| 1745 | 1813 | plot_string_params=(t_plot_string_params *)get_dssi_ptr(space,ds,si); |
| 1746 | 1814 | |
| 1747 | 1815 | OUTPUT_SEGOFS("SegFont:OfsFont",plot_string_params->seg_font,plot_string_params->ofs_font); |
| r9973 | r9974 | |
| 1760 | 1828 | logerror("\n"); |
| 1761 | 1829 | } |
| 1762 | 1830 | |
| 1763 | | static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si) |
| 1831 | static void decode_dssi_f_set_new_clt(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) |
| 1764 | 1832 | { |
| 1765 | 1833 | address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1766 | 1834 | UINT16 *new_colours; |
| 1767 | 1835 | int colour; |
| 1768 | 1836 | new_colours=(UINT16 *)get_dssi_ptr(space,ds,si); |
| 1769 | 1837 | |
| 1838 | if(raw_flag) |
| 1839 | return; |
| 1840 | |
| 1770 | 1841 | OUTPUT_SEGOFS("SegColours:OfsColours",ds,si); |
| 1771 | 1842 | |
| 1772 | 1843 | for(colour=0;colour<16;colour++) |
| r9973 | r9974 | |
| 1774 | 1845 | |
| 1775 | 1846 | } |
| 1776 | 1847 | |
| 1777 | | static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si) |
| 1848 | static void decode_dssi_f_plonk_char(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) |
| 1778 | 1849 | { |
| 1779 | 1850 | address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1780 | 1851 | UINT16 *params; |
| 1781 | 1852 | params=(UINT16 *)get_dssi_ptr(space,ds,si); |
| 1782 | 1853 | |
| 1854 | if(raw_flag) |
| 1855 | return; |
| 1856 | |
| 1783 | 1857 | OUTPUT_SEGOFS("SegParams:OfsParams",ds,si); |
| 1784 | 1858 | |
| 1785 | 1859 | logerror("plonked_char=%c\n",params[0]); |
| 1786 | 1860 | } |
| 1787 | 1861 | |
| 1788 | | static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si) |
| 1862 | static void decode_dssi_f_rw_sectors(device_t *device,UINT16 ds, UINT16 si, UINT8 raw_flag) |
| 1789 | 1863 | { |
| 1790 | 1864 | address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM); |
| 1791 | 1865 | UINT16 *params; |
| 1792 | 1866 | int param_no; |
| 1793 | 1867 | |
| 1868 | if(raw_flag) |
| 1869 | return; |
| 1870 | |
| 1794 | 1871 | params=(UINT16 *)get_dssi_ptr(space,ds,si); |
| 1795 | 1872 | |
| 1796 | 1873 | for(param_no=0;param_no<16;param_no++) |