Oric 1: Spring cleaning [O. Galibert]

Putting back the apple2 disk2 in the Pravetz 8D will wait until the
next generation one is finalized.
This commit is contained in:
Olivier Galibert 2014-04-12 15:15:20 +00:00
parent 49d95127f1
commit 5e378738aa
21 changed files with 1457 additions and 2498 deletions

3
.gitattributes vendored
View File

@ -8207,7 +8207,6 @@ src/mess/includes/next.h svneol=native#text/plain
src/mess/includes/ob68k1a.h svneol=native#text/plain
src/mess/includes/ondra.h svneol=native#text/plain
src/mess/includes/orao.h svneol=native#text/plain
src/mess/includes/oric.h svneol=native#text/plain
src/mess/includes/orion.h svneol=native#text/plain
src/mess/includes/osborne1.h svneol=native#text/plain
src/mess/includes/osi.h svneol=native#text/plain
@ -8562,7 +8561,6 @@ src/mess/machine/nextmo.c svneol=native#text/plain
src/mess/machine/nextmo.h svneol=native#text/plain
src/mess/machine/ondra.c svneol=native#text/plain
src/mess/machine/orao.c svneol=native#text/plain
src/mess/machine/oric.c svneol=native#text/plain
src/mess/machine/orion.c svneol=native#text/plain
src/mess/machine/osborne1.c svneol=native#text/plain
src/mess/machine/p2000t.c svneol=native#text/plain
@ -8834,7 +8832,6 @@ src/mess/video/nick.c svneol=native#text/plain
src/mess/video/nick.h svneol=native#text/plain
src/mess/video/ondra.c svneol=native#text/plain
src/mess/video/orao.c svneol=native#text/plain
src/mess/video/oric.c svneol=native#text/plain
src/mess/video/orion.c svneol=native#text/plain
src/mess/video/osi.c svneol=native#text/plain
src/mess/video/p2000m.c svneol=native#text/plain

View File

@ -1047,3 +1047,14 @@ OBJDIRS += $(BUSOBJ)/macpds
BUSOBJS += $(BUSOBJ)/macpds/macpds.o
BUSOBJS += $(BUSOBJ)/macpds/pds_tpdfpd.o
endif
#-------------------------------------------------
#
#@src/emu/bus/oricext/oricext.h,BUSES += ORICEXT
#-------------------------------------------------
ifneq ($(filter ORICEXT,$(BUSES)),)
OBJDIRS += $(BUSOBJ)/oricext
BUSOBJS += $(BUSOBJ)/oricext/oricext.o
BUSOBJS += $(BUSOBJ)/oricext/jasmin.o
BUSOBJS += $(BUSOBJ)/oricext/microdisc.o
endif

View File

@ -0,0 +1,173 @@
#include "jasmin.h"
#include "formats/oric_dsk.h"
const device_type JASMIN = &device_creator<jasmin_device>;
ROM_START( jasmin )
ROM_REGION( 0x800, "jasmin", 0 )
ROM_LOAD("jasmin.rom", 0, 0x800, CRC(37220e89) SHA1(70e59b8abd67092f050462abc6cb5271e4c15f01) )
ROM_END
FLOPPY_FORMATS_MEMBER( jasmin_device::floppy_formats )
FLOPPY_ORIC_DSK_FORMAT
FLOPPY_FORMATS_END
static SLOT_INTERFACE_START( jasmin_floppies )
SLOT_INTERFACE( "3dsdd", FLOPPY_3_DSDD )
SLOT_INTERFACE_END
static MACHINE_CONFIG_FRAGMENT( jasmin )
MCFG_WD1770x_ADD("fdc", XTAL_8MHz)
MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(oricext_device, irq_w))
MCFG_FLOPPY_DRIVE_ADD("fdc:0", jasmin_floppies, "3dsdd", jasmin_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", jasmin_floppies, NULL, jasmin_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:2", jasmin_floppies, NULL, jasmin_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:3", jasmin_floppies, NULL, jasmin_device::floppy_formats)
MACHINE_CONFIG_END
INPUT_PORTS_START( jasmin )
PORT_START("JASMIN")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Boot") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CHANGED_MEMBER(DEVICE_SELF, jasmin_device, boot_pressed, 0)
INPUT_PORTS_END
DEVICE_ADDRESS_MAP_START(map, 8, jasmin_device)
AM_RANGE(0x3f4, 0x3f7) AM_DEVREADWRITE("fdc", wd1770_t, read, write)
AM_RANGE(0x3f8, 0x3f8) AM_WRITE(side_sel_w)
AM_RANGE(0x3f9, 0x3f9) AM_WRITE(fdc_reset_w)
AM_RANGE(0x3fa, 0x3fa) AM_WRITE(ram_access_w)
AM_RANGE(0x3fb, 0x3fb) AM_WRITE(rom_access_w)
AM_RANGE(0x3fc, 0x3ff) AM_WRITE(select_w)
ADDRESS_MAP_END
jasmin_device::jasmin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
oricext_device(mconfig, JASMIN, "Jasmin floppy drive interface", tag, owner, clock, "jasmin", __FILE__),
fdc(*this, "fdc")
{
}
jasmin_device::~jasmin_device()
{
}
void jasmin_device::device_start()
{
oricext_device::device_start();
astring tempstring;
jasmin_rom = device().machine().root_device().memregion(this->subtag(tempstring, "jasmin"))->base();
cpu->space(AS_PROGRAM).install_device(0x0000, 0xffff, *this, &jasmin_device::map);
for(int i=0; i<4; i++) {
char name[32];
sprintf(name, "fdc:%d", i);
floppies[i] = subdevice<floppy_connector>(name)->get_device();
}
}
void jasmin_device::device_reset()
{
side_sel = fdc_reset = ram_access = rom_access = false;
select[0] = select[1] = select[2] = select[3] = false;
remap();
cur_floppy = NULL;
fdc->set_floppy(NULL);
}
const rom_entry *jasmin_device::device_rom_region() const
{
return ROM_NAME( jasmin );
}
machine_config_constructor jasmin_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( jasmin );
}
ioport_constructor jasmin_device::device_input_ports() const
{
return INPUT_PORTS_NAME( jasmin );
}
void jasmin_device::remap()
{
if(rom_access) {
if(ram_access) {
bank_c000_r->set_base(ram+0xc000);
bank_e000_r->set_base(ram+0xe000);
bank_f800_r->set_base(jasmin_rom);
bank_c000_w->set_base(ram+0xc000);
bank_e000_w->set_base(ram+0xe000);
bank_f800_w->set_base(junk_write);
} else {
bank_c000_r->set_base(junk_read);
bank_e000_r->set_base(junk_read);
bank_f800_r->set_base(jasmin_rom);
bank_c000_w->set_base(junk_write);
bank_e000_w->set_base(junk_write);
bank_f800_w->set_base(junk_write);
}
} else {
if(ram_access) {
bank_c000_r->set_base(ram+0xc000);
bank_e000_r->set_base(ram+0xe000);
bank_f800_r->set_base(ram+0xf800);
bank_c000_w->set_base(ram+0xc000);
bank_e000_w->set_base(ram+0xe000);
bank_f800_w->set_base(ram+0xf800);
} else {
bank_c000_r->set_base(rom+0x0000);
bank_e000_r->set_base(rom+0x2000);
bank_f800_r->set_base(rom+0x3800);
bank_c000_w->set_base(junk_write);
bank_e000_w->set_base(junk_write);
bank_f800_w->set_base(junk_write);
}
}
}
INPUT_CHANGED_MEMBER(jasmin_device::boot_pressed)
{
if(newval) {
rom_access = true;
remap();
cpu->reset();
}
}
WRITE8_MEMBER(jasmin_device::side_sel_w)
{
side_sel = data & 1;
if(cur_floppy)
cur_floppy->ss_w(side_sel);
}
WRITE8_MEMBER(jasmin_device::fdc_reset_w)
{
if((data & 1) != fdc_reset)
fdc->soft_reset();
fdc_reset = data & 1;
}
WRITE8_MEMBER(jasmin_device::ram_access_w)
{
ram_access = data & 1;
remap();
}
WRITE8_MEMBER(jasmin_device::rom_access_w)
{
rom_access = data & 1;
remap();
}
WRITE8_MEMBER(jasmin_device::select_w)
{
select[offset] = data & 1;
cur_floppy = NULL;
for(int i=0; i != 4; i++)
if(select[i]) {
cur_floppy = floppies[i];
break;
}
fdc->set_floppy(cur_floppy);
}

View File

@ -0,0 +1,41 @@
#ifndef __JASMIN_H__
#define __JASMIN_H__
#include "oricext.h"
#include "imagedev/floppy.h"
#include "machine/wd_fdc.h"
extern const device_type JASMIN;
class jasmin_device : public oricext_device
{
public:
jasmin_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~jasmin_device();
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_ADDRESS_MAP(map, 8);
DECLARE_INPUT_CHANGED_MEMBER(boot_pressed);
DECLARE_WRITE8_MEMBER(side_sel_w);
DECLARE_WRITE8_MEMBER(fdc_reset_w);
DECLARE_WRITE8_MEMBER(ram_access_w);
DECLARE_WRITE8_MEMBER(rom_access_w);
DECLARE_WRITE8_MEMBER(select_w);
protected:
required_device<wd1770_t> fdc;
bool side_sel, fdc_reset, ram_access, rom_access, select[4];
UINT8 *jasmin_rom;
floppy_image_device *cur_floppy, *floppies[4];
virtual void device_start();
virtual void device_reset();
const rom_entry *device_rom_region() const;
machine_config_constructor device_mconfig_additions() const;
virtual ioport_constructor device_input_ports() const;
void remap();
};
#endif

View File

@ -0,0 +1,151 @@
#include "microdisc.h"
#include "formats/oric_dsk.h"
const device_type MICRODISC = &device_creator<microdisc_device>;
ROM_START( microdisc )
ROM_REGION( 0x2000, "microdisc", 0 )
ROM_LOAD ("microdis.rom", 0, 0x02000, CRC(a9664a9c) SHA1(0d2ef6e67322f48f4b7e08d8bbe68827e2074561) )
ROM_END
FLOPPY_FORMATS_MEMBER( microdisc_device::floppy_formats )
FLOPPY_ORIC_DSK_FORMAT
FLOPPY_FORMATS_END
static SLOT_INTERFACE_START( microdisc_floppies )
SLOT_INTERFACE( "3dsdd", FLOPPY_3_DSDD )
SLOT_INTERFACE_END
static MACHINE_CONFIG_FRAGMENT( microdisc )
MCFG_FD1793x_ADD("fdc", XTAL_8MHz/8)
MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(microdisc_device, fdc_irq_w))
MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(microdisc_device, fdc_drq_w))
MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(microdisc_device, fdc_hld_w))
MCFG_WD_FDC_FORCE_READY
MCFG_FLOPPY_DRIVE_ADD("fdc:0", microdisc_floppies, "3dsdd", microdisc_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", microdisc_floppies, NULL, microdisc_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:2", microdisc_floppies, NULL, microdisc_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:3", microdisc_floppies, NULL, microdisc_device::floppy_formats)
MACHINE_CONFIG_END
DEVICE_ADDRESS_MAP_START(map, 8, microdisc_device)
AM_RANGE(0x310, 0x313) AM_DEVREADWRITE("fdc", fd1793_t, read, write)
AM_RANGE(0x314, 0x314) AM_READWRITE(port_314_r, port_314_w)
AM_RANGE(0x318, 0x318) AM_READ(port_318_r)
ADDRESS_MAP_END
microdisc_device::microdisc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
oricext_device(mconfig, MICRODISC, "Microdisc floppy drive interface", tag, owner, clock, "microdisc", __FILE__),
fdc(*this, "fdc")
{
}
microdisc_device::~microdisc_device()
{
}
void microdisc_device::device_start()
{
oricext_device::device_start();
astring tempstring;
microdisc_rom = device().machine().root_device().memregion(this->subtag(tempstring, "microdisc"))->base();
cpu->space(AS_PROGRAM).install_device(0x0000, 0xffff, *this, &microdisc_device::map);
for(int i=0; i<4; i++) {
char name[32];
sprintf(name, "fdc:%d", i);
floppies[i] = subdevice<floppy_connector>(name)->get_device();
}
intrq_state = drq_state = hld_state = false;
}
void microdisc_device::device_reset()
{
port_314 = 0x00;
irq_w(false);
remap();
fdc->set_floppy(floppies[0]);
// The bootstrap checksums part of the high ram and if the sum is
// 0 it goes wrong.
ram[0xe000] = 0x42;
}
const rom_entry *microdisc_device::device_rom_region() const
{
return ROM_NAME( microdisc );
}
machine_config_constructor microdisc_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( microdisc );
}
void microdisc_device::remap()
{
if(port_314 & P_ROMDIS) {
bank_c000_r->set_base(rom+0x0000);
bank_e000_r->set_base(rom+0x2000);
bank_f800_r->set_base(rom+0x3800);
bank_c000_w->set_base(junk_write);
bank_e000_w->set_base(junk_write);
bank_f800_w->set_base(junk_write);
} else {
bank_c000_r->set_base(ram+0xc000);
bank_c000_w->set_base(ram+0xc000);
if(port_314 & P_EPROM) {
bank_e000_r->set_base(ram+0xe000);
bank_f800_r->set_base(ram+0xf800);
bank_e000_w->set_base(ram+0xe000);
bank_f800_w->set_base(ram+0xf800);
} else {
bank_e000_r->set_base(microdisc_rom+0x0000);
bank_f800_r->set_base(microdisc_rom+0x1800);
bank_e000_w->set_base(junk_write);
bank_f800_w->set_base(junk_write);
}
}
}
WRITE8_MEMBER(microdisc_device::port_314_w)
{
port_314 = data;
remap();
floppy_image_device *floppy = floppies[(port_314 >> 5) & 3];
fdc->set_floppy(floppy);
fdc->dden_w(port_314 & P_DDEN);
if(floppy) {
floppy->ss_w(port_314 & P_SS ? 1 : 0);
floppy->mon_w(0);
}
irq_w(intrq_state && (port_314 & P_IRQEN));
}
READ8_MEMBER(microdisc_device::port_314_r)
{
return (intrq_state && (port_314 & P_IRQEN)) ? 0x7f : 0xff;
}
READ8_MEMBER(microdisc_device::port_318_r)
{
return drq_state ? 0x7f : 0xff;
}
WRITE_LINE_MEMBER(microdisc_device::fdc_irq_w)
{
intrq_state = state;
irq_w(intrq_state && (port_314 & P_IRQEN));
}
WRITE_LINE_MEMBER(microdisc_device::fdc_drq_w)
{
drq_state = state;
}
WRITE_LINE_MEMBER(microdisc_device::fdc_hld_w)
{
logerror("hld %d\n", state);
hld_state = state;
floppies[(port_314 >> 5) & 3]->mon_w(!hld_state);
}

View File

@ -0,0 +1,52 @@
#ifndef __MICRODISC_H__
#define __MICRODISC_H__
#include "oricext.h"
#include "imagedev/floppy.h"
#include "machine/wd_fdc.h"
extern const device_type MICRODISC;
class microdisc_device : public oricext_device
{
public:
microdisc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~microdisc_device();
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_ADDRESS_MAP(map, 8);
DECLARE_WRITE8_MEMBER(port_314_w);
DECLARE_READ8_MEMBER(port_314_r);
DECLARE_READ8_MEMBER(port_318_r);
DECLARE_WRITE_LINE_MEMBER(fdc_irq_w);
DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
DECLARE_WRITE_LINE_MEMBER(fdc_hld_w);
protected:
enum {
P_IRQEN = 0x01,
P_ROMDIS = 0x02,
P_DDS = 0x04,
P_DDEN = 0x08,
P_SS = 0x10,
P_DRIVE = 0x60,
P_EPROM = 0x80
};
required_device<fd1793_t> fdc;
UINT8 *microdisc_rom;
floppy_image_device *floppies[4];
UINT8 port_314;
bool intrq_state, drq_state, hld_state;
virtual void device_start();
virtual void device_reset();
const rom_entry *device_rom_region() const;
machine_config_constructor device_mconfig_additions() const;
void remap();
};
#endif

View File

@ -0,0 +1,76 @@
#include "oricext.h"
#include "jasmin.h"
#include "microdisc.h"
const device_type ORICEXT_CONNECTOR = &device_creator<oricext_connector>;
oricext_connector::oricext_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, ORICEXT_CONNECTOR, "ORIC extension connector", tag, owner, clock, "oricext_connector", __FILE__),
device_slot_interface(mconfig, *this),
irq_handler(*this)
{
}
oricext_connector::~oricext_connector()
{
}
void oricext_connector::set_cputag(const char *tag)
{
cputag = tag;
}
void oricext_connector::device_start()
{
irq_handler.resolve_safe();
}
void oricext_connector::irq_w(int state)
{
irq_handler(state);
}
void oricext_connector::device_config_complete()
{
oricext_device *dev = dynamic_cast<oricext_device *>(get_card_device());
if(dev)
dev->set_cputag(cputag);
}
oricext_device::oricext_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_slot_card_interface(mconfig, *this)
{
}
void oricext_device::set_cputag(const char *tag)
{
cputag = tag;
}
void oricext_device::device_start()
{
cpu = machine().device<m6502_device>(cputag);
connector = downcast<oricext_connector *>(owner());
bank_c000_r = membank(":bank_c000_r");
bank_e000_r = membank(":bank_e000_r");
bank_f800_r = membank(":bank_f800_r");
bank_c000_w = membank(":bank_c000_w");
bank_e000_w = membank(":bank_e000_w");
bank_f800_w = membank(":bank_f800_w");
rom = (UINT8 *)machine().root_device().memregion(cputag)->base();
ram = (UINT8 *)memshare(":ram")->ptr();
memset(junk_read, 0xff, sizeof(junk_read));
memset(junk_write, 0x00, sizeof(junk_write));
}
WRITE_LINE_MEMBER(oricext_device::irq_w)
{
connector->irq_w(state);
}
SLOT_INTERFACE_START(oricext_intf)
SLOT_INTERFACE("jasmin", JASMIN)
SLOT_INTERFACE("microdisc", MICRODISC)
SLOT_INTERFACE_END

View File

@ -0,0 +1,63 @@
/***************************************************************************
oric.h - Oric 1/Atmos extension port
***************************************************************************/
#ifndef __ORICEXT_H__
#define __ORICEXT_H__
#include "emu.h"
#include "cpu/m6502/m6502.h"
#define MCFG_ORICEXT_ADD(_tag, _slot_intf, _def_slot, _cputag, _irq) \
MCFG_DEVICE_ADD(_tag, ORICEXT_CONNECTOR, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
downcast<oricext_connector *>(device)->set_cputag(_cputag); \
devcb = &oricext_connector::set_irq_handler(*device, DEVCB2_##_irq);
class oricext_device;
class oricext_connector: public device_t,
public device_slot_interface
{
public:
oricext_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~oricext_connector();
void set_cputag(const char *tag);
template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<oricext_connector &>(device).irq_handler.set_callback(object); }
void irq_w(int state);
protected:
devcb2_write_line irq_handler;
const char *cputag;
virtual void device_start();
virtual void device_config_complete();
};
class oricext_device : public device_t,
public device_slot_card_interface
{
public:
oricext_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
void set_cputag(const char *tag);
DECLARE_WRITE_LINE_MEMBER(irq_w);
protected:
const char *cputag;
m6502_device *cpu;
oricext_connector *connector;
memory_bank *bank_c000_r, *bank_e000_r, *bank_f800_r, *bank_c000_w, *bank_e000_w, *bank_f800_w;
UINT8 *rom, *ram;
UINT8 junk_read[8192], junk_write[8192];
virtual void device_start();
};
extern const device_type ORICEXT_CONNECTOR;
SLOT_INTERFACE_EXTERN( oricext_intf );
#endif /* __ORICEXT_H__ */

View File

@ -16,7 +16,7 @@
*/
// Show step operation
#define TRACE_STEP 0
#define TRACE_STEP 1
// device type definition
const device_type FLOPPY_CONNECTOR = &device_creator<floppy_connector>;
@ -759,7 +759,6 @@ void floppy_image_device::set_write_splice(attotime when)
attotime base;
int splice_pos = find_position(base, when);
image->set_write_splice_position(cyl, ss, splice_pos);
logerror("%s: Track %d head %d set splice pos %d\n", tag(), cyl, ss, splice_pos);
}
UINT32 floppy_image_device::get_form_factor() const

View File

@ -842,6 +842,11 @@ void via6522_device::write_pa(int line, int state)
m_in_a &= ~(1 << line);
}
WRITE8_MEMBER( via6522_device::write_pa )
{
m_in_a = data;
}
/*-------------------------------------------------
ca1_w - interface setting VIA port CA1 input
-------------------------------------------------*/
@ -902,6 +907,11 @@ void via6522_device::write_pb(int line, int state)
m_in_b &= ~(1 << line);
}
WRITE8_MEMBER( via6522_device::write_pb )
{
m_in_b = data;
}
/*-------------------------------------------------
cb1_w - interface setting VIA port CB1 input
-------------------------------------------------*/

View File

@ -88,6 +88,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( write_pa5 ) { write_pa(5, state); }
DECLARE_WRITE_LINE_MEMBER( write_pa6 ) { write_pa(6, state); }
DECLARE_WRITE_LINE_MEMBER( write_pa7 ) { write_pa(7, state); }
DECLARE_WRITE8_MEMBER( write_pa );
DECLARE_WRITE_LINE_MEMBER( write_ca1 );
DECLARE_WRITE_LINE_MEMBER( write_ca2 );
@ -99,6 +100,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( write_pb5 ) { write_pb(5, state); }
DECLARE_WRITE_LINE_MEMBER( write_pb6 ) { write_pb(6, state); }
DECLARE_WRITE_LINE_MEMBER( write_pb7 ) { write_pb(7, state); }
DECLARE_WRITE8_MEMBER( write_pb );
DECLARE_WRITE_LINE_MEMBER( write_cb1 );
DECLARE_WRITE_LINE_MEMBER( write_cb2 );

View File

@ -38,7 +38,7 @@ const device_type WD1773x = &device_creator<wd1773_t>;
#define TRACE_COMP 0
// Shows command invocation
#define TRACE_COMMAND 0
#define TRACE_COMMAND 1
// Shows sync actions
#define TRACE_SYNC 0
@ -223,7 +223,7 @@ void wd_fdc_t::command_end()
void wd_fdc_t::seek_start(int state)
{
if (TRACE_COMMAND) logerror("%s: seek %d\n", tag(), data);
if (TRACE_COMMAND) logerror("%s: seek %d (track=%d)\n", tag(), data, track);
main_state = state;
status = (status & ~(S_CRC|S_RNF|S_SPIN)) | S_BUSY;
if(head_control) {
@ -264,8 +264,10 @@ void wd_fdc_t::seek_continue()
delay_cycles(t_gen, step_times[command & 3]);
}
if(main_state == SEEK && track == data)
if(main_state == SEEK && track == data) {
logerror("track=%d data=%d\n", track, data);
sub_state = SEEK_DONE;
}
if(sub_state == SPINUP_DONE) {
counter = 0;
@ -1184,10 +1186,9 @@ void wd_fdc_t::spinup()
counter = 0;
}
status |= S_MON;
status |= S_MON|S_SPIN;
if(floppy)
floppy->mon_w(0);
}
void wd_fdc_t::ready_callback(floppy_image_device *floppy, int state)
@ -2669,7 +2670,7 @@ wd1770_t::wd1770_t(const machine_config &mconfig, const char *tag, device_t *own
{
step_times = wd_digital_step_times;
delay_register_commit = 32;
delay_command_commit = 48;
delay_command_commit = 36; // official 48 is too high for oric jasmin boot
disable_mfm = false;
inverted_bus = false;
side_control = false;

View File

@ -99,7 +99,7 @@ int mfi_format::identify(io_generic *io, UINT32 form_factor)
if(memcmp( h.sign, sign, 16 ) == 0 &&
h.cyl_count <= 160 &&
h.head_count <= 2 &&
(!form_factor || h.form_factor == form_factor))
(!form_factor || !h.form_factor || h.form_factor == form_factor))
return 100;
return 0;
}

View File

@ -1,3 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
/*********************************************************************
formats/oric_dsk.c
@ -6,311 +8,107 @@
*********************************************************************/
#include <string.h>
#include "emu.h"
#include "formats/oric_dsk.h"
#include "imageutl.h"
#include "flopimg.h"
#include "oric_dsk.h"
#include "basicdsk.h"
#define mfm_disk_header_size 0x0100
#define MFM_ID "MFM_DISK"
#define TRACK_SIZE_MFM 0x1900
struct mfm_disk_sector_info
oric_dsk_format::oric_dsk_format()
{
int id_ptr;
int data_ptr;
int sector_size;
UINT8 ddam;
};
struct oricdsk_tag
{
int tracks;
int heads;
int geometry;
int tracksize;
int num_sectors;
struct mfm_disk_sector_info sector_data[32];
};
static struct oricdsk_tag *get_tag(floppy_image_legacy *floppy)
{
struct oricdsk_tag *tag;
tag = (oricdsk_tag *)floppy_tag(floppy);
return tag;
}
static FLOPPY_IDENTIFY(oric_dsk_identify)
const char *oric_dsk_format::name() const
{
UINT8 header[mfm_disk_header_size];
floppy_image_read(floppy, header, 0, mfm_disk_header_size);
if ( memcmp( header, MFM_ID, 8 ) ==0) {
UINT32 heads = pick_integer_le(header, 8, 4);
UINT32 tracks = pick_integer_le(header, 12, 4);
if (floppy_image_size(floppy)==((tracks*heads*TRACK_SIZE_MFM)+mfm_disk_header_size)) {
*vote = 100;
} else {
*vote = 0;
}
} else {
*vote = 0;
}
return FLOPPY_ERROR_SUCCESS;
}
static int oric_get_track_offset(floppy_image_legacy *floppy,int track, int head)
{
if (get_tag(floppy)->geometry==1) {
return mfm_disk_header_size + (get_tag(floppy)->tracksize * track) + (head * get_tag(floppy)->tracksize * get_tag(floppy)->tracks);
} else {
return mfm_disk_header_size + (get_tag(floppy)->tracksize*((track * get_tag(floppy)->heads)+head));
}
return "oric_dsk";
}
static int oric_get_heads_per_disk(floppy_image_legacy *floppy)
const char *oric_dsk_format::description() const
{
return get_tag(floppy)->heads;
return "Oric disk image";
}
static int oric_get_tracks_per_disk(floppy_image_legacy *floppy)
const char *oric_dsk_format::extensions() const
{
return get_tag(floppy)->tracks;
return "dsk";
}
static void mfm_info_cache_sector_info(floppy_image_legacy *floppy,int track,int head)
bool oric_dsk_format::supports_save() const
{
UINT8 track_data[TRACK_SIZE_MFM];
return true;
}
/* initialise these with single density values if single density */
UINT8 IdMark = 0x0fe;
UINT8 DataMark = 0x0fb;
UINT8 DeletedDataMark = 0x0f8;
int oric_dsk_format::identify(io_generic *io, UINT32 form_factor)
{
UINT8 h[256];
io_generic_read(io, h, 0, 256);
UINT8 SectorCount;
UINT8 SearchCode = 0;
UINT8 sector_number = 0;
int ptr = 0;
int track_offset = oric_get_track_offset(floppy,track,head);
floppy_image_read(floppy, track_data, track_offset, TRACK_SIZE_MFM);
SectorCount = 0;
if(memcmp(h, "MFM_DISK", 8))
return 0;
do
{
switch (SearchCode)
{
/* searching for id's */
case 0:
{
/* found id mark? */
if (track_data[ptr] == IdMark)
{
sector_number = track_data[ptr+3]-1;
/* store pointer to id mark */
get_tag(floppy)->sector_data[sector_number].id_ptr = ptr + track_offset;
SectorCount++;
int sides = (h[11] << 24) | (h[10] << 16) | (h[ 9] << 8) | h[ 8];
int tracks = (h[15] << 24) | (h[14] << 16) | (h[13] << 8) | h[12];
int geom = (h[19] << 24) | (h[18] << 16) | (h[17] << 8) | h[16];
/* grab N value - used to skip data in data field */
get_tag(floppy)->sector_data[sector_number].sector_size = (1<< (track_data[ptr+4]+7));
int size = io_generic_size(io);
if(sides < 0 || sides > 2 || geom != 1 || size != 256+6400*sides*tracks)
return 0;
/* skip past id field and crc */
ptr+=7;
return 100;
}
/* now looking for data field */
SearchCode = 1;
bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
UINT8 h[256];
UINT8 t[6250+3];
UINT32 stream[100000];
t[6250] = t[6251] = t[6252] = 0;
io_generic_read(io, h, 0, 256);
int sides = (h[11] << 24) | (h[10] << 16) | (h[ 9] << 8) | h[ 8];
int tracks = (h[15] << 24) | (h[14] << 16) | (h[13] << 8) | h[12];
for(int side=0; side<sides; side++)
for(int track=0; track<tracks; track++) {
io_generic_read(io, t, 256+6400*(tracks*side + track), 6250);
int pos = 0;
int sector_size = 128;
for(int i=0; i<6250; i++) {
if(t[i] == 0xc2 && t[i+1] == 0xc2 && t[i+2] == 0xc2) {
raw_w(stream, pos, 16, 0x5224);
raw_w(stream, pos, 16, 0x5224);
raw_w(stream, pos, 16, 0x5224);
i += 2;
continue;
}
else
{
/* update position */
ptr++;
if(t[i] == 0xa1 && t[i+1] == 0xa1 && t[i+2] == 0xa1) {
raw_w(stream, pos, 16, 0x4489);
raw_w(stream, pos, 16, 0x4489);
raw_w(stream, pos, 16, 0x4489);
int copy;
if(t[i+3] == 0xfe) {
copy = 7;
sector_size = 128 << (t[i+7] & 3);
logerror("%02x %x - %02x %02x %02x %02x\n",
track, side, t[i+4], t[i+5], t[i+6], t[i+7]);
} else if(t[i+3] == 0xfb)
copy = sector_size+3;
else
copy = 0;
for(int j=0; j<copy; j++)
mfm_w(stream, pos, 8, t[i+3+j]);
i += 2+copy;
continue;
}
mfm_w(stream, pos, 8, t[i]);
}
break;
/* searching for data id's */
case 1:
{
/* found data or deleted data? */
if ((track_data[ptr] == DataMark) || (track_data[ptr] == DeletedDataMark))
{
/* yes */
get_tag(floppy)->sector_data[sector_number].data_ptr = ptr + track_offset + 1;
get_tag(floppy)->sector_data[sector_number].ddam = (track_data[ptr] == DeletedDataMark) ? ID_FLAG_DELETED_DATA : 0;
/* skip data field and id */
ptr += get_tag(floppy)->sector_data[sector_number].sector_size + 3;
/* now looking for id field */
SearchCode = 0;
}
else
{
ptr++;
}
}
break;
default:
break;
generate_track_from_levels(track, side, stream, 100000, 0, image);
}
}
while (ptr < TRACK_SIZE_MFM);
get_tag(floppy)->num_sectors = SectorCount;
return true;
}
static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
bool oric_dsk_format::save(io_generic *io, floppy_image *image)
{
UINT64 offs;
/* translate the sector to a raw sector */
if (!sector_is_index)
{
sector -= 1;
}
mfm_info_cache_sector_info(floppy,track,head);
/* check to see if we are out of range */
if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks)
|| (sector < 0) || (sector >=get_tag(floppy)->num_sectors))
return FLOPPY_ERROR_SEEKERROR;
offs = get_tag(floppy)->sector_data[sector].data_ptr;
if (offset)
*offset = offs;
return FLOPPY_ERROR_SUCCESS;
return true;
}
static floperr_t internal_oric_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
UINT64 offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
return err;
floppy_image_read(floppy, buffer, offset, buflen);
return FLOPPY_ERROR_SUCCESS;
}
static floperr_t internal_oric_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
UINT64 offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
return err;
floppy_image_write(floppy, buffer, offset, buflen);
return FLOPPY_ERROR_SUCCESS;
}
static floperr_t oric_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
return internal_oric_read_sector(floppy, head, track, sector, FALSE, buffer, buflen);
}
static floperr_t oric_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
return internal_oric_write_sector(floppy, head, track, sector, FALSE, buffer, buflen, ddam);
}
static floperr_t oric_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
return internal_oric_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
static floperr_t oric_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
return internal_oric_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
static floperr_t oric_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, NULL);
if (err)
return err;
if (sector_length) {
*sector_length = get_tag(floppy)->sector_data[sector].sector_size;
}
return FLOPPY_ERROR_SUCCESS;
}
static floperr_t oric_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
{
floperr_t retVal;
sector_index += 1;
retVal = oric_get_sector_length(floppy, head, track, sector_index, sector_length);
if (sector_length!=NULL) {
*sector_length = get_tag(floppy)->sector_data[sector_index-1].sector_size;
}
if (cylinder)
*cylinder = track;
if (side)
*side = head;
if (sector)
*sector = sector_index;
if (flags)
*flags = get_tag(floppy)->sector_data[sector_index].ddam;
return retVal;
}
static FLOPPY_CONSTRUCT(oric_dsk_construct)
{
struct FloppyCallbacks *callbacks;
struct oricdsk_tag *tag;
UINT8 header[mfm_disk_header_size];
floppy_image_read(floppy, header, 0, mfm_disk_header_size);
tag = (struct oricdsk_tag *) floppy_create_tag(floppy, sizeof(struct oricdsk_tag));
if (!tag)
return FLOPPY_ERROR_OUTOFMEMORY;
tag->heads = pick_integer_le(header, 8, 4);
tag->tracks = pick_integer_le(header, 12, 4);
tag->geometry = pick_integer_le(header, 16, 4);
tag->tracksize = TRACK_SIZE_MFM;
memset(tag->sector_data,0,sizeof(tag->sector_data));
callbacks = floppy_callbacks(floppy);
callbacks->read_sector = oric_read_sector;
callbacks->write_sector = oric_write_sector;
callbacks->read_indexed_sector = oric_read_indexed_sector;
callbacks->write_indexed_sector = oric_write_indexed_sector;
callbacks->get_sector_length = oric_get_sector_length;
callbacks->get_heads_per_disk = oric_get_heads_per_disk;
callbacks->get_tracks_per_disk = oric_get_tracks_per_disk;
callbacks->get_indexed_sector_info = oric_get_indexed_sector_info;
return FLOPPY_ERROR_SUCCESS;
}
/* ----------------------------------------------------------------------- */
LEGACY_FLOPPY_OPTIONS_START( oric )
LEGACY_FLOPPY_OPTION( oricmfm, "dsk", "Oric MFM floppy disk image", oric_dsk_identify, oric_dsk_construct, NULL, NULL)
LEGACY_FLOPPY_OPTION( oric, "dsk", "Oric disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
HEADS([2])
TRACKS([80])
SECTORS([9])
SECTOR_LENGTH([512])
FIRST_SECTOR_ID([1]))
LEGACY_FLOPPY_OPTIONS_END
const floppy_format_type FLOPPY_ORIC_DSK_FORMAT = &floppy_image_format_creator<oric_dsk_format>;

View File

@ -11,8 +11,20 @@
#include "flopimg.h"
/**************************************************************************/
class oric_dsk_format : public floppy_image_format_t
{
public:
oric_dsk_format();
virtual int identify(io_generic *io, UINT32 form_factor);
virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image);
virtual bool save(io_generic *io, floppy_image *image);
LEGACY_FLOPPY_OPTIONS_EXTERN(oric);
virtual const char *name() const;
virtual const char *description() const;
virtual const char *extensions() const;
virtual bool supports_save() const;
};
extern const floppy_format_type FLOPPY_ORIC_DSK_FORMAT;
#endif /* ORIC_DSK_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
/*****************************************************************************
*
* includes/oric.h
*
****************************************************************************/
#ifndef ORIC_H_
#define ORIC_H_
#include "emu.h"
#include "cpu/m6502/m6502.h"
#include "sound/ay8910.h"
#include "sound/wave.h"
#include "machine/6522via.h"
#include "machine/mos6551.h"
#include "machine/buffer.h"
#include "bus/centronics/ctronics.h"
#include "machine/wd17xx.h"
//#include <stdio.h>
#include "machine/applefdc.h"
#include "imagedev/flopdrv.h"
#include "imagedev/cassette.h"
#include "formats/oric_dsk.h"
#include "formats/ap2_dsk.h"
#include "formats/oric_tap.h"
enum
{
TELESTRAT_MEM_BLOCK_UNDEFINED,
TELESTRAT_MEM_BLOCK_RAM,
TELESTRAT_MEM_BLOCK_ROM
};
struct telestrat_mem_block
{
int MemType;
unsigned char *ptr;
};
/* current state of the display */
/* some attributes persist until they are turned off.
This structure holds this persistant information */
struct oric_vh_state
{
/* foreground and background colour used for rendering */
/* if flash attribute is set, these two will both be equal to background colour */
UINT8 active_foreground_colour;
UINT8 active_background_colour;
/* current foreground and background colour */
UINT8 foreground_colour;
UINT8 background_colour;
UINT8 mode;
/* text attributes */
UINT8 text_attributes;
offs_t read_addr;
/* current addr to fetch data */
UINT8 *char_data;
/* base of char data */
UINT8 *char_base;
/* if (1<<3), display graphics, if 0, hide graphics */
/* current count */
UINT8 flash_count;
};
class oric_state : public driver_device
{
public:
oric_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_ram(*this, "ram"),
m_maincpu(*this, "maincpu"),
m_ay8912(*this, "ay8912"),
m_centronics(*this, "centronics"),
m_cent_data_out(*this, "cent_data_out"),
m_cassette(*this, "cassette"),
m_via6522_0(*this, "via6522_0"),
m_region_maincpu(*this, "maincpu"),
m_bank1(*this, "bank1"),
m_bank2(*this, "bank2"),
m_bank3(*this, "bank3"),
m_bank4(NULL),
m_bank5(*this, "bank5"),
m_bank6(*this, "bank6"),
m_bank7(*this, "bank7"),
m_io_row0(*this, "ROW0"),
m_io_row1(*this, "ROW1"),
m_io_row2(*this, "ROW2"),
m_io_row3(*this, "ROW3"),
m_io_row4(*this, "ROW4"),
m_io_row5(*this, "ROW5"),
m_io_row6(*this, "ROW6"),
m_io_row7(*this, "ROW7"),
m_io_floppy(*this, "FLOPPY") { }
optional_shared_ptr<UINT8> m_ram;
bool m_is_telestrat;
UINT8 m_irqs;
UINT8 *m_ram_0x0c000;
UINT8 m_keyboard_line;
UINT8 m_key_sense_bit;
UINT8 m_keyboard_mask;
UINT8 m_via_port_a_data;
UINT8 m_psg_control;
UINT8 m_previous_portb_data;
UINT8 m_port_3fa_w;
UINT8 m_port_3fb_w;
UINT8 m_wd179x_int_state;
UINT8 m_port_314_r;
UINT8 m_port_318_r;
UINT8 m_port_314_w;
UINT8 m_telestrat_bank_selection;
UINT8 m_telestrat_via2_port_a_data;
UINT8 m_telestrat_via2_port_b_data;
telestrat_mem_block m_telestrat_blocks[8];
oric_vh_state m_vh_state;
DECLARE_WRITE8_MEMBER(oric_psg_porta_write);
DECLARE_WRITE8_MEMBER(apple2_v2_interface_w);
DECLARE_READ8_MEMBER(oric_jasmin_r);
DECLARE_WRITE8_MEMBER(oric_jasmin_w);
DECLARE_READ8_MEMBER(oric_microdisc_r);
DECLARE_WRITE8_MEMBER(oric_microdisc_w);
DECLARE_READ8_MEMBER(oric_IO_r);
DECLARE_WRITE8_MEMBER(oric_IO_w);
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
DECLARE_PALETTE_INIT(oric);
DECLARE_MACHINE_START(telestrat);
UINT32 screen_update_oric(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(oric_refresh_tape);
TIMER_CALLBACK_MEMBER(oric_vh_timer_callback);
DECLARE_READ8_MEMBER(oric_via_in_a_func);
DECLARE_READ8_MEMBER(oric_via_in_b_func);
DECLARE_WRITE8_MEMBER(oric_via_out_a_func);
DECLARE_WRITE8_MEMBER(oric_via_out_b_func);
DECLARE_WRITE_LINE_MEMBER(oric_via_out_ca2_func);
DECLARE_WRITE_LINE_MEMBER(oric_via_out_cb2_func);
DECLARE_WRITE_LINE_MEMBER(oric_jasmin_wd179x_drq_w);
DECLARE_WRITE_LINE_MEMBER(oric_microdisc_wd179x_intrq_w);
DECLARE_WRITE_LINE_MEMBER(oric_microdisc_wd179x_drq_w);
DECLARE_WRITE_LINE_MEMBER(oric_wd179x_intrq_w);
DECLARE_WRITE_LINE_MEMBER(oric_wd179x_drq_w);
DECLARE_WRITE_LINE_MEMBER(oric_via_irq_func);
DECLARE_READ8_MEMBER(telestrat_via2_in_a_func);
DECLARE_WRITE8_MEMBER(telestrat_via2_out_a_func);
DECLARE_READ8_MEMBER(telestrat_via2_in_b_func);
DECLARE_WRITE8_MEMBER(telestrat_via2_out_b_func);
DECLARE_WRITE_LINE_MEMBER(telestrat_via2_irq_func);
DECLARE_WRITE_LINE_MEMBER(telestrat_acia_callback);
protected:
required_device<cpu_device> m_maincpu;
required_device<ay8910_device> m_ay8912;
required_device<centronics_device> m_centronics;
required_device<output_latch_device> m_cent_data_out;
required_device<cassette_image_device> m_cassette;
required_device<via6522_device> m_via6522_0;
required_memory_region m_region_maincpu;
required_memory_bank m_bank1;
required_memory_bank m_bank2;
optional_memory_bank m_bank3;
memory_bank *m_bank4;
optional_memory_bank m_bank5;
optional_memory_bank m_bank6;
optional_memory_bank m_bank7;
required_ioport m_io_row0;
required_ioport m_io_row1;
required_ioport m_io_row2;
required_ioport m_io_row3;
required_ioport m_io_row4;
required_ioport m_io_row5;
required_ioport m_io_row6;
required_ioport m_io_row7;
required_ioport m_io_floppy;
void oric_microdisc_refresh_wd179x_ints();
void oric_refresh_ints();
void oric_keyboard_sense_refresh();
void oric_psg_connection_refresh(address_space &space);
void oric_common_init_machine();
void oric_install_apple2_interface();
void oric_install_apple2_v2_interface();
void oric_install_microdisc_interface();
void oric_install_jasmin_interface();
void oric_microdisc_set_mem_0x0c000();
void telestrat_refresh_mem();
void oric_enable_memory(int low, int high, int rd, int wr);
void oric_jasmin_set_mem_0x0c000();
void oric_vh_update_attribute(UINT8 c);
void oric_vh_update_flash();
void oric_refresh_charset();
void oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag);
};
/*----------- defined in machine/oric.c -----------*/
extern const wd17xx_interface oric_wd17xx_interface;
#endif /* ORIC_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -553,6 +553,7 @@ BUSES += MIDI
BUSES += MEGADRIVE
BUSES += NES
BUSES += NUBUS
BUSES += ORICEXT
BUSES += PCE
BUSES += PCI
BUSES += PC_JOY
@ -1788,9 +1789,7 @@ $(MESSOBJ)/tangerin.a: \
$(MESS_VIDEO)/microtan.o \
$(MESS_MACHINE)/microtan.o \
$(MESS_DRIVERS)/microtan.o \
$(MESS_DRIVERS)/oric.o \
$(MESS_VIDEO)/oric.o \
$(MESS_MACHINE)/oric.o \
$(MESS_DRIVERS)/oric.o
$(MESSOBJ)/tatung.a: \
$(MESS_DRIVERS)/einstein.o \

View File

@ -39,6 +39,10 @@
#include "formats/ap_dsk35.h"
#include "formats/ap2_dsk.h"
#include "formats/oric_dsk.h"
#include "formats/applix_dsk.h"
static floppy_format_type floppy_formats[] = {
FLOPPY_MFI_FORMAT,
FLOPPY_DFI_FORMAT,
@ -60,6 +64,10 @@ static floppy_format_type floppy_formats[] = {
FLOPPY_DC42_FORMAT,
FLOPPY_A216S_FORMAT,
FLOPPY_RWTS18_FORMAT,
FLOPPY_ORIC_DSK_FORMAT,
FLOPPY_APPLIX_FORMAT,
};
void CLIB_DECL ATTR_PRINTF(1,2) logerror(const char *format, ...)

View File

@ -1,304 +0,0 @@
/***************************************************************************
video/oric.c
All graphic effects are supported including mid-line changes.
There may be some small bugs.
TODO:
- speed up this code a bit?
***************************************************************************/
#include "includes/oric.h"
TIMER_CALLBACK_MEMBER(oric_state::oric_vh_timer_callback)
{
/* update flash count */
m_vh_state.flash_count++;
}
void oric_state::oric_vh_update_flash()
{
/* flash active? */
if (BIT(m_vh_state.text_attributes, 2))
{
/* yes */
/* show or hide text? */
if (BIT(m_vh_state.flash_count, 4))
{
/* hide */
/* set foreground and background to be the same */
m_vh_state.active_foreground_colour = m_vh_state.background_colour;
m_vh_state.active_background_colour = m_vh_state.background_colour;
return;
}
}
/* show */
m_vh_state.active_foreground_colour = m_vh_state.foreground_colour;
m_vh_state.active_background_colour = m_vh_state.background_colour;
}
/* the alternate charset follows from the standard charset.
Each charset holds 128 chars with 8 bytes for each char.
The start address for the standard charset is dependant on the video mode */
void oric_state::oric_refresh_charset()
{
/* alternate char set? */
if (BIT(m_vh_state.text_attributes, 0))
{
/* yes */
m_vh_state.char_data = m_vh_state.char_base + (128*8);
}
else
{
/* no */
m_vh_state.char_data = m_vh_state.char_base;
}
}
/* update video hardware state depending on the new attribute */
void oric_state::oric_vh_update_attribute(UINT8 c)
{
/* attribute */
UINT8 attribute = c & 0x03f;
address_space &space = m_maincpu->space(AS_PROGRAM);
switch ((attribute>>3) & 0x03)
{
case 0:
{
/* set foreground colour 00-07 = black,red,green,yellow,blue,magenta,cyan,white */
m_vh_state.foreground_colour = attribute & 0x07;
oric_vh_update_flash();
}
break;
case 1:
{
m_vh_state.text_attributes = attribute & 0x07;
oric_refresh_charset();
/* text attributes */
oric_vh_update_flash();
}
break;
case 2:
{
/* set background colour */
m_vh_state.background_colour = attribute & 0x07;
oric_vh_update_flash();
}
break;
case 3:
{
/* set video mode */
m_vh_state.mode = attribute & 0x07;
// a different charset base is used depending on the video mode
// hires takes all the data from 0x0a000 through to about 0x0bf68,
// so the charset is moved to 0x09800 */
// text mode starts at 0x0bb80 and so the charset is in a different location
if (BIT(m_vh_state.mode, 2))
{
/* set screen memory base and standard charset location for this mode */
m_vh_state.read_addr = 0x0a000;
if (m_ram)
m_vh_state.char_base = m_ram + (offs_t)0x09800;
else
m_vh_state.char_base = (UINT8 *)space.get_read_ptr(0x09800);
}
else
{
/* set screen memory base and standard charset location for this mode */
m_vh_state.read_addr = 0x0bb80;
if (m_ram)
m_vh_state.char_base = m_ram + (offs_t)0x0b400;
else
m_vh_state.char_base = (UINT8 *)space.get_read_ptr(0x0b400);
}
/* changing the mode also changes the position of the standard charset and alternative charset */
oric_refresh_charset();
}
break;
default:
break;
}
}
/* render 6-pixels using foreground and background colours specified */
/* used in hires and text mode */
void oric_state::oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag)
{
/* invert? */
if (invert_flag)
{
fg ^=0x07;
bg ^=0x07;
}
bitmap.pix16(y, x++) = BIT(data, 5) ? fg : bg;
bitmap.pix16(y, x++) = BIT(data, 4) ? fg : bg;
bitmap.pix16(y, x++) = BIT(data, 3) ? fg : bg;
bitmap.pix16(y, x++) = BIT(data, 2) ? fg : bg;
bitmap.pix16(y, x++) = BIT(data, 1) ? fg : bg;
bitmap.pix16(y, x++) = BIT(data, 0) ? fg : bg;
}
/***************************************************************************
oric_vh_screenrefresh
***************************************************************************/
UINT32 oric_state::screen_update_oric(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
UINT8 *RAM, y;
offs_t byte_offset, read_addr_base;
bool hires_active;
address_space &space = m_maincpu->space(AS_PROGRAM);
RAM = m_ram;
/* set initial base */
read_addr_base = m_vh_state.read_addr;
/* is hires active? */
hires_active = BIT(m_vh_state.mode, 2);
for (y = 0; y < 224; y++)
{
int x = 0;
/* foreground colour white */
oric_vh_update_attribute(7);
/* background colour black */
oric_vh_update_attribute((1<<3));
oric_vh_update_attribute((1<<4));
for (byte_offset=0; byte_offset<40; byte_offset++)
{
UINT8 c;
offs_t read_addr;
/* after line 200 all rendering is done in text mode */
if (y<200)
{
/* calculate fetch address based on current line and current mode */
if (hires_active)
{
read_addr = read_addr_base + byte_offset + (offs_t)(y*40);
}
else
{
UINT8 char_line = y>>3;
read_addr = read_addr_base + byte_offset + (offs_t)(char_line*40);
}
}
else
{
UINT8 char_line = (y-200)>>3;
read_addr = read_addr_base + byte_offset + (offs_t)(char_line*40);
}
/* fetch data */
c = RAM ? RAM[read_addr] : space.read_byte(read_addr);
/* if bits 6 and 5 are zero, the byte contains a serial attribute */
if ((c & ((1 << 6) | (1 << 5))) == 0)
{
oric_vh_update_attribute(c);
/* display background colour when attribute has been found */
oric_vh_render_6pixels(bitmap, x, y, m_vh_state.active_foreground_colour, m_vh_state.active_background_colour, 0, (c & 0x080));
if (y < 200)
{
/* is hires active? */
hires_active = BIT(m_vh_state.mode, 2);
read_addr_base = m_vh_state.read_addr;
}
}
else
{
/* hires? */
if (hires_active)
{
UINT8 pixel_data = c & 0x03f;
/* plot hires pixels */
oric_vh_render_6pixels(bitmap,x,y,m_vh_state.active_foreground_colour, m_vh_state.active_background_colour, pixel_data, BIT(c, 7));
}
else
{
UINT8 char_index, char_data, ch_line;
char_index = (c & 0x07f);
ch_line = y & 7;
/* is double height set? */
if (BIT(m_vh_state.text_attributes, 1))
{
/* if char line is even, top half of character is displayed else bottom half */
UINT8 double_height_flag = BIT(y, 3);
/* calculate line to fetch */
ch_line = (ch_line>>1) + (double_height_flag<<2);
}
/* fetch pixel data for this char line */
char_data = m_vh_state.char_data[(char_index<<3) | ch_line] & 0x03f;
/* draw! */
oric_vh_render_6pixels(bitmap,x,y,
m_vh_state.active_foreground_colour,
m_vh_state.active_background_colour, char_data, BIT(c, 7));
}
}
x+=6;
}
/* after 200 lines have been drawn, force a change of the read address */
/* there are 200 lines of hires/text mode, then 24 lines of text mode */
/* the mode can't be changed in the last 24 lines. */
if (y==199)
{
/* mode */
read_addr_base = (offs_t)0x0bf68;
hires_active = 0;
}
}
return 0;
}
void oric_state::video_start()
{
// initialise variables
m_vh_state.active_foreground_colour = 0;
m_vh_state.active_background_colour = 0;
m_vh_state.foreground_colour = 0;
m_vh_state.background_colour = 0;
m_vh_state.mode = 0;
m_vh_state.text_attributes = 0;
m_vh_state.read_addr = 0;
m_vh_state.char_data = 0;
m_vh_state.char_base = 0;
/* initialise flash timer */
m_vh_state.flash_count = 0;
machine().scheduler().timer_pulse(attotime::from_hz(50), timer_expired_delegate(FUNC(oric_state::oric_vh_timer_callback),this));
/* mode */
oric_vh_update_attribute((1<<3)|(1<<4));
}