Previous 199869 Revisions Next

r34795 Sunday 1st February, 2015 at 12:39:41 UTC by Couriersud
Merge branch 'master' of https://github.com/mamedev/mame.git
[/trunk]makefile
[3rdparty/sqlite3]sqlite3.h
[src/emu]softlist.c
[src/emu/bus/a2bus]a2bus.c a2bus.h a2mcms.c a2mcms.h a2softcard.c a2softcard.h a2themill.c a2themill.h
[src/emu/cpu]drcbex64.h drcbex86.h uml.h
[src/emu/cpu/amis2000]amis2000.c amis2000.h amis2000d.c amis2000op.inc
[src/emu/ui]inputmap.c mainmenu.c
[src/lib/formats]ap2_dsk.c
[src/lib/util]bitmap.c
[src/mame/drivers]fastfred.c
[src/mame/includes]fastfred.h
[src/mame/video]fastfred.c
[src/mess/drivers]wildfire.c
[src/osd/modules/midi]portmidi.c
[src/osd/windows]vconv.c winprefix.h

trunk/3rdparty/sqlite3/sqlite3.h
r243306r243307
256256typedef sqlite_int64 sqlite3_int64;
257257typedef sqlite_uint64 sqlite3_uint64;
258258
259/* pointer-sized values */
260#ifdef PTR64
261typedef sqlite3_uint64                      FPTR;
262#else
263typedef unsigned int                        FPTR;
264#endif
265
266259/*
267260** If compiling for a processor that lacks floating point support,
268261** substitute integer for floating-point.
r243306r243307
43894382*/
43904383typedef void (*sqlite3_destructor_type)(void*);
43914384#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
4392#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)(FPTR)-1)
4385#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
43934386
43944387/*
43954388** CAPI3REF: Setting The Result Of An SQL Function
trunk/makefile
r243306r243307
650650ARFLAGS = -crs
651651endif
652652endif
653ifeq ($(TARGETOS),emscripten)
654ARFLAGS = cr
655endif
656653
657654
658655#-------------------------------------------------
r243306r243307
929926
930927ifndef EXECUTABLE_DEFINED
931928
932$(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)
929EMULATOROBJLIST = $(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)
930
931ifeq ($(TARGETOS),emscripten)
932EMULATOROBJ = $(EMULATOROBJLIST:.a=.bc)
933else
934EMULATOROBJ = $(EMULATOROBJLIST)
935endif
936
937$(EMULATOR): $(EMULATOROBJ)
933938   $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ)
934939   @echo Linking $@...
935940ifeq ($(TARGETOS),emscripten)
936# Emscripten's linker seems to be stricter about the ordering of .a files
941# Emscripten's linker seems to be stricter about the ordering of files
937942   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) -Wl,--start-group $^ -Wl,--end-group $(LIBS) -o $@
938943else
939944   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) $^ $(LIBS) -o $@
r243306r243307
10021007   @echo Building driver list $<...
10031008   @$(MAKELIST) $< >$@
10041009
1010ifeq ($(TARGETOS),emscripten)
1011# Avoid using .a files with Emscripten, link to bitcode instead
10051012$(OBJ)/%.a:
1013   @echo Linking $@...
1014   $(RM) $@
1015   $(LD) $^ -o $@
1016$(OBJ)/%.bc: $(OBJ)/%.a
1017   @cp $< $@
1018else
1019$(OBJ)/%.a:
10061020   @echo Archiving $@...
10071021   $(RM) $@
10081022   $(AR) $(ARFLAGS) $@ $^
1023endif
10091024
10101025ifeq ($(TARGETOS),macosx)
10111026$(OBJ)/%.o: $(SRC)/%.m | $(OSPREBUILD)
trunk/src/emu/bus/a2bus/a2bus.c
r243306r243307
160160void a2bus_device::device_start()
161161{
162162   m_maincpu = machine().device<cpu_device>(m_cputag);
163   m_maincpu_space = &machine().device<cpu_device>(m_cputag)->space(AS_PROGRAM);
163164
164165   // resolve callbacks
165166   m_out_irq_cb.resolve_safe();
r243306r243307
246247   m_maincpu->set_input_line(INPUT_LINE_HALT, state);
247248}
248249
250UINT8 a2bus_device::dma_r(address_space &space, UINT16 offset)
251{
252   m_maincpu_space->set_debugger_access(space.debugger_access());
253
254   return m_maincpu_space->read_byte(offset);
255}
256
257void a2bus_device::dma_w(address_space &space, UINT16 offset, UINT8 data)
258{
259   m_maincpu_space->set_debugger_access(space.debugger_access());
260
261   m_maincpu_space->write_byte(offset, data);
262}
263
264UINT8 a2bus_device::dma_nospace_r(UINT16 offset)
265{
266   return m_maincpu_space->read_byte(offset);
267}
268
269void a2bus_device::dma_nospace_w(UINT16 offset, UINT8 data)
270{
271   m_maincpu_space->write_byte(offset, data);
272}
273
249274void a2bus_device::recalc_inh(int slot)
250275{
251276   m_out_inh_cb(ASSERT_LINE);
trunk/src/emu/bus/a2bus/a2bus.h
r243306r243307
106106   void set_nmi_line(int state, int slot);
107107   void set_maincpu_halt(int state);
108108   void recalc_inh(int slot);
109   UINT8 dma_r(address_space &space, UINT16 offset);
110   void dma_w(address_space &space, UINT16 offset, UINT8 data);
111   UINT8 dma_nospace_r(UINT16 offset);
112   void dma_nospace_w(UINT16 offset, UINT8 data);
109113
110114   DECLARE_WRITE_LINE_MEMBER( irq_w );
111115   DECLARE_WRITE_LINE_MEMBER( nmi_w );
r243306r243307
117121
118122   // internal state
119123   cpu_device   *m_maincpu;
124   address_space *m_maincpu_space;
120125
121126   devcb_write_line    m_out_irq_cb;
122127   devcb_write_line    m_out_nmi_cb;
r243306r243307
144149   device_a2bus_card_interface(const machine_config &mconfig, device_t &device);
145150   virtual ~device_a2bus_card_interface();
146151
147   virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { printf("a2bus: unhandled read at C0n%x\n", offset); return 0; }       // C0nX - /DEVSEL
148   virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to C0n%x\n", data, offset); }
152   virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { logerror("a2bus: unhandled read at C0n%x\n", offset); return 0; }       // C0nX - /DEVSEL
153   virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to C0n%x\n", data, offset); }
149154   virtual UINT8 read_cnxx(address_space &space, UINT8 offset) { return 0; }       // CnXX - /IOSEL
150   virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to Cn%02x\n", data, offset); }
155   virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to Cn%02x\n", data, offset); }
151156   virtual UINT8 read_c800(address_space &space, UINT16 offset) { return 0; }      // C800 - /IOSTB
152   virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { printf("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); }
157   virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); }
153158   virtual bool take_c800() { return true; }   // override and return false if your card doesn't take over the c800 space
154159   virtual UINT8 read_inh_rom(address_space &space, UINT16 offset) { return 0; }
155160   virtual void write_inh_rom(address_space &space, UINT16 offset, UINT8 data) { }
r243306r243307
171176   void recalc_slot_inh() { m_a2bus->recalc_inh(m_slot); }
172177   void set_maincpu_halt(int state) { m_a2bus->set_maincpu_halt(state); }
173178
179   // pass through the original address space if any for debugger protection
180   // when debugging e.g. coprocessor cards (Z80 SoftCard etc).
181   UINT8 slot_dma_read(address_space &space, UINT16 offset) { return m_a2bus->dma_r(space, offset); }
182   void slot_dma_write(address_space &space, UINT16 offset, UINT8 data) { m_a2bus->dma_w(space, offset, data); }
183
184   // these versions forego that protection for when the DMA isn't coming from a debuggable CPU device
185   UINT8 slot_dma_read_no_space(UINT16 offset) { return m_a2bus->dma_nospace_r(offset); }
186   void slot_dma_write_no_space(UINT16 offset, UINT8 data) { m_a2bus->dma_nospace_w(offset, data); }
187
174188   // inline configuration
175189   static void static_set_a2bus_tag(device_t &device, const char *tag, const char *slottag);
176190public:
trunk/src/emu/bus/a2bus/a2mcms.c
r243306r243307
9494
9595void a2bus_mcms1_device::device_reset()
9696{
97   m_mcms->set_bus_device(this);
9798}
9899
99100// read once at c0n0 to disable 125 Hz IRQs
r243306r243307
290291            wptr = (m_table[v]<<8) | (m_acc[v]>>8);
291292            m_rand = (m_acc[v]>>8) & 0x1f;
292293
293            sample = (m_6502space->read_byte(wptr) ^ 0x80);
294            sample = (m_pBusDevice->slot_dma_read_no_space(wptr) ^ 0x80);
294295            if (v & 1)
295296            {
296297               mixL += sample * m_vols[v];
r243306r243307
355356
356357WRITE8_MEMBER(mcms_device::control_w)
357358{
358   // keep the space (TODO: we need to define a formal DMA mechanism from machine/apple2 out to the slots)
359   m_6502space = &space;
360
361359   m_stream->update();
362360
363361   switch (offset)
trunk/src/emu/bus/a2bus/a2mcms.h
r243306r243307
2020//  TYPE DEFINITIONS
2121//**************************************************************************
2222
23class a2bus_mcms1_device;
24
2325class mcms_device : public device_t, public device_sound_interface
2426{
2527public:
r243306r243307
3032   DECLARE_WRITE8_MEMBER(control_w);
3133   UINT8 get_pen_rand(void) { m_stream->update(); return m_rand; }
3234
35   void set_bus_device(a2bus_mcms1_device *pDev) { m_pBusDevice = pDev; }
36
3337   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); }
3438   devcb_write_line m_write_irq;
3539
r243306r243307
4347
4448private:
4549   sound_stream *m_stream;
46   address_space *m_6502space;
4750   emu_timer *m_timer, *m_clrtimer;
51   a2bus_mcms1_device *m_pBusDevice;
4852   bool m_enabled;
4953   UINT8 m_vols[16];
5054   UINT8 m_table[16];
trunk/src/emu/bus/a2bus/a2softcard.c
r243306r243307
5252a2bus_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) :
5353   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
5454   device_a2bus_card_interface(mconfig, *this),
55   m_z80(*this, Z80_TAG),
56   m_6502space(NULL)
55   m_z80(*this, Z80_TAG)
5756{
5857}
5958
6059a2bus_softcard_device::a2bus_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
6160   device_t(mconfig, A2BUS_SOFTCARD, "Microsoft SoftCard", tag, owner, clock, "a2softcard", __FILE__),
6261   device_a2bus_card_interface(mconfig, *this),
63   m_z80(*this, Z80_TAG),
64   m_6502space(NULL)
62   m_z80(*this, Z80_TAG)
6563{
6664}
6765
r243306r243307
8280{
8381   m_bEnabled = false;
8482
85   m_6502space = NULL;
8683   m_FirstZ80Boot = true;
8784   m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
8885}
r243306r243307
9188{
9289   if (!m_bEnabled)
9390   {
94      // steal the 6502's address space
95      m_6502space = &space;
96
9791      m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
9892      set_maincpu_halt(ASSERT_LINE);
9993
r243306r243307
115109
116110READ8_MEMBER( a2bus_softcard_device::dma_r )
117111{
118   if (m_6502space)
112   if (m_bEnabled)
119113   {
120114      if (offset <= 0xafff)
121115      {
122         return m_6502space->read_byte(offset+0x1000);
116         return slot_dma_read(space, offset+0x1000);
123117      }
124118      else if (offset <= 0xbfff)  // LC bank 2 d000-dfff
125119      {
126         return m_6502space->read_byte((offset&0xfff) + 0xd000);
120         return slot_dma_read(space, (offset&0xfff) + 0xd000);
127121      }
128122      else if (offset <= 0xcfff)  // LC e000-efff
129123      {
130         return m_6502space->read_byte((offset&0xfff) + 0xe000);
124         return slot_dma_read(space, (offset&0xfff) + 0xe000);
131125      }
132126      else if (offset <= 0xdfff)  // LC f000-ffff (or ROM?)
133127      {
134         return m_6502space->read_byte((offset&0xfff) + 0xf000);
128         return slot_dma_read(space, (offset&0xfff) + 0xf000);
135129      }
136130      else if (offset <= 0xefff)  // I/O space c000-cfff
137131      {
138         return m_6502space->read_byte((offset&0xfff) + 0xc000);
132         return slot_dma_read(space, (offset&0xfff) + 0xc000);
139133      }
140134      else    // zero page
141135      {
142         return m_6502space->read_byte(offset&0xfff);
136         return slot_dma_read(space, offset&0xfff);
143137      }
144138   }
145139
r243306r243307
153147
154148WRITE8_MEMBER( a2bus_softcard_device::dma_w )
155149{
156   if (m_6502space)
150   if (m_bEnabled)
157151   {
158152      if (offset <= 0xafff)
159153      {
160         m_6502space->write_byte(offset+0x1000, data);
154         slot_dma_write(space, offset+0x1000, data);
161155      }
162156      else if (offset <= 0xbfff)  // LC bank 2 d000-dfff
163157      {
164         m_6502space->write_byte((offset&0xfff) + 0xd000, data);
158         slot_dma_write(space, (offset&0xfff) + 0xd000, data);
165159      }
166160      else if (offset <= 0xcfff)  // LC e000-efff
167161      {
168         m_6502space->write_byte((offset&0xfff) + 0xe000, data);
162         slot_dma_write(space, (offset&0xfff) + 0xe000, data);
169163      }
170164      else if (offset <= 0xdfff)  // LC f000-ffff (or ROM?)
171165      {
172         m_6502space->write_byte((offset&0xfff) + 0xf000, data);
166         slot_dma_write(space, (offset&0xfff) + 0xf000, data);
173167      }
174168      else if (offset <= 0xefff)  // I/O space c000-cfff
175169      {
176         m_6502space->write_byte((offset&0xfff) + 0xc000, data);
170         slot_dma_write(space, (offset&0xfff) + 0xc000, data);
177171      }
178172      else    // zero page
179173      {
180         m_6502space->write_byte(offset&0xfff, data);
174         slot_dma_write(space, offset&0xfff, data);
181175      }
182176   }
183177}
trunk/src/emu/bus/a2bus/a2softcard.h
r243306r243307
4444private:
4545   bool m_bEnabled;
4646   bool m_FirstZ80Boot;
47   address_space *m_6502space;
4847};
4948
5049// device type definition
trunk/src/emu/bus/a2bus/a2themill.c
r243306r243307
7171a2bus_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) :
7272   device_t(mconfig, type, name, tag, owner, clock, shortname, source),
7373   device_a2bus_card_interface(mconfig, *this),
74   m_6809(*this, M6809_TAG),
75   m_6502space(NULL)
74   m_6809(*this, M6809_TAG)
7675{
7776}
7877
7978a2bus_themill_device::a2bus_themill_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
8079   device_t(mconfig, A2BUS_THEMILL, "Stellation Two The Mill", tag, owner, clock, "a2themill", __FILE__),
8180   device_a2bus_card_interface(mconfig, *this),
82   m_6809(*this, M6809_TAG),
83   m_6502space(NULL)
81   m_6809(*this, M6809_TAG)
8482{
8583}
8684
r243306r243307
102100void a2bus_themill_device::device_reset()
103101{
104102   m_bEnabled = false;
105   m_6502space = NULL;
106103   m_flipAddrSpace = false;
107104   m_6809Mode = false;
108105   m_status = 0xc0;    // OS9 loader relies on this
r243306r243307
135132      case 2: // 6809 reset
136133         if (data & 0x80)
137134         {
138            // steal the 6502's address space
139            m_6502space = &space;
140135            m_6809->reset();
141136
142137            m_6809->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
r243306r243307
241236
242237READ8_MEMBER( a2bus_themill_device::dma_r )
243238{
244   if (m_6502space)
239   if (m_6809Mode)
245240   {
246      if (m_6809Mode)
241      if (offset <= 0xafff)
247242      {
248         if (offset <= 0xafff)
249         {
250            return m_6502space->read_byte(offset+0x1000);
251         }
252         else if (offset <= 0xbfff)
253         {
254            return m_6502space->read_byte((offset&0xfff) + 0xd000);
255         }
256         else if (offset <= 0xcfff)
257         {
258            return m_6502space->read_byte((offset&0xfff) + 0xe000);
259         }
260         else if (offset <= 0xdfff)
261         {
262            return m_6502space->read_byte((offset&0xfff) + 0xf000);
263         }
264         else if (offset <= 0xefff)
265         {
266            return m_6502space->read_byte((offset&0xfff) + 0xc000);
267         }
268         else    // 6809 Fxxx -> 6502 ZP
269         {
270            return m_6502space->read_byte(offset&0xfff);
271         }
243         return slot_dma_read(space, offset+0x1000);
272244      }
245      else if (offset <= 0xbfff)
246      {
247         return slot_dma_read(space, (offset&0xfff) + 0xd000);
248      }
249      else if (offset <= 0xcfff)
250      {
251         return slot_dma_read(space, (offset&0xfff) + 0xe000);
252      }
253      else if (offset <= 0xdfff)
254      {
255         return slot_dma_read(space, (offset&0xfff) + 0xf000);
256      }
257      else if (offset <= 0xefff)
258      {
259         return slot_dma_read(space, (offset&0xfff) + 0xc000);
260      }
261      else    // 6809 Fxxx -> 6502 ZP
262      {
263         return slot_dma_read(space, offset&0xfff);
264      }
265   }
266   else
267   {
268      if (m_flipAddrSpace)
269      {
270         return slot_dma_read(space, offset^0x8000);
271      }
273272      else
274273      {
275         if (m_flipAddrSpace)
276         {
277            return m_6502space->read_byte(offset^0x8000);
278         }
279         else
280         {
281            return m_6502space->read_byte(offset);
282         }
274         return slot_dma_read(space, offset);
283275      }
284276   }
285277
r243306r243307
293285
294286WRITE8_MEMBER( a2bus_themill_device::dma_w )
295287{
296   if (m_6502space)
288   if (m_6809Mode)
297289   {
298      if (m_6809Mode)
290      if (offset <= 0xafff)
299291      {
300         if (offset <= 0xafff)
301         {
302            m_6502space->write_byte(offset+0x1000, data);
303         }
304         else if (offset <= 0xbfff)
305         {
306            m_6502space->write_byte((offset&0xfff) + 0xd000, data);
307         }
308         else if (offset <= 0xcfff)
309         {
310            m_6502space->write_byte((offset&0xfff) + 0xe000, data);
311         }
312         else if (offset <= 0xdfff)
313         {
314            m_6502space->write_byte((offset&0xfff) + 0xf000, data);
315         }
316         else if (offset <= 0xefff)
317         {
318            m_6502space->write_byte((offset&0xfff) + 0xc000, data);
319         }
320         else    // 6809 Fxxx -> 6502 ZP
321         {
322            m_6502space->write_byte(offset&0xfff, data);
323         }
292         slot_dma_write(space, offset+0x1000, data);
324293      }
294      else if (offset <= 0xbfff)
295      {
296         slot_dma_write(space, (offset&0xfff) + 0xd000, data);
297      }
298      else if (offset <= 0xcfff)
299      {
300         slot_dma_write(space, (offset&0xfff) + 0xe000, data);
301      }
302      else if (offset <= 0xdfff)
303      {
304         slot_dma_write(space, (offset&0xfff) + 0xf000, data);
305      }
306      else if (offset <= 0xefff)
307      {
308         slot_dma_write(space, (offset&0xfff) + 0xc000, data);
309      }
310      else    // 6809 Fxxx -> 6502 ZP
311      {
312         slot_dma_write(space, offset&0xfff, data);
313      }
314   }
315   else
316   {
317      if (m_flipAddrSpace)
318      {
319         slot_dma_write(space, offset^0x8000, data);
320      }
325321      else
326322      {
327         if (m_flipAddrSpace)
328         {
329            m_6502space->write_byte(offset^0x8000, data);
330         }
331         else
332         {
333            m_6502space->write_byte(offset, data);
334         }
323         slot_dma_write(space, offset, data);
335324      }
336325   }
337326}
trunk/src/emu/bus/a2bus/a2themill.h
r243306r243307
4646   bool m_bEnabled;
4747   bool m_flipAddrSpace;
4848   bool m_6809Mode;
49   address_space *m_6502space;
5049   UINT8 m_status;
5150};
5251
trunk/src/emu/cpu/amis2000/amis2000.c
r243306r243307
77  TODO:
88  - unemulated opcodes (need more testing material)
99  - support external program map
10  - STATUS pin(wildfire.c sound?)
1011  - add 50/60hz timer
1112  - add S2200/S2400
1213
r243306r243307
1516#include "amis2000.h"
1617#include "debugger.h"
1718
19#include "amis2000op.inc"
1820
21
1922// S2000 is the most basic one, 64 nibbles internal RAM and 1KB internal ROM
2023// S2150 increased RAM to 80 nibbles and ROM to 1.5KB
2124// high-voltage output versions of these chips (S2000A and S2150A) are identical overall
r243306r243307
2528
2629// internal memory maps
2730static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_device)
28   AM_RANGE(0x0000, 0x03ff) AM_ROM AM_MIRROR(0x1c00)
31   AM_RANGE(0x0000, 0x03ff) AM_ROM
2932ADDRESS_MAP_END
3033
3134static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_device)
32   AM_RANGE(0x0000, 0x03ff) AM_ROM AM_MIRROR(0x1800)
33   AM_RANGE(0x0400, 0x05ff) AM_ROM AM_MIRROR(0x1a00)
35   AM_RANGE(0x0000, 0x03ff) AM_ROM
36   AM_RANGE(0x0400, 0x05ff) AM_NOP
37   AM_RANGE(0x0600, 0x07ff) AM_ROM
3438ADDRESS_MAP_END
3539
3640
r243306r243307
116120enum
117121{
118122   S2000_PC=1, S2000_BL, S2000_BU,
119   S2000_ACC, S2000_E, S2000_CARRY
123   S2000_ACC, S2000_E, S2000_CY
120124};
121125
122126void amis2000_device::device_start()
r243306r243307
138142   m_pc = 0;
139143   m_ppr = 0;
140144   m_pbr = 0;
141   m_pp_index = 0;
142145   m_skip = false;
143146   m_op = 0;
147   m_prev_op = 0;
144148   m_f = 0;
145149   m_carry = 0;
146150   m_bl = 0;
r243306r243307
150154   m_i = 0;
151155   m_k = 0;
152156   m_d = 0;
157   m_d_active = false;
158   m_d_polarity = 0;
153159   m_a = 0;
154160
155161   // register for savestates
r243306r243307
157163   save_item(NAME(m_pc));
158164   save_item(NAME(m_ppr));
159165   save_item(NAME(m_pbr));
160   save_item(NAME(m_pp_index));
161166   save_item(NAME(m_skip));
162167   save_item(NAME(m_op));
168   save_item(NAME(m_prev_op));
163169   save_item(NAME(m_f));
164170   save_item(NAME(m_carry));
165171   save_item(NAME(m_bl));
r243306r243307
169175   save_item(NAME(m_i));
170176   save_item(NAME(m_k));
171177   save_item(NAME(m_d));
178   save_item(NAME(m_d_active));
179   save_item(NAME(m_d_polarity));
172180   save_item(NAME(m_a));
173181
174182   // register state for debugger
r243306r243307
177185   state_add(S2000_BU,     "BU",     m_bu    ).formatstr("%01X");
178186   state_add(S2000_ACC,    "ACC",    m_acc   ).formatstr("%01X");
179187   state_add(S2000_E,      "E",      m_e     ).formatstr("%01X");
180   state_add(S2000_CARRY,  "CARRY",  m_carry ).formatstr("%01X");
188   state_add(S2000_CY,     "CY",     m_carry ).formatstr("%01X");
181189
182190   state_add(STATE_GENPC, "curpc", m_pc).formatstr("%04X").noshow();
183191   state_add(STATE_GENFLAGS, "GENFLAGS", m_f).formatstr("%6s").noshow();
r243306r243307
198206   m_op = 0;
199207   
200208   // clear i/o
209   m_d_polarity = 0;
210   m_d = 0; d_latch_out(false);
211   m_a = 0; m_write_a(0, 0, 0xffff);
201212   m_i = 0;
202213   m_k = 0;
203   m_d = 0; m_write_d(0, 0, 0xff);
204   m_a = 0; m_write_a(0, 0, 0xffff);
205214}
206215
207216
r243306r243307
210219//  execute
211220//-------------------------------------------------
212221
213#include "amis2000op.inc"
214
215222void amis2000_device::execute_run()
216223{
217224   while (m_icount > 0)
218225   {
219226      m_icount--;
220227     
221      // increase PP prefix count
222      if ((m_op & 0xf0) == 0x60)
223      {
224         if (m_pp_index < 2)
225            m_pp_index++;
226      }
227      else
228         m_pp_index = 0;
228      // remember previous opcode
229      m_prev_op = m_op;
229230
230231      debugger_instruction_hook(this, m_pc);
231232      m_op = m_program->read_byte(m_pc);
r243306r243307
251252            switch (m_op)
252253            {
253254         case 0x00: op_nop(); break;
254         case 0x01: op_illegal(); break; // reserved for devkit-use
255         case 0x01: op_halt(); break;
255256         case 0x02: op_rt(); break;
256257         case 0x03: op_rts(); break;
257258         case 0x04: op_psh(); break;
trunk/src/emu/cpu/amis2000/amis2000.h
r243306r243307
8080   UINT16 m_pc;                // 13-bit program counter
8181   UINT8 m_ppr;                // prepared page register (PP 1)
8282   UINT8 m_pbr;                // prepared bank register (PP 2)
83   UINT8 m_pp_index;           // number of handled PP prefixes
8483   bool m_skip;                // skip next opcode, including PP prefixes
8584   UINT8 m_op;
85   UINT8 m_prev_op;            // previous opcode, needed for PP, LAI, LB*
8686   UINT8 m_f;                  // generic flags: 2 on 2000/2150, 6 on 2200/2400
8787   UINT8 m_carry;              // carry flag
8888   UINT8 m_bl;                 // 4-bit ram index x
r243306r243307
9292   UINT8 m_i;                  // 4-bit i-pins latch
9393   UINT8 m_k;                  // 4-bit k-pins latch
9494   UINT8 m_d;                  // 8-bit d-pins latch
95   bool m_d_active;            // d-pins available for direct i/o(floating), or outputting d-latch
96   UINT8 m_d_polarity;         // invert d-latch output
9597   UINT16 m_a;                 // 13-bit a-pins latch (master strobe latch)
9698
9799   devcb_read8 m_read_k;
r243306r243307
106108   void ram_w(UINT8 data);
107109   void pop_callstack();
108110   void push_callstack();
109   void op_illegal();
111   void d_latch_out(bool active);
110112   
111113   void op_lai();
112114   void op_lab();
r243306r243307
141143   void op_rt();
142144   void op_rts();
143145   void op_nop();
146   void op_halt();
144147
145148   void op_szc();
146149   void op_szm();
trunk/src/emu/cpu/amis2000/amis2000d.c
r243306r243307
1717   mLAM, mXC, mXCI, mXCD, mSTM, mRSM,
1818   mADD, mADCS, mADIS, mAND, mXOR, mCMA, mSTC, mRSC, mSF1, mRF1, mSF2, mRF2,
1919   mSAM, mSZM, mSBE, mSZC, mSOS, mSZK, mSZI, mTF1, mTF2,
20   mPP, mJMP, mJMS, mRT, mRTS, mNOP,
21   mINP, mOUT, mDISB, mDISN, mMVS, mPSH, mPSL, mEUR,
22   mILL
20   mPP, mJMP, mJMS, mRT, mRTS, mNOP, mHALT,
21   mINP, mOUT, mDISB, mDISN, mMVS, mPSH, mPSL, mEUR
2322};
2423
2524static const char *const s_mnemonics[] =
r243306r243307
2827   "LAM", "XC", "XCI", "XCD", "STM", "RSM",
2928   "ADD", "ADCS", "ADIS", "AND", "XOR", "CMA", "STC", "RSC", "SF1", "RF1", "SF2", "RF2",
3029   "SAM", "SZM", "SBE", "SZC", "SOS", "SZK", "SZI", "TF1", "TF2",
31   "PP", "JMP", "JMS", "RT", "RTS", "NOP",
32   "INP", "OUT", "DISB", "DISN", "MVS", "PSH", "PSL", "EUR",
33   "?"
30   "PP", "JMP", "JMS", "RT", "RTS", "NOP", "HALT",
31   "INP", "OUT", "DISB", "DISN", "MVS", "PSH", "PSL", "EUR"
3432};
3533
3634
r243306r243307
4341   0, 0, 0, 0, 0, 0,
4442   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4543   0, 0, 0, 0, 0, 0, 0, 0, 0,
46   0, 0, _OVER, _OUT, _OUT, 0,
47   0, 0, 0, 0, 0, 0, 0, 0,
48   0
44   0, 0, _OVER, _OUT, _OUT, 0, 0,
45   0, 0, 0, 0, 0, 0, 0, 0
4946};
5047
5148
r243306r243307
5552   -2, -2, -2, -2, 2, 2,
5653   0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5754   0, 2, 0, 0, 0, 0, 0, 0, 0,
58   -4, 6, 6, 0, 0, 0,
59   0, 0, 0, 0, 0, 0, 0, 0,
60   0
55   -4, 6, 6, 0, 0, 0, 0,
56   0, 0, 0, 0, 0, 0, 0, 0
6157};
6258
6359
6460static const UINT8 s2000_mnemonic[0x100] =
6561{
6662   /* 0x00 */
67   mNOP, mILL, mRT, mRTS, mPSH, mPSL, mAND, mSOS,
63   mNOP, mHALT, mRT, mRTS, mPSH, mPSL, mAND, mSOS,
6864   mSBE, mSZC, mSTC, mRSC, mLAE, mXAE, mINP, mEUR,
6965   /* 0x10 */
7066   mCMA, mXABU, mLAB, mXAB, mADCS, mXOR, mADD, mSAM,
trunk/src/emu/cpu/amis2000/amis2000op.inc
r243306r243307
44
55UINT8 amis2000_device::ram_r()
66{
7   UINT16 address = m_bu << m_bu_bits | m_bl;
7   UINT16 address = m_bu << 4 | m_bl;
88   return m_data->read_byte(address) & 0xf;
99}
1010
1111void amis2000_device::ram_w(UINT8 data)
1212{
13   UINT16 address = m_bu << m_bu_bits | m_bl;
13   UINT16 address = m_bu << 4 | m_bl;
1414   m_data->write_byte(address, data & 0xf);
1515}
1616
r243306r243307
3333   m_callstack[0] = m_pc & m_callstack_mask;
3434}
3535
36void amis2000_device::op_illegal()
36void amis2000_device::d_latch_out(bool active)
3737{
38   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
38   m_write_d(0, active ? (m_d ^ m_d_polarity) : 0, 0xff);
39   m_d_active = active;
3940}
4041
4142
r243306r243307
4445void amis2000_device::op_lai()
4546{
4647   // LAI X: load ACC with X, select I and K inputs
47   UINT8 param = m_op & 0x0f;
48   m_acc = param;
49   m_i = m_read_i(0, 0xff) & param;
50   m_k = m_read_k(0, 0xff) & param;
48   // note: only execute the first one in a sequence of LAI
49   if ((m_prev_op & 0xf0) != (m_op & 0xf0))
50   {
51      UINT8 param = m_op & 0x0f;
52      m_acc = param;
53      m_i = m_read_i(0, 0xff) & param;
54      m_k = m_read_k(0, 0xff) & param;
55   }
5156}
5257
5358void amis2000_device::op_lab()
r243306r243307
8994void amis2000_device::op_lbe()
9095{
9196   // LBE Y: load BU with Y, load BL with E
92   UINT8 param = m_op & 0x03;
93   m_bu = param & m_bu_mask;
94   m_bl = m_e;
97   // note: only execute the first one in a sequence of LB*
98   if ((m_prev_op & 0xf0) != (m_op & 0xf0))
99   {
100      UINT8 param = m_op & 0x03;
101      m_bu = param & m_bu_mask;
102      m_bl = m_e;
103   }
95104}
96105
97106void amis2000_device::op_lbep()
98107{
99108   // LBEP Y: load BU with Y, load BL with E+1
100   UINT8 param = m_op & 0x03;
101   m_bu = param & m_bu_mask;
102   m_bl = m_e + 1;
109   // note: only execute the first one in a sequence of LB*
110   if ((m_prev_op & 0xf0) != (m_op & 0xf0))
111   {
112      UINT8 param = m_op & 0x03;
113      m_bu = param & m_bu_mask;
114      m_bl = (m_e + 1) & 0xf;
115   }
103116}
104117
105118void amis2000_device::op_lbz()
106119{
107120   // LBZ Y: load BU with Y, load BL with 0
108   UINT8 param = m_op & 0x03;
109   m_bu = param & m_bu_mask;
110   m_bl = 0;
121   // note: only execute the first one in a sequence of LB*
122   if ((m_prev_op & 0xf0) != (m_op & 0xf0))
123   {
124      UINT8 param = m_op & 0x03;
125      m_bu = param & m_bu_mask;
126      m_bl = 0;
127   }
111128}
112129
113130void amis2000_device::op_lbf()
114131{
115132   // LBF Y: load BU with Y, load BL with 15
116   UINT8 param = m_op & 0x03;
117   m_bu = param & m_bu_mask;
118   m_bl = 0xf;
133   // note: only execute the first one in a sequence of LB*
134   if ((m_prev_op & 0xf0) != (m_op & 0xf0))
135   {
136      UINT8 param = m_op & 0x03;
137      m_bu = param & m_bu_mask;
138      m_bl = 0xf;
139   }
119140}
120141
121142
r243306r243307
126147   // LAM _Y: load ACC with RAM, xor BU with _Y
127148   m_acc = ram_r();
128149   UINT8 param = ~m_op & 0x03;
129   m_bu ^= param & m_bu_mask;
150   m_bu ^= (param & m_bu_mask);
130151}
131152
132153void amis2000_device::op_xc()
r243306r243307
136157   m_acc = ram_r();
137158   ram_w(old_acc);
138159   UINT8 param = ~m_op & 0x03;
139   m_bu ^= param & m_bu_mask;
160   m_bu ^= (param & m_bu_mask);
140161}
141162
142163void amis2000_device::op_xci()
r243306r243307
175196void amis2000_device::op_inp()
176197{
177198   // INP: input D-pins to ACC and RAM
178   op_illegal();
199   UINT8 in = m_d_active ? m_d : m_read_d(0, 0xff);
200   m_acc = in & 0xf;
201   ram_w(in >> 4 & 0xf);
179202}
180203
181204void amis2000_device::op_out()
182205{
183206   // OUT: pulse output ACC and RAM to D-pins
184   op_illegal();
207   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
185208}
186209
187210void amis2000_device::op_disb()
188211{
189212   // DISB: set D-latch to ACC and RAM directly
190213   m_d = m_acc | ram_r() << 4;
191   m_write_d(0, m_d, 0xff);
192   // TODO: exit from floating mode on D-pins
214   d_latch_out(true);
193215}
194216
195217void amis2000_device::op_disn()
r243306r243307
201223      0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47
202224   };
203225   m_d = lut_segment_decoder[m_acc] | (m_carry ? 0x80 : 0x00);
204   m_write_d(0, m_d, 0xff);
205   // TODO: exit from floating mode on D-pins
226   d_latch_out(true);
206227}
207228
208229void amis2000_device::op_mvs()
209230{
210231   // MVS: output master strobe latch to A-pins
232   d_latch_out(false);
211233   m_write_a(0, m_a, 0xffff);
212   // TODO: enter floating mode on D-pins
213234}
214235
215236void amis2000_device::op_psh()
r243306r243307
224245
225246      case 0xe:
226247         // exit from floating mode on D-pins
227         // ?
248         d_latch_out(true);
228249         break;
229250
230251      case 0xf:
r243306r243307
251272
252273      case 0xe:
253274         // enter floating mode on D-pins
254         // ?
275         d_latch_out(false);
255276         break;
256277
257278      case 0xf:
r243306r243307
268289
269290void amis2000_device::op_eur()
270291{
271   // EUR: set timer frequency(European) and D-latch polarity
272   op_illegal();
292   // EUR: set timer frequency(European) and D-latch polarity, via ACC
293   m_d_polarity = (m_acc & 1) ? 0x00 : 0xff;
294   d_latch_out(m_d_active); // refresh
273295}
274296
275297
r243306r243307
279301{
280302   // PP _X: prepare page/bank with _X
281303   UINT8 param = ~m_op & 0x0f;
282   if (m_pp_index == 0)
304   if ((m_prev_op & 0xf0) != (m_op & 0xf0))
283305      m_ppr = param;
284306   else
285307      m_pbr = param & 7;
r243306r243307
290312   // JMP X: jump to X(+PP)
291313   UINT16 mask = 0x3f;
292314   UINT16 param = m_op & mask;
293   if (m_pp_index > 0)
315   
316   // if previous opcode was PP, change PC high bits too
317   if ((m_prev_op & 0xf0) == 0x60)
294318   {
295      param |= m_ppr << 6;
296      mask |= 0x3c0;
319      param |= (m_ppr << 6) | (m_pbr << 10);
320      mask = 0x1fff;
297321   }
298   if (m_pp_index > 1)
299   {
300      param |= m_pbr << 10;
301      mask |= 0x1c00;
302   }
303322   m_pc = (m_pc & ~mask) | param;
304323}
305324
r243306r243307
308327   // JMS X: call to X(+PP)
309328   m_icount--;
310329   push_callstack();
311   if (m_pp_index == 0)
312   {
313      // subroutines default location is page 15
314      m_ppr = 0xf;
315      m_pp_index++;
316   }
317330   op_jmp();
331
332   // subroutines default location is page 15
333   if ((m_prev_op & 0xf0) != 0x60)
334      m_pc |= 0x3c0;
318335}
319336
320337void amis2000_device::op_rt()
r243306r243307
335352   // NOP: no operation
336353}
337354
355void amis2000_device::op_halt()
356{
357   // HALT: debugger breakpoint for devkit-use
358   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
359}
338360
361
339362// Skip Instructions
340363
341364void amis2000_device::op_szc()
r243306r243307
378401void amis2000_device::op_sos()
379402{
380403   // SOS: skip next on SF(timer output), clear SF
381   op_illegal();
404   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
382405}
383406
384407void amis2000_device::op_tf1()
385408{
386409   // TF1: skip next on flag 1
387   m_skip = (m_f & 0x01);
410   m_skip = (m_f & 0x01) ? true : false;
388411}
389412
390413void amis2000_device::op_tf2()
391414{
392415   // TF2: skip next on flag 2
393   m_skip = (m_f & 0x02);
416   m_skip = (m_f & 0x02) ? true : false;
394417}
395418
396419
trunk/src/emu/cpu/drcbex64.h
r243306r243307
7373      static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
7474      static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
7575      static inline be_parameter make_vreg(int regnum) { assert(regnum >= 0 && regnum < x64emit::REG_MAX); return be_parameter(PTYPE_VECTOR_REGISTER, regnum); }
76      static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(base))); }
77      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)))); }
76      static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
77      static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
7878
7979      // operators
8080      bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
trunk/src/emu/cpu/drcbex86.h
r243306r243307
7373      static inline be_parameter make_ireg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_INT_REGISTER, regnum); }
7474      static inline be_parameter make_freg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_FLOAT_REGISTER, regnum); }
7575      static inline be_parameter make_vreg(int regnum) { assert(regnum >= 0 && regnum < x86emit::REG_MAX); return be_parameter(PTYPE_VECTOR_REGISTER, regnum); }
76      static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, static_cast<be_parameter_value>(reinterpret_cast<FPTR>(base))); }
77      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)))); }
76      static inline be_parameter make_memory(void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(base)); }
77      static inline be_parameter make_memory(const void *base) { return be_parameter(PTYPE_MEMORY, reinterpret_cast<be_parameter_value>(const_cast<void *>(base))); }
7878
7979      // operators
8080      bool operator==(const be_parameter &rhs) const { return (m_type == rhs.m_type && m_value == rhs.m_value); }
trunk/src/emu/cpu/uml.h
r243306r243307
305305      parameter(UINT64 val) : m_type(PTYPE_IMMEDIATE), m_value(val) { }
306306      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); }
307307      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); }
308      parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(static_cast<parameter_value>(reinterpret_cast<FPTR>(&handle))) { }
308      parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(reinterpret_cast<parameter_value>(&handle)) { }
309309      parameter(code_label &label) : m_type(PTYPE_CODE_LABEL), m_value(label) { }
310310
311311      // creators for types that don't safely default
r243306r243307
313313      static inline parameter make_freg(int regnum) { assert(regnum >= REG_F0 && regnum < REG_F_END); return parameter(PTYPE_FLOAT_REGISTER, regnum); }
314314      static inline parameter make_vreg(int regnum) { assert(regnum >= REG_V0 && regnum < REG_V_END); return parameter(PTYPE_VECTOR_REGISTER, regnum); }
315315      static inline parameter make_mapvar(int mvnum) { assert(mvnum >= MAPVAR_M0 && mvnum < MAPVAR_END); return parameter(PTYPE_MAPVAR, mvnum); }
316      static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(base))); }
317      static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); }
316      static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(base)); }
317      static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(const_cast<void *>(base))); }
318318      static inline parameter make_size(operand_size size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); return parameter(PTYPE_SIZE, size); }
319      static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<char *>(string)))); }
320      static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, static_cast<parameter_value>(reinterpret_cast<FPTR>(func))); }
319      static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, reinterpret_cast<parameter_value>(const_cast<char *>(string))); }
320      static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, reinterpret_cast<parameter_value>(func)); }
321321      static inline parameter make_rounding(float_rounding_mode mode) { assert(mode >= ROUND_TRUNC && mode <= ROUND_DEFAULT); return parameter(PTYPE_ROUNDING, mode); }
322322
323323      // operators
trunk/src/emu/softlist.c
r243306r243307
265265
266266
267267//**************************************************************************
268//  CONST STRING POOL
269//**************************************************************************
270
271//-------------------------------------------------
272//  const_string_pool - constructor
273//-------------------------------------------------
274
275const_string_pool::const_string_pool()
276{
277}
278
279
280//-------------------------------------------------
281//  add - add a string to the string pool
282//-------------------------------------------------
283
284const char *const_string_pool::add(const char *string)
285{
286   // if NULL or a small number (for some hash strings), just return as-is
287   if (FPTR(string) < 0x100)
288      return string;
289
290   // scan to find space
291   for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next())
292   {
293      const char *result = chunk->add(string);
294      if (result != NULL)
295         return result;
296   }
297
298   // no space anywhere, create a new pool and prepend it (so it gets used first)
299   const char *result = m_chunklist.prepend(*global_alloc(pool_chunk)).add(string);
300   assert(result != NULL);
301   return result;
302}
303
304
305//-------------------------------------------------
306//  contains - determine if the given string
307//  pointer lives in the pool
308//-------------------------------------------------
309
310bool const_string_pool::contains(const char *string)
311{
312   // if NULL or a small number (for some hash strings), then yes, effectively
313   if (FPTR(string) < 0x100)
314      return true;
315
316   // scan to find it
317   for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next())
318      if (chunk->contains(string))
319         return true;
320
321   return false;
322}
323
324
325//-------------------------------------------------
326//  pool_chunk - constructor
327//-------------------------------------------------
328
329const_string_pool::pool_chunk::pool_chunk()
330   : m_next(NULL),
331      m_used(0)
332{
333}
334
335
336//-------------------------------------------------
337//  add - add a string to this pool
338//-------------------------------------------------
339
340const char *const_string_pool::pool_chunk::add(const char *string)
341{
342   // get the length of the string (no string can be longer than a full pool)
343   int bytes = strlen(string) + 1;
344   assert(bytes < POOL_SIZE);
345
346   // if too big, return NULL
347   if (m_used + bytes > POOL_SIZE)
348      return NULL;
349
350   // allocate, copy, and return the memory
351   char *dest = &m_buffer[m_used];
352   m_used += bytes;
353   memcpy(dest, string, bytes);
354   return dest;
355}
356
357
358
359//**************************************************************************
360268//  SOFTWARE LIST DEVICE
361269//**************************************************************************
362270
trunk/src/emu/ui/inputmap.c
r243306r243307
7373   /* process the menu */
7474   const ui_menu_event *menu_event = process(0);
7575   if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT)
76      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)((FPTR)menu_event->itemref)-1))));
76      ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_general(machine(), container, int((long long)(menu_event->itemref)-1))));
7777}
7878
7979
trunk/src/emu/ui/mainmenu.c
r243306r243307
151151   /* process the menu */
152152   const ui_menu_event *menu_event = process(0);
153153   if (menu_event != NULL && menu_event->iptkey == IPT_UI_SELECT) {
154      switch((long long)((FPTR) menu_event->itemref)) {
154      switch((long long)(menu_event->itemref)) {
155155      case INPUT_GROUPS:
156156         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_input_groups(machine(), container)));
157157         break;
trunk/src/lib/formats/ap2_dsk.c
r243306r243307
615615      static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
616616      static const unsigned char sos_block1[4] = { 0xc9, 0x20, 0xf0, 0x3e };
617617      static const unsigned char a3a2emul_block1[6] = { 0x8d, 0xd0, 0x03, 0x4c, 0xc7, 0xa4 };
618      static const unsigned char cpm22_block1[8] = { 0xa2, 0x55, 0xa9, 0x00, 0x9d, 0x00, 0x0d, 0xca };
618619
619620      io_generic_read(io, sector_data, fpos, 256*16);
620621
r243306r243307
658659         else if (!memcmp(pascal2_block1, &sector_data[0x100], 4))
659660         {
660661            m_prodos_order = true;
662         }   // check for CP/M disks in ProDOS order
663         else if (!memcmp(cpm22_block1, &sector_data[0x100], 8))
664         {
665            m_prodos_order = true;
661666         }
662667      }
663668
trunk/src/lib/util/bitmap.c
r243306r243307
4949inline void bitmap_t::compute_base(int xslop, int yslop)
5050{
5151   m_base = m_alloc + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
52   UINT64 aligned_base = ((static_cast<UINT64>(reinterpret_cast<FPTR>(m_base)) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
52   UINT64 aligned_base = ((reinterpret_cast<UINT64>(m_base) + (BITMAP_OVERALL_ALIGN - 1)) / BITMAP_OVERALL_ALIGN) * BITMAP_OVERALL_ALIGN;
5353   m_base = reinterpret_cast<void *>(aligned_base);
5454}
5555
trunk/src/mame/drivers/fastfred.c
r243306r243307
1414#include "sound/ay8910.h"
1515
1616
17void fastfred_state::machine_start()
18{
19   save_item(NAME(m_charbank));
20   save_item(NAME(m_colorbank));
21   save_item(NAME(m_nmi_mask));
22   save_item(NAME(m_sound_nmi_mask));
23}
24
1725// This routine is a big hack, but the only way I can get the game working
1826// without knowing anything about the way the protection chip works.
1927// These values were derived based on disassembly of the code. Usually, it
r243306r243307
124132
125133MACHINE_START_MEMBER(fastfred_state,imago)
126134{
135   machine_start();
127136   m_gfxdecode->gfx(1)->set_source(m_imago_sprites);
128137}
129138
r243306r243307
10391048   m_hardware_type = 3;
10401049}
10411050
1042GAME( 1982, flyboy,   0,        fastfred, flyboy, fastfred_state,   flyboy,   ROT90, "Kaneko", "Fly-Boy", 0 )
1043GAME( 1982, flyboyb,  flyboy,   fastfred, flyboy, fastfred_state,   flyboyb,  ROT90, "bootleg", "Fly-Boy (bootleg)", 0 )
1044GAME( 1982, fastfred, flyboy,   fastfred, fastfred, fastfred_state, fastfred, ROT90, "Kaneko (Atari license)", "Fast Freddie", 0 )
1045GAME( 1983, jumpcoas, 0,        jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko", "Jump Coaster", 0 )
1046GAME( 1983, jumpcoast,jumpcoas, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko (Taito license)", "Jump Coaster (Taito)", 0 )
1047GAME( 1983, boggy84,  0,        jumpcoas, boggy84, fastfred_state,  boggy84,  ROT90, "Kaneko", "Boggy '84", 0 )
1048GAME( 1983, boggy84b, boggy84,  jumpcoas, boggy84, fastfred_state,  boggy84b, ROT90, "bootleg (Eddie's Games)", "Boggy '84 (bootleg)", 0 )
1049GAME( 1986, redrobin, 0,        fastfred, redrobin, fastfred_state, flyboyb,  ROT90, "Elettronolo", "Red Robin", 0 )
1051GAME( 1982, flyboy,   0,        fastfred, flyboy, fastfred_state,   flyboy,   ROT90, "Kaneko", "Fly-Boy", GAME_SUPPORTS_SAVE )
1052GAME( 1982, flyboyb,  flyboy,   fastfred, flyboy, fastfred_state,   flyboyb,  ROT90, "bootleg", "Fly-Boy (bootleg)", GAME_SUPPORTS_SAVE )
1053GAME( 1982, fastfred, flyboy,   fastfred, fastfred, fastfred_state, fastfred, ROT90, "Kaneko (Atari license)", "Fast Freddie", GAME_SUPPORTS_SAVE )
1054GAME( 1983, jumpcoas, 0,        jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko", "Jump Coaster", GAME_SUPPORTS_SAVE )
1055GAME( 1983, jumpcoast,jumpcoas, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko (Taito license)", "Jump Coaster (Taito)", GAME_SUPPORTS_SAVE )
1056GAME( 1983, boggy84,  0,        jumpcoas, boggy84, fastfred_state,  boggy84,  ROT90, "Kaneko", "Boggy '84", GAME_SUPPORTS_SAVE )
1057GAME( 1983, boggy84b, boggy84,  jumpcoas, boggy84, fastfred_state,  boggy84b, ROT90, "bootleg (Eddie's Games)", "Boggy '84 (bootleg)", GAME_SUPPORTS_SAVE )
1058GAME( 1986, redrobin, 0,        fastfred, redrobin, fastfred_state, flyboyb,  ROT90, "Elettronolo", "Red Robin", GAME_SUPPORTS_SAVE )
10501059GAME( 1984, imago,    0,        imago,    imago, fastfred_state,    imago,    ROT90, "Acom", "Imago (cocktail set)", 0 )
10511060GAME( 1983, imagoa,   imago,    imago,    imagoa, fastfred_state,   imago,    ROT90, "Acom", "Imago (no cocktail set)", 0 )
trunk/src/mame/includes/fastfred.h
r243306r243307
1212public:
1313   fastfred_state(const machine_config &mconfig, device_type type, const char *tag)
1414      : galaxold_state(mconfig, type, tag),
15         m_gfxdecode(*this, "gfxdecode"),
16         m_palette(*this, "palette"),
1517         m_videoram(*this, "videoram"),
1618         m_spriteram(*this, "spriteram"),
1719         m_attributesram(*this, "attributesram"),
1820         m_background_color(*this, "bgcolor"),
19         m_imago_fg_videoram(*this, "imago_fg_vram"),
20         m_gfxdecode(*this, "gfxdecode"),
21         m_palette(*this, "palette") { }
21         m_imago_fg_videoram(*this, "imago_fg_vram") { }
2222
23   UINT8 m_imago_sprites[0x800*3];
24   UINT16 m_imago_sprites_address;
25   UINT8 m_imago_sprites_bank;
26   int m_hardware_type;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<palette_device> m_palette;
25   
2726   required_shared_ptr<UINT8> m_videoram;
2827   required_shared_ptr<UINT8> m_spriteram;
2928   required_shared_ptr<UINT8> m_attributesram;
3029   optional_shared_ptr<UINT8> m_background_color;
3130   optional_shared_ptr<UINT8> m_imago_fg_videoram;
32   required_device<gfxdecode_device> m_gfxdecode;
33   required_device<palette_device> m_palette;
3431
32   int m_hardware_type;
3533   UINT16 m_charbank;
3634   UINT8 m_colorbank;
35   UINT8 m_nmi_mask;
36   UINT8 m_sound_nmi_mask;
37   UINT8 m_imago_sprites[0x800*3];
38   UINT16 m_imago_sprites_address;
39   UINT8 m_imago_sprites_bank;
40   
3741   tilemap_t *m_bg_tilemap;
3842   tilemap_t *m_fg_tilemap;
3943   tilemap_t *m_web_tilemap;
4044
41   UINT8 m_nmi_mask;
42   UINT8 m_sound_nmi_mask;
4345   DECLARE_READ8_MEMBER(fastfred_custom_io_r);
4446   DECLARE_READ8_MEMBER(flyboy_custom1_io_r);
4547   DECLARE_READ8_MEMBER(flyboy_custom2_io_r);
r243306r243307
5153   DECLARE_READ8_MEMBER(imago_sprites_offset_r);
5254   DECLARE_WRITE8_MEMBER(nmi_mask_w);
5355   DECLARE_WRITE8_MEMBER(sound_nmi_mask_w);
56   DECLARE_WRITE8_MEMBER(fastfred_videoram_w);
57   DECLARE_WRITE8_MEMBER(fastfred_attributes_w);
58   DECLARE_WRITE8_MEMBER(fastfred_charbank1_w);
59   DECLARE_WRITE8_MEMBER(fastfred_charbank2_w);
60   DECLARE_WRITE8_MEMBER(fastfred_colorbank1_w);
61   DECLARE_WRITE8_MEMBER(fastfred_colorbank2_w);
62   DECLARE_WRITE8_MEMBER(fastfred_flip_screen_x_w);
63   DECLARE_WRITE8_MEMBER(fastfred_flip_screen_y_w);
64   DECLARE_WRITE8_MEMBER(imago_fg_videoram_w);
65   DECLARE_WRITE8_MEMBER(imago_charbank_w);
66
5467   DECLARE_DRIVER_INIT(fastfred);
5568   DECLARE_DRIVER_INIT(flyboy);
5669   DECLARE_DRIVER_INIT(flyboyb);
r243306r243307
5871   DECLARE_DRIVER_INIT(boggy84);
5972   DECLARE_DRIVER_INIT(jumpcoas);
6073   DECLARE_DRIVER_INIT(boggy84b);
74
6175   TILE_GET_INFO_MEMBER(get_tile_info);
6276   TILE_GET_INFO_MEMBER(imago_get_tile_info_bg);
6377   TILE_GET_INFO_MEMBER(imago_get_tile_info_fg);
6478   TILE_GET_INFO_MEMBER(imago_get_tile_info_web);
65   DECLARE_VIDEO_START(fastfred);
79   
80   INTERRUPT_GEN_MEMBER(vblank_irq);
81   INTERRUPT_GEN_MEMBER(sound_timer_irq);
82
83   virtual void machine_start();
6684   DECLARE_PALETTE_INIT(fastfred);
6785   DECLARE_MACHINE_START(imago);
86   DECLARE_VIDEO_START(fastfred);
6887   DECLARE_VIDEO_START(imago);
88
6989   UINT32 screen_update_fastfred(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7090   UINT32 screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
71   INTERRUPT_GEN_MEMBER(vblank_irq);
72   INTERRUPT_GEN_MEMBER(sound_timer_irq);
7391   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
74   DECLARE_WRITE8_MEMBER(fastfred_videoram_w);
75   DECLARE_WRITE8_MEMBER(fastfred_attributes_w);
76   DECLARE_WRITE8_MEMBER(fastfred_charbank1_w);
77   DECLARE_WRITE8_MEMBER(fastfred_charbank2_w);
78   DECLARE_WRITE8_MEMBER(fastfred_colorbank1_w);
79   DECLARE_WRITE8_MEMBER(fastfred_colorbank2_w);
80   DECLARE_WRITE8_MEMBER(fastfred_flip_screen_x_w);
81   DECLARE_WRITE8_MEMBER(fastfred_flip_screen_y_w);
82
83   DECLARE_WRITE8_MEMBER(imago_fg_videoram_w);
84   DECLARE_WRITE8_MEMBER(imago_charbank_w);
8592};
trunk/src/mame/video/fastfred.c
r243306r243307
345345   /* web colors */
346346   m_palette->set_pen_color(256+64+0,rgb_t(0x50,0x00,0x00));
347347   m_palette->set_pen_color(256+64+1,rgb_t(0x00,0x00,0x00));
348   
349   save_item(NAME(m_imago_sprites));
350   save_item(NAME(m_imago_sprites_address));
351   save_item(NAME(m_imago_sprites_bank));
352
353   // galaxold starfield related save states. Something's still missing here.
354   save_item(NAME(m_stars_on));
355   save_item(NAME(m_stars_blink_state));
356   save_item(NAME(m_timer_adjusted));
357   save_item(NAME(m_stars_colors_start));
358   save_item(NAME(m_stars_scrollpos));
359   
360   for (int i = 0; i < STAR_COUNT; i++)
361   {
362      save_item(NAME(m_stars[i].x), i);
363      save_item(NAME(m_stars[i].y), i);
364      save_item(NAME(m_stars[i].color), i);
365   }
348366}
349367
350368UINT32 fastfred_state::screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
trunk/src/mess/drivers/wildfire.c
r243306r243307
3131   required_device<cpu_device> m_maincpu;
3232   required_device<speaker_sound_device> m_speaker;
3333
34   DECLARE_WRITE8_MEMBER(write_d);
35   DECLARE_WRITE16_MEMBER(write_a);
36
3437   virtual void machine_start();
3538};
3639
r243306r243307
4144
4245***************************************************************************/
4346
44//..
47WRITE8_MEMBER(wildfire_state::write_d)
48{
49}
4550
51WRITE16_MEMBER(wildfire_state::write_a)
52{
53}
4654
4755
56
4857/***************************************************************************
4958
5059  Inputs
r243306r243307
5261***************************************************************************/
5362
5463static INPUT_PORTS_START( wildfire )
64   PORT_START("IN1") // I
65   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Shooter Button")
66   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Flipper")
67   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Flipper")
68   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
5569INPUT_PORTS_END
5670
5771
r243306r243307
7185
7286   /* basic machine hardware */
7387   MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK)
88   MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1"))
89   MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d))
90   MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a))
7491
7592   MCFG_DEFAULT_LAYOUT(layout_wildfire)
7693
r243306r243307
91108***************************************************************************/
92109
93110ROM_START( wildfire )
94   ROM_REGION( 0x0600, "maincpu", 0 )
95   ROM_LOAD( "us4341385", 0x0000, 0x0600, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums)
111   ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 )
112   ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums)
113   ROM_CONTINUE(          0x0600, 0x0200 )
96114ROM_END
97115
98116
trunk/src/osd/modules/midi/portmidi.c
r243306r243307
452452}
453453#else
454454   #include "modules/osdmodule.h"
455   #include "netdev_module.h"
455   #include "midi_module.h"
456456
457457   MODULE_NOT_SUPPORTED(pm_module, OSD_MIDI_PROVIDER, "pm")
458458#endif
trunk/src/osd/windows/vconv.c
r243306r243307
103103   // warning C4711: function 'xxx' selected for automatic inline expansion // optimized only
104104   // warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation
105105   // warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx'
106   { 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" },
106   // warning C4826: Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior. // 32-bit only
107   { 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" },
107108   { 0,        "-Wall",                    "/W0" },
108109   { VS7,      "-Wno-unused",              "/wd4100 /wd4101 /wd4102 /wd4505" },
109110   { 0,        "-Wno-sign-compare",        "/wd4365 /wd4389 /wd4245 /wd4388" },
trunk/src/osd/windows/winprefix.h
r243306r243307
1313#ifdef _MSC_VER
1414#include <assert.h>
1515#include <malloc.h>
16#if _MSC_VER < 1800
16#if _MSC_VER < 1500 // < VS2008
17#define vsnprintf _vsnprintf
18#elif _MSC_VER < 1800 // < VS2013
1719#define alloca _alloca
1820#define round(x) floor((x) + 0.5)
19#endif
20#if _MSC_VER < 1500
21#define vsnprintf _vsnprintf
22#endif
23#if _MSC_VER < 1900
21#define strtoll _strtoi64
22#define _USE_MATH_DEFINES
23#include <math.h>
24static __inline double fmin(double x, double y){ return (x < y) ? x : y; }
25static __inline double fmax(double x, double y){ return (x > y) ? x : y; }
26static __inline double log2(double x) { return log(x) * M_LOG2E; }
27#elif _MSC_VER < 1900 // < VS2015
2428#define snprintf _snprintf
2529#else
2630#pragma warning (disable: 4091)
r243306r243307
3135#pragma warning (disable: 5025 5026 5027)
3236#define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS
3337#endif
34#define strtoll _strtoi64
3538#endif
3639
3740#ifdef __GNUC__
r243306r243307
4144#define min(x,y) fmin(x,y)
4245#define max(x,y) fmax(x,y)
4346#endif
44#ifdef _MSC_VER
45#if _MSC_VER < 1800
46#define _USE_MATH_DEFINES
47#include <math.h>
48static __inline double fmin(double x, double y){ return (x < y) ? x : y; }
49static __inline double fmax(double x, double y){ return (x > y) ? x : y; }
50static __inline double log2(double x) { return log(x) * M_LOG2E; }
51#endif
52#endif
5347
5448#define PATH_SEPARATOR      "\\"


Previous 199869 Revisions Next


© 1997-2024 The MAME Team