Previous 15994 Revisions Next

r2649 Sunday 18th May, 2008 at 09:42:24 UTC by Barry Rodewald
[X68000] Moved HD controller to new file, converted to new device system.
[src/mess]mess.mak
[src/mess/drivers]x68k.c
[src/mess/machine]x68k_hdc.c* x68k_hdc.h*

src/mess/machine/x68k_hdc.c
r0r2649
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 
20DEVICE_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 
30WRITE16_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 
36READ16_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 
54DEVICE_SET_INFO( x68k_hdc )
55{
56   switch (state)
57   {
58      /* no parameters to set */
59   }
60}
61 
62DEVICE_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/machine/x68k_hdc.h
r0r2649
1/*
2 
3   X68000 Custom SASI HD controller
4 
5*/
6 
7#include "driver.h"
8 
9enum
10{
11   SASI_PHASE_BUSFREE = 0,
12   SASI_PHASE_ARBITRATION,
13   SASI_PHASE_SELECTION,
14   SASI_PHASE_RESELECTION,
15   SASI_PHASE_COMMAND,
16   SASI_PHASE_DATA,
17   SASI_PHASE_STATUS,
18   SASI_PHASE_MESSAGE
19};
20 
21typedef struct _sasi_ctrl_t sasi_ctrl_t;
22struct _sasi_ctrl_t
23{
24   int phase;
25   unsigned char status_port;  // read at 0xe96003
26   unsigned char status;       // status phase output
27   unsigned char message;
28   unsigned char command[10];
29};
30 
31DEVICE_START( x68k_hdc );
32DEVICE_GET_INFO( x68k_hdc );
33 
34#define X68KHDC DEVICE_GET_INFO_NAME(x68k_hdc)
35 
36WRITE16_DEVICE_HANDLER( x68k_hdc_w );
37READ16_DEVICE_HANDLER( x68k_hdc_r );
src/mess/mess.mak
r2648r2649
981981   $(MESS_VIDEO)/x68k.o   \
982982   $(MESS_MACHINE)/hd63450.o   \
983983   $(MESS_MACHINE)/rp5c15.o   \
984   $(MESS_MACHINE)/x68k_hdc.o   \
984985
985986$(MESSOBJ)/hp48.a:     \
986987   $(MESS_MACHINE)/hp48.o     \
src/mess/drivers/x68k.c
r2648r2649
8686
8787    HDC/HDD : SASI and SCSI are not implemented, not a requirement at this point.
8888
89    RTC : Seems to work. (Tested using SX-Windows' Timer application)
89    RTC : Seems to work. (Tested using SX-Window's Timer application)
9090
9191    DMA : FDD reading mostly works, other channels should work for effective memory copying (channel 2, often
9292          used to copy data to video RAM or the palette in the background).
r2648r2649
9696    SCC : Works enough to get the mouse running
9797
9898    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.
100100            BG tiles and sprites work, but many games have the sprites offset by a small amount (some by a lot :))
101101
102102    Other issues:
103103      Bus error exceptions are a bit late at times.  Currently using a fake bus error for MIDI expansion checks.  These
104104      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).
107106      Supervisor area set isn't implemented.
108107
109    Some minor game-specific issues (at 19/06/07):
108    Some minor game-specific issues (at 14/05/08):
110109      Pacmania:      Black squares on the maze (transparency?).
111110      Nemesis '94:   Menu system doesn't work except for start buttons.
112111      Flying Shark:  Appears to lock up at main menu.
r2648r2649
115114      Dragon Buster: Text is black and unreadable (text palette should be loaded from disk, but it reads all zeroes).
116115      Baraduke:      Corrupt background, locks up on demo mode.
117116      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.
119117      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.
121119
122120
123121    More detailed documentation at http://x68kdev.emuvibes.com/iomap.html - if you can stand broken english :)
r2648r2649
137135#include "machine/hd63450.h"
138136#include "machine/rp5c15.h"
139137#include "devices/basicdsk.h"
138#include "devices/harddriv.h"
139#include "machine/x68k_hdc.h"
140140#include "includes/x68k.h"
141141
142//#define ENABLE_SASI
143
142144struct x68k_system sys;
143145
144146extern UINT16* gvram;  // Graphic VRAM
r2648r2649
674676}
675677#endif
676678
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*/
677687static WRITE8_HANDLER( ppi_port_c_w )
678688{
679689   // ADPCM / Joystick control
r2648r2649
800810   sys.fdc.drq_state = state;
801811}
802812
803static 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
809static 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
821813static WRITE16_HANDLER( x68k_fm_w )
822814{
823815   switch(offset)
r2648r2649
849841   nec765_set_ready_state(data & 0x01);
850842}
851843
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*/
853860static WRITE16_HANDLER( x68k_ioc_w )
854861{
855862   switch(offset)
r2648r2649
894901   }
895902}
896903
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*/
897924static WRITE16_HANDLER( x68k_sysport_w )
898925{
899926   render_container* container;
r2648r2649
11881215static READ16_HANDLER( x68k_sram_r )
11891216{
11901217   // HACKS!
1218#ifndef ENABLE_SASI
11911219   if(offset == 0x5a/2)  // 0x5a should be 0 if no SASI HDs are present.
11921220      return 0x0000;
1221#endif
11931222   if(offset == 0x08/2)
11941223      return mess_ram_size >> 16;  // RAM size
11951224   /*if(offset == 0x46/2)
r2648r2649
15271556   AM_RANGE(0xe90000, 0xe91fff) AM_READWRITE(x68k_fm_r, x68k_fm_w)
15281557   AM_RANGE(0xe92000, 0xe93fff) AM_READWRITE(x68k_adpcm_r, x68k_adpcm_w)
15291558   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)
15311560   AM_RANGE(0xe98000, 0xe99fff) AM_READWRITE(x68k_scc_r, x68k_scc_w)
15321561   AM_RANGE(0xe9a000, 0xe9bfff) AM_DEVREADWRITE(PPI8255, "ppi8255", x68k_ppi_r, x68k_ppi_w)
15331562   AM_RANGE(0xe9c000, 0xe9dfff) AM_READWRITE(x68k_ioc_r, x68k_ioc_w)
r2648r2649
18811910   }
18821911}
18831912
1913static 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
18841935static MACHINE_RESET( x68000 )
18851936{
18861937   /* The last half of the IPLROM is mapped to 0x000000 on reset only
r2648r2649
20252076   MDRV_DEVICE_ADD( "hd63450", HD63450 )
20262077   MDRV_DEVICE_CONFIG( dmac_interface )
20272078
2079   MDRV_DEVICE_ADD( "x68k_hdc", X68KHDC )
2080
20282081    /* video hardware */
20292082   MDRV_SCREEN_ADD("main", RASTER)
20302083   MDRV_SCREEN_REFRESH_RATE(55.45)
r2648r2649
20542107
20552108SYSTEM_CONFIG_START(x68000)
20562109   CONFIG_DEVICE(x68k_floppy_getinfo)
2110   CONFIG_DEVICE(x68k_sasihd_getinfo)
20572111   CONFIG_RAM(0x100000)
20582112   CONFIG_RAM(0x200000)
20592113   CONFIG_RAM(0x300000)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team