src/mess/machine/x68k_hdc.c
| r0 | r2649 | |
| 1 | /*
|
| 2 | |
| 3 | X68000 custom SASI Hard Disk controller
|
| 4 | |
| 5 | 0xe96001 (R/W) - SASI data I/O
|
| 6 | 0xe96003 (W) - SEL signal high (0)
|
| 7 | 0xe96003 (R) - SASI status
|
| 8 | - bit 4 = MSG - if 1, content of data line is a message
|
| 9 | - bit 3 = Command / Data - if 1, content of data line is a command or status, otherwise it is data.
|
| 10 | - bit 2 = I/O - if 0, Host -> Controller (Output), otherwise Controller -> Host (Input).
|
| 11 | - bit 1 = BSY - if 1, HD is busy.
|
| 12 | - bit 0 = REQ - if 1, host is demanding data transfer to the host.
|
| 13 | 0xe96005 (W/O) - data is arbitrary (?)
|
| 14 | 0xe96007 (W/O) - SEL signal low (1)
|
| 15 | |
| 16 | */
|
| 17 | |
| 18 | #include "x68k_hdc.h"
|
| 19 | |
| 20 | DEVICE_START( x68k_hdc )
|
| 21 | {
|
| 22 | sasi_ctrl_t* sasi = device->token;
|
| 23 | |
| 24 | assert(device->machine != NULL);
|
| 25 | |
| 26 | sasi->status = 0x00;
|
| 27 | sasi->phase = SASI_PHASE_BUSFREE;
|
| 28 | }
|
| 29 | |
| 30 | WRITE16_DEVICE_HANDLER( x68k_hdc_w )
|
| 31 | {
|
| 32 | // SASI HDC - HDDs are not a required system component, so this is something to be done later
|
| 33 | logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data);
|
| 34 | }
|
| 35 | |
| 36 | READ16_DEVICE_HANDLER( x68k_hdc_r )
|
| 37 | {
|
| 38 | logerror("SASI: [%08x] read from HDC, offset %04x\n",activecpu_get_pc(),offset);
|
| 39 | switch(offset)
|
| 40 | {
|
| 41 | case 0x00:
|
| 42 | return 0x00;
|
| 43 | case 0x01:
|
| 44 | return 0x00;
|
| 45 | case 0x02:
|
| 46 | return 0x00;
|
| 47 | case 0x03:
|
| 48 | return 0x00;
|
| 49 | default:
|
| 50 | return 0xff;
|
| 51 | }
|
| 52 | }
|
| 53 | |
| 54 | DEVICE_SET_INFO( x68k_hdc )
|
| 55 | {
|
| 56 | switch (state)
|
| 57 | {
|
| 58 | /* no parameters to set */
|
| 59 | }
|
| 60 | }
|
| 61 | |
| 62 | DEVICE_GET_INFO(x68k_hdc)
|
| 63 | {
|
| 64 | switch (state)
|
| 65 | {
|
| 66 | /* --- the following bits of info are returned as 64-bit signed integers --- */
|
| 67 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_OTHER; break;
|
| 68 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sasi_ctrl_t); break;
|
| 69 | |
| 70 | /* --- the following bits of info are returned as pointers to data or functions --- */
|
| 71 | case DEVINFO_FCT_SET_INFO: info->set_info = DEVICE_SET_INFO_NAME(x68k_hdc); break;
|
| 72 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(x68k_hdc); break;
|
| 73 | case DEVINFO_FCT_STOP: /* Nothing */ break;
|
| 74 | case DEVINFO_FCT_RESET: /*info->reset = DEVICE_RESET_NAME(x68k_hdc);*/ break;
|
| 75 | |
| 76 | /* --- the following bits of info are returned as NULL-terminated strings --- */
|
| 77 | case DEVINFO_STR_NAME: info->s = "X68000 SASI Hard Disk Controller"; break;
|
| 78 | case DEVINFO_STR_FAMILY: info->s = "SASI Hard Disk Controller"; break;
|
| 79 | case DEVINFO_STR_VERSION: info->s = "1.0"; break;
|
| 80 | case DEVINFO_STR_SOURCE_FILE: info->s = __FILE__; break;
|
| 81 | case DEVINFO_STR_CREDITS: info->s = "Copyright the MESS Team"; break;
|
| 82 | }
|
| 83 | }
|
| 84 | |
src/mess/drivers/x68k.c
| r2648 | r2649 | |
| 86 | 86 | |
| 87 | 87 | HDC/HDD : SASI and SCSI are not implemented, not a requirement at this point. |
| 88 | 88 | |
| 89 | | RTC : Seems to work. (Tested using SX-Windows' Timer application) |
| 89 | RTC : Seems to work. (Tested using SX-Window's Timer application) |
| 90 | 90 | |
| 91 | 91 | DMA : FDD reading mostly works, other channels should work for effective memory copying (channel 2, often |
| 92 | 92 | used to copy data to video RAM or the palette in the background). |
| r2648 | r2649 | |
| 96 | 96 | SCC : Works enough to get the mouse running |
| 97 | 97 | |
| 98 | 98 | Video : Text mode works, but is rather slow, especially scrolling up (uses multple "raster copy" commands). |
| 99 | | 16 and 256 graphic layers work, but colours on a 65,536 colour layer are wrong. |
| 99 | Graphic layers work. |
| 100 | 100 | BG tiles and sprites work, but many games have the sprites offset by a small amount (some by a lot :)) |
| 101 | 101 | |
| 102 | 102 | Other issues: |
| 103 | 103 | Bus error exceptions are a bit late at times. Currently using a fake bus error for MIDI expansion checks. These |
| 104 | 104 | are used determine if a piece of expansion hardware is present. |
| 105 | | Partial updates don't work at all well, and can be excruciatingly slow. |
| 106 | | Keyboard doesn't work well for games. |
| 105 | Keyboard doesn't work (MFP USART). |
| 107 | 106 | Supervisor area set isn't implemented. |
| 108 | 107 | |
| 109 | | Some minor game-specific issues (at 19/06/07): |
| 108 | Some minor game-specific issues (at 14/05/08): |
| 110 | 109 | Pacmania: Black squares on the maze (transparency?). |
| 111 | 110 | Nemesis '94: Menu system doesn't work except for start buttons. |
| 112 | 111 | Flying Shark: Appears to lock up at main menu. |
| r2648 | r2649 | |
| 115 | 114 | Dragon Buster: Text is black and unreadable (text palette should be loaded from disk, but it reads all zeroes). |
| 116 | 115 | Baraduke: Corrupt background, locks up on demo mode. |
| 117 | 116 | Viewpoint: Corrupt graphics on title screen, phantom movements on title screen, corrupt sprites, locks up. |
| 118 | | Mr. Do: Locks up or resets after some time. Happens on Mr Do vs. Unicorns, as well. |
| 119 | 117 | Tetris: Black dots over screen (text layer). |
| 120 | | Parodius Da!: Water isn't animated (beginning of stage 1), black squares (raster effects?) |
| 118 | Parodius Da!: Black squares in areas. |
| 121 | 119 | |
| 122 | 120 | |
| 123 | 121 | More detailed documentation at http://x68kdev.emuvibes.com/iomap.html - if you can stand broken english :) |
| r2648 | r2649 | |
| 137 | 135 | #include "machine/hd63450.h" |
| 138 | 136 | #include "machine/rp5c15.h" |
| 139 | 137 | #include "devices/basicdsk.h" |
| 138 | #include "devices/harddriv.h" |
| 139 | #include "machine/x68k_hdc.h" |
| 140 | 140 | #include "includes/x68k.h" |
| 141 | 141 | |
| 142 | //#define ENABLE_SASI |
| 143 | |
| 142 | 144 | struct x68k_system sys; |
| 143 | 145 | |
| 144 | 146 | extern UINT16* gvram; // Graphic VRAM |
| r2648 | r2649 | |
| 674 | 676 | } |
| 675 | 677 | #endif |
| 676 | 678 | |
| 679 | /* PPI port C (Joystick control, R/W) |
| 680 | bit 7 - IOC7 - Function B operation of joystick 1 (?) |
| 681 | bit 6 - IOC6 - Function A operation of joystick 1 (?) |
| 682 | bit 5 - IOC5 - Enable Joystick 2 |
| 683 | bit 4 - IOC4 - Enable Joystick 1 |
| 684 | bits 3,2 - ADPCM Sample rate |
| 685 | bits 1,0 - ADPCM Pan |
| 686 | */ |
| 677 | 687 | static WRITE8_HANDLER( ppi_port_c_w ) |
| 678 | 688 | { |
| 679 | 689 | // ADPCM / Joystick control |
| r2648 | r2649 | |
| 800 | 810 | sys.fdc.drq_state = state; |
| 801 | 811 | } |
| 802 | 812 | |
| 803 | | static WRITE16_HANDLER( x68k_hdc_w ) |
| 804 | | { |
| 805 | | // SASI HDC - HDDs are not a required system component, so this is something to be done later |
| 806 | | logerror("SASI: write to HDC, offset %04x, data %04x\n",offset,data); |
| 807 | | } |
| 808 | | |
| 809 | | static READ16_HANDLER( x68k_hdc_r ) |
| 810 | | { |
| 811 | | logerror("SASI: [%08x] read from HDC, offset %04x\n",activecpu_get_pc(),offset); |
| 812 | | switch(offset) |
| 813 | | { |
| 814 | | case 0x01: |
| 815 | | return 0x00; |
| 816 | | default: |
| 817 | | return 0xff; |
| 818 | | } |
| 819 | | } |
| 820 | | |
| 821 | 813 | static WRITE16_HANDLER( x68k_fm_w ) |
| 822 | 814 | { |
| 823 | 815 | switch(offset) |
| r2648 | r2649 | |
| 849 | 841 | nec765_set_ready_state(data & 0x01); |
| 850 | 842 | } |
| 851 | 843 | |
| 852 | | |
| 844 | /* |
| 845 | Custom I/O controller at 0xe9c000 |
| 846 | 0xe9c001 (R) - Interrupt status |
| 847 | 0xe9c001 (W) - Interrupt mask (low nibble only) |
| 848 | - bit 7 = FDC interrupt |
| 849 | - bit 6 = FDD interrupt |
| 850 | - bit 5 = Printer Busy signal |
| 851 | - bit 4 = HDD interrupt |
| 852 | - bit 3 = HDD interrupts enabled |
| 853 | - bit 2 = FDC interrupts enabled |
| 854 | - bit 1 = FDD interrupts enabled |
| 855 | - bit 0 = Printer interrupts enabled |
| 856 | 0xe9c003 (W) - Interrupt vector |
| 857 | - bits 7-2 = vector |
| 858 | - bits 1,0 = device (00 = FDC, 01 = FDD, 10 = HDD, 11 = Printer) |
| 859 | */ |
| 853 | 860 | static WRITE16_HANDLER( x68k_ioc_w ) |
| 854 | 861 | { |
| 855 | 862 | switch(offset) |
| r2648 | r2649 | |
| 894 | 901 | } |
| 895 | 902 | } |
| 896 | 903 | |
| 904 | /* |
| 905 | System ports at 0xe8e000 |
| 906 | Port 1 (0xe8e001) - Monitor contrast (bits 3-0) |
| 907 | Port 2 (0xe8e003) - Display / 3D scope control |
| 908 | - bit 3 - Display control signal (0 = on) |
| 909 | - bit 1 - 3D scope left shutter (0 = closed) |
| 910 | - bit 0 - 3D scope right shutter |
| 911 | Port 3 (0xe8e005) - Colour image unit control (bits 3-0) |
| 912 | Port 4 (0xe8e007) - Keyboard/NMI/Dot clock |
| 913 | - bit 3 - (R) 1 = Keyboard connected, (W) 1 = Key data can be transmitted |
| 914 | - bit 1 - NMI Reset |
| 915 | - bit 0 - HRL - high resolution dot clock - 1 = 1/2, 1/4, 1/8, 0 = 1/2, 1/3, 1/6 (normal) |
| 916 | Port 5 (0xe8e009) - ROM (bits 7-4)/DRAM (bits 3-0) wait, X68030 only |
| 917 | Port 6 (0xe8e00b) - CPU type and clock speed (XVI or later only, X68000 returns 0xFF) |
| 918 | - bits 7-4 - CPU Type (1100 = 68040, 1101 = 68030, 1110 = 68020, 1111 = 68000) |
| 919 | - bits 3-0 - clock speed (1001 = 50MHz, 40, 33, 25, 20, 16, 1111 = 10MHz) |
| 920 | Port 7 (0xe8e00d) - SRAM write enable - if 0x31 is written to this port, writing to SRAM is allowed. |
| 921 | Any other value, then SRAM is read only. |
| 922 | Port 8 (0xe8e00f) - Power off control - write 0x00, 0x0f, 0x0f sequentially to switch power off. |
| 923 | */ |
| 897 | 924 | static WRITE16_HANDLER( x68k_sysport_w ) |
| 898 | 925 | { |
| 899 | 926 | render_container* container; |
| r2648 | r2649 | |
| 1188 | 1215 | static READ16_HANDLER( x68k_sram_r ) |
| 1189 | 1216 | { |
| 1190 | 1217 | // HACKS! |
| 1218 | #ifndef ENABLE_SASI |
| 1191 | 1219 | if(offset == 0x5a/2) // 0x5a should be 0 if no SASI HDs are present. |
| 1192 | 1220 | return 0x0000; |
| 1221 | #endif |
| 1193 | 1222 | if(offset == 0x08/2) |
| 1194 | 1223 | return mess_ram_size >> 16; // RAM size |
| 1195 | 1224 | /*if(offset == 0x46/2) |
| r2648 | r2649 | |
| 1527 | 1556 | AM_RANGE(0xe90000, 0xe91fff) AM_READWRITE(x68k_fm_r, x68k_fm_w) |
| 1528 | 1557 | AM_RANGE(0xe92000, 0xe93fff) AM_READWRITE(x68k_adpcm_r, x68k_adpcm_w) |
| 1529 | 1558 | AM_RANGE(0xe94000, 0xe95fff) AM_READWRITE(x68k_fdc_r, x68k_fdc_w) |
| 1530 | | AM_RANGE(0xe96000, 0xe97fff) AM_READWRITE(x68k_hdc_r, x68k_hdc_w) |
| 1559 | AM_RANGE(0xe96000, 0xe97fff) AM_DEVREADWRITE(X68KHDC,"x68k_hdc",x68k_hdc_r, x68k_hdc_w) |
| 1531 | 1560 | AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w) |
| 1532 | 1561 | AM_RANGE(0xe9a000, 0xe9bfff) AM_DEVREADWRITE(PPI8255, "ppi8255", x68k_ppi_r, x68k_ppi_w) |
| 1533 | 1562 | AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w) |
| r2648 | r2649 | |
| 1881 | 1910 | } |
| 1882 | 1911 | } |
| 1883 | 1912 | |
| 1913 | static void x68k_sasihd_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info) |
| 1914 | { |
| 1915 | switch(state) |
| 1916 | { |
| 1917 | case MESS_DEVINFO_INT_COUNT: |
| 1918 | info->i = 1; |
| 1919 | break; |
| 1920 | case MESS_DEVINFO_STR_NAME: |
| 1921 | strcpy(info->s = device_temp_str(), "sasihd"); |
| 1922 | break; |
| 1923 | case MESS_DEVINFO_STR_SHORT_NAME: |
| 1924 | strcpy(info->s = device_temp_str(), "sasi"); |
| 1925 | break; |
| 1926 | case MESS_DEVINFO_STR_DESCRIPTION: |
| 1927 | strcpy(info->s = device_temp_str(), "SASI Hard Disk"); |
| 1928 | break; |
| 1929 | default: |
| 1930 | harddisk_device_getinfo(devclass, state, info); |
| 1931 | break; |
| 1932 | } |
| 1933 | } |
| 1934 | |
| 1884 | 1935 | static MACHINE_RESET( x68000 ) |
| 1885 | 1936 | { |
| 1886 | 1937 | /* The last half of the IPLROM is mapped to 0x000000 on reset only |
| r2648 | r2649 | |
| 2025 | 2076 | MDRV_DEVICE_ADD( "hd63450", HD63450 ) |
| 2026 | 2077 | MDRV_DEVICE_CONFIG( dmac_interface ) |
| 2027 | 2078 | |
| 2079 | MDRV_DEVICE_ADD( "x68k_hdc", X68KHDC ) |
| 2080 | |
| 2028 | 2081 | /* video hardware */ |
| 2029 | 2082 | MDRV_SCREEN_ADD("main", RASTER) |
| 2030 | 2083 | MDRV_SCREEN_REFRESH_RATE(55.45) |
| r2648 | r2649 | |
| 2054 | 2107 | |
| 2055 | 2108 | SYSTEM_CONFIG_START(x68000) |
| 2056 | 2109 | CONFIG_DEVICE(x68k_floppy_getinfo) |
| 2110 | CONFIG_DEVICE(x68k_sasihd_getinfo) |
| 2057 | 2111 | CONFIG_RAM(0x100000) |
| 2058 | 2112 | CONFIG_RAM(0x200000) |
| 2059 | 2113 | CONFIG_RAM(0x300000) |