This commit is contained in:
couriersud 2015-02-01 13:39:41 +01:00
commit 2a8936c2fe
29 changed files with 385 additions and 372 deletions

View File

@ -256,13 +256,6 @@ typedef struct sqlite3 sqlite3;
typedef sqlite_int64 sqlite3_int64;
typedef sqlite_uint64 sqlite3_uint64;
/* pointer-sized values */
#ifdef PTR64
typedef sqlite3_uint64 FPTR;
#else
typedef unsigned int FPTR;
#endif
/*
** If compiling for a processor that lacks floating point support,
** substitute integer for floating-point.
@ -4389,7 +4382,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
*/
typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT ((sqlite3_destructor_type)(FPTR)-1)
#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
/*
** CAPI3REF: Setting The Result Of An SQL Function

View File

@ -650,9 +650,6 @@ ifeq ($(COMMAND_MODE),"legacy")
ARFLAGS = -crs
endif
endif
ifeq ($(TARGETOS),emscripten)
ARFLAGS = cr
endif
#-------------------------------------------------
@ -929,11 +926,19 @@ $(sort $(OBJDIRS)):
ifndef EXECUTABLE_DEFINED
$(EMULATOR): $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBBUS) $(LIBOPTIONAL) $(LIBEMU) $(LIBDASM) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(LUA_LIB) $(SQLITE3_LIB) $(WEB_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE)
EMULATOROBJLIST = $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBBUS) $(LIBOPTIONAL) $(LIBEMU) $(LIBDASM) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(LUA_LIB) $(SQLITE3_LIB) $(WEB_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE)
ifeq ($(TARGETOS),emscripten)
EMULATOROBJ = $(EMULATOROBJLIST:.a=.bc)
else
EMULATOROBJ = $(EMULATOROBJLIST)
endif
$(EMULATOR): $(EMULATOROBJ)
$(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ)
@echo Linking $@...
ifeq ($(TARGETOS),emscripten)
# Emscripten's linker seems to be stricter about the ordering of .a files
# Emscripten's linker seems to be stricter about the ordering of files
$(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) -Wl,--start-group $^ -Wl,--end-group $(LIBS) -o $@
else
$(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) $^ $(LIBS) -o $@
@ -1002,10 +1007,20 @@ $(DRIVLISTSRC): $(SRC)/$(TARGET)/$(SUBTARGET).lst $(MAKELIST_TARGET)
@echo Building driver list $<...
@$(MAKELIST) $< >$@
ifeq ($(TARGETOS),emscripten)
# Avoid using .a files with Emscripten, link to bitcode instead
$(OBJ)/%.a:
@echo Linking $@...
$(RM) $@
$(LD) $^ -o $@
$(OBJ)/%.bc: $(OBJ)/%.a
@cp $< $@
else
$(OBJ)/%.a:
@echo Archiving $@...
$(RM) $@
$(AR) $(ARFLAGS) $@ $^
endif
ifeq ($(TARGETOS),macosx)
$(OBJ)/%.o: $(SRC)/%.m | $(OSPREBUILD)

View File

@ -160,6 +160,7 @@ a2bus_device::a2bus_device(const machine_config &mconfig, device_type type, cons
void a2bus_device::device_start()
{
m_maincpu = machine().device<cpu_device>(m_cputag);
m_maincpu_space = &machine().device<cpu_device>(m_cputag)->space(AS_PROGRAM);
// resolve callbacks
m_out_irq_cb.resolve_safe();
@ -246,6 +247,30 @@ void a2bus_device::set_maincpu_halt(int state)
m_maincpu->set_input_line(INPUT_LINE_HALT, state);
}
UINT8 a2bus_device::dma_r(address_space &space, UINT16 offset)
{
m_maincpu_space->set_debugger_access(space.debugger_access());
return m_maincpu_space->read_byte(offset);
}
void a2bus_device::dma_w(address_space &space, UINT16 offset, UINT8 data)
{
m_maincpu_space->set_debugger_access(space.debugger_access());
m_maincpu_space->write_byte(offset, data);
}
UINT8 a2bus_device::dma_nospace_r(UINT16 offset)
{
return m_maincpu_space->read_byte(offset);
}
void a2bus_device::dma_nospace_w(UINT16 offset, UINT8 data)
{
m_maincpu_space->write_byte(offset, data);
}
void a2bus_device::recalc_inh(int slot)
{
m_out_inh_cb(ASSERT_LINE);

View File

@ -106,6 +106,10 @@ public:
void set_nmi_line(int state, int slot);
void set_maincpu_halt(int state);
void recalc_inh(int slot);
UINT8 dma_r(address_space &space, UINT16 offset);
void dma_w(address_space &space, UINT16 offset, UINT8 data);
UINT8 dma_nospace_r(UINT16 offset);
void dma_nospace_w(UINT16 offset, UINT8 data);
DECLARE_WRITE_LINE_MEMBER( irq_w );
DECLARE_WRITE_LINE_MEMBER( nmi_w );
@ -117,6 +121,7 @@ protected:
// internal state
cpu_device *m_maincpu;
address_space *m_maincpu_space;
devcb_write_line m_out_irq_cb;
devcb_write_line m_out_nmi_cb;
@ -144,12 +149,12 @@ public:
device_a2bus_card_interface(const machine_config &mconfig, device_t &device);
virtual ~device_a2bus_card_interface();
virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { printf("a2bus: unhandled read at C0n%x\n", offset); return 0; } // C0nX - /DEVSEL
virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to C0n%x\n", data, offset); }
virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { logerror("a2bus: unhandled read at C0n%x\n", offset); return 0; } // C0nX - /DEVSEL
virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to C0n%x\n", data, offset); }
virtual UINT8 read_cnxx(address_space &space, UINT8 offset) { return 0; } // CnXX - /IOSEL
virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to Cn%02x\n", data, offset); }
virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to Cn%02x\n", data, offset); }
virtual UINT8 read_c800(address_space &space, UINT16 offset) { return 0; } // C800 - /IOSTB
virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { printf("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); }
virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); }
virtual bool take_c800() { return true; } // override and return false if your card doesn't take over the c800 space
virtual UINT8 read_inh_rom(address_space &space, UINT16 offset) { return 0; }
virtual void write_inh_rom(address_space &space, UINT16 offset, UINT8 data) { }
@ -171,6 +176,15 @@ public:
void recalc_slot_inh() { m_a2bus->recalc_inh(m_slot); }
void set_maincpu_halt(int state) { m_a2bus->set_maincpu_halt(state); }
// pass through the original address space if any for debugger protection
// when debugging e.g. coprocessor cards (Z80 SoftCard etc).
UINT8 slot_dma_read(address_space &space, UINT16 offset) { return m_a2bus->dma_r(space, offset); }
void slot_dma_write(address_space &space, UINT16 offset, UINT8 data) { m_a2bus->dma_w(space, offset, data); }
// these versions forego that protection for when the DMA isn't coming from a debuggable CPU device
UINT8 slot_dma_read_no_space(UINT16 offset) { return m_a2bus->dma_nospace_r(offset); }
void slot_dma_write_no_space(UINT16 offset, UINT8 data) { m_a2bus->dma_nospace_w(offset, data); }
// inline configuration
static void static_set_a2bus_tag(device_t &device, const char *tag, const char *slottag);
public:

View File

@ -94,6 +94,7 @@ void a2bus_mcms1_device::device_start()
void a2bus_mcms1_device::device_reset()
{
m_mcms->set_bus_device(this);
}
// read once at c0n0 to disable 125 Hz IRQs
@ -290,7 +291,7 @@ void mcms_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
wptr = (m_table[v]<<8) | (m_acc[v]>>8);
m_rand = (m_acc[v]>>8) & 0x1f;
sample = (m_6502space->read_byte(wptr) ^ 0x80);
sample = (m_pBusDevice->slot_dma_read_no_space(wptr) ^ 0x80);
if (v & 1)
{
mixL += sample * m_vols[v];
@ -355,9 +356,6 @@ WRITE8_MEMBER(mcms_device::voiceregs_w)
WRITE8_MEMBER(mcms_device::control_w)
{
// keep the space (TODO: we need to define a formal DMA mechanism from machine/apple2 out to the slots)
m_6502space = &space;
m_stream->update();
switch (offset)

View File

@ -20,6 +20,8 @@
// TYPE DEFINITIONS
//**************************************************************************
class a2bus_mcms1_device;
class mcms_device : public device_t, public device_sound_interface
{
public:
@ -30,6 +32,8 @@ public:
DECLARE_WRITE8_MEMBER(control_w);
UINT8 get_pen_rand(void) { m_stream->update(); return m_rand; }
void set_bus_device(a2bus_mcms1_device *pDev) { m_pBusDevice = pDev; }
template<class _Object> static devcb_base &set_irq_cb(device_t &device, _Object wr) { return downcast<mcms_device &>(device).m_write_irq.set_callback(wr); }
devcb_write_line m_write_irq;
@ -43,8 +47,8 @@ protected:
private:
sound_stream *m_stream;
address_space *m_6502space;
emu_timer *m_timer, *m_clrtimer;
a2bus_mcms1_device *m_pBusDevice;
bool m_enabled;
UINT8 m_vols[16];
UINT8 m_table[16];

View File

@ -52,16 +52,14 @@ machine_config_constructor a2bus_softcard_device::device_mconfig_additions() con
a2bus_softcard_device::a2bus_softcard_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_a2bus_card_interface(mconfig, *this),
m_z80(*this, Z80_TAG),
m_6502space(NULL)
m_z80(*this, Z80_TAG)
{
}
a2bus_softcard_device::a2bus_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, A2BUS_SOFTCARD, "Microsoft SoftCard", tag, owner, clock, "a2softcard", __FILE__),
device_a2bus_card_interface(mconfig, *this),
m_z80(*this, Z80_TAG),
m_6502space(NULL)
m_z80(*this, Z80_TAG)
{
}
@ -82,7 +80,6 @@ void a2bus_softcard_device::device_reset()
{
m_bEnabled = false;
m_6502space = NULL;
m_FirstZ80Boot = true;
m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
}
@ -91,9 +88,6 @@ void a2bus_softcard_device::write_cnxx(address_space &space, UINT8 offset, UINT8
{
if (!m_bEnabled)
{
// steal the 6502's address space
m_6502space = &space;
m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
set_maincpu_halt(ASSERT_LINE);
@ -115,31 +109,31 @@ void a2bus_softcard_device::write_cnxx(address_space &space, UINT8 offset, UINT8
READ8_MEMBER( a2bus_softcard_device::dma_r )
{
if (m_6502space)
if (m_bEnabled)
{
if (offset <= 0xafff)
{
return m_6502space->read_byte(offset+0x1000);
return slot_dma_read(space, offset+0x1000);
}
else if (offset <= 0xbfff) // LC bank 2 d000-dfff
{
return m_6502space->read_byte((offset&0xfff) + 0xd000);
return slot_dma_read(space, (offset&0xfff) + 0xd000);
}
else if (offset <= 0xcfff) // LC e000-efff
{
return m_6502space->read_byte((offset&0xfff) + 0xe000);
return slot_dma_read(space, (offset&0xfff) + 0xe000);
}
else if (offset <= 0xdfff) // LC f000-ffff (or ROM?)
{
return m_6502space->read_byte((offset&0xfff) + 0xf000);
return slot_dma_read(space, (offset&0xfff) + 0xf000);
}
else if (offset <= 0xefff) // I/O space c000-cfff
{
return m_6502space->read_byte((offset&0xfff) + 0xc000);
return slot_dma_read(space, (offset&0xfff) + 0xc000);
}
else // zero page
{
return m_6502space->read_byte(offset&0xfff);
return slot_dma_read(space, offset&0xfff);
}
}
@ -153,31 +147,31 @@ READ8_MEMBER( a2bus_softcard_device::dma_r )
WRITE8_MEMBER( a2bus_softcard_device::dma_w )
{
if (m_6502space)
if (m_bEnabled)
{
if (offset <= 0xafff)
{
m_6502space->write_byte(offset+0x1000, data);
slot_dma_write(space, offset+0x1000, data);
}
else if (offset <= 0xbfff) // LC bank 2 d000-dfff
{
m_6502space->write_byte((offset&0xfff) + 0xd000, data);
slot_dma_write(space, (offset&0xfff) + 0xd000, data);
}
else if (offset <= 0xcfff) // LC e000-efff
{
m_6502space->write_byte((offset&0xfff) + 0xe000, data);
slot_dma_write(space, (offset&0xfff) + 0xe000, data);
}
else if (offset <= 0xdfff) // LC f000-ffff (or ROM?)
{
m_6502space->write_byte((offset&0xfff) + 0xf000, data);
slot_dma_write(space, (offset&0xfff) + 0xf000, data);
}
else if (offset <= 0xefff) // I/O space c000-cfff
{
m_6502space->write_byte((offset&0xfff) + 0xc000, data);
slot_dma_write(space, (offset&0xfff) + 0xc000, data);
}
else // zero page
{
m_6502space->write_byte(offset&0xfff, data);
slot_dma_write(space, offset&0xfff, data);
}
}
}

View File

@ -44,7 +44,6 @@ protected:
private:
bool m_bEnabled;
bool m_FirstZ80Boot;
address_space *m_6502space;
};
// device type definition

View File

@ -71,16 +71,14 @@ machine_config_constructor a2bus_themill_device::device_mconfig_additions() cons
a2bus_themill_device::a2bus_themill_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_a2bus_card_interface(mconfig, *this),
m_6809(*this, M6809_TAG),
m_6502space(NULL)
m_6809(*this, M6809_TAG)
{
}
a2bus_themill_device::a2bus_themill_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, A2BUS_THEMILL, "Stellation Two The Mill", tag, owner, clock, "a2themill", __FILE__),
device_a2bus_card_interface(mconfig, *this),
m_6809(*this, M6809_TAG),
m_6502space(NULL)
m_6809(*this, M6809_TAG)
{
}
@ -102,7 +100,6 @@ void a2bus_themill_device::device_start()
void a2bus_themill_device::device_reset()
{
m_bEnabled = false;
m_6502space = NULL;
m_flipAddrSpace = false;
m_6809Mode = false;
m_status = 0xc0; // OS9 loader relies on this
@ -135,8 +132,6 @@ void a2bus_themill_device::write_c0nx(address_space &space, UINT8 offset, UINT8
case 2: // 6809 reset
if (data & 0x80)
{
// steal the 6502's address space
m_6502space = &space;
m_6809->reset();
m_6809->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
@ -241,45 +236,42 @@ void a2bus_themill_device::write_c0nx(address_space &space, UINT8 offset, UINT8
READ8_MEMBER( a2bus_themill_device::dma_r )
{
if (m_6502space)
if (m_6809Mode)
{
if (m_6809Mode)
if (offset <= 0xafff)
{
if (offset <= 0xafff)
{
return m_6502space->read_byte(offset+0x1000);
}
else if (offset <= 0xbfff)
{
return m_6502space->read_byte((offset&0xfff) + 0xd000);
}
else if (offset <= 0xcfff)
{
return m_6502space->read_byte((offset&0xfff) + 0xe000);
}
else if (offset <= 0xdfff)
{
return m_6502space->read_byte((offset&0xfff) + 0xf000);
}
else if (offset <= 0xefff)
{
return m_6502space->read_byte((offset&0xfff) + 0xc000);
}
else // 6809 Fxxx -> 6502 ZP
{
return m_6502space->read_byte(offset&0xfff);
}
return slot_dma_read(space, offset+0x1000);
}
else if (offset <= 0xbfff)
{
return slot_dma_read(space, (offset&0xfff) + 0xd000);
}
else if (offset <= 0xcfff)
{
return slot_dma_read(space, (offset&0xfff) + 0xe000);
}
else if (offset <= 0xdfff)
{
return slot_dma_read(space, (offset&0xfff) + 0xf000);
}
else if (offset <= 0xefff)
{
return slot_dma_read(space, (offset&0xfff) + 0xc000);
}
else // 6809 Fxxx -> 6502 ZP
{
return slot_dma_read(space, offset&0xfff);
}
}
else
{
if (m_flipAddrSpace)
{
return slot_dma_read(space, offset^0x8000);
}
else
{
if (m_flipAddrSpace)
{
return m_6502space->read_byte(offset^0x8000);
}
else
{
return m_6502space->read_byte(offset);
}
return slot_dma_read(space, offset);
}
}
@ -293,45 +285,42 @@ READ8_MEMBER( a2bus_themill_device::dma_r )
WRITE8_MEMBER( a2bus_themill_device::dma_w )
{
if (m_6502space)
if (m_6809Mode)
{
if (m_6809Mode)
if (offset <= 0xafff)
{
if (offset <= 0xafff)
{
m_6502space->write_byte(offset+0x1000, data);
}
else if (offset <= 0xbfff)
{
m_6502space->write_byte((offset&0xfff) + 0xd000, data);
}
else if (offset <= 0xcfff)
{
m_6502space->write_byte((offset&0xfff) + 0xe000, data);
}
else if (offset <= 0xdfff)
{
m_6502space->write_byte((offset&0xfff) + 0xf000, data);
}
else if (offset <= 0xefff)
{
m_6502space->write_byte((offset&0xfff) + 0xc000, data);
}
else // 6809 Fxxx -> 6502 ZP
{
m_6502space->write_byte(offset&0xfff, data);
}
slot_dma_write(space, offset+0x1000, data);
}
else if (offset <= 0xbfff)
{
slot_dma_write(space, (offset&0xfff) + 0xd000, data);
}
else if (offset <= 0xcfff)
{
slot_dma_write(space, (offset&0xfff) + 0xe000, data);
}
else if (offset <= 0xdfff)
{
slot_dma_write(space, (offset&0xfff) + 0xf000, data);
}
else if (offset <= 0xefff)
{
slot_dma_write(space, (offset&0xfff) + 0xc000, data);
}
else // 6809 Fxxx -> 6502 ZP
{
slot_dma_write(space, offset&0xfff, data);
}
}
else
{
if (m_flipAddrSpace)
{
slot_dma_write(space, offset^0x8000, data);
}
else
{
if (m_flipAddrSpace)
{
m_6502space->write_byte(offset^0x8000, data);
}
else
{
m_6502space->write_byte(offset, data);
}
slot_dma_write(space, offset, data);
}
}
}

View File

@ -46,7 +46,6 @@ private:
bool m_bEnabled;
bool m_flipAddrSpace;
bool m_6809Mode;
address_space *m_6502space;
UINT8 m_status;
};

View File

@ -7,6 +7,7 @@
TODO:
- unemulated opcodes (need more testing material)
- support external program map
- STATUS pin(wildfire.c sound?)
- add 50/60hz timer
- add S2200/S2400
@ -15,6 +16,8 @@
#include "amis2000.h"
#include "debugger.h"
#include "amis2000op.inc"
// S2000 is the most basic one, 64 nibbles internal RAM and 1KB internal ROM
// S2150 increased RAM to 80 nibbles and ROM to 1.5KB
@ -25,12 +28,13 @@ const device_type AMI_S2150 = &device_creator<amis2150_device>;
// internal memory maps
static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_device)
AM_RANGE(0x0000, 0x03ff) AM_ROM AM_MIRROR(0x1c00)
AM_RANGE(0x0000, 0x03ff) AM_ROM
ADDRESS_MAP_END
static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_device)
AM_RANGE(0x0000, 0x03ff) AM_ROM AM_MIRROR(0x1800)
AM_RANGE(0x0400, 0x05ff) AM_ROM AM_MIRROR(0x1a00)
AM_RANGE(0x0000, 0x03ff) AM_ROM
AM_RANGE(0x0400, 0x05ff) AM_NOP
AM_RANGE(0x0600, 0x07ff) AM_ROM
ADDRESS_MAP_END
@ -116,7 +120,7 @@ offs_t amis2000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8
enum
{
S2000_PC=1, S2000_BL, S2000_BU,
S2000_ACC, S2000_E, S2000_CARRY
S2000_ACC, S2000_E, S2000_CY
};
void amis2000_device::device_start()
@ -138,9 +142,9 @@ void amis2000_device::device_start()
m_pc = 0;
m_ppr = 0;
m_pbr = 0;
m_pp_index = 0;
m_skip = false;
m_op = 0;
m_prev_op = 0;
m_f = 0;
m_carry = 0;
m_bl = 0;
@ -150,6 +154,8 @@ void amis2000_device::device_start()
m_i = 0;
m_k = 0;
m_d = 0;
m_d_active = false;
m_d_polarity = 0;
m_a = 0;
// register for savestates
@ -157,9 +163,9 @@ void amis2000_device::device_start()
save_item(NAME(m_pc));
save_item(NAME(m_ppr));
save_item(NAME(m_pbr));
save_item(NAME(m_pp_index));
save_item(NAME(m_skip));
save_item(NAME(m_op));
save_item(NAME(m_prev_op));
save_item(NAME(m_f));
save_item(NAME(m_carry));
save_item(NAME(m_bl));
@ -169,6 +175,8 @@ void amis2000_device::device_start()
save_item(NAME(m_i));
save_item(NAME(m_k));
save_item(NAME(m_d));
save_item(NAME(m_d_active));
save_item(NAME(m_d_polarity));
save_item(NAME(m_a));
// register state for debugger
@ -177,7 +185,7 @@ void amis2000_device::device_start()
state_add(S2000_BU, "BU", m_bu ).formatstr("%01X");
state_add(S2000_ACC, "ACC", m_acc ).formatstr("%01X");
state_add(S2000_E, "E", m_e ).formatstr("%01X");
state_add(S2000_CARRY, "CARRY", m_carry ).formatstr("%01X");
state_add(S2000_CY, "CY", m_carry ).formatstr("%01X");
state_add(STATE_GENPC, "curpc", m_pc).formatstr("%04X").noshow();
state_add(STATE_GENFLAGS, "GENFLAGS", m_f).formatstr("%6s").noshow();
@ -198,10 +206,11 @@ void amis2000_device::device_reset()
m_op = 0;
// clear i/o
m_d_polarity = 0;
m_d = 0; d_latch_out(false);
m_a = 0; m_write_a(0, 0, 0xffff);
m_i = 0;
m_k = 0;
m_d = 0; m_write_d(0, 0, 0xff);
m_a = 0; m_write_a(0, 0, 0xffff);
}
@ -210,22 +219,14 @@ void amis2000_device::device_reset()
// execute
//-------------------------------------------------
#include "amis2000op.inc"
void amis2000_device::execute_run()
{
while (m_icount > 0)
{
m_icount--;
// increase PP prefix count
if ((m_op & 0xf0) == 0x60)
{
if (m_pp_index < 2)
m_pp_index++;
}
else
m_pp_index = 0;
// remember previous opcode
m_prev_op = m_op;
debugger_instruction_hook(this, m_pc);
m_op = m_program->read_byte(m_pc);
@ -251,7 +252,7 @@ void amis2000_device::execute_run()
switch (m_op)
{
case 0x00: op_nop(); break;
case 0x01: op_illegal(); break; // reserved for devkit-use
case 0x01: op_halt(); break;
case 0x02: op_rt(); break;
case 0x03: op_rts(); break;
case 0x04: op_psh(); break;

View File

@ -80,9 +80,9 @@ protected:
UINT16 m_pc; // 13-bit program counter
UINT8 m_ppr; // prepared page register (PP 1)
UINT8 m_pbr; // prepared bank register (PP 2)
UINT8 m_pp_index; // number of handled PP prefixes
bool m_skip; // skip next opcode, including PP prefixes
UINT8 m_op;
UINT8 m_prev_op; // previous opcode, needed for PP, LAI, LB*
UINT8 m_f; // generic flags: 2 on 2000/2150, 6 on 2200/2400
UINT8 m_carry; // carry flag
UINT8 m_bl; // 4-bit ram index x
@ -92,6 +92,8 @@ protected:
UINT8 m_i; // 4-bit i-pins latch
UINT8 m_k; // 4-bit k-pins latch
UINT8 m_d; // 8-bit d-pins latch
bool m_d_active; // d-pins available for direct i/o(floating), or outputting d-latch
UINT8 m_d_polarity; // invert d-latch output
UINT16 m_a; // 13-bit a-pins latch (master strobe latch)
devcb_read8 m_read_k;
@ -106,7 +108,7 @@ protected:
void ram_w(UINT8 data);
void pop_callstack();
void push_callstack();
void op_illegal();
void d_latch_out(bool active);
void op_lai();
void op_lab();
@ -141,6 +143,7 @@ protected:
void op_rt();
void op_rts();
void op_nop();
void op_halt();
void op_szc();
void op_szm();

View File

@ -17,9 +17,8 @@ enum e_mnemonics
mLAM, mXC, mXCI, mXCD, mSTM, mRSM,
mADD, mADCS, mADIS, mAND, mXOR, mCMA, mSTC, mRSC, mSF1, mRF1, mSF2, mRF2,
mSAM, mSZM, mSBE, mSZC, mSOS, mSZK, mSZI, mTF1, mTF2,
mPP, mJMP, mJMS, mRT, mRTS, mNOP,
mINP, mOUT, mDISB, mDISN, mMVS, mPSH, mPSL, mEUR,
mILL
mPP, mJMP, mJMS, mRT, mRTS, mNOP, mHALT,
mINP, mOUT, mDISB, mDISN, mMVS, mPSH, mPSL, mEUR
};
static const char *const s_mnemonics[] =
@ -28,9 +27,8 @@ static const char *const s_mnemonics[] =
"LAM", "XC", "XCI", "XCD", "STM", "RSM",
"ADD", "ADCS", "ADIS", "AND", "XOR", "CMA", "STC", "RSC", "SF1", "RF1", "SF2", "RF2",
"SAM", "SZM", "SBE", "SZC", "SOS", "SZK", "SZI", "TF1", "TF2",
"PP", "JMP", "JMS", "RT", "RTS", "NOP",
"INP", "OUT", "DISB", "DISN", "MVS", "PSH", "PSL", "EUR",
"?"
"PP", "JMP", "JMS", "RT", "RTS", "NOP", "HALT",
"INP", "OUT", "DISB", "DISN", "MVS", "PSH", "PSL", "EUR"
};
@ -43,9 +41,8 @@ static const UINT32 s_flags[] =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, _OVER, _OUT, _OUT, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0
0, 0, _OVER, _OUT, _OUT, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
@ -55,16 +52,15 @@ static const int s_bits[] =
-2, -2, -2, -2, 2, 2,
0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 0,
-4, 6, 6, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0
-4, 6, 6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
static const UINT8 s2000_mnemonic[0x100] =
{
/* 0x00 */
mNOP, mILL, mRT, mRTS, mPSH, mPSL, mAND, mSOS,
mNOP, mHALT, mRT, mRTS, mPSH, mPSL, mAND, mSOS,
mSBE, mSZC, mSTC, mRSC, mLAE, mXAE, mINP, mEUR,
/* 0x10 */
mCMA, mXABU, mLAB, mXAB, mADCS, mXOR, mADD, mSAM,

View File

@ -4,13 +4,13 @@
UINT8 amis2000_device::ram_r()
{
UINT16 address = m_bu << m_bu_bits | m_bl;
UINT16 address = m_bu << 4 | m_bl;
return m_data->read_byte(address) & 0xf;
}
void amis2000_device::ram_w(UINT8 data)
{
UINT16 address = m_bu << m_bu_bits | m_bl;
UINT16 address = m_bu << 4 | m_bl;
m_data->write_byte(address, data & 0xf);
}
@ -33,9 +33,10 @@ void amis2000_device::push_callstack()
m_callstack[0] = m_pc & m_callstack_mask;
}
void amis2000_device::op_illegal()
void amis2000_device::d_latch_out(bool active)
{
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
m_write_d(0, active ? (m_d ^ m_d_polarity) : 0, 0xff);
m_d_active = active;
}
@ -44,10 +45,14 @@ void amis2000_device::op_illegal()
void amis2000_device::op_lai()
{
// LAI X: load ACC with X, select I and K inputs
UINT8 param = m_op & 0x0f;
m_acc = param;
m_i = m_read_i(0, 0xff) & param;
m_k = m_read_k(0, 0xff) & param;
// note: only execute the first one in a sequence of LAI
if ((m_prev_op & 0xf0) != (m_op & 0xf0))
{
UINT8 param = m_op & 0x0f;
m_acc = param;
m_i = m_read_i(0, 0xff) & param;
m_k = m_read_k(0, 0xff) & param;
}
}
void amis2000_device::op_lab()
@ -89,33 +94,49 @@ void amis2000_device::op_xae()
void amis2000_device::op_lbe()
{
// LBE Y: load BU with Y, load BL with E
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = m_e;
// note: only execute the first one in a sequence of LB*
if ((m_prev_op & 0xf0) != (m_op & 0xf0))
{
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = m_e;
}
}
void amis2000_device::op_lbep()
{
// LBEP Y: load BU with Y, load BL with E+1
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = m_e + 1;
// note: only execute the first one in a sequence of LB*
if ((m_prev_op & 0xf0) != (m_op & 0xf0))
{
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = (m_e + 1) & 0xf;
}
}
void amis2000_device::op_lbz()
{
// LBZ Y: load BU with Y, load BL with 0
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = 0;
// note: only execute the first one in a sequence of LB*
if ((m_prev_op & 0xf0) != (m_op & 0xf0))
{
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = 0;
}
}
void amis2000_device::op_lbf()
{
// LBF Y: load BU with Y, load BL with 15
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = 0xf;
// note: only execute the first one in a sequence of LB*
if ((m_prev_op & 0xf0) != (m_op & 0xf0))
{
UINT8 param = m_op & 0x03;
m_bu = param & m_bu_mask;
m_bl = 0xf;
}
}
@ -126,7 +147,7 @@ void amis2000_device::op_lam()
// LAM _Y: load ACC with RAM, xor BU with _Y
m_acc = ram_r();
UINT8 param = ~m_op & 0x03;
m_bu ^= param & m_bu_mask;
m_bu ^= (param & m_bu_mask);
}
void amis2000_device::op_xc()
@ -136,7 +157,7 @@ void amis2000_device::op_xc()
m_acc = ram_r();
ram_w(old_acc);
UINT8 param = ~m_op & 0x03;
m_bu ^= param & m_bu_mask;
m_bu ^= (param & m_bu_mask);
}
void amis2000_device::op_xci()
@ -175,21 +196,22 @@ void amis2000_device::op_rsm()
void amis2000_device::op_inp()
{
// INP: input D-pins to ACC and RAM
op_illegal();
UINT8 in = m_d_active ? m_d : m_read_d(0, 0xff);
m_acc = in & 0xf;
ram_w(in >> 4 & 0xf);
}
void amis2000_device::op_out()
{
// OUT: pulse output ACC and RAM to D-pins
op_illegal();
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
}
void amis2000_device::op_disb()
{
// DISB: set D-latch to ACC and RAM directly
m_d = m_acc | ram_r() << 4;
m_write_d(0, m_d, 0xff);
// TODO: exit from floating mode on D-pins
d_latch_out(true);
}
void amis2000_device::op_disn()
@ -201,15 +223,14 @@ void amis2000_device::op_disn()
0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47
};
m_d = lut_segment_decoder[m_acc] | (m_carry ? 0x80 : 0x00);
m_write_d(0, m_d, 0xff);
// TODO: exit from floating mode on D-pins
d_latch_out(true);
}
void amis2000_device::op_mvs()
{
// MVS: output master strobe latch to A-pins
d_latch_out(false);
m_write_a(0, m_a, 0xffff);
// TODO: enter floating mode on D-pins
}
void amis2000_device::op_psh()
@ -224,7 +245,7 @@ void amis2000_device::op_psh()
case 0xe:
// exit from floating mode on D-pins
// ?
d_latch_out(true);
break;
case 0xf:
@ -251,7 +272,7 @@ void amis2000_device::op_psl()
case 0xe:
// enter floating mode on D-pins
// ?
d_latch_out(false);
break;
case 0xf:
@ -268,8 +289,9 @@ void amis2000_device::op_psl()
void amis2000_device::op_eur()
{
// EUR: set timer frequency(European) and D-latch polarity
op_illegal();
// EUR: set timer frequency(European) and D-latch polarity, via ACC
m_d_polarity = (m_acc & 1) ? 0x00 : 0xff;
d_latch_out(m_d_active); // refresh
}
@ -279,7 +301,7 @@ void amis2000_device::op_pp()
{
// PP _X: prepare page/bank with _X
UINT8 param = ~m_op & 0x0f;
if (m_pp_index == 0)
if ((m_prev_op & 0xf0) != (m_op & 0xf0))
m_ppr = param;
else
m_pbr = param & 7;
@ -290,15 +312,12 @@ void amis2000_device::op_jmp()
// JMP X: jump to X(+PP)
UINT16 mask = 0x3f;
UINT16 param = m_op & mask;
if (m_pp_index > 0)
// if previous opcode was PP, change PC high bits too
if ((m_prev_op & 0xf0) == 0x60)
{
param |= m_ppr << 6;
mask |= 0x3c0;
}
if (m_pp_index > 1)
{
param |= m_pbr << 10;
mask |= 0x1c00;
param |= (m_ppr << 6) | (m_pbr << 10);
mask = 0x1fff;
}
m_pc = (m_pc & ~mask) | param;
}
@ -308,13 +327,11 @@ void amis2000_device::op_jms()
// JMS X: call to X(+PP)
m_icount--;
push_callstack();
if (m_pp_index == 0)
{
// subroutines default location is page 15
m_ppr = 0xf;
m_pp_index++;
}
op_jmp();
// subroutines default location is page 15
if ((m_prev_op & 0xf0) != 0x60)
m_pc |= 0x3c0;
}
void amis2000_device::op_rt()
@ -335,6 +352,12 @@ void amis2000_device::op_nop()
// NOP: no operation
}
void amis2000_device::op_halt()
{
// HALT: debugger breakpoint for devkit-use
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
}
// Skip Instructions
@ -378,19 +401,19 @@ void amis2000_device::op_sam()
void amis2000_device::op_sos()
{
// SOS: skip next on SF(timer output), clear SF
op_illegal();
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
}
void amis2000_device::op_tf1()
{
// TF1: skip next on flag 1
m_skip = (m_f & 0x01);
m_skip = (m_f & 0x01) ? true : false;
}
void amis2000_device::op_tf2()
{
// TF2: skip next on flag 2
m_skip = (m_f & 0x02);
m_skip = (m_f & 0x02) ? true : false;
}

View File

@ -73,8 +73,8 @@ private:
static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_vreg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_VECTOR_REGISTER, regnum); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(base))); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
// operators
bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }

View File

@ -73,8 +73,8 @@ private:
static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline be_parameter make_vreg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_VECTOR_REGISTER, regnum); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(base))); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
// operators
bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }

View File

@ -305,7 +305,7 @@ namespace uml
parameter(UINT64 val) : m_type(PTYPE_IMMEDIATE), m_value(val) { }
parameter(operand_size size, memory_scale scale) : m_type(PTYPE_SIZE_SCALE), m_value((scale << 4) | size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); assert(scale >= SCALE_x1 && scale <= SCALE_x8); }
parameter(operand_size size, memory_space space) : m_type(PTYPE_SIZE_SPACE), m_value((space << 4) | size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); assert(space >= SPACE_PROGRAM && space <= SPACE_IO); }
parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(static_cast<parameter_value>(reinterpret_cast<FPTR>(&handle))) { }
parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(reinterpret_cast<parameter_value>(&handle)) { }
parameter(code_label &label) : m_type(PTYPE_CODE_LABEL), m_value(label) { }
// creators for types that don't safely default
@ -313,11 +313,11 @@ namespace uml
static inline parameter make_freg(int regnum) { assert(regnum >= REG_F0 && regnum < REG_F_END); return parameter(PTYPE_FLOAT_REGISTER, regnum); }
static inline parameter make_vreg(int regnum) { assert(regnum >= REG_V0 && regnum < REG_V_END); return parameter(PTYPE_VECTOR_REGISTER, regnum); }
static inline parameter make_mapvar(int mvnum) { assert(mvnum >= MAPVAR_M0 && mvnum < MAPVAR_END); return parameter(PTYPE_MAPVAR, mvnum); }
static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(base))); }
static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(base)); }
static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(const_cast<void *>(base))); }
static inline parameter make_size(operand_size size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); return parameter(PTYPE_SIZE, size); }
static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<char *>(string)))); }
static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, static_cast<parameter_value>(reinterpret_cast<FPTR>(func))); }
static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, reinterpret_cast<parameter_value>(const_cast<char *>(string))); }
static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, reinterpret_cast<parameter_value>(func)); }
static inline parameter make_rounding(float_rounding_mode mode) { assert(mode >= ROUND_TRUNC && mode <= ROUND_DEFAULT); return parameter(PTYPE_ROUNDING, mode); }
// operators

View File

@ -264,98 +264,6 @@ bool software_info::has_multiple_parts(const char *interface) const
//**************************************************************************
// CONST STRING POOL
//**************************************************************************
//-------------------------------------------------
// const_string_pool - constructor
//-------------------------------------------------
const_string_pool::const_string_pool()
{
}
//-------------------------------------------------
// add - add a string to the string pool
//-------------------------------------------------
const char *const_string_pool::add(const char *string)
{
// if NULL or a small number (for some hash strings), just return as-is
if (FPTR(string) < 0x100)
return string;
// scan to find space
for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next())
{
const char *result = chunk->add(string);
if (result != NULL)
return result;
}
// no space anywhere, create a new pool and prepend it (so it gets used first)
const char *result = m_chunklist.prepend(*global_alloc(pool_chunk)).add(string);
assert(result != NULL);
return result;
}
//-------------------------------------------------
// contains - determine if the given string
// pointer lives in the pool
//-------------------------------------------------
bool const_string_pool::contains(const char *string)
{
// if NULL or a small number (for some hash strings), then yes, effectively
if (FPTR(string) < 0x100)
return true;
// scan to find it
for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next())
if (chunk->contains(string))
return true;
return false;
}
//-------------------------------------------------
// pool_chunk - constructor
//-------------------------------------------------
const_string_pool::pool_chunk::pool_chunk()
: m_next(NULL),
m_used(0)
{
}
//-------------------------------------------------
// add - add a string to this pool
//-------------------------------------------------
const char *const_string_pool::pool_chunk::add(const char *string)
{
// get the length of the string (no string can be longer than a full pool)
int bytes = strlen(string) + 1;
assert(bytes < POOL_SIZE);
// if too big, return NULL
if (m_used + bytes > POOL_SIZE)
return NULL;
// allocate, copy, and return the memory
char *dest = &m_buffer[m_used];
m_used += bytes;
memcpy(dest, string, bytes);
return dest;
}
//**************************************************************************
// SOFTWARE LIST DEVICE
//**************************************************************************

View File

@ -73,7 +73,7 @@ void ui_menu_input_groups::handle()
/* process the menu */
const ui_menu_event *menu_event = process(0);
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT)
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)((FPTR)menu_event->itemref)-1))));
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)(menu_event->itemref)-1))));
}

View File

@ -151,7 +151,7 @@ void ui_menu_main::handle()
/* process the menu */
const ui_menu_event *menu_event = process(0);
if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) {
switch((long long)((FPTR) menu_event->itemref)) {
switch((long long)(menu_event->itemref)) {
case INPUT_GROUPS:
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
break;

View File

@ -615,6 +615,7 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
static const unsigned char sos_block1[4] = { 0xc9, 0x20, 0xf0, 0x3e };
static const unsigned char a3a2emul_block1[6] = { 0x8d, 0xd0, 0x03, 0x4c, 0xc7, 0xa4 };
static const unsigned char cpm22_block1[8] = { 0xa2, 0x55, 0xa9, 0x00, 0x9d, 0x00, 0x0d, 0xca };
io_generic_read(io, sector_data, fpos, 256*16);
@ -656,6 +657,10 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
m_prodos_order = true;
} // check for a later version of the Pascal boot block
else if (!memcmp(pascal2_block1, &sector_data[0x100], 4))
{
m_prodos_order = true;
} // check for CP/M disks in ProDOS order
else if (!memcmp(cpm22_block1, &sector_data[0x100], 8))
{
m_prodos_order = true;
}

View File

@ -49,7 +49,7 @@ inline INT32 bitmap_t::compute_rowpixels(int width, int xslop)
inline void bitmap_t::compute_base(int xslop, int yslop)
{
m_base = m_alloc + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
UINT64 aligned_base = ((static_cast<UINT64>(reinterpret_cast<FPTR>(m_base)) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
UINT64 aligned_base = ((reinterpret_cast<UINT64>(m_base) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
m_base = reinterpret_cast<void *>(aligned_base);
}

View File

@ -14,6 +14,14 @@
#include "sound/ay8910.h"
void fastfred_state::machine_start()
{
save_item(NAME(m_charbank));
save_item(NAME(m_colorbank));
save_item(NAME(m_nmi_mask));
save_item(NAME(m_sound_nmi_mask));
}
// This routine is a big hack, but the only way I can get the game working
// without knowing anything about the way the protection chip works.
// These values were derived based on disassembly of the code. Usually, it
@ -124,6 +132,7 @@ READ8_MEMBER(fastfred_state::boggy84_custom_io_r)
MACHINE_START_MEMBER(fastfred_state,imago)
{
machine_start();
m_gfxdecode->gfx(1)->set_source(m_imago_sprites);
}
@ -1039,13 +1048,13 @@ DRIVER_INIT_MEMBER(fastfred_state,imago)
m_hardware_type = 3;
}
GAME( 1982, flyboy, 0, fastfred, flyboy, fastfred_state, flyboy, ROT90, "Kaneko", "Fly-Boy", 0 )
GAME( 1982, flyboyb, flyboy, fastfred, flyboy, fastfred_state, flyboyb, ROT90, "bootleg", "Fly-Boy (bootleg)", 0 )
GAME( 1982, fastfred, flyboy, fastfred, fastfred, fastfred_state, fastfred, ROT90, "Kaneko (Atari license)", "Fast Freddie", 0 )
GAME( 1983, jumpcoas, 0, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko", "Jump Coaster", 0 )
GAME( 1983, jumpcoast,jumpcoas, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko (Taito license)", "Jump Coaster (Taito)", 0 )
GAME( 1983, boggy84, 0, jumpcoas, boggy84, fastfred_state, boggy84, ROT90, "Kaneko", "Boggy '84", 0 )
GAME( 1983, boggy84b, boggy84, jumpcoas, boggy84, fastfred_state, boggy84b, ROT90, "bootleg (Eddie's Games)", "Boggy '84 (bootleg)", 0 )
GAME( 1986, redrobin, 0, fastfred, redrobin, fastfred_state, flyboyb, ROT90, "Elettronolo", "Red Robin", 0 )
GAME( 1982, flyboy, 0, fastfred, flyboy, fastfred_state, flyboy, ROT90, "Kaneko", "Fly-Boy", GAME_SUPPORTS_SAVE )
GAME( 1982, flyboyb, flyboy, fastfred, flyboy, fastfred_state, flyboyb, ROT90, "bootleg", "Fly-Boy (bootleg)", GAME_SUPPORTS_SAVE )
GAME( 1982, fastfred, flyboy, fastfred, fastfred, fastfred_state, fastfred, ROT90, "Kaneko (Atari license)", "Fast Freddie", GAME_SUPPORTS_SAVE )
GAME( 1983, jumpcoas, 0, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko", "Jump Coaster", GAME_SUPPORTS_SAVE )
GAME( 1983, jumpcoast,jumpcoas, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko (Taito license)", "Jump Coaster (Taito)", GAME_SUPPORTS_SAVE )
GAME( 1983, boggy84, 0, jumpcoas, boggy84, fastfred_state, boggy84, ROT90, "Kaneko", "Boggy '84", GAME_SUPPORTS_SAVE )
GAME( 1983, boggy84b, boggy84, jumpcoas, boggy84, fastfred_state, boggy84b, ROT90, "bootleg (Eddie's Games)", "Boggy '84 (bootleg)", GAME_SUPPORTS_SAVE )
GAME( 1986, redrobin, 0, fastfred, redrobin, fastfred_state, flyboyb, ROT90, "Elettronolo", "Red Robin", GAME_SUPPORTS_SAVE )
GAME( 1984, imago, 0, imago, imago, fastfred_state, imago, ROT90, "Acom", "Imago (cocktail set)", 0 )
GAME( 1983, imagoa, imago, imago, imagoa, fastfred_state, imago, ROT90, "Acom", "Imago (no cocktail set)", 0 )

View File

@ -12,34 +12,36 @@ class fastfred_state : public galaxold_state
public:
fastfred_state(const machine_config &mconfig, device_type type, const char *tag)
: galaxold_state(mconfig, type, tag),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_attributesram(*this, "attributesram"),
m_background_color(*this, "bgcolor"),
m_imago_fg_videoram(*this, "imago_fg_vram"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_imago_fg_videoram(*this, "imago_fg_vram") { }
UINT8 m_imago_sprites[0x800*3];
UINT16 m_imago_sprites_address;
UINT8 m_imago_sprites_bank;
int m_hardware_type;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_attributesram;
optional_shared_ptr<UINT8> m_background_color;
optional_shared_ptr<UINT8> m_imago_fg_videoram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
int m_hardware_type;
UINT16 m_charbank;
UINT8 m_colorbank;
UINT8 m_nmi_mask;
UINT8 m_sound_nmi_mask;
UINT8 m_imago_sprites[0x800*3];
UINT16 m_imago_sprites_address;
UINT8 m_imago_sprites_bank;
tilemap_t *m_bg_tilemap;
tilemap_t *m_fg_tilemap;
tilemap_t *m_web_tilemap;
UINT8 m_nmi_mask;
UINT8 m_sound_nmi_mask;
DECLARE_READ8_MEMBER(fastfred_custom_io_r);
DECLARE_READ8_MEMBER(flyboy_custom1_io_r);
DECLARE_READ8_MEMBER(flyboy_custom2_io_r);
@ -51,26 +53,6 @@ public:
DECLARE_READ8_MEMBER(imago_sprites_offset_r);
DECLARE_WRITE8_MEMBER(nmi_mask_w);
DECLARE_WRITE8_MEMBER(sound_nmi_mask_w);
DECLARE_DRIVER_INIT(fastfred);
DECLARE_DRIVER_INIT(flyboy);
DECLARE_DRIVER_INIT(flyboyb);
DECLARE_DRIVER_INIT(imago);
DECLARE_DRIVER_INIT(boggy84);
DECLARE_DRIVER_INIT(jumpcoas);
DECLARE_DRIVER_INIT(boggy84b);
TILE_GET_INFO_MEMBER(get_tile_info);
TILE_GET_INFO_MEMBER(imago_get_tile_info_bg);
TILE_GET_INFO_MEMBER(imago_get_tile_info_fg);
TILE_GET_INFO_MEMBER(imago_get_tile_info_web);
DECLARE_VIDEO_START(fastfred);
DECLARE_PALETTE_INIT(fastfred);
DECLARE_MACHINE_START(imago);
DECLARE_VIDEO_START(imago);
UINT32 screen_update_fastfred(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(fastfred_videoram_w);
DECLARE_WRITE8_MEMBER(fastfred_attributes_w);
DECLARE_WRITE8_MEMBER(fastfred_charbank1_w);
@ -79,7 +61,32 @@ public:
DECLARE_WRITE8_MEMBER(fastfred_colorbank2_w);
DECLARE_WRITE8_MEMBER(fastfred_flip_screen_x_w);
DECLARE_WRITE8_MEMBER(fastfred_flip_screen_y_w);
DECLARE_WRITE8_MEMBER(imago_fg_videoram_w);
DECLARE_WRITE8_MEMBER(imago_charbank_w);
DECLARE_DRIVER_INIT(fastfred);
DECLARE_DRIVER_INIT(flyboy);
DECLARE_DRIVER_INIT(flyboyb);
DECLARE_DRIVER_INIT(imago);
DECLARE_DRIVER_INIT(boggy84);
DECLARE_DRIVER_INIT(jumpcoas);
DECLARE_DRIVER_INIT(boggy84b);
TILE_GET_INFO_MEMBER(get_tile_info);
TILE_GET_INFO_MEMBER(imago_get_tile_info_bg);
TILE_GET_INFO_MEMBER(imago_get_tile_info_fg);
TILE_GET_INFO_MEMBER(imago_get_tile_info_web);
INTERRUPT_GEN_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
virtual void machine_start();
DECLARE_PALETTE_INIT(fastfred);
DECLARE_MACHINE_START(imago);
DECLARE_VIDEO_START(fastfred);
DECLARE_VIDEO_START(imago);
UINT32 screen_update_fastfred(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};

View File

@ -345,6 +345,24 @@ VIDEO_START_MEMBER(fastfred_state,imago)
/* web colors */
m_palette->set_pen_color(256+64+0,rgb_t(0x50,0x00,0x00));
m_palette->set_pen_color(256+64+1,rgb_t(0x00,0x00,0x00));
save_item(NAME(m_imago_sprites));
save_item(NAME(m_imago_sprites_address));
save_item(NAME(m_imago_sprites_bank));
// galaxold starfield related save states. Something's still missing here.
save_item(NAME(m_stars_on));
save_item(NAME(m_stars_blink_state));
save_item(NAME(m_timer_adjusted));
save_item(NAME(m_stars_colors_start));
save_item(NAME(m_stars_scrollpos));
for (int i = 0; i < STAR_COUNT; i++)
{
save_item(NAME(m_stars[i].x), i);
save_item(NAME(m_stars[i].y), i);
save_item(NAME(m_stars[i].color), i);
}
}
UINT32 fastfred_state::screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)

View File

@ -31,6 +31,9 @@ public:
required_device<cpu_device> m_maincpu;
required_device<speaker_sound_device> m_speaker;
DECLARE_WRITE8_MEMBER(write_d);
DECLARE_WRITE16_MEMBER(write_a);
virtual void machine_start();
};
@ -41,7 +44,13 @@ public:
***************************************************************************/
//..
WRITE8_MEMBER(wildfire_state::write_d)
{
}
WRITE16_MEMBER(wildfire_state::write_a)
{
}
@ -52,6 +61,11 @@ public:
***************************************************************************/
static INPUT_PORTS_START( wildfire )
PORT_START("IN1") // I
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Shooter Button")
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Flipper")
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Flipper")
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
@ -71,6 +85,9 @@ static MACHINE_CONFIG_START( wildfire, wildfire_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK)
MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1"))
MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d))
MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a))
MCFG_DEFAULT_LAYOUT(layout_wildfire)
@ -91,8 +108,9 @@ MACHINE_CONFIG_END
***************************************************************************/
ROM_START( wildfire )
ROM_REGION( 0x0600, "maincpu", 0 )
ROM_LOAD( "us4341385", 0x0000, 0x0600, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums)
ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 )
ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums)
ROM_CONTINUE( 0x0600, 0x0200 )
ROM_END

View File

@ -452,7 +452,7 @@ void osd_midi_device_pm::write(UINT8 data)
}
#else
#include "modules/osdmodule.h"
#include "netdev_module.h"
#include "midi_module.h"
MODULE_NOT_SUPPORTED(pm_module, OSD_MIDI_PROVIDER, "pm")
#endif

View File

@ -103,7 +103,8 @@ static const translation_info gcc_translate[] =
// warning C4711: function 'xxx' selected for automatic inline expansion // optimized only
// warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation
// warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx'
{ VS7, "-Wall", "/Wall /W4 /wd4003 /wd4018 /wd4061 /wd4100 /wd4127 /wd4131 /wd4141 /wd4146 /wd4150 /wd4189 /wd4201 /wd4242 /wd4244 /wd4250 /wd4255 /wd4296 /wd4310 /wd4324 /wd4347 /wd4435 /wd4510 /wd4512 /wd4514 /wd4571 /wd4610 /wd4619 /wd4625 /wd4626 /wd4668 /wd4702 /wd4706 /wd4710 /wd4711 /wd4805 /wd4820" },
// warning C4826: Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior. // 32-bit only
{ VS7, "-Wall", "/Wall /W4 /wd4003 /wd4018 /wd4061 /wd4100 /wd4127 /wd4131 /wd4141 /wd4146 /wd4150 /wd4189 /wd4201 /wd4242 /wd4244 /wd4250 /wd4255 /wd4296 /wd4310 /wd4324 /wd4347 /wd4435 /wd4510 /wd4512 /wd4514 /wd4571 /wd4610 /wd4619 /wd4625 /wd4626 /wd4668 /wd4702 /wd4706 /wd4710 /wd4711 /wd4805 /wd4820 /wd4826" },
{ 0, "-Wall", "/W0" },
{ VS7, "-Wno-unused", "/wd4100 /wd4101 /wd4102 /wd4505" },
{ 0, "-Wno-sign-compare", "/wd4365 /wd4389 /wd4245 /wd4388" },

View File

@ -13,14 +13,18 @@
#ifdef _MSC_VER
#include <assert.h>
#include <malloc.h>
#if _MSC_VER < 1800
#if _MSC_VER < 1500 // < VS2008
#define vsnprintf _vsnprintf
#elif _MSC_VER < 1800 // < VS2013
#define alloca _alloca
#define round(x) floor((x) + 0.5)
#endif
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
#endif
#if _MSC_VER < 1900
#define strtoll _strtoi64
#define _USE_MATH_DEFINES
#include <math.h>
static __inline double fmin(double x, double y){ return (x < y) ? x : y; }
static __inline double fmax(double x, double y){ return (x > y) ? x : y; }
static __inline double log2(double x) { return log(x) * M_LOG2E; }
#elif _MSC_VER < 1900 // < VS2015
#define snprintf _snprintf
#else
#pragma warning (disable: 4091)
@ -31,7 +35,6 @@
#pragma warning (disable: 5025 5026 5027)
#define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS
#endif
#define strtoll _strtoi64
#endif
#ifdef __GNUC__
@ -41,14 +44,5 @@
#define min(x,y) fmin(x,y)
#define max(x,y) fmax(x,y)
#endif
#ifdef _MSC_VER
#if _MSC_VER < 1800
#define _USE_MATH_DEFINES
#include <math.h>
static __inline double fmin(double x, double y){ return (x < y) ? x : y; }
static __inline double fmax(double x, double y){ return (x > y) ? x : y; }
static __inline double log2(double x) { return log(x) * M_LOG2E; }
#endif
#endif
#define PATH_SEPARATOR "\\"