Merge pull request #521 from jfdelnero/master

Squale Floppy drives working, EF9365 emulation improvement. [jfdelnero]
This commit is contained in:
Miodrag Milanović 2015-12-25 18:33:58 +01:00
commit c4451bdc89
3 changed files with 108 additions and 15 deletions

View File

@ -181,6 +181,22 @@ void ef9365_device::draw_border(UINT16 line)
}
void ef9365_device::plot(int x_pos,int y_pos)
{
int p;
y_pos = ( 255 - y_pos );
for( p = 0 ; p < 4 ; p++ )
{
if( m_current_color & (0x01 << p) )
m_videoram->write_byte ( (0x2000*p) + (((y_pos*256) + x_pos)>>3), m_videoram->read_byte( (0x2000*p) + (((y_pos*256) + x_pos)>>3)) | (0x80 >> (((y_pos*256) + x_pos)&7) ) );
else
m_videoram->write_byte ( (0x2000*p) + (((y_pos*256) + x_pos)>>3), m_videoram->read_byte( (0x2000*p) + (((y_pos*256) + x_pos)>>3)) & ~(0x80 >> (((y_pos*256) + x_pos)&7) ) );
}
}
void ef9365_device::draw_character( unsigned char c, int block, int smallblock )
{
int x_char,y_char;
@ -300,8 +316,6 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
{
m_state = 0;
set_busy_flag(4);
if( ( cmd>>4 ) == 0 )
{
switch(cmd & 0xF)
@ -311,30 +325,35 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
printf("Set bit 1 of CTRL1 : Pen Selection\n");
#endif
m_registers[EF9365_REG_CTRL1] |= 0x02;
set_busy_flag(10); // Timing to check on the real hardware
break;
case 0x1: // Clear bit 1 of CTRL1 : Eraser Selection
#ifdef DBGMODE
printf("Clear bit 1 of CTRL1 : Eraser Selection\n");
#endif
m_registers[EF9365_REG_CTRL1] &= (~0x02);
set_busy_flag(10); // Timing to check on the real hardware
break;
case 0x2: // Set bit 0 of CTRL1 : Pen/Eraser down selection
#ifdef DBGMODE
printf("Set bit 0 of CTRL1 : Pen/Eraser down selection\n");
#endif
m_registers[EF9365_REG_CTRL1] |= 0x01;
set_busy_flag(10); // Timing to check on the real hardware
break;
case 0x3: // Clear bit 0 of CTRL1 : Pen/Eraser up selection
#ifdef DBGMODE
printf("Clear bit 0 of CTRL1 : Pen/Eraser up selection\n");
#endif
m_registers[EF9365_REG_CTRL1] &= (~0x01);
set_busy_flag(10); // Timing to check on the real hardware
break;
case 0x4: // Clear screen
#ifdef DBGMODE
printf("Clear screen\n");
#endif
screen_scanning(1);
set_busy_flag(30*40*25); // Timing to check on the real hardware
break;
case 0x5: // X and Y registers reset to 0
#ifdef DBGMODE
@ -345,6 +364,7 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
m_registers[EF9365_REG_Y_MSB] = 0;
m_registers[EF9365_REG_Y_LSB] = 0;
set_busy_flag(80); // Timing to check on the real hardware
break;
case 0x6: // X and Y registers reset to 0 and clear screen
#ifdef DBGMODE
@ -355,40 +375,48 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
m_registers[EF9365_REG_Y_MSB] = 0;
m_registers[EF9365_REG_Y_LSB] = 0;
screen_scanning(1);
set_busy_flag(30*40*25); // Timing to check on the real hardware
break;
case 0x7: // Clear screen, set CSIZE to code "minsize". All other registers reset to 0
#ifdef DBGMODE
printf("Clear screen, set CSIZE to code \"minsize\". All other registers reset to 0\n");
#endif
screen_scanning(1);
set_busy_flag(30*40*25); // Timing to check on the real hardware
break;
case 0x8: // Light-pen initialization (/White forced low)
#ifdef DBGMODE
printf("Light-pen initialization (/White forced low)\n");
#endif
set_busy_flag(10); // Timing to check on the real hardware
break;
case 0x9: // Light-pen initialization
#ifdef DBGMODE
printf("Light-pen initialization\n");
#endif
set_busy_flag(10); // Timing to check on the real hardware
break;
case 0xA: // 5x8 block drawing (size according to CSIZE)
#ifdef DBGMODE
printf("5x8 block drawing (size according to CSIZE)\n");
#endif
draw_character( 0x00 , 1 , 0 );
set_busy_flag(72); // Value measured from the Apollo Squale
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 );
set_busy_flag(72); // Timing to check on the real hardware
break;
case 0xC: // Screen scanning : pen or Eraser as defined by CTRL1
#ifdef DBGMODE
printf("Screen scanning : pen or Eraser as defined by CTRL1\n");
#endif
screen_scanning(0);
set_busy_flag(30*40*25); // Timing to check
break;
case 0xD: // X reset to 0
#ifdef DBGMODE
@ -396,6 +424,7 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
#endif
m_registers[EF9365_REG_X_MSB] = 0;
m_registers[EF9365_REG_X_LSB] = 0;
set_busy_flag(5); // Timing to check on the real hardware
break;
case 0xE: // Y reset to 0
#ifdef DBGMODE
@ -403,11 +432,13 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
#endif
m_registers[EF9365_REG_Y_MSB] = 0;
m_registers[EF9365_REG_Y_LSB] = 0;
set_busy_flag(5); // Timing to check on the real hardware
break;
case 0xF: // Direct image memory access request for the next free cycle.
#ifdef DBGMODE
printf("Direct image memory access request for the next free cycle.\n");
#endif
set_busy_flag(30); // Timing to check on the real hardware
break;
default:
logerror("Unemulated EF9365 cmd: %02x\n", cmd);
@ -423,6 +454,12 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
#ifdef DBGMODE
printf("Vector generation ( for b2,b1,0 see small vector definition)\n");
#endif
// WIP : Vector drawing. One dot only at the origin point for the moment
plot( ( (m_registers[EF9365_REG_X_MSB]<<8) | m_registers[EF9365_REG_X_LSB]),
( (m_registers[EF9365_REG_Y_MSB]<<8) | m_registers[EF9365_REG_Y_LSB]));
set_busy_flag(30); // Timing to check
}
else
{
@ -430,6 +467,12 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
#ifdef DBGMODE
printf("Special direction vectors generation ( for b2,b1,0 see small vector definition)\n");
#endif
// WIP : Vector drawing. One dot only at the origin point for the moment
plot( ( (m_registers[EF9365_REG_X_MSB]<<8) | m_registers[EF9365_REG_X_LSB]),
( (m_registers[EF9365_REG_Y_MSB]<<8) | m_registers[EF9365_REG_Y_LSB]));
set_busy_flag(30); // Timing to check
}
}
else
@ -440,6 +483,10 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
#ifdef DBGMODE
printf("Small vector definition.\n");
#endif
// WIP : Vector drawing. One dot only at the origin point for the moment
plot( ( (m_registers[EF9365_REG_X_MSB]<<8) | m_registers[EF9365_REG_X_LSB]),
( (m_registers[EF9365_REG_Y_MSB]<<8) | m_registers[EF9365_REG_Y_LSB]));
}
else
{
@ -448,6 +495,7 @@ void ef9365_device::ef9365_exec(UINT8 cmd)
printf("Draw character\n");
#endif
draw_character( cmd - 0x20, 0 , 0 );
set_busy_flag(30); // Value measured from the Squale
}
}
}

View File

@ -59,6 +59,7 @@ protected:
private:
void draw_character( unsigned char c, int block, int smallblock );
void plot(int x_pos,int y_pos);
void screen_scanning( int force_clear );
void set_busy_flag(int period);
void set_video_mode(void);

View File

@ -82,6 +82,7 @@ public:
, m_maincpu(*this, "maincpu")
, m_fdc(*this, "wd1770")
, m_floppy0(*this, "wd1770:0")
, m_floppy1(*this, "wd1770:1")
, m_floppy(NULL)
, m_cart(*this, "cartslot")
{ }
@ -133,6 +134,7 @@ private:
required_device<cpu_device> m_maincpu;
required_device<wd1770_t> m_fdc;
required_device<floppy_connector> m_floppy0;
required_device<floppy_connector> m_floppy1;
floppy_image_device *m_floppy;
required_device<generic_slot_device> m_cart;
@ -160,20 +162,56 @@ WRITE8_MEMBER( squale_state::ctrl_w )
WRITE8_MEMBER( squale_state::fdc_sel0_w )
{
floppy_image_device *floppy = 0;
#ifdef DBGMODE
printf("write fdc_sel0_w reg : 0x%X\n",data);
printf("%s: write fdc_sel0_w reg : 0x%X\n",machine().describe_context(),data);
#endif
fdc_sel0 = data;
// drive select
m_floppy = NULL;
if( BIT(data, 3) ) // Drive 0
{
floppy = m_floppy0->get_device();
if(!floppy)
fdc_sel0 = fdc_sel0 & ~(0x08);
else
{
if(!floppy->dskchg_r())
{
fdc_sel0 = fdc_sel0 & ~(0x08);
}
}
}
if( BIT(data, 2) ) // Drive 1
{
floppy = m_floppy1->get_device();
if(!floppy)
fdc_sel0 = fdc_sel0 & ~(0x04);
else
{
if(!floppy->dskchg_r())
{
fdc_sel0 = fdc_sel0 & ~(0x04);
}
}
}
if(floppy)
{
floppy->ss_w(BIT(data, 4)); // Side selector bit
}
//m_fdc->mon_w(BIT(data, 3));
m_fdc->dden_w(BIT(data, 5)); // Double / Single density selector bit
m_fdc->set_floppy(floppy);
}
WRITE8_MEMBER( squale_state::fdc_sel1_w )
{
#ifdef DBGMODE
printf("write fdc_sel1_w reg : 0x%X\n",data);
printf("%s: write fdc_sel1_w reg : 0x%X\n",machine().describe_context(),data);
#endif
fdc_sel1 = data;
@ -181,23 +219,27 @@ WRITE8_MEMBER( squale_state::fdc_sel1_w )
READ8_MEMBER( squale_state::fdc_sel0_r )
{
UINT8 data = 0xFF;
UINT8 data;
data = fdc_sel0;
#ifdef DBGMODE
printf("%s: read fdc_sel0_r\n",machine().describe_context());
printf("%s: read fdc_sel0_r 0x%.2X\n",machine().describe_context(),data);
#endif
data = 0x00;
return data;
}
READ8_MEMBER( squale_state::fdc_sel1_r )
{
UINT8 data = 0xFF;
UINT8 data;
data = fdc_sel1;
#ifdef DBGMODE
printf("%s: read fdc_sel1_r\n",machine().describe_context());
printf("%s: read fdc_sel1_r 0x%.2X\n",machine().describe_context(),data);
#endif
data = 0x00;
return data;
}
@ -618,13 +660,14 @@ static INPUT_PORTS_START( squale )
INPUT_PORTS_END
static SLOT_INTERFACE_START( squale_floppies )
SLOT_INTERFACE( "525dd", FLOPPY_525_DD )
SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
SLOT_INTERFACE_END
void squale_state::machine_start()
{
int i;
std::string region_tag;
m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
fdc_sel0 = 0x00;
@ -656,7 +699,7 @@ void squale_state::machine_reset()
static MACHINE_CONFIG_START( squale, squale_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu",M6809, CPU_CLOCK)
MCFG_CPU_ADD("maincpu",M6809E, CPU_CLOCK) // 12/2015 : Should be set to M6809 but it actually have the wrong clock divisor (1 instead of 4) and working 4 times too fast...
MCFG_CPU_PROGRAM_MAP(squale_mem)
MCFG_CPU_IO_MAP(squale_io)
@ -704,7 +747,8 @@ static MACHINE_CONFIG_START( squale, squale_state )
/* Floppy */
MCFG_WD1770_ADD("wd1770", XTAL_8MHz )
MCFG_FLOPPY_DRIVE_ADD("wd1770:0", squale_floppies, "525dd", floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("wd1770:0", squale_floppies, "525qd", floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("wd1770:1", squale_floppies, "525qd", floppy_image_device::default_floppy_formats)
MCFG_SOFTWARE_LIST_ADD("flop525_list", "squale")
/* Cartridge slot */