From a1708a30b35a7c50ede8412378e14300ba7183e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20DEL=20NERO?= Date: Sat, 5 Dec 2015 16:16:24 +0100 Subject: [PATCH 1/5] Keyboard support added ! --- src/mame/drivers/squale.cpp | 264 +++++++++++++++++++++++++++++++++++- 1 file changed, 260 insertions(+), 4 deletions(-) diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index b9484a20bea..5e4c4b0f6d3 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -79,10 +79,27 @@ public: { } DECLARE_WRITE8_MEMBER(ctrl_w); + DECLARE_READ8_MEMBER(pia_u72_porta_r); + DECLARE_READ8_MEMBER(pia_u72_portb_r); + DECLARE_READ8_MEMBER(pia_u75_porta_r); + DECLARE_READ8_MEMBER(pia_u75_portb_r); + DECLARE_WRITE8_MEMBER(pia_u72_porta_w); + DECLARE_WRITE8_MEMBER(pia_u72_portb_w); + DECLARE_WRITE8_MEMBER(pia_u75_porta_w); + DECLARE_WRITE8_MEMBER(pia_u75_portb_w); + + DECLARE_READ8_MEMBER(ay_porta_r); + DECLARE_READ8_MEMBER(ay_portb_r); + DECLARE_WRITE8_MEMBER(ay_porta_w); + DECLARE_WRITE8_MEMBER(ay_portb_w); + DECLARE_WRITE_LINE_MEMBER(pia_u75_ca2_w); + DECLARE_WRITE_LINE_MEMBER(pia_u75_cb2_w); virtual void machine_start(); virtual void machine_reset(); + UINT8 keyboard_line; + TIMER_DEVICE_CALLBACK_MEMBER(squale_scanline); private: @@ -109,6 +126,149 @@ WRITE8_MEMBER( squale_state::ctrl_w ) m_ef9365->static_set_color_filler(data & 0xF); } +READ8_MEMBER( squale_state::pia_u72_porta_r ) +{ + UINT8 data = 0xFF; + + #ifdef DBGMODE + printf("%s: read pia_u72_porta_r\n",machine().describe_context()); + #endif + + return data; +} + +READ8_MEMBER( squale_state::pia_u75_porta_r ) +{ + UINT8 data = 0xAA; + #ifdef DBGMODE + printf("%s: read pia_u75_porta_r\n",machine().describe_context()); + #endif + data = keyboard_line; + return data; +} + +READ8_MEMBER( squale_state::pia_u72_portb_r ) +{ + UINT8 data = 0xFF; + #ifdef DBGMODE + printf("%s: read pia_u72_portb_r\n",machine().describe_context()); + #endif + return data; +} + +READ8_MEMBER( squale_state::pia_u75_portb_r ) +{ + char kbdrow[6]; + UINT8 data = 0xFF; + + for (int i = 0; i < 8; i++) + { + sprintf(kbdrow,"X%X",i); + + for( int j = 0; j < 8 ; j++) + { + if( !(keyboard_line & (0x01<read() & (0x01<read(); + + #ifdef DBGMODE + printf("%s: read ay_portb_r : 0x%.2X\n",machine().describe_context(),data); + #endif + + return data; +} + +WRITE_LINE_MEMBER(squale_state::pia_u75_ca2_w) +{ + #ifdef DBGMODE + printf("%s: U75 PIA Port CA2 Set to %2x\n", machine().describe_context(),state); + #endif +} + +WRITE_LINE_MEMBER(squale_state::pia_u75_cb2_w) +{ + #ifdef DBGMODE + printf("%s: U75 PIA Port CB2 Set to %2x\n", machine().describe_context(),state); + #endif +} + TIMER_DEVICE_CALLBACK_MEMBER( squale_state::squale_scanline ) { m_ef9365->update_scanline((UINT16)param); @@ -119,8 +279,8 @@ static ADDRESS_MAP_START(squale_mem, AS_PROGRAM, 8, squale_state) AM_RANGE(0x0000,0xefff) AM_RAM AM_RANGE(0xf000,0xf00f) AM_DEVREADWRITE("ef9365", ef9365_device, data_r, data_w) AM_RANGE(0xf010,0xf01f) AM_WRITE( ctrl_w ) - AM_RANGE(0xf044,0xf047) AM_DEVREADWRITE("pia_u75", pia6821_device, read_alt, write_alt) - AM_RANGE(0xf048,0xf04b) AM_DEVREADWRITE("pia_u72", pia6821_device, read_alt, write_alt) + AM_RANGE(0xf044,0xf047) AM_DEVREADWRITE("pia_u75", pia6821_device, read, write) + AM_RANGE(0xf048,0xf04b) AM_DEVREADWRITE("pia_u72", pia6821_device, read, write) AM_RANGE(0xf050,0xf05f) AM_DEVREADWRITE("ef6850", acia6850_device, data_r, data_w) AM_RANGE(0xf060,0xf06f) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, address_data_w) AM_RANGE(0xf100,0xffff) AM_ROMBANK("rom_bank"); @@ -132,6 +292,90 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( squale ) + PORT_START("X0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) + + PORT_START("X1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BackS Delete") PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(8) PORT_CHAR(UCHAR_MAMEKEY(DEL)) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') + + PORT_START("X2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('-') + + PORT_START("X4") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('[') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(']') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("X5") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("BS") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + + PORT_START("X6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + + PORT_START("X7") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LF") PORT_CODE(KEYCODE_RALT) PORT_CHAR(10) + + PORT_START("ay_keys") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lck") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) INPUT_PORTS_END void squale_state::machine_start() @@ -166,16 +410,28 @@ static MACHINE_CONFIG_START( squale, squale_state ) /* Cartridge pia */ MCFG_DEVICE_ADD("pia_u72", PIA6821, 0) - // TODO : Add port I/O handler + MCFG_PIA_READPA_HANDLER(READ8(squale_state, pia_u72_porta_r)) + MCFG_PIA_READPB_HANDLER(READ8(squale_state, pia_u72_portb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(squale_state, pia_u72_porta_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(squale_state, pia_u72_portb_w)) /* Keyboard pia */ MCFG_DEVICE_ADD("pia_u75", PIA6821, 0) - // TODO : Add port I/O handler + MCFG_PIA_READPA_HANDLER(READ8(squale_state, pia_u75_porta_r)) + MCFG_PIA_READPB_HANDLER(READ8(squale_state, pia_u75_portb_r)) + MCFG_PIA_WRITEPA_HANDLER(WRITE8(squale_state, pia_u75_porta_w)) + MCFG_PIA_WRITEPB_HANDLER(WRITE8(squale_state, pia_u75_portb_w)) + MCFG_PIA_CA2_HANDLER(WRITELINE(squale_state, pia_u75_ca2_w)) + MCFG_PIA_CB2_HANDLER(WRITELINE(squale_state, pia_u75_cb2_w)) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ay8910", AY8910, AY_CLOCK) // TODO : Add port I/O handler + MCFG_AY8910_PORT_A_READ_CB(READ8(squale_state, ay_porta_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(squale_state, ay_portb_r)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(squale_state, ay_porta_w)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(squale_state, ay_portb_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MCFG_DEVICE_ADD ("ef6850", ACIA6850, 0) From 977ddba3b8cfebce0312fd6160203668cca40a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20DEL=20NERO?= Date: Sun, 6 Dec 2015 00:52:32 +0100 Subject: [PATCH 2/5] block drawing support added. --- src/devices/video/ef9365.cpp | 56 +++++++++++++++++++++++++++++------- src/devices/video/ef9365.h | 2 +- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp index 403638a1697..78660945391 100644 --- a/src/devices/video/ef9365.cpp +++ b/src/devices/video/ef9365.cpp @@ -181,44 +181,78 @@ void ef9365_device::draw_border(UINT16 line) } -void ef9365_device::draw_character( unsigned char c ) +void ef9365_device::draw_character( unsigned char c, int block, int smallblock ) { int x_char,y_char; int char_base,char_pix; unsigned int x, y, p; + int x_char_res,y_char_res; x = ( (m_registers[EF9365_REG_X_MSB]<<8) | m_registers[EF9365_REG_X_LSB]); y = ( (m_registers[EF9365_REG_Y_MSB]<<8) | m_registers[EF9365_REG_Y_LSB]); + x_char_res = 5; + y_char_res = 8; + + if( smallblock ) + { + block = 1; + x_char_res = 4; + y_char_res = 4; + } + if(c<96) { - y = ( 256 - y ) - 8; + y = ( 256 - y ) - y_char_res; - if( ( x < ( 256 - 5 ) ) && ( y < ( 256 - 8 ) ) ) + if( ( x < ( 256 - 5 ) ) && ( y < ( 256 - y_char_res ) ) ) { char_base = c * 5; // 5 bytes per char. char_pix = 0; - for(y_char=0;y_char<8;y_char++) + if ( block ) { - for(x_char=0;x_char<5;x_char++) + // 5x8 or 4x4 block + + for( y_char = 0 ; y_char < y_char_res ; y_char++ ) { - if ( m_charset->u8(char_base + (char_pix>>3) ) & ( 0x80 >> (char_pix&7))) + for( x_char = 0 ; x_char < x_char_res ; x_char++ ) { - for(p = 0 ; p < 4 ; p++) + for( p = 0 ; p < 4 ; p++ ) { if( m_current_color & (0x01 << p) ) m_videoram->write_byte ( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3), m_videoram->read_byte( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3)) | (0x80 >> ((((y_char+y)*256) + (x_char+x))&7) ) ); else m_videoram->write_byte ( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3), m_videoram->read_byte( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3)) & ~(0x80 >> ((((y_char+y)*256) + (x_char+x))&7) ) ); } + char_pix++; } + } + } + else + { + // 5x8 character + for( y_char=0 ; y_char < y_char_res ;y_char++ ) + { + for( x_char=0 ; x_char < x_char_res ; x_char++ ) + { + if ( m_charset->u8(char_base + (char_pix>>3) ) & ( 0x80 >> (char_pix&7))) + { + for( p = 0 ; p < 4 ; p++ ) + { + if( m_current_color & (0x01 << p) ) + m_videoram->write_byte ( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3), m_videoram->read_byte( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3)) | (0x80 >> ((((y_char+y)*256) + (x_char+x))&7) ) ); + else + m_videoram->write_byte ( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3), m_videoram->read_byte( (0x2000*p) + ((((y_char+y)*256) + (x_char+x))>>3)) & ~(0x80 >> ((((y_char+y)*256) + (x_char+x))&7) ) ); + } + } - char_pix++; + char_pix++; + } } } - x = x + 6; + x = x + ( x_char_res + 1 ); m_registers[EF9365_REG_X_MSB] = x >> 8; m_registers[EF9365_REG_X_LSB] = x & 0xFF; @@ -342,11 +376,13 @@ void ef9365_device::ef9365_exec(UINT8 cmd) #ifdef DBGMODE printf("5x8 block drawing (size according to CSIZE)\n"); #endif + draw_character( 0x00 , 1 , 0 ); break; case 0xB: // 4x4 block drawing (size according to CSIZE) #ifdef DBGMODE printf("4x4 block drawing (size according to CSIZE)\n"); #endif + draw_character( 0x00 , 1 , 1 ); break; case 0xC: // Screen scanning : pen or Eraser as defined by CTRL1 #ifdef DBGMODE @@ -411,7 +447,7 @@ void ef9365_device::ef9365_exec(UINT8 cmd) #ifdef DBGMODE printf("Draw character\n"); #endif - draw_character( cmd - 0x20 ); + draw_character( cmd - 0x20, 0 , 0 ); } } } diff --git a/src/devices/video/ef9365.h b/src/devices/video/ef9365.h index fde027e22c3..567a70d175f 100644 --- a/src/devices/video/ef9365.h +++ b/src/devices/video/ef9365.h @@ -58,7 +58,7 @@ protected: // inline helper private: - void draw_character( unsigned char c ); + void draw_character( unsigned char c, int block, int smallblock ); void screen_scanning( int force_clear ); void set_busy_flag(int period); void set_video_mode(void); From 04adea430892e13ace2d03fbeb79a8431c7ec2e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20DEL=20NERO?= Date: Sun, 6 Dec 2015 10:49:34 +0100 Subject: [PATCH 3/5] WD1770 FDC support added (Work In Progress). --- src/mame/drivers/squale.cpp | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index 5e4c4b0f6d3..65ba12dda75 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -60,6 +60,8 @@ #include "machine/6821pia.h" #include "machine/6850acia.h" #include "sound/ay8910.h" +#include "machine/wd_fdc.h" +#include "softlist.h" #define MAIN_CLOCK XTAL_14MHz #define AY_CLOCK MAIN_CLOCK / 8 /* 1.75 Mhz */ @@ -76,9 +78,16 @@ public: , m_pia_u75(*this, "pia_u75") , m_ef9365(*this, "ef9365") , m_maincpu(*this, "maincpu") + , m_fdc(*this, "wd1770") + , m_floppy0(*this, "wd1770:0") + , m_floppy(NULL) { } DECLARE_WRITE8_MEMBER(ctrl_w); + DECLARE_WRITE8_MEMBER(fdc_sel0_w); + DECLARE_READ8_MEMBER(fdc_sel0_r); + DECLARE_WRITE8_MEMBER(fdc_sel1_w); + DECLARE_READ8_MEMBER(fdc_sel1_r); DECLARE_READ8_MEMBER(pia_u72_porta_r); DECLARE_READ8_MEMBER(pia_u72_portb_r); DECLARE_READ8_MEMBER(pia_u75_porta_r); @@ -99,6 +108,8 @@ public: virtual void machine_reset(); UINT8 keyboard_line; + UINT8 fdc_sel0; + UINT8 fdc_sel1; TIMER_DEVICE_CALLBACK_MEMBER(squale_scanline); @@ -109,6 +120,9 @@ private: required_device m_pia_u75; required_device m_ef9365; required_device m_maincpu; + required_device m_fdc; + required_device m_floppy0; + floppy_image_device *m_floppy; }; /************************* @@ -126,6 +140,46 @@ WRITE8_MEMBER( squale_state::ctrl_w ) m_ef9365->static_set_color_filler(data & 0xF); } +WRITE8_MEMBER( squale_state::fdc_sel0_w ) +{ + #ifdef DBGMODE + printf("write fdc_sel0_w reg : 0x%X\n",data); + #endif + + fdc_sel0 = data; +} + +WRITE8_MEMBER( squale_state::fdc_sel1_w ) +{ + #ifdef DBGMODE + printf("write fdc_sel1_w reg : 0x%X\n",data); + #endif + + fdc_sel1 = data; +} + +READ8_MEMBER( squale_state::fdc_sel0_r ) +{ + UINT8 data = 0xFF; + + #ifdef DBGMODE + printf("%s: read fdc_sel0_r\n",machine().describe_context()); + #endif + data = 0x00; + return data; +} + +READ8_MEMBER( squale_state::fdc_sel1_r ) +{ + UINT8 data = 0xFF; + + #ifdef DBGMODE + printf("%s: read fdc_sel1_r\n",machine().describe_context()); + #endif + data = 0x00; + return data; +} + READ8_MEMBER( squale_state::pia_u72_porta_r ) { UINT8 data = 0xFF; @@ -283,7 +337,11 @@ static ADDRESS_MAP_START(squale_mem, AS_PROGRAM, 8, squale_state) AM_RANGE(0xf048,0xf04b) AM_DEVREADWRITE("pia_u72", pia6821_device, read, write) AM_RANGE(0xf050,0xf05f) AM_DEVREADWRITE("ef6850", acia6850_device, data_r, data_w) AM_RANGE(0xf060,0xf06f) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, address_data_w) + AM_RANGE(0xf080,0xf083) AM_DEVREADWRITE("wd1770", wd1770_t, read, write) + AM_RANGE(0xf08a,0xf08a) AM_READWRITE( fdc_sel0_r, fdc_sel0_w ) + AM_RANGE(0xf08b,0xf08b) AM_READWRITE( fdc_sel1_r, fdc_sel1_w ) AM_RANGE(0xf100,0xffff) AM_ROMBANK("rom_bank"); + ADDRESS_MAP_END static ADDRESS_MAP_START( squale_io, AS_IO, 8, squale_state) @@ -378,10 +436,17 @@ static INPUT_PORTS_START( squale ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) INPUT_PORTS_END +static SLOT_INTERFACE_START( squale_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + void squale_state::machine_start() { int i; + fdc_sel0 = 0x00; + fdc_sel1 = 0x00; + membank("rom_bank")->configure_entry(0, memregion("maincpu")->base() + 0x100); membank("rom_bank")->configure_entry(1, memregion("maincpu")->base() + 0x1100); membank("rom_bank")->set_entry( 0 ); @@ -449,6 +514,11 @@ static MACHINE_CONFIG_START( squale, squale_state ) MCFG_EF9365_PALETTE("palette") MCFG_TIMER_DRIVER_ADD_SCANLINE("squale_sl", squale_state, squale_scanline, "screen", 0, 10) + /* Floppy */ + MCFG_WD1770_ADD("wd1770", XTAL_8MHz ) + MCFG_FLOPPY_DRIVE_ADD("wd1770:0", squale_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_SOFTWARE_LIST_ADD("flop525_list", "squale") + MACHINE_CONFIG_END /* ROM definition */ From f242af926ba978cb9395878de1584c04fc39c07d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20DEL=20NERO?= Date: Sun, 6 Dec 2015 11:10:15 +0100 Subject: [PATCH 4/5] Change the machine tags as working :). --- src/mame/drivers/squale.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index 65ba12dda75..192a8bcc4df 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -538,4 +538,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1984, squale, 0, 0, squale, squale,driver_device, 0, "Apollo 7", "Squale", MACHINE_IS_SKELETON ) +COMP( 1984, squale, 0, 0, squale, squale,driver_device, 0, "Apollo 7", "Squale", MACHINE_TYPE_COMPUTER | MACHINE_IMPERFECT_GRAPHICS ) From 750f78cd14d8991da47176ecf06b2c4c3bdfce24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20DEL=20NERO?= Date: Sun, 6 Dec 2015 14:39:06 +0100 Subject: [PATCH 5/5] Clang error corrected. --- src/mame/drivers/squale.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index 192a8bcc4df..f8a3a73d915 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -147,6 +147,9 @@ WRITE8_MEMBER( squale_state::fdc_sel0_w ) #endif fdc_sel0 = data; + + // drive select + m_floppy = NULL; } WRITE8_MEMBER( squale_state::fdc_sel1_w ) @@ -446,6 +449,7 @@ void squale_state::machine_start() fdc_sel0 = 0x00; fdc_sel1 = 0x00; + m_floppy = NULL; membank("rom_bank")->configure_entry(0, memregion("maincpu")->base() + 0x100); membank("rom_bank")->configure_entry(1, memregion("maincpu")->base() + 0x1100);