Previous 199869 Revisions Next

r35083 Tuesday 17th February, 2015 at 06:31:50 UTC by Vasantha Crabb
Make QT debugger file names match class names without redundant prefix
[3rdparty/mongoose]LICENSE README.md mongoose.c
[3rdparty/mongoose/docs]SSL.md
[3rdparty/mongoose/examples/http_client]Makefile
[hash]pencil2.xml
[src/emu/cpu/amis2000]amis2000.c amis2000.h amis2000op.inc
[src/emu/cpu/m68000]m68000.h m68kcpu.c m68kcpu.h
[src/mame/drivers]cclimber.c cops.c n8080.c nbmj9195.c skeetsht.c wc90.c wwfsstar.c xxmissio.c
[src/mame/includes]wc90.h wwfsstar.h xxmissio.h
[src/mame/video]wc90.c wwfsstar.c xxmissio.c
[src/mess/drivers]pencil2.c tb303.c wildfire.c
[src/osd/modules/debugger]debugqt.c
[src/osd/modules/debugger/qt]breakpointswindow.c* breakpointswindow.h* dasmwindow.c* dasmwindow.h* debuggerview.c* debuggerview.h* debugqtbreakpointswindow.c debugqtbreakpointswindow.h debugqtdasmwindow.c debugqtdasmwindow.h debugqtdeviceinformationwindow.c debugqtdeviceinformationwindow.h debugqtdeviceswindow.c debugqtdeviceswindow.h debugqtlogwindow.c debugqtlogwindow.h debugqtmainwindow.c debugqtmainwindow.h debugqtmemorywindow.c debugqtmemorywindow.h debugqtview.c debugqtview.h debugqtwindow.c debugqtwindow.h deviceinformationwindow.c* deviceinformationwindow.h* deviceswindow.c* deviceswindow.h* logwindow.c* logwindow.h* mainwindow.c* mainwindow.h* memorywindow.c* memorywindow.h* windowqt.c* windowqt.h*
[src/osd/modules/sound]sdl_sound.c
[src/osd/osdmini]osdmini.mak
[src/osd/sdl]sdl.mak

trunk/3rdparty/mongoose/LICENSE
r243594r243595
11Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
2Copyright (c) 2013-2015 Cesanta Software Limited
2Copyright (c) 2013 Cesanta Software Limited
33All rights reserved
44
55This code is dual-licensed: you can redistribute it and/or modify
trunk/3rdparty/mongoose/README.md
r243594r243595
7878
7979# Other products by Cesanta Software: simple and effective
8080
81- [Fossa](http://github.com/cesanta/fossa) - Multi-protocol networking library
8281- [SSL Wrapper](https://github.com/cesanta/ssl_wrapper) - application to
8382  secure network communications
8483- [Frozen](https://github.com/cesanta/frozen) - JSON parser and generator
8584- [SLRE](https://github.com/cesanta/slre) - Super Light Regular Expression
8685  library
86- [Net Skeleton](https://github.com/cesanta/net_skeleton) - framework for
87  building network applications
88- [SLDR](https://github.com/cesanta/sldr) - Super Light DNS Resolver
trunk/3rdparty/mongoose/docs/SSL.md
r243594r243595
11# Mongoose SSL guide
22
33SSL is a protocol that makes web communication secure. To enable SSL
4in mongoose, 2 steps are required:
4in mongoose, 3 steps are required:
55
6   1. Create valid SSL certificate file
7   2. Append SSL certificate file path to the `listening_ports` option
6   1. Valid certificate file must be created
7   2. `ssl_certificate` options must be set to contain path to the
8       certificate file.
9   3. `listening_ports` option must contain a port number with letter `s`
10        appended to it, which instructs Mongoose to use SSL for all connections
11        made to that port.
812
913Below is the `mongoose.conf` file snippet for typical SSL setup:
1014
11    document_root     www_root         # Serve files in www_root directory
12    listening_ports   80,443:cert.pem  # Listen on ports 80 and 443
15    document_root     www_root        # Serve files in www_root directory
16    listening_ports   80r,443s        # Redirect all HTTP requests to HTTPS
17    ssl_certificate   ssl_cert.pem    # Location of certificate file
1318
1419## How to create SSL certificate file
1520
trunk/3rdparty/mongoose/examples/http_client/Makefile
r243594r243595
99   $(CC) -o $(PROG) $(SOURCES) $(CFLAGS)
1010
1111clean:
12   rm -rf $(PROG) *.exe *.dSYM *.obj *.exp *.o *.lib
12   rm -rf $(PROG) *.exe *.dSYM *.obj *.exp .*o *.lib
trunk/3rdparty/mongoose/mongoose.c
r243594r243595
4848#define _INTEGRAL_MAX_BITS 64   // Enable _stati64() on Windows
4949#define _CRT_SECURE_NO_WARNINGS // Disable deprecation warning in VS2005+
5050#undef WIN32_LEAN_AND_MEAN      // Let windows.h always include winsock2.h
51#if defined(__Linux__) || defined(_WIN32)
5251#define _XOPEN_SOURCE 600       // For flockfile() on Linux
53#endif
5452#define __STDC_FORMAT_MACROS    // <inttypes.h> wants this for C++
5553#define __STDC_LIMIT_MACROS     // C++ wants that for INT64_MAX
5654#ifndef _LARGEFILE_SOURCE
r243594r243595
347345  assert(io != NULL);
348346  assert(io->len <= io->size);
349347
350  /* check overflow */
351  if (len > ~(size_t)0 - (size_t)(io->buf + io->len)) {
352    return 0;
353  }
354
355348  if (len <= 0) {
356349  } else if (io->len + len <= io->size) {
357350    memcpy(io->buf + io->len, buf, len);
r243594r243595
28982891static int deliver_websocket_frame(struct connection *conn) {
28992892  // Having buf unsigned char * is important, as it is used below in arithmetic
29002893  unsigned char *buf = (unsigned char *) conn->ns_conn->recv_iobuf.buf;
2901  size_t i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0,
2894  int i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0,
29022895      mask_len = 0, header_len = 0, data_len = 0, buffered = 0;
29032896
29042897  if (buf_len >= 2) {
r243594r243595
29092902      header_len = 2 + mask_len;
29102903    } else if (len == 126 && buf_len >= 4 + mask_len) {
29112904      header_len = 4 + mask_len;
2912      data_len = ((((size_t) buf[2]) << 8) + buf[3]);
2905      data_len = ((((int) buf[2]) << 8) + buf[3]);
29132906    } else if (buf_len >= 10 + mask_len) {
29142907      header_len = 10 + mask_len;
2915      data_len = (size_t) (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) +
2908      data_len = (int) (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) +
29162909        htonl(* (uint32_t *) &buf[6]);
29172910    }
29182911  }
r243594r243595
29432936}
29442937
29452938size_t mg_websocket_write(struct mg_connection *conn, int opcode,
2946                          const char *data, size_t data_len) {
2939                       const char *data, size_t data_len) {
29472940    unsigned char mem[4192], *copy = mem;
29482941    size_t copy_len = 0;
29492942
2950    /* Check overflow */
2951    if (data_len > ~(size_t)0 - (size_t)10) {
2952      return 0;
2953    }
2954
29552943    if (data_len + 10 > sizeof(mem) &&
29562944        (copy = (unsigned char *) NS_MALLOC(data_len + 10)) == NULL) {
29572945      return 0;
trunk/hash/pencil2.xml
r243594r243595
55<!--
66
77Undumped known carts
8~~~~~~~~~~~~~~~~~~~~
8
99SD-BASIC V1.0
1010Le Jardin Magique (PEN-701)
1111Le Plongeur a la Recherche du Tresor (PEN-702) / Treasure Hunter
12Alien Invader
1312Big Foot Chase
14Parashooter
15Pinball
16Robot Killer
1713Smurf
18Space Squadron
19Space Vulture
20Super Bug
2114Zaxxon
2215
23Undumped known floppies
24~~~~~~~~~~~~~~~~~~~~~~~
25Basic Computer
26Data Base
27Payroll
28
29Undumped known cassettes
30~~~~~~~~~~~~~~~~~~~~~~~~
31Cheque Book Balance
32Data Base
33Household Expenses
34Reminder Calendar
35
3616-->
3717
3818
trunk/src/emu/cpu/amis2000/amis2000.c
r243594r243595
66  Overall functionality is similar to (and probably derived from) NEC uCOM-4.
77
88  References:
9  - AMI MOS Products Catalog 1979/1980
9  - AMI MOS Products Catalog Winter 1979
1010  - AMI S2000 Programming Manual (rev. 2)
1111
1212  TODO:
r243594r243595
2727// S2000 is the most basic one, 64 nibbles internal RAM and 1KB internal ROM
2828// S2150 increased RAM to 80 nibbles and ROM to 1.5KB
2929// high-voltage output versions of these chips (S2000A and S2150A) are identical overall
30const device_type AMI_S2000 = &device_creator<amis2000_cpu_device>;
31const device_type AMI_S2150 = &device_creator<amis2150_cpu_device>;
30const device_type AMI_S2000 = &device_creator<amis2000_device>;
31const device_type AMI_S2150 = &device_creator<amis2150_device>;
3232
33// S2152 is an extension to S2150, removing the K pins and adding a better timer
34const device_type AMI_S2152 = &device_creator<amis2152_cpu_device>;
3533
36
3734// internal memory maps
38static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_base_device)
35static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_device)
3936   AM_RANGE(0x0000, 0x03ff) AM_ROM
4037ADDRESS_MAP_END
4138
42static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_base_device)
39static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_device)
4340   AM_RANGE(0x0000, 0x03ff) AM_ROM
4441   AM_RANGE(0x0400, 0x05ff) AM_NOP // 0x00
4542   AM_RANGE(0x0600, 0x07ff) AM_ROM
4643ADDRESS_MAP_END
4744
4845
49static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, amis2000_base_device)
46static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, amis2000_device)
5047   AM_RANGE(0x00, 0x3f) AM_RAM
5148ADDRESS_MAP_END
5249
53static ADDRESS_MAP_START(data_80x4, AS_DATA, 8, amis2000_base_device)
50static ADDRESS_MAP_START(data_80x4, AS_DATA, 8, amis2000_device)
5451   AM_RANGE(0x00, 0x3f) AM_RAM
5552   AM_RANGE(0x40, 0x4f) AM_RAM
5653ADDRESS_MAP_END
5754
5855
5956// device definitions
60amis2000_cpu_device::amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
61   : amis2000_base_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, 2, 10, 3, 13, ADDRESS_MAP_NAME(program_1k), 6, ADDRESS_MAP_NAME(data_64x4), "amis2000", __FILE__)
62{ }
57amis2000_device::amis2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
58   : cpu_device(mconfig, AMI_S2000, "AMI S2000", tag, owner, clock, "amis2000", __FILE__),
59   m_program_config("program", ENDIANNESS_BIG, 8, 13, 0, ADDRESS_MAP_NAME(program_1k)),
60   m_data_config("data", ENDIANNESS_BIG, 8, 6, 0, ADDRESS_MAP_NAME(data_64x4)),
61   m_bu_bits(2),
62   m_callstack_bits(10),
63   m_callstack_depth(3),
64   m_read_k(*this),
65   m_read_i(*this),
66   m_read_d(*this),
67   m_write_d(*this),
68   m_write_a(*this)
69{
70}
6371
64amis2150_cpu_device::amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
65   : amis2000_base_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__)
66{ }
72amis2000_device::amis2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
73   : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source),
74   m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program),
75   m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data),
76   m_bu_bits(bu_bits),
77   m_callstack_bits(callstack_bits),
78   m_callstack_depth(callstack_depth),
79   m_read_k(*this),
80   m_read_i(*this),
81   m_read_d(*this),
82   m_write_d(*this),
83   m_write_a(*this)
84{
85}
6786
68amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
69   : amis2000_base_device(mconfig, AMI_S2152, "AMI S2152", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2152", __FILE__)
70{ }
87amis2150_device::amis2150_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
88   : amis2000_device(mconfig, AMI_S2150, "AMI S2150", tag, owner, clock, 3, 11, 3, 13, ADDRESS_MAP_NAME(program_1_5k), 7, ADDRESS_MAP_NAME(data_80x4), "amis2150", __FILE__)
89{
90}
7191
7292
73
7493// disasm
75void amis2000_base_device::state_string_export(const device_state_entry &entry, astring &string)
94void amis2000_device::state_string_export(const device_state_entry &entry, astring &string)
7695{
7796   switch (entry.index())
7897   {
r243594r243595
91110   }
92111}
93112
94offs_t amis2000_base_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
113offs_t amis2000_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
95114{
96115   extern CPU_DISASSEMBLE(amis2000);
97116   return CPU_DISASSEMBLE_NAME(amis2000)(this, buffer, pc, oprom, opram, options);
r243594r243595
109128   S2000_ACC, S2000_E, S2000_CY
110129};
111130
112void amis2000_base_device::device_start()
131void amis2000_device::device_start()
113132{
114133   m_program = &space(AS_PROGRAM);
115134   m_data = &space(AS_DATA);
r243594r243595
119138   m_read_d.resolve_safe(0);
120139   m_write_d.resolve_safe();
121140   m_write_a.resolve_safe();
122   m_write_f.resolve_safe();
123141
124142   m_bu_mask = (1 << m_bu_bits) - 1;
125143   m_callstack_mask = (1 << m_callstack_bits) - 1;
r243594r243595
179197}
180198
181199
182void amis2152_cpu_device::device_start()
183{
184   amis2000_base_device::device_start();
185200
186   m_d2f_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amis2152_cpu_device::d2f_timer_cb), this));
187   
188   // zerofill
189   m_d2f_latch = 0;
190   m_fout_state = 0;
191
192   // register for savestates
193   save_item(NAME(m_d2f_latch));
194   save_item(NAME(m_fout_state));
195}
196
197
198
199201//-------------------------------------------------
200202//  device_reset - device-specific reset
201203//-------------------------------------------------
202204
203void amis2000_base_device::device_reset()
205void amis2000_device::device_reset()
204206{
205207   m_pc = 0;
206208   m_op = 0;
207209   m_skip = false;
208210   
209211   // clear i/o
210   m_a = 0x1fff;
211   m_write_a(0, m_a, 0xffff);
212212   m_d_polarity = 0;
213   m_d = 0;
214   d_latch_out(false);
213   m_d = 0; d_latch_out(false);
214   m_a = 0; m_write_a(0, 0, 0xffff);
215215}
216216
217217
218void amis2152_cpu_device::device_reset()
219{
220   amis2000_base_device::device_reset();
221218
222   // start d2f timer
223   m_write_f(0);
224   d2f_timer_clock();
225}
226
227
228
229219//-------------------------------------------------
230220//  execute
231221//-------------------------------------------------
232222
233void amis2000_base_device::execute_run()
223void amis2000_device::execute_run()
234224{
235225   while (m_icount > 0)
236226   {
trunk/src/emu/cpu/amis2000/amis2000.h
r243594r243595
1414
1515// generic input pins (4 bits each)
1616#define MCFG_AMI_S2000_READ_K_CB(_devcb) \
17   amis2000_base_device::set_read_k_callback(*device, DEVCB_##_devcb);
17   amis2000_device::set_read_k_callback(*device, DEVCB_##_devcb);
1818
1919#define MCFG_AMI_S2000_READ_I_CB(_devcb) \
20   amis2000_base_device::set_read_i_callback(*device, DEVCB_##_devcb);
20   amis2000_device::set_read_i_callback(*device, DEVCB_##_devcb);
2121
2222// 8-bit external databus coupled as input/output pins
2323#define MCFG_AMI_S2000_READ_D_CB(_devcb) \
24   amis2000_base_device::set_read_d_callback(*device, DEVCB_##_devcb);
24   amis2000_device::set_read_d_callback(*device, DEVCB_##_devcb);
2525
2626#define MCFG_AMI_S2000_WRITE_D_CB(_devcb) \
27   amis2000_base_device::set_write_d_callback(*device, DEVCB_##_devcb);
27   amis2000_device::set_write_d_callback(*device, DEVCB_##_devcb);
2828
2929// 13-bit external addressbus coupled as output pins
3030#define MCFG_AMI_S2000_WRITE_A_CB(_devcb) \
31   amis2000_base_device::set_write_a_callback(*device, DEVCB_##_devcb);
31   amis2000_device::set_write_a_callback(*device, DEVCB_##_devcb);
3232
33// F_out pin (only for S2152)
34#define MCFG_AMI_S2152_FOUT_CB(_devcb) \
35   amis2000_base_device::set_write_f_callback(*device, DEVCB_##_devcb);
3633
37
38class amis2000_base_device : public cpu_device
34class amis2000_device : public cpu_device
3935{
4036public:
4137   // construction/destruction
42   amis2000_base_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source)
43      : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
44      , m_program_config("program", ENDIANNESS_BIG, 8, prgwidth, 0, program)
45      , m_data_config("data", ENDIANNESS_BIG, 8, datawidth, 0, data)
46      , m_bu_bits(bu_bits)
47      , m_callstack_bits(callstack_bits)
48      , m_callstack_depth(callstack_depth)
49      , m_read_k(*this)
50      , m_read_i(*this)
51      , m_read_d(*this)
52      , m_write_d(*this)
53      , m_write_a(*this)
54      , m_write_f(*this)
55   { }
38   amis2000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
39   amis2000_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 bu_bits, UINT8 callstack_bits, UINT8 callstack_depth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source);
5640
5741   // static configuration helpers
58   template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_k.set_callback(object); }
59   template<class _Object> static devcb_base &set_read_i_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_i.set_callback(object); }
60   template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_read_d.set_callback(object); }
61   template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_d.set_callback(object); }
62   template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_a.set_callback(object); }
63   template<class _Object> static devcb_base &set_write_f_callback(device_t &device, _Object object) { return downcast<amis2000_base_device &>(device).m_write_f.set_callback(object); }
42   template<class _Object> static devcb_base &set_read_k_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_k.set_callback(object); }
43   template<class _Object> static devcb_base &set_read_i_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_i.set_callback(object); }
44   template<class _Object> static devcb_base &set_read_d_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_read_d.set_callback(object); }
45   template<class _Object> static devcb_base &set_write_d_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_write_d.set_callback(object); }
46   template<class _Object> static devcb_base &set_write_a_callback(device_t &device, _Object object) { return downcast<amis2000_device &>(device).m_write_a.set_callback(object); }
6447
6548protected:
6649   // device-level overrides
r243594r243595
120103   devcb_read8 m_read_d;
121104   devcb_write8 m_write_d;
122105   devcb_write16 m_write_a;
123   devcb_write_line m_write_f;
124106   
125107   // misc internal helpers
126108   UINT8 ram_r();
r243594r243595
130112   void d_latch_out(bool active);
131113   
132114   // opcode handlers
133   virtual void op_lai();
134   virtual void op_lab();
135   virtual void op_lae();
136   virtual void op_xab();
137   virtual void op_xabu();
138   virtual void op_xae();
139   virtual void op_lbe();
140   virtual void op_lbep();
141   virtual void op_lbz();
142   virtual void op_lbf();
115   void op_lai();
116   void op_lab();
117   void op_lae();
118   void op_xab();
119   void op_xabu();
120   void op_xae();
121   void op_lbe();
122   void op_lbep();
123   void op_lbz();
124   void op_lbf();
143125
144   virtual void op_lam();
145   virtual void op_xc();
146   virtual void op_xci();
147   virtual void op_xcd();
148   virtual void op_stm();
149   virtual void op_rsm();
126   void op_lam();
127   void op_xc();
128   void op_xci();
129   void op_xcd();
130   void op_stm();
131   void op_rsm();
150132
151   virtual void op_inp();
152   virtual void op_out();
153   virtual void op_disb();
154   virtual void op_disn();
155   virtual void op_mvs();
156   virtual void op_psh();
157   virtual void op_psl();
158   virtual void op_eur();
133   void op_inp();
134   void op_out();
135   void op_disb();
136   void op_disn();
137   void op_mvs();
138   void op_psh();
139   void op_psl();
140   void op_eur();
159141
160   virtual void op_pp();
161   virtual void op_jmp();
162   virtual void op_jms();
163   virtual void op_rt();
164   virtual void op_rts();
165   virtual void op_nop();
166   virtual void op_halt();
142   void op_pp();
143   void op_jmp();
144   void op_jms();
145   void op_rt();
146   void op_rts();
147   void op_nop();
148   void op_halt();
167149
168   virtual void op_szc();
169   virtual void op_szm();
170   virtual void op_szi();
171   virtual void op_szk();
172   virtual void op_sbe();
173   virtual void op_sam();
174   virtual void op_sos();
175   virtual void op_tf1();
176   virtual void op_tf2();
150   void op_szc();
151   void op_szm();
152   void op_szi();
153   void op_szk();
154   void op_sbe();
155   void op_sam();
156   void op_sos();
157   void op_tf1();
158   void op_tf2();
177159
178   virtual void op_adcs();
179   virtual void op_adis();
180   virtual void op_add();
181   virtual void op_and();
182   virtual void op_xor();
183   virtual void op_stc();
184   virtual void op_rsc();
185   virtual void op_cma();
186   virtual void op_sf1();
187   virtual void op_rf1();
188   virtual void op_sf2();
189   virtual void op_rf2();
160   void op_adcs();
161   void op_adis();
162   void op_add();
163   void op_and();
164   void op_xor();
165   void op_stc();
166   void op_rsc();
167   void op_cma();
168   void op_sf1();
169   void op_rf1();
170   void op_sf2();
171   void op_rf2();
190172};
191173
192174
193class amis2000_cpu_device : public amis2000_base_device
175class amis2150_device : public amis2000_device
194176{
195177public:
196   amis2000_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
178   amis2150_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
197179};
198180
199181
200class amis2150_cpu_device : public amis2000_base_device
201{
202public:
203   amis2150_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
204};
205182
206
207class amis2152_cpu_device : public amis2000_base_device
208{
209public:
210   amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
211
212protected:
213   // device-level overrides
214   virtual void device_start();
215   virtual void device_reset();
216   
217   // digital-to-frequency converter
218   UINT8 m_d2f_latch;
219   emu_timer *m_d2f_timer;
220   int m_fout_state;
221
222   void d2f_timer_clock();
223   TIMER_CALLBACK_MEMBER(d2f_timer_cb);
224   
225   // opcode handlers
226   virtual void op_szk();
227};
228
229
230
231183extern const device_type AMI_S2000;
232184extern const device_type AMI_S2150;
233extern const device_type AMI_S2152;
234185
235186
236187#endif /* _AMIS2000_H_ */
trunk/src/emu/cpu/amis2000/amis2000op.inc
r243594r243595
22
33// internal helpers
44
5inline UINT8 amis2000_base_device::ram_r()
5inline UINT8 amis2000_device::ram_r()
66{
77   UINT16 address = m_bu << 4 | m_bl;
88   return m_data->read_byte(address) & 0xf;
99}
1010
11inline void amis2000_base_device::ram_w(UINT8 data)
11inline void amis2000_device::ram_w(UINT8 data)
1212{
1313   UINT16 address = m_bu << 4 | m_bl;
1414   m_data->write_byte(address, data & 0xf);
1515}
1616
17void amis2000_base_device::pop_callstack()
17void amis2000_device::pop_callstack()
1818{
1919   m_pc = (m_pc & ~m_callstack_mask) | (m_callstack[0] & m_callstack_mask);
2020   for (int i = 0; i < m_callstack_depth-1; i++)
2121      m_callstack[i] = m_callstack[i+1];
2222}
2323
24void amis2000_base_device::push_callstack()
24void amis2000_device::push_callstack()
2525{
2626   for (int i = m_callstack_depth-1; i >= 1; i--)
2727      m_callstack[i] = m_callstack[i-1];
2828   m_callstack[0] = m_pc & m_callstack_mask;
2929}
3030
31void amis2000_base_device::d_latch_out(bool active)
31void amis2000_device::d_latch_out(bool active)
3232{
3333   m_write_d(0, active ? (m_d ^ m_d_polarity) : 0, 0xff);
3434   m_d_active = active;
r243594r243595
3737
3838// Register Instructions
3939
40void amis2000_base_device::op_lai()
40void amis2000_device::op_lai()
4141{
4242   // LAI X: load ACC with X, select I and K inputs
4343   // note: only execute the first one in a sequence of LAI
r243594r243595
4949   }
5050}
5151
52void amis2000_base_device::op_lab()
52void amis2000_device::op_lab()
5353{
5454   // LAB: load ACC with BL
5555   m_acc = m_bl;
5656}
5757
58void amis2000_base_device::op_lae()
58void amis2000_device::op_lae()
5959{
6060   // LAE: load ACC with E
6161   m_acc = m_e;
6262}
6363
64void amis2000_base_device::op_xab()
64void amis2000_device::op_xab()
6565{
6666   // XAB: exchange ACC with BL
6767   UINT8 old_acc = m_acc;
r243594r243595
6969   m_bl = old_acc;
7070}
7171
72void amis2000_base_device::op_xabu()
72void amis2000_device::op_xabu()
7373{
7474   // XABU: exchange ACC with BU
7575   UINT8 old_acc = m_acc;
r243594r243595
7777   m_bu = old_acc & m_bu_mask;
7878}
7979
80void amis2000_base_device::op_xae()
80void amis2000_device::op_xae()
8181{
8282   // XAE: exchange ACC with E
8383   UINT8 old_acc = m_acc;
r243594r243595
8585   m_e = old_acc;
8686}
8787
88void amis2000_base_device::op_lbe()
88void amis2000_device::op_lbe()
8989{
9090   // LBE Y: load BU with Y, load BL with E
9191   // note: only execute the first one in a sequence of LB*
r243594r243595
9797   }
9898}
9999
100void amis2000_base_device::op_lbep()
100void amis2000_device::op_lbep()
101101{
102102   // LBEP Y: load BU with Y, load BL with E+1
103103   // note: only execute the first one in a sequence of LB*
r243594r243595
109109   }
110110}
111111
112void amis2000_base_device::op_lbz()
112void amis2000_device::op_lbz()
113113{
114114   // LBZ Y: load BU with Y, load BL with 0
115115   // note: only execute the first one in a sequence of LB*
r243594r243595
121121   }
122122}
123123
124void amis2000_base_device::op_lbf()
124void amis2000_device::op_lbf()
125125{
126126   // LBF Y: load BU with Y, load BL with 15
127127   // note: only execute the first one in a sequence of LB*
r243594r243595
136136
137137// RAM Instructions
138138
139void amis2000_base_device::op_lam()
139void amis2000_device::op_lam()
140140{
141141   // LAM _Y: load ACC with RAM, xor BU with _Y
142142   m_acc = ram_r();
r243594r243595
144144   m_bu ^= (param & m_bu_mask);
145145}
146146
147void amis2000_base_device::op_xc()
147void amis2000_device::op_xc()
148148{
149149   // XC _Y: exchange ACC with RAM, xor BU with _Y
150150   UINT8 old_acc = m_acc;
r243594r243595
154154   m_bu ^= (param & m_bu_mask);
155155}
156156
157void amis2000_base_device::op_xci()
157void amis2000_device::op_xci()
158158{
159159   // XCI _Y: exchange ACC with RAM, increment BL(skip next on carry), xor BU with _Y
160160   op_xc();
r243594r243595
162162   m_skip = (m_bl == 0);
163163}
164164
165void amis2000_base_device::op_xcd()
165void amis2000_device::op_xcd()
166166{
167167   // XCD _Y: exchange ACC with RAM, decrement BL(skip next on carry), xor BU with _Y
168168   op_xc();
r243594r243595
170170   m_skip = (m_bl == 0xf);
171171}
172172
173void amis2000_base_device::op_stm()
173void amis2000_device::op_stm()
174174{
175175   // STM Z: set RAM bit Z
176176   UINT8 param = 1 << (m_op & 0x03);
177177   ram_w(ram_r() | param);
178178}
179179
180void amis2000_base_device::op_rsm()
180void amis2000_device::op_rsm()
181181{
182182   // RSM Z: reset RAM bit Z
183183   UINT8 param = 1 << (m_op & 0x03);
r243594r243595
187187
188188// Input/Output Instructions
189189
190void amis2000_base_device::op_inp()
190void amis2000_device::op_inp()
191191{
192192   // INP: input D-pins to ACC and RAM
193193   UINT8 in = m_d_active ? m_d : m_read_d(0, 0xff);
r243594r243595
195195   ram_w(in >> 4 & 0xf);
196196}
197197
198void amis2000_base_device::op_out()
198void amis2000_device::op_out()
199199{
200200   // OUT: pulse output ACC and RAM to D-pins
201201   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
202202}
203203
204void amis2000_base_device::op_disb()
204void amis2000_device::op_disb()
205205{
206206   // DISB: set D-latch to ACC and RAM directly
207207   m_d = m_acc | ram_r() << 4;
208208   d_latch_out(true);
209209}
210210
211void amis2000_base_device::op_disn()
211void amis2000_device::op_disn()
212212{
213213   // DISN: set D-latch to ACC+carry via on-die segment decoder
214214   static const UINT8 lut_segment_decoder[0x10] =
r243594r243595
220220   d_latch_out(true);
221221}
222222
223void amis2000_base_device::op_mvs()
223void amis2000_device::op_mvs()
224224{
225225   // MVS: output master strobe latch to A-pins
226226   d_latch_out(false);
227227   m_write_a(0, m_a, 0xffff);
228228}
229229
230void amis2000_base_device::op_psh()
230void amis2000_device::op_psh()
231231{
232232   // PSH: preset high(BL) master strobe latch
233233   switch (m_bl)
r243594r243595
254254   }
255255}
256256
257void amis2000_base_device::op_psl()
257void amis2000_device::op_psl()
258258{
259259   // PSL: preset low(BL) master strobe latch
260260   switch (m_bl)
r243594r243595
281281   }
282282}
283283
284void amis2000_base_device::op_eur()
284void amis2000_device::op_eur()
285285{
286286   // EUR: set timer frequency(European) and D-latch polarity, via ACC
287287   m_d_polarity = (m_acc & 1) ? 0x00 : 0xff;
r243594r243595
291291
292292// Program Control Instructions
293293
294void amis2000_base_device::op_pp()
294void amis2000_device::op_pp()
295295{
296296   // PP _X: prepare page/bank with _X
297297   UINT8 param = ~m_op & 0x0f;
r243594r243595
301301      m_pbr = param & 7;
302302}
303303
304void amis2000_base_device::op_jmp()
304void amis2000_device::op_jmp()
305305{
306306   // JMP X: jump to X(+PP)
307307   UINT16 mask = 0x3f;
r243594r243595
316316   m_pc = (m_pc & ~mask) | param;
317317}
318318
319void amis2000_base_device::op_jms()
319void amis2000_device::op_jms()
320320{
321321   // JMS X: call to X(+PP)
322322   m_icount--;
r243594r243595
328328      m_pc |= 0x3c0;
329329}
330330
331void amis2000_base_device::op_rt()
331void amis2000_device::op_rt()
332332{
333333   // RT: return from subroutine
334334   pop_callstack();
335335}
336336
337void amis2000_base_device::op_rts()
337void amis2000_device::op_rts()
338338{
339339   // RTS: return from subroutine and skip next
340340   op_rt();
341341   m_skip = true;
342342}
343343
344void amis2000_base_device::op_nop()
344void amis2000_device::op_nop()
345345{
346346   // NOP: no operation
347347}
348348
349void amis2000_base_device::op_halt()
349void amis2000_device::op_halt()
350350{
351351   // HALT: debugger breakpoint for devkit-use
352352   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
r243594r243595
355355
356356// Skip Instructions
357357
358void amis2000_base_device::op_szc()
358void amis2000_device::op_szc()
359359{
360360   // SZC: skip next on zero(no) carry
361361   m_skip = !m_carry;
362362}
363363
364void amis2000_base_device::op_szm()
364void amis2000_device::op_szm()
365365{
366366   // SZM Z: skip next on zero RAM bit Z
367367   UINT8 param = 1 << (m_op & 0x03);
368368   m_skip = !(ram_r() & param);
369369}
370370
371void amis2000_base_device::op_szi()
371void amis2000_device::op_szi()
372372{
373373   // SZI: skip next on I pin(s)
374374   m_skip = ((~m_read_i(0, 0xff) & m_ki_mask) != 0);
375375}
376376
377void amis2000_base_device::op_szk()
377void amis2000_device::op_szk()
378378{
379379   // SZK: skip next on K pin(s)
380380   m_skip = ((~m_read_k(0, 0xff) & m_ki_mask) != 0);
381381}
382382
383void amis2000_base_device::op_sbe()
383void amis2000_device::op_sbe()
384384{
385385   // SBE: skip next on BL equals E
386386   m_skip = (m_bl == m_e);
387387}
388388
389void amis2000_base_device::op_sam()
389void amis2000_device::op_sam()
390390{
391391   // SAM: skip next on ACC equals RAM
392392   m_skip = (m_acc == ram_r());
393393}
394394
395void amis2000_base_device::op_sos()
395void amis2000_device::op_sos()
396396{
397397   // SOS: skip next on SF(timer output), clear SF
398398   logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
399399}
400400
401void amis2000_base_device::op_tf1()
401void amis2000_device::op_tf1()
402402{
403403   // TF1: skip next on flag 1
404404   m_skip = ((m_f & 0x01) != 0);
405405}
406406
407void amis2000_base_device::op_tf2()
407void amis2000_device::op_tf2()
408408{
409409   // TF2: skip next on flag 2
410410   m_skip = ((m_f & 0x02) != 0);
r243594r243595
413413
414414// Arithmetic and Logical Instructions
415415
416void amis2000_base_device::op_adcs()
416void amis2000_device::op_adcs()
417417{
418418   // ADCS: add RAM to ACC+carry, skip next on not carry
419419   m_acc += ram_r() + m_carry;
r243594r243595
422422   m_acc &= 0xf;
423423}
424424
425void amis2000_base_device::op_adis()
425void amis2000_device::op_adis()
426426{
427427   // ADIS X: add X to ACC, skip next on not carry
428428   UINT8 param = m_op & 0x0f;
r243594r243595
431431   m_acc &= 0xf;
432432}
433433
434void amis2000_base_device::op_add()
434void amis2000_device::op_add()
435435{
436436   // ADD: add RAM to ACC
437437   m_acc = (m_acc + ram_r()) & 0xf;
438438}
439439
440void amis2000_base_device::op_and()
440void amis2000_device::op_and()
441441{
442442   // AND: and ACC with RAM
443443   m_acc &= ram_r();
444444}
445445
446void amis2000_base_device::op_xor()
446void amis2000_device::op_xor()
447447{
448448   // XOR: xor ACC with RAM
449449   m_acc ^= ram_r();
450450}
451451
452void amis2000_base_device::op_stc()
452void amis2000_device::op_stc()
453453{
454454   // STC: set carry
455455   m_carry = 1;
456456}
457457
458void amis2000_base_device::op_rsc()
458void amis2000_device::op_rsc()
459459{
460460   // RSC: reset carry
461461   m_carry = 0;
462462}
463463
464void amis2000_base_device::op_cma()
464void amis2000_device::op_cma()
465465{
466466   // CMA: complement ACC
467467   m_acc ^= 0xf;
468468}
469469
470void amis2000_base_device::op_sf1()
470void amis2000_device::op_sf1()
471471{
472472   // SF1: set flag 1
473473   m_f |= 0x01;
474474}
475475
476void amis2000_base_device::op_rf1()
476void amis2000_device::op_rf1()
477477{
478478   // RF1: reset flag 1
479479   m_f &= ~0x01;
480480}
481481
482void amis2000_base_device::op_sf2()
482void amis2000_device::op_sf2()
483483{
484484   // SF2: set flag 2
485485   m_f |= 0x02;
486486}
487487
488void amis2000_base_device::op_rf2()
488void amis2000_device::op_rf2()
489489{
490490   // RF2: reset flag 2
491491   m_f &= ~0x02;
492492}
493
494
495
496// AMI S2152 specific handlers
497
498void amis2152_cpu_device::d2f_timer_clock()
499{
500   // schedule next timeout (frequency is guessed)
501   attotime base = attotime::from_hz(unscaled_clock() / 4 / 64);
502   m_d2f_timer->adjust(base * (0x10 - m_d2f_latch));
503}
504
505TIMER_CALLBACK_MEMBER(amis2152_cpu_device::d2f_timer_cb)
506{
507   m_write_f(m_fout_state);
508   m_fout_state ^= 1;
509   
510   d2f_timer_clock();
511}
512
513void amis2152_cpu_device::op_szk()
514{
515   // instead of SZK: ???: load d2f latch with ACC(?)
516   m_d2f_latch = m_acc;
517}
trunk/src/emu/cpu/m68000/m68000.h
r243594r243595
356356   UINT16 mmu_tmp_buserror_rw;   /* temporary hack: (first) bus error rw */
357357
358358   UINT32 ic_address[M68K_IC_SIZE];   /* instruction cache address data */
359   UINT32 ic_data[M68K_IC_SIZE];      /* instruction cache content data */
360   bool   ic_valid[M68K_IC_SIZE];      /* instruction cache valid flags */
359   UINT16 ic_data[M68K_IC_SIZE];      /* instruction cache content data */
361360
362361
363362
363
364364   /* 68307 / 68340 internal address map */
365365   address_space *internal;
366366
trunk/src/emu/cpu/m68000/m68kcpu.c
r243594r243595
24782478   mmu_tmp_buserror_rw = 0;
24792479
24802480   for (int i=0;i<M68K_IC_SIZE;i++)
2481   {
24822481      ic_address[i] = 0;
2482
2483   for (int i=0;i<M68K_IC_SIZE;i++)
24832484      ic_data[i] = 0;
2484      ic_valid[i] = false;
2485   }
24862485
24872486   internal = 0;
24882487}
trunk/src/emu/cpu/m68000/m68kcpu.h
r243594r243595
683683
684684INLINE UINT32 m68ki_ic_readimm16(m68000_base_device *m68k, UINT32 address)
685685{
686   if (m68k->cacr & M68K_CACR_EI)
686/*  if(CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type) && (m68k->cacr & M68K_CACR_EI))
687    {
688        UINT32 ic_offset = (address >> 1) % M68K_IC_SIZE;
689        if (m68k->ic_address[ic_offset] == address)
690        {
691            return m68k->ic_data[ic_offset];
692        }
693        else
694        {
695            UINT32 data = m68k->memory.readimm16(address);
696            if (!m68k->mmu_tmp_buserror_occurred)
697            {
698                m68k->ic_data[ic_offset] = data;
699                m68k->ic_address[ic_offset] = address;
700            }
701            return data;
702        }
703    }
704    else*/
687705   {
688      // 68020 series I-cache (MC68020 User's Manual, Section 4 - On-Chip Cache Memory)
689      if (m68k->cpu_type & (CPU_TYPE_EC020 | CPU_TYPE_020))
690      {
691         UINT32 tag = (address >> 8) | (m68k->s_flag ? 0x1000000 : 0);
692         int idx = (address >> 2) & 0x3f;   // 1-of-64 select
693
694         // do a cache fill if the line is invalid or the tags don't match
695         if ((!m68k->ic_valid[idx]) || (m68k->ic_address[idx] != tag))
696         {
697            m68k->ic_data[idx] = m68k->read32(address & ~3);
698
699//            printf("m68k: doing cache fill at %08x (tag %08x idx %d)\n", address, tag, idx);
700
701            // if no buserror occured, validate the tag
702            if (!m68k->mmu_tmp_buserror_occurred)
703            {
704               m68k->ic_address[idx] = tag;
705               m68k->ic_valid[idx] = true;
706            }
707            else
708            {
709               return m68k->readimm16(address);
710            }
711         }
712
713         // at this point, the cache is guaranteed to be valid, either as
714         // a hit or because we just filled it.
715         if (address & 2)
716         {
717            return m68k->ic_data[idx] & 0xffff;
718         }
719         else
720         {
721            return m68k->ic_data[idx] >> 16;
722         }
723      }
706      return m68k->/*memory.*/readimm16(address);
724707   }
725708
726   return m68k->readimm16(address);
709   // this can't happen, but Apple GCC insists
710//  return 0;
727711}
728712
729713/* Handles all immediate reads, does address error check, function code setting,
trunk/src/mame/drivers/cclimber.c
r243594r243595
16221622
16231623This game runs on dedicated hardware.
16241624
1625Possibly bootlegged by Hafasonic?
1626
16271625CPU Board
16281626---------
16291627
r243594r243595
23962394GAME( 1981, ckong,       0,        cclimber, ckong, driver_device,    0,        ROT270, "Kyoei / Falcon", "Crazy Kong", 0 ) // on a Falcon FCK-01 PCB, but doesn't display any Falcon copyright
23972395GAME( 1981, ckongalc,    ckong,    cclimber, ckong, driver_device,    0,        ROT270, "bootleg (Alca)", "Crazy Kong (Alca bootleg)", 0 )
23982396GAME( 1981, monkeyd,     ckong,    cclimber, ckong, driver_device,    0,        ROT270, "bootleg", "Monkey Donkey", 0 )
2399GAME( 1981, dking,       ckong,    cclimber, ckong, cclimber_state,   dking,    ROT270, "bootleg", "Donkey King", 0 ) // supposedly, possibly by Hafasonic?
2397GAME( 1981, dking,       ckong,    cclimber, ckong, cclimber_state,   dking,    ROT270, "bootleg", "Donkey King", 0 )
24002398GAME( 1981, ckongdks,    ckong,    cclimber, ckong, cclimber_state,   dking,    ROT270, "bootleg", "Donkey Kong (Spanish Crazy Kong bootleg)", 0 )
24012399
24022400/* these sets have correct colours, and also contain the graphics used for the extra attract screen in the BG roms, but it is unused
trunk/src/mame/drivers/cops.c
r243594r243595
889889
890890   ROM_REGION( 0x8000, "system", 0 )
891891   ROM_LOAD( "cops_sys.dat", 0x0000, 0x8000, CRC(0060e5d0) SHA1(b8c9f6fde6a315e33fa7946e5d3bb4ea2fbe76a8) )
892   
893   DISK_REGION( "audiocd" )
894        DISK_IMAGE_READONLY( "copscd", 0, NO_DUMP )
895
896   DISK_REGION( "laserdisc" )
897        DISK_IMAGE_READONLY( "cops", 0, NO_DUMP )
898892ROM_END
899893
900894ROM_START( copsuk )
r243594r243595
903897
904898   ROM_REGION( 0x8000, "system", 0 )
905899   ROM_LOAD( "cops_sys.dat", 0x0000, 0x8000, CRC(0060e5d0) SHA1(b8c9f6fde6a315e33fa7946e5d3bb4ea2fbe76a8) )
906
907   DISK_REGION( "audiocd" )
908        DISK_IMAGE_READONLY( "copscd", 0, NO_DUMP )
909
910   DISK_REGION( "laserdisc" )
911        DISK_IMAGE_READONLY( "cops", 0, NO_DUMP )
912900ROM_END
913901
914902ROM_START( revlatns )
r243594r243595
917905
918906   ROM_REGION( 0x8000, "system", 0 )
919907   ROM_LOAD( "revelations_sys.bin", 0x0000, 0x8000, CRC(43e5e3ec) SHA1(fa44b102b5aa7ad2421c575abdc67f1c29f23bc1) )
920
921   DISK_REGION( "laserdisc" )
922        DISK_IMAGE_READONLY( "revlatns", 0, NO_DUMP )
923908ROM_END
924909
925910
trunk/src/mame/drivers/n8080.c
r243594r243595
33  Nintendo 8080 hardware
44
55    - Space Fever
6    - Space Fever High Splitter (aka SF-Hisplitter)
6    - Space Fever High Splitter
77    - Space Launcher
88    - Sheriff / Bandido / Western Gun 2
99    - Helifire
r243594r243595
933933GAME( 1979, spacefev,   0,        spacefev, spacefev, driver_device, 0, ROT270, "Nintendo", "Space Fever (New Ver.)", GAME_SUPPORTS_SAVE )
934934GAME( 1979, spacefevo,  spacefev, spacefev, spacefev, driver_device, 0, ROT270, "Nintendo", "Space Fever (Old Ver.)", GAME_SUPPORTS_SAVE )
935935GAME( 1979, spacefevo2, spacefev, spacefev, spacefev, driver_device, 0, ROT270, "Nintendo", "Space Fever (Older Ver.)", GAME_SUPPORTS_SAVE )
936GAME( 1979, highsplt,   0,        spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", GAME_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
937GAME( 1979, highsplta,  highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", GAME_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
938GAME( 1979, highspltb,  highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", GAME_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
936GAME( 1979, highsplt,   0,        spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", GAME_SUPPORTS_SAVE )
937GAME( 1979, highsplta,  highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", GAME_SUPPORTS_SAVE )
938GAME( 1979, highspltb,  highsplt, spacefev, highsplt, driver_device, 0, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", GAME_SUPPORTS_SAVE )
939939GAME( 1979, spacelnc,   0,        spacefev, spacelnc, driver_device, 0, ROT270, "Nintendo", "Space Launcher", GAME_SUPPORTS_SAVE )
940940GAME( 1979, sheriff,    0,        sheriff,  sheriff, driver_device,  0, ROT270, "Nintendo", "Sheriff", GAME_SUPPORTS_SAVE )
941941GAME( 1980, bandido,    sheriff,  sheriff,  bandido, driver_device,  0, ROT270, "Nintendo (Exidy license)", "Bandido", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/nbmj9195.c
r243594r243595
37203720   ROM_LOAD( "6.bin",        0x020000, 0x010000, CRC(0fece809) SHA1(1fe8436af8ead02a3b517b6306f9824cd64b2d26) )
37213721   ROM_LOAD( "5.bin",        0x010000, 0x010000, CRC(0706386a) SHA1(29eee363775869dcc9c46285632e8bf745c9110b) )
37223722   ROM_LOAD( "4.bin",        0x000000, 0x010000, CRC(199e2127) SHA1(2514d51cb06438b312d1f328c72baa739280416a) )
3723   
3724   DISK_REGION( "laserdisc" )
3725        DISK_IMAGE_READONLY( "shabdama", 0, NO_DUMP )
37263723ROM_END
37273724
37283725//    YEAR, NAME,     PARENT,   MACHINE,  INPUT,    INIT,     MONITOR, COMPANY, FULLNAME, FLAGS
trunk/src/mame/drivers/skeetsht.c
r243594r243595
33    Dynamo Skeet Shot
44
55    Notes:
6        Pop Shot is a prototype sequel (or upgrade) to Skeet Shot
7       
8        Supposedly Skeet Shot used a laserdisc to supply video for eight
9        different background "scenes". Pop Shot probably did too, in that case.
6        Pop Shot is a prototype sequal (or upgrade) to Skeet Shot
107
118***************************************************************************/
129
r243594r243595
266263   ROM_REGION16_LE( 0x200000, "tms", 0 )
267264   ROM_LOAD16_BYTE( "even_v1.2.u14", 0x000000, 0x40000, CRC(c7c9515e) SHA1(ce3e813c15085790d5335d9fc751b3cc5b617b20) )
268265   ROM_LOAD16_BYTE( "odd_v1.2.u13",  0x000001, 0x40000, CRC(ea4402fb) SHA1(b0b6b191a8b48bead660a385c638363943a6ffe2) )
269   
270   DISK_REGION( "laserdisc" )
271        DISK_IMAGE_READONLY( "skeetsht", 0, NO_DUMP ) // unknown disc label?
272266ROM_END
273267
274268ROM_START( popshot )
r243594r243595
279273   ROM_REGION16_LE( 0x200000, "tms", 0 )
280274   ROM_LOAD16_BYTE( "popshot_tms34_even.u14", 0x000000, 0x80000, CRC(bf2f7309) SHA1(6ca252f857e5dc2e5267c176403c44e7a15f539e) )
281275   ROM_LOAD16_BYTE( "popshot_tms34_odd.u13",  0x000001, 0x80000, CRC(82d616d8) SHA1(83ab33727ebab882b79c9ebd3557e2c319b3387a) )
282
283   DISK_REGION( "laserdisc" )
284        DISK_IMAGE_READONLY( "popshot", 0, NO_DUMP ) // unknown disc label?
285276ROM_END
286277
287278
trunk/src/mame/drivers/wc90.c
r243594r243595
5555*                           *
5656*****************************
5757
58There is known to be a Pacman hack running on this hardware.  It was done by Mike C. and isn't meant
58There is known to be a Pacman hack running on this hardware.  It was done by Mike C. and isn't ment
5959for inclusion in MAME.  However the roms with checksums are listed below to prevent it being added
6060as a newly "found" game:
6161
r243594r243595
7979#include "includes/wc90.h"
8080
8181
82WRITE8_MEMBER(wc90_state::bankswitch_w)
82WRITE8_MEMBER(wc90_state::wc90_bankswitch_w)
8383{
8484   int bankaddress;
8585   UINT8 *RAM = memregion("maincpu")->base();
r243594r243595
8989   membank("bank1")->set_base(&RAM[bankaddress] );
9090}
9191
92WRITE8_MEMBER(wc90_state::bankswitch1_w)
92WRITE8_MEMBER(wc90_state::wc90_bankswitch1_w)
9393{
9494   int bankaddress;
9595   UINT8 *RAM = memregion("sub")->base();
r243594r243595
9999   membank("bank2")->set_base(&RAM[bankaddress] );
100100}
101101
102WRITE8_MEMBER(wc90_state::sound_command_w)
102WRITE8_MEMBER(wc90_state::wc90_sound_command_w)
103103{
104104   soundlatch_byte_w(space, offset, data);
105105   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
r243594r243595
110110static ADDRESS_MAP_START( wc90_map_1, AS_PROGRAM, 8, wc90_state )
111111   AM_RANGE(0x0000, 0x7fff) AM_ROM
112112   AM_RANGE(0x8000, 0x9fff) AM_RAM     /* Main RAM */
113   AM_RANGE(0xa000, 0xafff) AM_RAM_WRITE(fgvideoram_w) AM_SHARE("fgvideoram") /* fg video ram */
113   AM_RANGE(0xa000, 0xafff) AM_RAM_WRITE(wc90_fgvideoram_w) AM_SHARE("fgvideoram") /* fg video ram */
114114   AM_RANGE(0xb000, 0xbfff) AM_RAM
115   AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(bgvideoram_w) AM_SHARE("bgvideoram")
115   AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(wc90_bgvideoram_w) AM_SHARE("bgvideoram")
116116   AM_RANGE(0xd000, 0xdfff) AM_RAM
117   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") /* tx video ram */
117   AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(wc90_txvideoram_w) AM_SHARE("txvideoram") /* tx video ram */
118118   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank1")
119119   AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("share1")
120120   AM_RANGE(0xfc00, 0xfc00) AM_READ_PORT("P1")
r243594r243595
134134   AM_RANGE(0xfc43, 0xfc43) AM_WRITEONLY AM_SHARE("scroll2yhi")
135135   AM_RANGE(0xfc46, 0xfc46) AM_WRITEONLY AM_SHARE("scroll2xlo")
136136   AM_RANGE(0xfc47, 0xfc47) AM_WRITEONLY AM_SHARE("scroll2xhi")
137   AM_RANGE(0xfcc0, 0xfcc0) AM_WRITE(sound_command_w)
137   AM_RANGE(0xfcc0, 0xfcc0) AM_WRITE(wc90_sound_command_w)
138138   AM_RANGE(0xfcd0, 0xfcd0) AM_WRITE(watchdog_reset_w)
139   AM_RANGE(0xfce0, 0xfce0) AM_WRITE(bankswitch_w)
139   AM_RANGE(0xfce0, 0xfce0) AM_WRITE(wc90_bankswitch_w)
140140ADDRESS_MAP_END
141141
142142static ADDRESS_MAP_START( wc90_map_2, AS_PROGRAM, 8, wc90_state )
r243594r243595
147147   AM_RANGE(0xe000, 0xe7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
148148   AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK("bank2")
149149   AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE("share1")
150   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(bankswitch1_w)
150   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90_bankswitch1_w)
151151   AM_RANGE(0xfc01, 0xfc01) AM_WRITE(watchdog_reset_w)
152152ADDRESS_MAP_END
153153
r243594r243595
316316   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
317317   MCFG_SCREEN_SIZE(32*8, 32*8)
318318   MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
319   MCFG_SCREEN_UPDATE_DRIVER(wc90_state, screen_update)
319   MCFG_SCREEN_UPDATE_DRIVER(wc90_state, screen_update_wc90)
320320   MCFG_SCREEN_PALETTE("palette")
321321
322322   MCFG_GFXDECODE_ADD("gfxdecode", "palette", wc90)
r243594r243595
472472   ROM_LOAD( "ic82_06.bin",  0x00000, 0x20000, CRC(2fd692ed) SHA1(0273dc39181504320bec0187d074b2f86c821508) )
473473ROM_END
474474
475GAME( 1989, wc90,  0,    wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (World)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
476GAME( 1989, wc90a, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
477GAME( 1989, wc90b, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 2)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
478GAME( 1989, wc90t, wc90, wc90t,wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (trackball set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
475GAME( 1989, wc90,  0,    wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (World)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
476GAME( 1989, wc90a, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
477GAME( 1989, wc90b, wc90, wc90, wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (Euro set 2)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
478GAME( 1989, wc90t, wc90, wc90t,wc90, driver_device, 0, ROT0, "Tecmo", "Tecmo World Cup '90 (trackball set 1)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
trunk/src/mame/drivers/wwfsstar.c
r243594r243595
121121 04 Mar 2002 | Fixed Dip Switches and Inputs    (Steph)
122122             | Fixed screen flipping by using similar routine to the one
123123             | in src/video/wwfwfest.c        (Steph)
124 18 Jun 2001 | Changed Interrupt Function .. it's not fully understood what
124 18 Jun 2001 | Changed Interrupt Function .. its not fully understood whats
125125             | is meant to be going on ..
126126 15 Jun 2001 | Cleaned up Sprite Drawing a bit, correcting some clipping probs,
127127             | mapped DSW's
r243594r243595
170170
171171static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, wwfsstar_state )
172172   AM_RANGE(0x000000, 0x03ffff) AM_ROM
173   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(fg0_videoram_w) AM_SHARE("fg0_videoram") /* FG0 Ram */
174   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(bg0_videoram_w) AM_SHARE("bg0_videoram") /* BG0 Ram */
173   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(wwfsstar_fg0_videoram_w) AM_SHARE("fg0_videoram") /* FG0 Ram */
174   AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM_WRITE(wwfsstar_bg0_videoram_w) AM_SHARE("bg0_videoram") /* BG0 Ram */
175175   AM_RANGE(0x100000, 0x1003ff) AM_RAM AM_SHARE("spriteram")       /* SPR Ram */
176176   AM_RANGE(0x140000, 0x140fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
177   AM_RANGE(0x180000, 0x180003) AM_WRITE(irqack_w)
177   AM_RANGE(0x180000, 0x180003) AM_WRITE(wwfsstar_irqack_w)
178178   AM_RANGE(0x180000, 0x180001) AM_READ_PORT("DSW1")
179179   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("DSW2")
180180   AM_RANGE(0x180004, 0x180005) AM_READ_PORT("P1")
181   AM_RANGE(0x180004, 0x180007) AM_WRITE(scroll_w)
181   AM_RANGE(0x180004, 0x180007) AM_WRITE(wwfsstar_scrollwrite)
182182   AM_RANGE(0x180006, 0x180007) AM_READ_PORT("P2")
183183   AM_RANGE(0x180008, 0x180009) AM_READ_PORT("SYSTEM")
184   AM_RANGE(0x180008, 0x180009) AM_WRITE(sound_w)
185   AM_RANGE(0x18000a, 0x18000b) AM_WRITE(flipscreen_w)
184   AM_RANGE(0x180008, 0x180009) AM_WRITE(wwfsstar_soundwrite)
185   AM_RANGE(0x18000a, 0x18000b) AM_WRITE(wwfsstar_flipscreen_w)
186186   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM                             /* Work Ram */
187187ADDRESS_MAP_END
188188
r243594r243595
201201 as used by the above memory map
202202*******************************************************************************/
203203
204WRITE16_MEMBER(wwfsstar_state::scroll_w)
204WRITE16_MEMBER(wwfsstar_state::wwfsstar_scrollwrite)
205205{
206206   switch (offset)
207207   {
r243594r243595
214214   }
215215}
216216
217WRITE16_MEMBER(wwfsstar_state::sound_w)
217WRITE16_MEMBER(wwfsstar_state::wwfsstar_soundwrite)
218218{
219219   soundlatch_byte_w(space, 1, data & 0xff);
220220   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE );
221221}
222222
223WRITE16_MEMBER(wwfsstar_state::flipscreen_w)
223WRITE16_MEMBER(wwfsstar_state::wwfsstar_flipscreen_w)
224224{
225225   flip_screen_set(data & 1);
226226}
227227
228WRITE16_MEMBER(wwfsstar_state::irqack_w)
228WRITE16_MEMBER(wwfsstar_state::wwfsstar_irqack_w)
229229{
230230   if (offset == 0)
231231      m_maincpu->set_input_line(6, CLEAR_LINE);
r243594r243595
247247    A hack is required: raise the vblank bit a scanline early.
248248*/
249249
250TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_state::scanline)
250TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_state::wwfsstar_scanline)
251251{
252252   int scanline = param;
253253
r243594r243595
278278   }
279279}
280280
281CUSTOM_INPUT_MEMBER(wwfsstar_state::vblank_r)
281CUSTOM_INPUT_MEMBER(wwfsstar_state::wwfsstar_vblank_r)
282282{
283283   return m_vblank;
284284}
r243594r243595
313313   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Button B (1P VS 2P - Buy-in)")
314314
315315   PORT_START("SYSTEM")
316   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfsstar_state, vblank_r, NULL) /* VBlank */
316   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfsstar_state,wwfsstar_vblank_r, NULL) /* VBlank */
317317   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 )
318318   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN2 )
319319   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE1 )
r243594r243595
416416   /* basic machine hardware */
417417   MCFG_CPU_ADD("maincpu", M68000, CPU_CLOCK)
418418   MCFG_CPU_PROGRAM_MAP(main_map)
419   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", wwfsstar_state, scanline, "screen", 0, 1)
419   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", wwfsstar_state, wwfsstar_scanline, "screen", 0, 1)
420420
421421   MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz)
422422   MCFG_CPU_PROGRAM_MAP(sound_map)
r243594r243595
424424   /* video hardware */
425425   MCFG_SCREEN_ADD("screen", RASTER)
426426   MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 320, 0, 256, 272, 8, 248)   /* HTOTAL and VTOTAL are guessed */
427   MCFG_SCREEN_UPDATE_DRIVER(wwfsstar_state, screen_update)
427   MCFG_SCREEN_UPDATE_DRIVER(wwfsstar_state, screen_update_wwfsstar)
428428   MCFG_SCREEN_PALETTE("palette")
429429
430430   MCFG_GFXDECODE_ADD("gfxdecode", "palette", wwfsstar)
r243594r243595
627627
628628
629629
630GAME( 1989, wwfsstar,   0,        wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (Europe)", GAME_SUPPORTS_SAVE )
631GAME( 1989, wwfsstaru,  wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (US, Newer)", GAME_SUPPORTS_SAVE )
632GAME( 1989, wwfsstarua, wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (US)", GAME_SUPPORTS_SAVE )
633GAME( 1989, wwfsstarj,  wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (Japan)", GAME_SUPPORTS_SAVE )
634GAME( 1989, wwfsstarb,  wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "bootleg",       "WWF Superstars (bootleg)", GAME_SUPPORTS_SAVE )
630GAME( 1989, wwfsstar,   0,        wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (Europe)", 0 )
631GAME( 1989, wwfsstaru,  wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (US, Newer)", 0 )
632GAME( 1989, wwfsstarua, wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (US)", 0 )
633GAME( 1989, wwfsstarj,  wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "Technos Japan", "WWF Superstars (Japan)", 0 )
634GAME( 1989, wwfsstarb,  wwfsstar, wwfsstar, wwfsstar, driver_device,  0, ROT0, "bootleg",       "WWF Superstars (bootleg)", 0 )
trunk/src/mame/drivers/xxmissio.c
r243594r243595
1414#include "includes/xxmissio.h"
1515
1616
17WRITE8_MEMBER(xxmissio_state::bank_sel_w)
17WRITE8_MEMBER(xxmissio_state::xxmissio_bank_sel_w)
1818{
1919   membank("bank1")->set_entry(data & 7);
2020}
2121
22CUSTOM_INPUT_MEMBER(xxmissio_state::status_r)
22CUSTOM_INPUT_MEMBER(xxmissio_state::xxmissio_status_r)
2323{
2424   int bit_mask = (FPTR)param;
2525   return (m_status & bit_mask) ? 1 : 0;
2626}
2727
28WRITE8_MEMBER(xxmissio_state::status_m_w)
28WRITE8_MEMBER(xxmissio_state::xxmissio_status_m_w)
2929{
3030   switch (data)
3131   {
r243594r243595
4444   }
4545}
4646
47WRITE8_MEMBER(xxmissio_state::status_s_w)
47WRITE8_MEMBER(xxmissio_state::xxmissio_status_s_w)
4848{
4949   switch (data)
5050   {
r243594r243595
6363   }
6464}
6565
66INTERRUPT_GEN_MEMBER(xxmissio_state::interrupt_m)
66INTERRUPT_GEN_MEMBER(xxmissio_state::xxmissio_interrupt_m)
6767{
6868   m_status &= ~0x20;
69   m_maincpu->set_input_line(0, HOLD_LINE);
69   device.execute().set_input_line(0, HOLD_LINE);
7070}
7171
72INTERRUPT_GEN_MEMBER(xxmissio_state::interrupt_s)
72INTERRUPT_GEN_MEMBER(xxmissio_state::xxmissio_interrupt_s)
7373{
7474   m_status &= ~0x10;
75   m_subcpu->set_input_line(0, HOLD_LINE);
75   device.execute().set_input_line(0, HOLD_LINE);
7676}
7777
7878void xxmissio_state::machine_start()
7979{
8080   membank("bank1")->configure_entries(0, 8, memregion("user1")->base(), 0x4000);
8181   membank("bank1")->set_entry(0);
82   
83   save_item(NAME(m_status));
8482}
8583
8684/****************************************************************************/
r243594r243595
9492   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
9593   AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P2")
9694   AM_RANGE(0xa002, 0xa002) AM_READ_PORT("STATUS")
97   AM_RANGE(0xa002, 0xa002) AM_WRITE(status_m_w)
98   AM_RANGE(0xa003, 0xa003) AM_WRITE(flipscreen_w)
95   AM_RANGE(0xa002, 0xa002) AM_WRITE(xxmissio_status_m_w)
96   AM_RANGE(0xa003, 0xa003) AM_WRITE(xxmissio_flipscreen_w)
9997
10098   AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("fgram")
101   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(bgram_r, bgram_w) AM_SHARE("bgram")
99   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(xxmissio_bgram_r, xxmissio_bgram_w) AM_SHARE("bgram")
102100   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE("spriteram")
103101
104102   AM_RANGE(0xd800, 0xdaff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
r243594r243595
114112
115113   AM_RANGE(0x8000, 0x8001) AM_DEVREADWRITE("ym1", ym2203_device, read, write)
116114   AM_RANGE(0x8002, 0x8003) AM_DEVREADWRITE("ym2", ym2203_device, read, write)
117   AM_RANGE(0x8006, 0x8006) AM_WRITE(bank_sel_w)
115   AM_RANGE(0x8006, 0x8006) AM_WRITE(xxmissio_bank_sel_w)
118116
119117   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
120118   AM_RANGE(0xa001, 0xa001) AM_READ_PORT("P2")
121119   AM_RANGE(0xa002, 0xa002) AM_READ_PORT("STATUS")
122   AM_RANGE(0xa002, 0xa002) AM_WRITE(status_s_w)
123   AM_RANGE(0xa003, 0xa003) AM_WRITE(flipscreen_w)
120   AM_RANGE(0xa002, 0xa002) AM_WRITE(xxmissio_status_s_w)
121   AM_RANGE(0xa003, 0xa003) AM_WRITE(xxmissio_flipscreen_w)
124122
125123   AM_RANGE(0xc000, 0xc7ff) AM_SHARE("fgram") AM_RAM
126   AM_RANGE(0xc800, 0xcfff) AM_SHARE("bgram") AM_READWRITE(bgram_r, bgram_w)
124   AM_RANGE(0xc800, 0xcfff) AM_SHARE("bgram") AM_READWRITE(xxmissio_bgram_r, xxmissio_bgram_w)
127125   AM_RANGE(0xd000, 0xd7ff) AM_SHARE("spriteram") AM_RAM
128126
129127   AM_RANGE(0xd800, 0xdaff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
r243594r243595
198196   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Shown as "Unused" in the manual */
199197
200198   PORT_START("STATUS")
201   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x01)
199   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x01)
202200   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
203   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x04)
204   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x08)
205   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x10)
206   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x20)
207   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x40)
208   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state, status_r, (void *)0x80)
201   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x04)
202   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x08)
203   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x10)
204   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x20)
205   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x40)
206   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x80)
209207INPUT_PORTS_END
210208
211209/****************************************************************************/
r243594r243595
260258   /* basic machine hardware */
261259   MCFG_CPU_ADD("maincpu", Z80,12000000/4) /* 3.0MHz */
262260   MCFG_CPU_PROGRAM_MAP(map1)
263   MCFG_CPU_VBLANK_INT_DRIVER("screen", xxmissio_state,  interrupt_m)
261   MCFG_CPU_VBLANK_INT_DRIVER("screen", xxmissio_state,  xxmissio_interrupt_m)
264262
265263   MCFG_CPU_ADD("sub", Z80,12000000/4) /* 3.0MHz */
266264   MCFG_CPU_PROGRAM_MAP(map2)
267   MCFG_CPU_PERIODIC_INT_DRIVER(xxmissio_state, interrupt_s, 2*60)
265   MCFG_CPU_PERIODIC_INT_DRIVER(xxmissio_state, xxmissio_interrupt_s, 2*60)
268266
269267   MCFG_QUANTUM_TIME(attotime::from_hz(6000))
270268
r243594r243595
275273   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
276274   MCFG_SCREEN_SIZE(64*8, 32*8)
277275   MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 4*8, 28*8-1)
278   MCFG_SCREEN_UPDATE_DRIVER(xxmissio_state, screen_update)
276   MCFG_SCREEN_UPDATE_DRIVER(xxmissio_state, screen_update_xxmissio)
279277   MCFG_SCREEN_PALETTE("palette")
280278
281279   MCFG_GFXDECODE_ADD("gfxdecode", "palette", xxmissio)
r243594r243595
295293   MCFG_SOUND_ROUTE(3, "mono", 0.40)
296294
297295   MCFG_SOUND_ADD("ym2", YM2203, 12000000/8)
298   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(xxmissio_state, scroll_x_w))
299   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(xxmissio_state, scroll_y_w))
296   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(xxmissio_state, xxmissio_scroll_x_w))
297   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(xxmissio_state, xxmissio_scroll_y_w))
300298   MCFG_SOUND_ROUTE(0, "mono", 0.15)
301299   MCFG_SOUND_ROUTE(1, "mono", 0.15)
302300   MCFG_SOUND_ROUTE(2, "mono", 0.15)
r243594r243595
328326   ROM_LOAD16_BYTE( "xx11.4b", 0x0001,  0x8000, CRC(d9dd827c) SHA1(aea3a5abd871adf7f75ad4d6cc57eff0833135c7) )
329327ROM_END
330328
331GAME( 1986, xxmissio, 0, xxmissio, xxmissio, driver_device, 0, ROT90, "UPL", "XX Mission", GAME_SUPPORTS_SAVE )
329GAME( 1986, xxmissio, 0, xxmissio, xxmissio, driver_device, 0, ROT90, "UPL", "XX Mission", 0 )
trunk/src/mame/includes/wc90.h
r243594r243595
55public:
66   wc90_state(const machine_config &mconfig, device_type type, const char *tag)
77      : driver_device(mconfig, type, tag),
8      m_maincpu(*this, "maincpu"),
9      m_audiocpu(*this, "audiocpu"),
10      m_gfxdecode(*this, "gfxdecode"),
11      m_palette(*this, "palette"),
12      m_sprgen(*this, "spritegen"),
138      m_fgvideoram(*this, "fgvideoram"),
149      m_bgvideoram(*this, "bgvideoram"),
1510      m_txvideoram(*this, "txvideoram"),
r243594r243595
2520      m_scroll1yhi(*this, "scroll1yhi"),
2621      m_scroll2ylo(*this, "scroll2ylo"),
2722      m_scroll2yhi(*this, "scroll2yhi"),
28      m_spriteram(*this, "spriteram")
23      m_spriteram(*this, "spriteram"),
24      m_maincpu(*this, "maincpu"),
25      m_audiocpu(*this, "audiocpu"),
26      m_gfxdecode(*this, "gfxdecode"),
27      m_palette(*this, "palette"),
28      m_sprgen(*this, "spritegen")
2929   { }
3030
31   
32   required_device<cpu_device> m_maincpu;
33   required_device<cpu_device> m_audiocpu;
34   required_device<gfxdecode_device> m_gfxdecode;
35   required_device<palette_device> m_palette;
36   required_device<tecmo_spr_device> m_sprgen;
3731
32
3833   required_shared_ptr<UINT8> m_fgvideoram;
3934   required_shared_ptr<UINT8> m_bgvideoram;
4035   required_shared_ptr<UINT8> m_txvideoram;
r243594r243595
5045   required_shared_ptr<UINT8> m_scroll1yhi;
5146   required_shared_ptr<UINT8> m_scroll2ylo;
5247   required_shared_ptr<UINT8> m_scroll2yhi;
53   required_shared_ptr<UINT8> m_spriteram;
54   
5548   tilemap_t *m_tx_tilemap;
5649   tilemap_t *m_fg_tilemap;
5750   tilemap_t *m_bg_tilemap;
58
59   DECLARE_WRITE8_MEMBER(bankswitch_w);
60   DECLARE_WRITE8_MEMBER(bankswitch1_w);
61   DECLARE_WRITE8_MEMBER(sound_command_w);
62   DECLARE_WRITE8_MEMBER(bgvideoram_w);
63   DECLARE_WRITE8_MEMBER(fgvideoram_w);
64   DECLARE_WRITE8_MEMBER(txvideoram_w);
65   DECLARE_WRITE_LINE_MEMBER(irqhandler);
66   
51   required_shared_ptr<UINT8> m_spriteram;
52   DECLARE_WRITE8_MEMBER(wc90_bankswitch_w);
53   DECLARE_WRITE8_MEMBER(wc90_bankswitch1_w);
54   DECLARE_WRITE8_MEMBER(wc90_sound_command_w);
55   DECLARE_WRITE8_MEMBER(wc90_bgvideoram_w);
56   DECLARE_WRITE8_MEMBER(wc90_fgvideoram_w);
57   DECLARE_WRITE8_MEMBER(wc90_txvideoram_w);
6758   TILE_GET_INFO_MEMBER(get_bg_tile_info);
6859   TILE_GET_INFO_MEMBER(get_fg_tile_info);
6960   TILE_GET_INFO_MEMBER(get_tx_tile_info);
7061   TILE_GET_INFO_MEMBER(track_get_bg_tile_info);
7162   TILE_GET_INFO_MEMBER(track_get_fg_tile_info);
72   
7363   virtual void video_start();
7464   DECLARE_VIDEO_START(wc90t);
75   
76   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
65   UINT32 screen_update_wc90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
66
67   DECLARE_WRITE_LINE_MEMBER(irqhandler);
68   required_device<cpu_device> m_maincpu;
69   required_device<cpu_device> m_audiocpu;
70   required_device<gfxdecode_device> m_gfxdecode;
71   required_device<palette_device> m_palette;
72   required_device<tecmo_spr_device> m_sprgen;
7773};
trunk/src/mame/includes/wwfsstar.h
r243594r243595
33public:
44   wwfsstar_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
6      m_spriteram(*this, "spriteram"),
7      m_fg0_videoram(*this, "fg0_videoram"),
8      m_bg0_videoram(*this, "bg0_videoram"),
69      m_maincpu(*this, "maincpu"),
710      m_audiocpu(*this, "audiocpu"),
811      m_gfxdecode(*this, "gfxdecode"),
912      m_screen(*this, "screen"),
10      m_palette(*this, "palette"),
11      m_spriteram(*this, "spriteram"),
12      m_fg0_videoram(*this, "fg0_videoram"),
13      m_bg0_videoram(*this, "bg0_videoram") { }
13      m_palette(*this, "palette") { }
1414
15   required_device<cpu_device> m_maincpu;
16   required_device<cpu_device> m_audiocpu;
17   required_device<gfxdecode_device> m_gfxdecode;
18   required_device<screen_device> m_screen;
19   required_device<palette_device> m_palette;
20
21   required_shared_ptr<UINT16> m_spriteram;
22   required_shared_ptr<UINT16> m_fg0_videoram;
23   required_shared_ptr<UINT16> m_bg0_videoram;
24   
2515   int m_vblank;
2616   int m_scrollx;
2717   int m_scrolly;
18   required_shared_ptr<UINT16> m_spriteram;
19   required_shared_ptr<UINT16> m_fg0_videoram;
20   required_shared_ptr<UINT16> m_bg0_videoram;
2821   tilemap_t *m_fg0_tilemap;
2922   tilemap_t *m_bg0_tilemap;
30   
31   DECLARE_WRITE16_MEMBER(scroll_w);
32   DECLARE_WRITE16_MEMBER(sound_w);
33   DECLARE_WRITE16_MEMBER(flipscreen_w);
34   DECLARE_WRITE16_MEMBER(irqack_w);
35   DECLARE_WRITE16_MEMBER(fg0_videoram_w);
36   DECLARE_WRITE16_MEMBER(bg0_videoram_w);
37   
38   DECLARE_CUSTOM_INPUT_MEMBER(vblank_r);
39   
40   TIMER_DEVICE_CALLBACK_MEMBER(scanline);
41   
23   DECLARE_WRITE16_MEMBER(wwfsstar_scrollwrite);
24   DECLARE_WRITE16_MEMBER(wwfsstar_soundwrite);
25   DECLARE_WRITE16_MEMBER(wwfsstar_flipscreen_w);
26   DECLARE_WRITE16_MEMBER(wwfsstar_irqack_w);
27   DECLARE_WRITE16_MEMBER(wwfsstar_fg0_videoram_w);
28   DECLARE_WRITE16_MEMBER(wwfsstar_bg0_videoram_w);
29   DECLARE_CUSTOM_INPUT_MEMBER(wwfsstar_vblank_r);
4230   TILE_GET_INFO_MEMBER(get_fg0_tile_info);
4331   TILEMAP_MAPPER_MEMBER(bg0_scan);
4432   TILE_GET_INFO_MEMBER(get_bg0_tile_info);
45
4633   virtual void video_start();
47
48   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
34   UINT32 screen_update_wwfsstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
35   TIMER_DEVICE_CALLBACK_MEMBER(wwfsstar_scanline);
4936   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
37   required_device<cpu_device> m_maincpu;
38   required_device<cpu_device> m_audiocpu;
39   required_device<gfxdecode_device> m_gfxdecode;
40   required_device<screen_device> m_screen;
41   required_device<palette_device> m_palette;
5042};
trunk/src/mame/includes/xxmissio.h
r243594r243595
33public:
44   xxmissio_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
6      m_bgram(*this, "bgram"),
7      m_fgram(*this, "fgram"),
8      m_spriteram(*this, "spriteram"),
69      m_maincpu(*this, "maincpu"),
710      m_subcpu(*this, "sub"),
811      m_gfxdecode(*this, "gfxdecode"),
9      m_palette(*this, "palette"),
10      m_bgram(*this, "bgram"),
11      m_fgram(*this, "fgram"),
12      m_spriteram(*this, "spriteram")  { }
12      m_palette(*this, "palette")  { }
1313
14   required_device<cpu_device> m_maincpu;
15   required_device<cpu_device> m_subcpu;
16   required_device<gfxdecode_device> m_gfxdecode;
17   required_device<palette_device> m_palette;
18
14   UINT8 m_status;
1915   required_shared_ptr<UINT8> m_bgram;
2016   required_shared_ptr<UINT8> m_fgram;
2117   required_shared_ptr<UINT8> m_spriteram;
22
2318   tilemap_t *m_bg_tilemap;
2419   tilemap_t *m_fg_tilemap;
25   UINT8 m_status;
2620   UINT8 m_xscroll;
2721   UINT8 m_yscroll;
2822   UINT8 m_flipscreen;
29   
30   DECLARE_WRITE8_MEMBER(bank_sel_w);
31   DECLARE_WRITE8_MEMBER(status_m_w);
32   DECLARE_WRITE8_MEMBER(status_s_w);
33   DECLARE_WRITE8_MEMBER(flipscreen_w);
34   DECLARE_WRITE8_MEMBER(bgram_w);
35   DECLARE_READ8_MEMBER(bgram_r);
36   DECLARE_WRITE8_MEMBER(scroll_x_w);
37   DECLARE_WRITE8_MEMBER(scroll_y_w);
38   
39   DECLARE_CUSTOM_INPUT_MEMBER(status_r);
40   
41   INTERRUPT_GEN_MEMBER(interrupt_m);
42   INTERRUPT_GEN_MEMBER(interrupt_s);
43   
23   DECLARE_WRITE8_MEMBER(xxmissio_bank_sel_w);
24   DECLARE_WRITE8_MEMBER(xxmissio_status_m_w);
25   DECLARE_WRITE8_MEMBER(xxmissio_status_s_w);
26   DECLARE_WRITE8_MEMBER(xxmissio_flipscreen_w);
27   DECLARE_WRITE8_MEMBER(xxmissio_bgram_w);
28   DECLARE_READ8_MEMBER(xxmissio_bgram_r);
29   DECLARE_CUSTOM_INPUT_MEMBER(xxmissio_status_r);
4430   TILE_GET_INFO_MEMBER(get_bg_tile_info);
4531   TILE_GET_INFO_MEMBER(get_fg_tile_info);
46   
4732   virtual void machine_start();
4833   virtual void video_start();
49   
50   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
34   UINT32 screen_update_xxmissio(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
35   INTERRUPT_GEN_MEMBER(xxmissio_interrupt_m);
36   INTERRUPT_GEN_MEMBER(xxmissio_interrupt_s);
37   DECLARE_WRITE8_MEMBER(xxmissio_scroll_x_w);
38   DECLARE_WRITE8_MEMBER(xxmissio_scroll_y_w);
5139   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
40   required_device<cpu_device> m_maincpu;
41   required_device<cpu_device> m_subcpu;
42   required_device<gfxdecode_device> m_gfxdecode;
43   required_device<palette_device> m_palette;
5244};
trunk/src/mame/video/wc90.c
r243594r243595
9494
9595***************************************************************************/
9696
97WRITE8_MEMBER(wc90_state::bgvideoram_w)
97WRITE8_MEMBER(wc90_state::wc90_bgvideoram_w)
9898{
9999   m_bgvideoram[offset] = data;
100100   m_bg_tilemap->mark_tile_dirty(offset & 0x7ff);
101101}
102102
103WRITE8_MEMBER(wc90_state::fgvideoram_w)
103WRITE8_MEMBER(wc90_state::wc90_fgvideoram_w)
104104{
105105   m_fgvideoram[offset] = data;
106106   m_fg_tilemap->mark_tile_dirty(offset & 0x7ff);
107107}
108108
109WRITE8_MEMBER(wc90_state::txvideoram_w)
109WRITE8_MEMBER(wc90_state::wc90_txvideoram_w)
110110{
111111   m_txvideoram[offset] = data;
112112   m_tx_tilemap->mark_tile_dirty(offset & 0x7ff);
r243594r243595
121121***************************************************************************/
122122
123123
124UINT32 wc90_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
124UINT32 wc90_state::screen_update_wc90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
125125{
126126   m_bg_tilemap->set_scrollx(0,m_scroll2xlo[0] + 256 * m_scroll2xhi[0]);
127127   m_bg_tilemap->set_scrolly(0,m_scroll2ylo[0] + 256 * m_scroll2yhi[0]);
trunk/src/mame/video/wwfsstar.c
r243594r243595
1515 for writes to Video Ram
1616*******************************************************************************/
1717
18WRITE16_MEMBER(wwfsstar_state::fg0_videoram_w)
18WRITE16_MEMBER(wwfsstar_state::wwfsstar_fg0_videoram_w)
1919{
2020   COMBINE_DATA(&m_fg0_videoram[offset]);
2121   m_fg0_tilemap->mark_tile_dirty(offset/2);
2222}
2323
24WRITE16_MEMBER(wwfsstar_state::bg0_videoram_w)
24WRITE16_MEMBER(wwfsstar_state::wwfsstar_bg0_videoram_w)
2525{
2626   COMBINE_DATA(&m_bg0_videoram[offset]);
2727   m_bg0_tilemap->mark_tile_dirty(offset/2);
r243594r243595
207207
208208   m_bg0_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(wwfsstar_state::get_bg0_tile_info),this),tilemap_mapper_delegate(FUNC(wwfsstar_state::bg0_scan),this), 16, 16,32,32);
209209   m_fg0_tilemap->set_transparent_pen(0);
210   
211   save_item(NAME(m_vblank));
212   save_item(NAME(m_scrollx));
213   save_item(NAME(m_scrolly));
214210}
215211
216UINT32 wwfsstar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
212UINT32 wwfsstar_state::screen_update_wwfsstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
217213{
218214   m_bg0_tilemap->set_scrolly(0, m_scrolly  );
219215   m_bg0_tilemap->set_scrollx(0, m_scrollx  );
trunk/src/mame/video/xxmissio.c
r243594r243595
1212#include "includes/xxmissio.h"
1313
1414
15WRITE8_MEMBER(xxmissio_state::scroll_x_w)
15WRITE8_MEMBER(xxmissio_state::xxmissio_scroll_x_w)
1616{
1717   m_xscroll = data;
1818}
19WRITE8_MEMBER(xxmissio_state::scroll_y_w)
19WRITE8_MEMBER(xxmissio_state::xxmissio_scroll_y_w)
2020{
2121   m_yscroll = data;
2222}
2323
24WRITE8_MEMBER(xxmissio_state::flipscreen_w)
24WRITE8_MEMBER(xxmissio_state::xxmissio_flipscreen_w)
2525{
2626   m_flipscreen = data & 0x01;
2727}
2828
29WRITE8_MEMBER(xxmissio_state::bgram_w)
29WRITE8_MEMBER(xxmissio_state::xxmissio_bgram_w)
3030{
3131   int x = (offset + (m_xscroll >> 3)) & 0x1f;
3232   offset = (offset & 0x7e0) | x;
3333
3434   m_bgram[offset] = data;
3535}
36READ8_MEMBER(xxmissio_state::bgram_r)
36READ8_MEMBER(xxmissio_state::xxmissio_bgram_r)
3737{
3838   int x = (offset + (m_xscroll >> 3)) & 0x1f;
3939   offset = (offset & 0x7e0) | x;
r243594r243595
6969   m_bg_tilemap->set_scrolldx(2, 12);
7070
7171   m_fg_tilemap->set_transparent_pen(0);
72   
73   save_item(NAME(m_xscroll));
74   save_item(NAME(m_yscroll));
75   save_item(NAME(m_flipscreen));
7672}
7773
7874
r243594r243595
126122}
127123
128124
129UINT32 xxmissio_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
125UINT32 xxmissio_state::screen_update_xxmissio(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
130126{
131127   machine().tilemap().mark_all_dirty();
132128   machine().tilemap().set_flip_all(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
trunk/src/mess/drivers/pencil2.c
r243594r243595
99
1010    Computer kindly donated for MESS by Ian Farquhar.
1111
12    Accessories:
13    - PEN-216 : 16k RAM expansion
14    - PEN-264 : 64k RAM expansion
15    - PEN-511 : Data Cassette Recorder
16    - ???     : Printer
17    - ???     : Floppy Disk Drive (5.25)
18    - ???     : Floppy Disk Controller
19    - ???     : RS-232C Serial Interface
20    - PEN-8xx : Various software on Cassette or Floppy Disk
21    - ???     : Game Controller (joystick and 14 buttons)
22    - PEN-7xx : Various software in Cartridge format
23    - PEN-430 : Modem
24
2512Information found by looking inside the computer
2613------------------------------------------------
2714Main Board PEN-002 11-50332-10
r243594r243595
6956
7057
7158ToDo:
59- Cassette isn't working
7260- Joysticks (no info)
7361
7462****************************************************************************/
r243594r243595
10896   virtual void machine_start();
10997   int m_centronics_busy;
11098   int m_centronics_ack;
111   bool m_cass_state;
11299   required_device<cpu_device> m_maincpu;
113100   required_device<centronics_device> m_centronics;
114101   required_device<cassette_image_device> m_cass;
r243594r243595
148135
149136READ8_MEMBER( pencil2_state::porte2_r)
150137{
151   return (m_cass->input() > 0.1) ? 0xff : 0x7f;
138   return (m_cass->input() > 0.1);
152139}
153140
154141WRITE8_MEMBER( pencil2_state::port10_w )
r243594r243595
158145
159146WRITE8_MEMBER( pencil2_state::port30_w )
160147{
161   m_cass_state ^= 1;
162   m_cass->output( m_cass_state ? -1.0 : +1.0);
148   m_cass->output( BIT(data, 0) ? -1.0 : +1.0);
163149}
164150
165151WRITE8_MEMBER( pencil2_state::port80_w )
r243594r243595
337323/* Driver */
338324
339325/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT     STATE         INIT  COMPANY    FULLNAME       FLAGS */
340COMP( 1983, pencil2,   0,     0,     pencil2,   pencil2, driver_device,  0,  "Hanimex", "Pencil II", 0 )
326COMP( 1983, pencil2,   0,     0,     pencil2,   pencil2, driver_device,  0,  "Hanimex", "Pencil II", GAME_NOT_WORKING )
trunk/src/mess/drivers/tb303.c
r243594r243595
1313
1414#include "emu.h"
1515#include "cpu/ucom4/ucom4.h"
16#include "sound/speaker.h"
1617
1718#include "tb303.lh"
1819
r243594r243595
2223public:
2324   tb303_state(const machine_config &mconfig, device_type type, const char *tag)
2425      : driver_device(mconfig, type, tag),
25      m_maincpu(*this, "maincpu"),
26      m_t3_off_timer(*this, "t3_off")
26      m_maincpu(*this, "maincpu")
2727   { }
2828
2929   required_device<cpu_device> m_maincpu;
30   required_device<timer_device> m_t3_off_timer;
3130
32   TIMER_DEVICE_CALLBACK_MEMBER(t3_clock);
33   TIMER_DEVICE_CALLBACK_MEMBER(t3_off);
34
3531   virtual void machine_start();
3632};
3733
3834
39// T2 to MCU CLK: LC circuit, stable sine wave, 2.2us interval
40#define TB303_T2_CLOCK_HZ   454545 /* in hz */
41
42// T3 to MCU _INT: square wave, 1.8ms interval, short duty cycle
43#define TB303_T3_CLOCK      attotime::from_usec(1800)
44#define TB303_T3_OFF        (TB303_T3_CLOCK / 8)
45
46TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_off)
47{
48   m_maincpu->set_input_line(0, CLEAR_LINE);
49}
50
51TIMER_DEVICE_CALLBACK_MEMBER(tb303_state::t3_clock)
52{
53   m_maincpu->set_input_line(0, ASSERT_LINE);
54   m_t3_off_timer->adjust(TB303_T3_OFF);
55}
56
57
58
59
6035static INPUT_PORTS_START( tb303 )
6136INPUT_PORTS_END
6237
r243594r243595
7651static MACHINE_CONFIG_START( tb303, tb303_state )
7752
7853   /* basic machine hardware */
79   MCFG_CPU_ADD("maincpu", NEC_D650, TB303_T2_CLOCK_HZ)
54   MCFG_CPU_ADD("maincpu", NEC_D650, 454545) // LC circuit, 2.2us pulse interval
8055
81   MCFG_TIMER_DRIVER_ADD_PERIODIC("t3_clock", tb303_state, t3_clock, TB303_T3_CLOCK)
82   MCFG_TIMER_DRIVER_ADD("t3_off", tb303_state, t3_off)
83
8456   MCFG_DEFAULT_LAYOUT(layout_tb303)
8557
8658   /* no video! */
trunk/src/mess/drivers/wildfire.c
r243594r243595
1313
1414
1515  TODO:
16  - sound emulation could still be improved
16  - bad sound (probably MCU related)
1717  - when the game strobes a led faster, it should appear brighter, for example when
1818    the ball hits one of the bumpers
1919  - some 7segs digits are wrong (mcu on-die decoder is customizable?)
r243594r243595
2828#include "wildfire.lh" // this is a test layout, external artwork is necessary
2929
3030// master clock is a single stage RC oscillator: R=?K, C=?pf,
31// S2000 default frequency is 850kHz
31// S2150 default frequency is 850kHz
3232#define MASTER_CLOCK (850000)
3333
3434
r243594r243595
3838   wildfire_state(const machine_config &mconfig, device_type type, const char *tag)
3939      : driver_device(mconfig, type, tag),
4040      m_maincpu(*this, "maincpu"),
41      m_speaker(*this, "speaker"),
42      m_a12_decay_timer(*this, "a12_decay")
41      m_speaker(*this, "speaker")
4342   { }
4443
4544   required_device<cpu_device> m_maincpu;
4645   required_device<speaker_sound_device> m_speaker;
47   required_device<timer_device> m_a12_decay_timer;
4846
4947   UINT8 m_d;
5048   UINT16 m_a;
51   UINT8 m_q2;
52   UINT8 m_q3;
5349
5450   UINT16 m_display_state[0x10];
5551   UINT16 m_display_cache[0x10];
r243594r243595
5753
5854   DECLARE_WRITE8_MEMBER(write_d);
5955   DECLARE_WRITE16_MEMBER(write_a);
60   DECLARE_WRITE_LINE_MEMBER(write_f);
6156
6257   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
63   bool index_is_7segled(int index);
6458   void display_update();
65   
66   TIMER_DEVICE_CALLBACK_MEMBER(reset_q2);
67   void write_a12(int state);
68   void sound_update();
59   bool index_is_7segled(int index);
6960
7061   virtual void machine_start();
7162};
r243594r243595
113104   for (int i = 0; i < 0x10; i++)
114105   {
115106      // update current state
116      m_display_state[i] = (m_a >> i & 1) ? m_d : 0;
107      m_display_state[i] = (~m_a >> i & 1) ? m_d : 0;
117108
118109      active_state[i] = 0;
119110
r243594r243595
159150
160151/***************************************************************************
161152
162  Sound
163
164***************************************************************************/
165
166// Sound output is via a speaker between transistors Q2(from A12) and Q3(from F_out)
167// A12 to Q2 has a little electronic circuit going, causing a slight delay.
168// (see patent US4334679 FIG.5, the 2 resistors are 10K and the cap is a 4.7uF electrolytic)
169
170// decay time, in steps of 1ms
171#define A12_DECAY_TIME 5 /* a complete guess */
172
173void wildfire_state::sound_update()
174{
175   m_speaker->level_w(m_q2 & m_q3);
176}
177
178WRITE_LINE_MEMBER(wildfire_state::write_f)
179{
180   // F_out pin: speaker out
181   m_q3 = (state) ? 1 : 0;
182   sound_update();
183}
184
185TIMER_DEVICE_CALLBACK_MEMBER(wildfire_state::reset_q2)
186{
187   m_q2 = 0;
188   sound_update();
189}
190
191void wildfire_state::write_a12(int state)
192{
193   if (state)
194   {
195      m_a12_decay_timer->adjust(attotime::never);
196      m_q2 = state;
197      sound_update();
198   }
199   else if (m_a >> 12 & 1)
200   {
201      // falling edge
202      m_a12_decay_timer->adjust(attotime::from_msec(A12_DECAY_TIME));
203   }
204}
205
206
207
208/***************************************************************************
209
210153  I/O
211154
212155***************************************************************************/
r243594r243595
220163
221164WRITE16_MEMBER(wildfire_state::write_a)
222165{
223   data ^= 0x1fff; // active-low
224   
225   // A12: enable speaker
226   write_a12(data >> 12 & 1);
166   // A12: enable speaker out
167   // this is in combination with the MCU K4-pin, how?
168   m_speaker->level_w(data >> 12 & 1);
227169
228170   // A0-A2: select 7segleds
229171   // A3-A11: select other leds
r243594r243595
264206
265207   m_d = 0;
266208   m_a = 0;
267   m_q2 = 0;
268   m_q3 = 0;
269209
270210   // register for savestates
271211   save_item(NAME(m_display_state));
r243594r243595
274214
275215   save_item(NAME(m_d));
276216   save_item(NAME(m_a));
277   save_item(NAME(m_q2));
278   save_item(NAME(m_q3));
279217}
280218
281219
282220static MACHINE_CONFIG_START( wildfire, wildfire_state )
283221
284222   /* basic machine hardware */
285   MCFG_CPU_ADD("maincpu", AMI_S2152, MASTER_CLOCK)
223   MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK)
286224   MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1"))
287225   MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d))
288226   MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a))
289   MCFG_AMI_S2152_FOUT_CB(WRITELINE(wildfire_state, write_f))
290227
291228   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(1))
292   MCFG_TIMER_DRIVER_ADD("a12_decay", wildfire_state, reset_q2)
293229
294230   MCFG_DEFAULT_LAYOUT(layout_wildfire)
295231
trunk/src/osd/modules/debugger/debugqt.c
r243594r243595
2626#include "debugger.h"
2727#include "modules/lib/osdobj_common.h"
2828
29#include "qt/debugqtlogwindow.h"
30#include "qt/debugqtmainwindow.h"
31#include "qt/debugqtdasmwindow.h"
32#include "qt/debugqtmemorywindow.h"
33#include "qt/debugqtbreakpointswindow.h"
34#include "qt/debugqtdeviceswindow.h"
35#include "qt/debugqtdeviceinformationwindow.h"
29#include "qt/logwindow.h"
30#include "qt/mainwindow.h"
31#include "qt/dasmwindow.h"
32#include "qt/memorywindow.h"
33#include "qt/breakpointswindow.h"
34#include "qt/deviceswindow.h"
35#include "qt/deviceinformationwindow.h"
3636
3737class debug_qt : public osd_module, public debug_module
3838{
trunk/src/osd/modules/debugger/qt/breakpointswindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "breakpointswindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvbpoints.h"
8#include "debug/dvwpoints.h"
9
10
11BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) :
12   WindowQt(machine, NULL)
13{
14   setWindowTitle("Debug: All Breakpoints");
15
16   if (parent != NULL)
17   {
18      QPoint parentPos = parent->pos();
19      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
20   }
21
22   //
23   // The main frame and its input and breakpoints widgets
24   //
25   QFrame* mainWindowFrame = new QFrame(this);
26
27   // The main breakpoints view
28   m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);
29
30   // Layout
31   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
32   vLayout->setObjectName("vlayout");
33   vLayout->setSpacing(3);
34   vLayout->setContentsMargins(2,2,2,2);
35   vLayout->addWidget(m_breakpointsView);
36
37   setCentralWidget(mainWindowFrame);
38
39   //
40   // Menu bars
41   //
42   QActionGroup* typeGroup = new QActionGroup(this);
43   typeGroup->setObjectName("typegroup");
44   QAction* typeBreak = new QAction("Breakpoints", this);
45   typeBreak->setObjectName("typebreak");
46   QAction* typeWatch = new QAction("Watchpoints", this);
47   typeWatch->setObjectName("typewatch");
48   typeBreak->setCheckable(true);
49   typeWatch->setCheckable(true);
50   typeBreak->setActionGroup(typeGroup);
51   typeWatch->setActionGroup(typeGroup);
52   typeBreak->setShortcut(QKeySequence("Ctrl+1"));
53   typeWatch->setShortcut(QKeySequence("Ctrl+2"));
54   typeBreak->setChecked(true);
55   connect(typeGroup, SIGNAL(triggered(QAction*)), this, SLOT(typeChanged(QAction*)));
56
57   // Assemble the options menu
58   QMenu* optionsMenu = menuBar()->addMenu("&Options");
59   optionsMenu->addActions(typeGroup->actions());
60}
61
62
63BreakpointsWindow::~BreakpointsWindow()
64{
65}
66
67
68void BreakpointsWindow::typeChanged(QAction* changedTo)
69{
70   // Clean
71   delete m_breakpointsView;
72   m_breakpointsView = NULL;
73
74   // Create
75   if (changedTo->text() == "Breakpoints")
76   {
77      m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);
78      setWindowTitle("Debug: All Breakpoints");
79   }
80   else if (changedTo->text() == "Watchpoints")
81   {
82      m_breakpointsView = new DebuggerView(DVT_WATCH_POINTS, m_machine, this);
83      setWindowTitle("Debug: All Watchpoints");
84   }
85
86   // Re-register
87   QVBoxLayout* layout = findChild<QVBoxLayout*>("vlayout");
88   layout->addWidget(m_breakpointsView);
89}
90
91
92
93//=========================================================================
94//  BreakpointsWindowQtConfig
95//=========================================================================
96void BreakpointsWindowQtConfig::buildFromQWidget(QWidget* widget)
97{
98   WindowQtConfig::buildFromQWidget(widget);
99   BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
100
101   QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
102   if (typeGroup->checkedAction()->text() == "Breakpoints")
103      m_bwType = 0;
104   else if (typeGroup->checkedAction()->text() == "Watchpoints")
105      m_bwType = 1;
106}
107
108
109void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
110{
111   WindowQtConfig::applyToQWidget(widget);
112   BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
113
114   QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
115   typeGroup->actions()[m_bwType]->trigger();
116}
117
118
119void BreakpointsWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
120{
121   WindowQtConfig::addToXmlDataNode(node);
122   xml_set_attribute_int(node, "bwtype", m_bwType);
123}
124
125
126void BreakpointsWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
127{
128   WindowQtConfig::recoverFromXmlNode(node);
129   m_bwType = xml_get_attribute_int(node, "bwtype", m_bwType);
130}
trunk/src/osd/modules/debugger/qt/breakpointswindow.h
r0r243595
1#ifndef __DEBUG_QT_BREAK_POINTS_WINDOW_H__
2#define __DEBUG_QT_BREAK_POINTS_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debuggerview.h"
7#include "windowqt.h"
8
9
10//============================================================
11//  The Breakpoints Window.
12//============================================================
13class BreakpointsWindow : public WindowQt
14{
15   Q_OBJECT
16
17public:
18   BreakpointsWindow(running_machine* machine, QWidget* parent=NULL);
19   virtual ~BreakpointsWindow();
20
21
22private slots:
23   void typeChanged(QAction* changedTo);
24
25
26private:
27   // Widgets
28   DebuggerView* m_breakpointsView;
29};
30
31
32//=========================================================================
33//  A way to store the configuration of a window long enough to read/write.
34//=========================================================================
35class BreakpointsWindowQtConfig : public WindowQtConfig
36{
37public:
38   BreakpointsWindowQtConfig() :
39      WindowQtConfig(WIN_TYPE_BREAK_POINTS),
40      m_bwType(0)
41   {
42   }
43
44   ~BreakpointsWindowQtConfig() {}
45
46   // Settings
47   int m_bwType;
48
49   void buildFromQWidget(QWidget* widget);
50   void applyToQWidget(QWidget* widget);
51   void addToXmlDataNode(xml_data_node* node) const;
52   void recoverFromXmlNode(xml_data_node* node);
53};
54
55
56#endif
trunk/src/osd/modules/debugger/qt/dasmwindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "dasmwindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvdisasm.h"
8
9
10DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL)
12{
13   setWindowTitle("Debug: Disassembly View");
14
15   if (parent != NULL)
16   {
17      QPoint parentPos = parent->pos();
18      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
19   }
20
21   //
22   // The main frame and its input and log widgets
23   //
24   QFrame* mainWindowFrame = new QFrame(this);
25
26   // The top frame & groupbox that contains the input widgets
27   QFrame* topSubFrame = new QFrame(mainWindowFrame);
28
29   // The input edit
30   m_inputEdit = new QLineEdit(topSubFrame);
31   connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));
32
33   // The cpu combo box
34   m_cpuComboBox = new QComboBox(topSubFrame);
35   m_cpuComboBox->setObjectName("cpu");
36   m_cpuComboBox->setMinimumWidth(300);
37   connect(m_cpuComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(cpuChanged(int)));
38
39   // The main disasm window
40   m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
41                           m_machine,
42                           this);
43
44   // Force a recompute of the disassembly region
45   downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
46
47   // Populate the combo box & set the proper cpu
48   populateComboBox();
49   //const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu);
50   //gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source));
51   //mem->views[0]->view->set_source(*source);
52
53
54   // Layout
55   QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
56   subLayout->addWidget(m_inputEdit);
57   subLayout->addWidget(m_cpuComboBox);
58   subLayout->setSpacing(3);
59   subLayout->setContentsMargins(2,2,2,2);
60
61   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
62   vLayout->setSpacing(3);
63   vLayout->setContentsMargins(2,2,2,2);
64   vLayout->addWidget(topSubFrame);
65   vLayout->addWidget(m_dasmView);
66
67   setCentralWidget(mainWindowFrame);
68
69   //
70   // Menu bars
71   //
72   // Create two commands
73   QAction* breakpointSetAct = new QAction("Toggle Breakpoint At Cursor", this);
74   QAction* runToCursorAct = new QAction("Run To Cursor", this);
75   breakpointSetAct->setShortcut(Qt::Key_F9);
76   runToCursorAct->setShortcut(Qt::Key_F4);
77   connect(breakpointSetAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
78   connect(runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool)));
79
80   // Right bar options
81   QActionGroup* rightBarGroup = new QActionGroup(this);
82   rightBarGroup->setObjectName("rightbargroup");
83   QAction* rightActRaw = new QAction("Raw Opcodes", this);
84   QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
85   QAction* rightActComments = new QAction("Comments", this);
86   rightActRaw->setCheckable(true);
87   rightActEncrypted->setCheckable(true);
88   rightActComments->setCheckable(true);
89   rightActRaw->setActionGroup(rightBarGroup);
90   rightActEncrypted->setActionGroup(rightBarGroup);
91   rightActComments->setActionGroup(rightBarGroup);
92   rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
93   rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
94   rightActComments->setShortcut(QKeySequence("Ctrl+C"));
95   rightActRaw->setChecked(true);
96   connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*)));
97
98   // Assemble the options menu
99   QMenu* optionsMenu = menuBar()->addMenu("&Options");
100   optionsMenu->addAction(breakpointSetAct);
101   optionsMenu->addAction(runToCursorAct);
102   optionsMenu->addSeparator();
103   optionsMenu->addActions(rightBarGroup->actions());
104}
105
106
107DasmWindow::~DasmWindow()
108{
109}
110
111
112void DasmWindow::cpuChanged(int index)
113{
114   m_dasmView->view()->set_source(*m_dasmView->view()->source_list().find(index));
115   m_dasmView->viewport()->update();
116}
117
118
119void DasmWindow::expressionSubmitted()
120{
121   const QString expression = m_inputEdit->text();
122   downcast<debug_view_disasm*>(m_dasmView->view())->set_expression(expression.toLocal8Bit().data());
123   m_dasmView->viewport()->update();
124}
125
126
127void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
128{
129   if (m_dasmView->view()->cursor_visible())
130   {
131      if (debug_cpu_get_visible_cpu(*m_machine) == m_dasmView->view()->source()->device())
132      {
133         offs_t address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
134         device_debug *cpuinfo = m_dasmView->view()->source()->device()->debug();
135
136         // Find an existing breakpoint at this address
137         INT32 bpindex = -1;
138         for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
139               bp != NULL;
140               bp = bp->next())
141         {
142            if (address == bp->address())
143            {
144               bpindex = bp->index();
145               break;
146            }
147         }
148
149         // If none exists, add a new one
150         astring command;
151         if (bpindex == -1)
152         {
153            command.printf("bpset 0x%X", address);
154         }
155         else
156         {
157            command.printf("bpclear 0x%X", bpindex);
158         }
159         debug_console_execute_command(*m_machine, command, 1);
160      }
161   }
162
163   refreshAll();
164}
165
166
167void DasmWindow::runToCursor(bool changedTo)
168{
169   if (m_dasmView->view()->cursor_visible())
170   {
171      if (debug_cpu_get_visible_cpu(*m_machine) == m_dasmView->view()->source()->device())
172      {
173         offs_t address = downcast<debug_view_disasm*>(m_dasmView->view())->selected_address();
174         astring command;
175         command.printf("go 0x%X", address);
176         debug_console_execute_command(*m_machine, command, 1);
177      }
178   }
179}
180
181
182void DasmWindow::rightBarChanged(QAction* changedTo)
183{
184   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmView->view());
185   if (changedTo->text() == "Raw Opcodes")
186   {
187      dasmView->set_right_column(DASM_RIGHTCOL_RAW);
188   }
189   else if (changedTo->text() == "Encrypted Opcodes")
190   {
191      dasmView->set_right_column(DASM_RIGHTCOL_ENCRYPTED);
192   }
193   else if (changedTo->text() == "Comments")
194   {
195      dasmView->set_right_column(DASM_RIGHTCOL_COMMENTS);
196   }
197   m_dasmView->viewport()->update();
198}
199
200
201void DasmWindow::populateComboBox()
202{
203   if (m_dasmView == NULL)
204      return;
205
206   m_cpuComboBox->clear();
207   for (const debug_view_source* source = m_dasmView->view()->first_source();
208         source != NULL;
209         source = source->next())
210   {
211      m_cpuComboBox->addItem(source->name());
212   }
213}
214
215
216//=========================================================================
217//  DasmWindowQtConfig
218//=========================================================================
219void DasmWindowQtConfig::buildFromQWidget(QWidget* widget)
220{
221   WindowQtConfig::buildFromQWidget(widget);
222   DasmWindow* window = dynamic_cast<DasmWindow*>(widget);
223   QComboBox* cpu = window->findChild<QComboBox*>("cpu");
224   m_cpu = cpu->currentIndex();
225
226   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
227   if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
228      m_rightBar = 0;
229   else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
230      m_rightBar = 1;
231   else if (rightBarGroup->checkedAction()->text() == "Comments")
232      m_rightBar = 2;
233}
234
235void DasmWindowQtConfig::applyToQWidget(QWidget* widget)
236{
237   WindowQtConfig::applyToQWidget(widget);
238   DasmWindow* window = dynamic_cast<DasmWindow*>(widget);
239   QComboBox* cpu = window->findChild<QComboBox*>("cpu");
240   cpu->setCurrentIndex(m_cpu);
241
242   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
243   rightBarGroup->actions()[m_rightBar]->trigger();
244}
245
246void DasmWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
247{
248   WindowQtConfig::addToXmlDataNode(node);
249   xml_set_attribute_int(node, "cpu", m_cpu);
250   xml_set_attribute_int(node, "rightbar", m_rightBar);
251}
252
253void DasmWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
254{
255   WindowQtConfig::recoverFromXmlNode(node);
256   m_cpu = xml_get_attribute_int(node, "cpu", m_cpu);
257   m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
258}
trunk/src/osd/modules/debugger/qt/dasmwindow.h
r0r243595
1#ifndef __DEBUG_QT_DASM_WINDOW_H__
2#define __DEBUG_QT_DASM_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debuggerview.h"
7#include "windowqt.h"
8
9
10//============================================================
11//  The Disassembly Window.
12//============================================================
13class DasmWindow : public WindowQt
14{
15   Q_OBJECT
16
17public:
18   DasmWindow(running_machine* machine, QWidget* parent=NULL);
19   virtual ~DasmWindow();
20
21
22private slots:
23   void cpuChanged(int index);
24   void expressionSubmitted();
25
26   void toggleBreakpointAtCursor(bool changedTo);
27   void runToCursor(bool changedTo);
28   void rightBarChanged(QAction* changedTo);
29
30
31private:
32   void populateComboBox();
33
34
35private:
36   // Widgets
37   QLineEdit* m_inputEdit;
38   QComboBox* m_cpuComboBox;
39   DebuggerView* m_dasmView;
40};
41
42
43//=========================================================================
44//  A way to store the configuration of a window long enough to read/write.
45//=========================================================================
46class DasmWindowQtConfig : public WindowQtConfig
47{
48public:
49   DasmWindowQtConfig() :
50      WindowQtConfig(WIN_TYPE_DASM),
51      m_cpu(0),
52      m_rightBar(0)
53   {
54   }
55
56   ~DasmWindowQtConfig() {}
57
58   // Settings
59   int m_cpu;
60   int m_rightBar;
61
62   void buildFromQWidget(QWidget* widget);
63   void applyToQWidget(QWidget* widget);
64   void addToXmlDataNode(xml_data_node* node) const;
65   void recoverFromXmlNode(xml_data_node* node);
66};
67
68
69#endif
trunk/src/osd/modules/debugger/qt/debuggerview.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "debuggerview.h"
4
5DebuggerView::DebuggerView(const debug_view_type& type,
6                     running_machine* machine,
7                     QWidget* parent) :
8   QAbstractScrollArea(parent),
9   m_preferBottom(false),
10   m_view(NULL),
11   m_machine(machine)
12{
13   // I like setting the font per-view since it doesn't override the menuing fonts.
14   QFont viewFontRequest("Courier New");
15   viewFontRequest.setFixedPitch(true);
16   viewFontRequest.setPointSize(11);
17   setFont(viewFontRequest);
18
19   m_view = m_machine->debug_view().alloc_view(type,
20                                    DebuggerView::debuggerViewUpdate,
21                                    this);
22
23   connect(verticalScrollBar(), SIGNAL(valueChanged(int)),
24         this, SLOT(verticalScrollSlot(int)));
25   connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
26         this, SLOT(horizontalScrollSlot(int)));
27}
28
29
30DebuggerView::~DebuggerView()
31{
32   if (m_machine && m_view)
33      m_machine->debug_view().free_view(*m_view);
34}
35
36// TODO: remove this version no later than January 1, 2015
37#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
38void DebuggerView::paintEvent(QPaintEvent* event)
39{
40   // Tell the MAME debug view how much real estate is available
41   QFontMetrics actualFont = fontMetrics();
42   const int fontWidth = MAX(1, actualFont.width('_'));
43   const int fontHeight = MAX(1, actualFont.height());
44   m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight));
45
46
47   // Handle the scroll bars
48   const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x;
49   const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff;
50   horizontalScrollBar()->setRange(0, horizontalScrollSize);
51
52   // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly
53   const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0;
54
55   const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y;
56   const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust;
57   bool atEnd = false;
58   if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
59   {
60      atEnd = true;
61   }
62   verticalScrollBar()->setRange(0, verticalScrollSize);
63   if (m_preferBottom && atEnd)
64   {
65      verticalScrollBar()->setValue(verticalScrollSize);
66   }
67
68
69   // Draw the viewport widget
70   QPainter painter(viewport());
71   painter.fillRect(0, 0, width(), height(), QBrush(Qt::white));
72   painter.setBackgroundMode(Qt::OpaqueMode);
73   painter.setBackground(QColor(255,255,255));
74
75   // Background control
76   QBrush bgBrush;
77   bgBrush.setStyle(Qt::SolidPattern);
78   painter.setPen(QPen(QColor(0,0,0)));
79
80   size_t viewDataOffset = 0;
81   const debug_view_xy& visibleCharDims = m_view->visible_size();
82   for (int y = 0; y < visibleCharDims.y; y++)
83   {
84      for (int x = 0; x < visibleCharDims.x; x++)
85      {
86         const unsigned char textAttr = m_view->viewdata()[viewDataOffset].attrib;
87
88         if (x == 0 || textAttr != m_view->viewdata()[viewDataOffset-1].attrib)
89         {
90            // Text color handling
91            QColor fgColor(0,0,0);
92            QColor bgColor(255,255,255);
93
94            if(textAttr & DCA_VISITED)
95            {
96               bgColor.setRgb(0xc6, 0xe2, 0xff);
97            }
98            if(textAttr & DCA_ANCILLARY)
99            {
100               bgColor.setRgb(0xe0, 0xe0, 0xe0);
101            }
102            if(textAttr & DCA_SELECTED)
103            {
104               bgColor.setRgb(0xff, 0x80, 0x80);
105            }
106            if(textAttr & DCA_CURRENT)
107            {
108               bgColor.setRgb(0xff, 0xff, 0x00);
109            }
110            if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT))
111            {
112               bgColor.setRgb(0xff,0xc0,0x80);
113            }
114            if(textAttr & DCA_CHANGED)
115            {
116               fgColor.setRgb(0xff, 0x00, 0x00);
117            }
118            if(textAttr & DCA_INVALID)
119            {
120               fgColor.setRgb(0x00, 0x00, 0xff);
121            }
122            if(textAttr & DCA_DISABLED)
123            {
124               fgColor.setRgb((fgColor.red()   + bgColor.red())   >> 1,
125                           (fgColor.green() + bgColor.green()) >> 1,
126                           (fgColor.blue()  + bgColor.blue())  >> 1);
127            }
128            if(textAttr & DCA_COMMENT)
129            {
130               fgColor.setRgb(0x00, 0x80, 0x00);
131            }
132
133            bgBrush.setColor(bgColor);
134            painter.setBackground(bgBrush);
135            painter.setPen(QPen(fgColor));
136         }
137
138         // Your character is not guaranteed to take up the entire fontWidth x fontHeight, so fill before.
139         painter.fillRect(x*fontWidth, y*fontHeight, fontWidth, fontHeight, bgBrush);
140
141         // There is a touchy interplay between font height, drawing difference, visible position, etc
142         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
143         painter.drawText(x*fontWidth,
144                        (y*fontHeight + (fontHeight*0.80)),
145                        QString(m_view->viewdata()[viewDataOffset].byte));
146         viewDataOffset++;
147      }
148   }
149}
150#else
151void DebuggerView::paintEvent(QPaintEvent* event)
152{
153   // Tell the MAME debug view how much real estate is available
154   QFontMetrics actualFont = fontMetrics();
155   const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
156   const int fontHeight = MAX(1, actualFont.height());
157   m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight));
158
159
160   // Handle the scroll bars
161   const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x;
162   const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff;
163   horizontalScrollBar()->setRange(0, horizontalScrollSize);
164
165   // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly
166   const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0;
167
168   const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y;
169   const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust;
170   bool atEnd = false;
171   if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
172   {
173      atEnd = true;
174   }
175   verticalScrollBar()->setRange(0, verticalScrollSize);
176   if (m_preferBottom && atEnd)
177   {
178      verticalScrollBar()->setValue(verticalScrollSize);
179   }
180
181
182   // Draw the viewport widget
183   QPainter painter(viewport());
184   painter.fillRect(0, 0, width(), height(), QBrush(Qt::white));
185   painter.setBackgroundMode(Qt::OpaqueMode);
186   painter.setBackground(QColor(255,255,255));
187
188   // Background control
189   QBrush bgBrush;
190   bgBrush.setStyle(Qt::SolidPattern);
191   painter.setPen(QPen(QColor(0,0,0)));
192
193   size_t viewDataOffset = 0;
194   const debug_view_xy& visibleCharDims = m_view->visible_size();
195   const debug_view_char* viewdata = m_view->viewdata();
196   for (int y = 0; y < visibleCharDims.y; y++)
197   {
198      int width = 1;
199      for (int x = 0; x < visibleCharDims.x; viewDataOffset += width, x += width)
200      {
201         const unsigned char textAttr = viewdata[viewDataOffset].attrib;
202
203         // Text color handling
204         QColor fgColor(0,0,0);
205         QColor bgColor(255,255,255);
206
207         if(textAttr & DCA_VISITED)
208         {
209            bgColor.setRgb(0xc6, 0xe2, 0xff);
210         }
211         if(textAttr & DCA_ANCILLARY)
212         {
213            bgColor.setRgb(0xe0, 0xe0, 0xe0);
214         }
215         if(textAttr & DCA_SELECTED)
216         {
217            bgColor.setRgb(0xff, 0x80, 0x80);
218         }
219         if(textAttr & DCA_CURRENT)
220         {
221            bgColor.setRgb(0xff, 0xff, 0x00);
222         }
223         if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT))
224         {
225            bgColor.setRgb(0xff,0xc0,0x80);
226         }
227         if(textAttr & DCA_CHANGED)
228         {
229            fgColor.setRgb(0xff, 0x00, 0x00);
230         }
231         if(textAttr & DCA_INVALID)
232         {
233            fgColor.setRgb(0x00, 0x00, 0xff);
234         }
235         if(textAttr & DCA_DISABLED)
236         {
237            fgColor.setRgb((fgColor.red()   + bgColor.red())   >> 1,
238                        (fgColor.green() + bgColor.green()) >> 1,
239                        (fgColor.blue()  + bgColor.blue())  >> 1);
240         }
241         if(textAttr & DCA_COMMENT)
242         {
243            fgColor.setRgb(0x00, 0x80, 0x00);
244         }
245
246         bgBrush.setColor(bgColor);
247         painter.setBackground(bgBrush);
248         painter.setPen(QPen(fgColor));
249
250         QString text(QChar(viewdata[viewDataOffset].byte));
251         for (width = 1; x + width < visibleCharDims.x; width++)
252         {
253            if (textAttr != viewdata[viewDataOffset + width].attrib)
254               break;
255            text.append(QChar(viewdata[viewDataOffset + width].byte));
256         }
257
258         // Your characters are not guaranteed to take up the entire length x fontWidth x fontHeight, so fill before.
259         painter.fillRect(x*fontWidth, y*fontHeight, width*fontWidth, fontHeight, bgBrush);
260
261         // There is a touchy interplay between font height, drawing difference, visible position, etc
262         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
263         painter.drawText(x*fontWidth, (y*fontHeight + (fontHeight*0.80)), text);
264      }
265   }
266}
267#endif
268
269void DebuggerView::keyPressEvent(QKeyEvent* event)
270{
271   if (m_view == NULL)
272      return QWidget::keyPressEvent(event);
273
274   Qt::KeyboardModifiers keyMods = QApplication::keyboardModifiers();
275   const bool ctrlDown = keyMods.testFlag(Qt::ControlModifier);
276
277   int keyPress = -1;
278   switch (event->key())
279   {
280      case Qt::Key_Up:
281         keyPress = DCH_UP;
282         break;
283      case Qt::Key_Down:
284         keyPress = DCH_DOWN;
285         break;
286      case Qt::Key_Left:
287         keyPress = DCH_LEFT;
288         if (ctrlDown) keyPress = DCH_CTRLLEFT;
289         break;
290      case Qt::Key_Right:
291         keyPress = DCH_RIGHT;
292         if (ctrlDown) keyPress = DCH_CTRLRIGHT;
293         break;
294      case Qt::Key_PageUp:
295         keyPress = DCH_PUP;
296         break;
297      case Qt::Key_PageDown:
298         keyPress = DCH_PDOWN;
299         break;
300      case Qt::Key_Home:
301         keyPress = DCH_HOME;
302         if (ctrlDown) keyPress = DCH_CTRLHOME;
303         break;
304      case Qt::Key_End:
305         keyPress = DCH_END;
306         if (ctrlDown) keyPress = DCH_CTRLEND;
307         break;
308      case Qt::Key_0: keyPress = '0'; break;
309      case Qt::Key_1: keyPress = '1'; break;
310      case Qt::Key_2: keyPress = '2'; break;
311      case Qt::Key_3: keyPress = '3'; break;
312      case Qt::Key_4: keyPress = '4'; break;
313      case Qt::Key_5: keyPress = '5'; break;
314      case Qt::Key_6: keyPress = '6'; break;
315      case Qt::Key_7: keyPress = '7'; break;
316      case Qt::Key_8: keyPress = '8'; break;
317      case Qt::Key_9: keyPress = '9'; break;
318      case Qt::Key_A: keyPress = 'a'; break;
319      case Qt::Key_B: keyPress = 'b'; break;
320      case Qt::Key_C: keyPress = 'c'; break;
321      case Qt::Key_D: keyPress = 'd'; break;
322      case Qt::Key_E: keyPress = 'e'; break;
323      case Qt::Key_F: keyPress = 'f'; break;
324      default:
325         return QWidget::keyPressEvent(event);
326   }
327
328   m_view->set_cursor_visible(true);
329   m_view->process_char(keyPress);
330
331   // Catch the view up with the cursor
332   verticalScrollBar()->setValue(m_view->visible_position().y);
333
334   viewport()->update();
335   update();
336}
337
338
339void DebuggerView::mousePressEvent(QMouseEvent* event)
340{
341   if (m_view == NULL)
342      return;
343
344   if (event->button() == Qt::LeftButton)
345   {
346      QFontMetrics actualFont = fontMetrics();
347      const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
348      const int fontHeight = MAX(1, actualFont.height());
349
350      debug_view_xy topLeft = m_view->visible_position();
351      debug_view_xy clickViewPosition;
352      clickViewPosition.x = topLeft.x + (event->x() / fontWidth);
353      clickViewPosition.y = topLeft.y + (event->y() / fontHeight);
354      m_view->process_click(DCK_LEFT_CLICK, clickViewPosition);
355
356      viewport()->update();
357      update();
358   }
359}
360
361
362void DebuggerView::verticalScrollSlot(int value)
363{
364   m_view->set_visible_position(debug_view_xy(horizontalScrollBar()->value(), value));
365}
366
367
368void DebuggerView::horizontalScrollSlot(int value)
369{
370   m_view->set_visible_position(debug_view_xy(value, verticalScrollBar()->value()));
371}
372
373
374void DebuggerView::debuggerViewUpdate(debug_view& debugView, void* osdPrivate)
375{
376   // Get a handle to the DebuggerView being updated & redraw
377   DebuggerView* dView = (DebuggerView*)osdPrivate;
378   dView->verticalScrollBar()->setValue(dView->view()->visible_position().y);
379   dView->horizontalScrollBar()->setValue(dView->view()->visible_position().x);
380   dView->viewport()->update();
381   dView->update();
382}
trunk/src/osd/modules/debugger/qt/debuggerview.h
r0r243595
1#ifndef __DEBUG_QT_DEBUGGER_VIEW_H__
2#define __DEBUG_QT_DEBUGGER_VIEW_H__
3
4#include <QtGui/QtGui>
5
6#include "debug/debugvw.h"
7
8
9class DebuggerView : public QAbstractScrollArea
10{
11   Q_OBJECT
12
13public:
14   DebuggerView(const debug_view_type& type,
15               running_machine* machine,
16               QWidget* parent=NULL);
17   virtual ~DebuggerView();
18
19   void paintEvent(QPaintEvent* event);
20
21   // Callback to allow MAME to refresh the view
22   static void debuggerViewUpdate(debug_view& debugView, void* osdPrivate);
23
24   // Setters and accessors
25   void setPreferBottom(bool pb) { m_preferBottom = pb; }
26   debug_view* view() { return m_view; }
27
28
29protected:
30   void keyPressEvent(QKeyEvent* event);
31   void mousePressEvent(QMouseEvent* event);
32
33private slots:
34   void verticalScrollSlot(int value);
35   void horizontalScrollSlot(int value);
36
37
38private:
39   bool m_preferBottom;
40
41   debug_view* m_view;
42   running_machine* m_machine;
43};
44
45
46#endif
trunk/src/osd/modules/debugger/qt/debugqtbreakpointswindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtbreakpointswindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvbpoints.h"
8#include "debug/dvwpoints.h"
9
10
11BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) :
12   WindowQt(machine, NULL)
13{
14   setWindowTitle("Debug: All Breakpoints");
15
16   if (parent != NULL)
17   {
18      QPoint parentPos = parent->pos();
19      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
20   }
21
22   //
23   // The main frame and its input and breakpoints widgets
24   //
25   QFrame* mainWindowFrame = new QFrame(this);
26
27   // The main breakpoints view
28   m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);
29
30   // Layout
31   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
32   vLayout->setObjectName("vlayout");
33   vLayout->setSpacing(3);
34   vLayout->setContentsMargins(2,2,2,2);
35   vLayout->addWidget(m_breakpointsView);
36
37   setCentralWidget(mainWindowFrame);
38
39   //
40   // Menu bars
41   //
42   QActionGroup* typeGroup = new QActionGroup(this);
43   typeGroup->setObjectName("typegroup");
44   QAction* typeBreak = new QAction("Breakpoints", this);
45   typeBreak->setObjectName("typebreak");
46   QAction* typeWatch = new QAction("Watchpoints", this);
47   typeWatch->setObjectName("typewatch");
48   typeBreak->setCheckable(true);
49   typeWatch->setCheckable(true);
50   typeBreak->setActionGroup(typeGroup);
51   typeWatch->setActionGroup(typeGroup);
52   typeBreak->setShortcut(QKeySequence("Ctrl+1"));
53   typeWatch->setShortcut(QKeySequence("Ctrl+2"));
54   typeBreak->setChecked(true);
55   connect(typeGroup, SIGNAL(triggered(QAction*)), this, SLOT(typeChanged(QAction*)));
56
57   // Assemble the options menu
58   QMenu* optionsMenu = menuBar()->addMenu("&Options");
59   optionsMenu->addActions(typeGroup->actions());
60}
61
62
63BreakpointsWindow::~BreakpointsWindow()
64{
65}
66
67
68void BreakpointsWindow::typeChanged(QAction* changedTo)
69{
70   // Clean
71   delete m_breakpointsView;
72   m_breakpointsView = NULL;
73
74   // Create
75   if (changedTo->text() == "Breakpoints")
76   {
77      m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this);
78      setWindowTitle("Debug: All Breakpoints");
79   }
80   else if (changedTo->text() == "Watchpoints")
81   {
82      m_breakpointsView = new DebuggerView(DVT_WATCH_POINTS, m_machine, this);
83      setWindowTitle("Debug: All Watchpoints");
84   }
85
86   // Re-register
87   QVBoxLayout* layout = findChild<QVBoxLayout*>("vlayout");
88   layout->addWidget(m_breakpointsView);
89}
90
91
92
93//=========================================================================
94//  BreakpointsWindowQtConfig
95//=========================================================================
96void BreakpointsWindowQtConfig::buildFromQWidget(QWidget* widget)
97{
98   WindowQtConfig::buildFromQWidget(widget);
99   BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
100
101   QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
102   if (typeGroup->checkedAction()->text() == "Breakpoints")
103      m_bwType = 0;
104   else if (typeGroup->checkedAction()->text() == "Watchpoints")
105      m_bwType = 1;
106}
107
108
109void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget)
110{
111   WindowQtConfig::applyToQWidget(widget);
112   BreakpointsWindow* window = dynamic_cast<BreakpointsWindow*>(widget);
113
114   QActionGroup* typeGroup = window->findChild<QActionGroup*>("typegroup");
115   typeGroup->actions()[m_bwType]->trigger();
116}
117
118
119void BreakpointsWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
120{
121   WindowQtConfig::addToXmlDataNode(node);
122   xml_set_attribute_int(node, "bwtype", m_bwType);
123}
124
125
126void BreakpointsWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
127{
128   WindowQtConfig::recoverFromXmlNode(node);
129   m_bwType = xml_get_attribute_int(node, "bwtype", m_bwType);
130}
trunk/src/osd/modules/debugger/qt/debugqtbreakpointswindow.h
r243594r243595
1#ifndef __DEBUG_QT_BREAK_POINTS_WINDOW_H__
2#define __DEBUG_QT_BREAK_POINTS_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debugqtview.h"
7#include "debugqtwindow.h"
8
9
10//============================================================
11//  The Breakpoints Window.
12//============================================================
13class BreakpointsWindow : public WindowQt
14{
15   Q_OBJECT
16
17public:
18   BreakpointsWindow(running_machine* machine, QWidget* parent=NULL);
19   virtual ~BreakpointsWindow();
20
21
22private slots:
23   void typeChanged(QAction* changedTo);
24
25
26private:
27   // Widgets
28   DebuggerView* m_breakpointsView;
29};
30
31
32//=========================================================================
33//  A way to store the configuration of a window long enough to read/write.
34//=========================================================================
35class BreakpointsWindowQtConfig : public WindowQtConfig
36{
37public:
38   BreakpointsWindowQtConfig() :
39      WindowQtConfig(WIN_TYPE_BREAK_POINTS),
40      m_bwType(0)
41   {
42   }
43
44   ~BreakpointsWindowQtConfig() {}
45
46   // Settings
47   int m_bwType;
48
49   void buildFromQWidget(QWidget* widget);
50   void applyToQWidget(QWidget* widget);
51   void addToXmlDataNode(xml_data_node* node) const;
52   void recoverFromXmlNode(xml_data_node* node);
53};
54
55
56#endif
trunk/src/osd/modules/debugger/qt/debugqtdasmwindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtdasmwindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvdisasm.h"
8
9
10DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL)
12{
13   setWindowTitle("Debug: Disassembly View");
14
15   if (parent != NULL)
16   {
17      QPoint parentPos = parent->pos();
18      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
19   }
20
21   //
22   // The main frame and its input and log widgets
23   //
24   QFrame* mainWindowFrame = new QFrame(this);
25
26   // The top frame & groupbox that contains the input widgets
27   QFrame* topSubFrame = new QFrame(mainWindowFrame);
28
29   // The input edit
30   m_inputEdit = new QLineEdit(topSubFrame);
31   connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));
32
33   // The cpu combo box
34   m_cpuComboBox = new QComboBox(topSubFrame);
35   m_cpuComboBox->setObjectName("cpu");
36   m_cpuComboBox->setMinimumWidth(300);
37   connect(m_cpuComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(cpuChanged(int)));
38
39   // The main disasm window
40   m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
41                           m_machine,
42                           this);
43
44   // Force a recompute of the disassembly region
45   downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
46
47   // Populate the combo box & set the proper cpu
48   populateComboBox();
49   //const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu);
50   //gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source));
51   //mem->views[0]->view->set_source(*source);
52
53
54   // Layout
55   QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
56   subLayout->addWidget(m_inputEdit);
57   subLayout->addWidget(m_cpuComboBox);
58   subLayout->setSpacing(3);
59   subLayout->setContentsMargins(2,2,2,2);
60
61   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
62   vLayout->setSpacing(3);
63   vLayout->setContentsMargins(2,2,2,2);
64   vLayout->addWidget(topSubFrame);
65   vLayout->addWidget(m_dasmView);
66
67   setCentralWidget(mainWindowFrame);
68
69   //
70   // Menu bars
71   //
72   // Create two commands
73   QAction* breakpointSetAct = new QAction("Toggle Breakpoint At Cursor", this);
74   QAction* runToCursorAct = new QAction("Run To Cursor", this);
75   breakpointSetAct->setShortcut(Qt::Key_F9);
76   runToCursorAct->setShortcut(Qt::Key_F4);
77   connect(breakpointSetAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
78   connect(runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool)));
79
80   // Right bar options
81   QActionGroup* rightBarGroup = new QActionGroup(this);
82   rightBarGroup->setObjectName("rightbargroup");
83   QAction* rightActRaw = new QAction("Raw Opcodes", this);
84   QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
85   QAction* rightActComments = new QAction("Comments", this);
86   rightActRaw->setCheckable(true);
87   rightActEncrypted->setCheckable(true);
88   rightActComments->setCheckable(true);
89   rightActRaw->setActionGroup(rightBarGroup);
90   rightActEncrypted->setActionGroup(rightBarGroup);
91   rightActComments->setActionGroup(rightBarGroup);
92   rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
93   rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
94   rightActComments->setShortcut(QKeySequence("Ctrl+C"));
95   rightActRaw->setChecked(true);
96   connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*)));
97
98   // Assemble the options menu
99   QMenu* optionsMenu = menuBar()->addMenu("&Options");
100   optionsMenu->addAction(breakpointSetAct);
101   optionsMenu->addAction(runToCursorAct);
102   optionsMenu->addSeparator();
103   optionsMenu->addActions(rightBarGroup->actions());
104}
105
106
107DasmWindow::~DasmWindow()
108{
109}
110
111
112void DasmWindow::cpuChanged(int index)
113{
114   m_dasmView->view()->set_source(*m_dasmView->view()->source_list().find(index));
115   m_dasmView->viewport()->update();
116}
117
118
119void DasmWindow::expressionSubmitted()
120{
121   const QString expression = m_inputEdit->text();
122   downcast<debug_view_disasm*>(m_dasmView->view())->set_expression(expression.toLocal8Bit().data());
123   m_dasmView->viewport()->update();
124}
125
126
127void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
128{
129   if (m_dasmView->view()->cursor_visible())
130   {
131      if (debug_cpu_get_visible_cpu(*m_machine) == m_dasmView->view()->source()->device())
132      {
133         offs_t address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
134         device_debug *cpuinfo = m_dasmView->view()->source()->device()->debug();
135
136         // Find an existing breakpoint at this address
137         INT32 bpindex = -1;
138         for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
139               bp != NULL;
140               bp = bp->next())
141         {
142            if (address == bp->address())
143            {
144               bpindex = bp->index();
145               break;
146            }
147         }
148
149         // If none exists, add a new one
150         astring command;
151         if (bpindex == -1)
152         {
153            command.printf("bpset 0x%X", address);
154         }
155         else
156         {
157            command.printf("bpclear 0x%X", bpindex);
158         }
159         debug_console_execute_command(*m_machine, command, 1);
160      }
161   }
162
163   refreshAll();
164}
165
166
167void DasmWindow::runToCursor(bool changedTo)
168{
169   if (m_dasmView->view()->cursor_visible())
170   {
171      if (debug_cpu_get_visible_cpu(*m_machine) == m_dasmView->view()->source()->device())
172      {
173         offs_t address = downcast<debug_view_disasm*>(m_dasmView->view())->selected_address();
174         astring command;
175         command.printf("go 0x%X", address);
176         debug_console_execute_command(*m_machine, command, 1);
177      }
178   }
179}
180
181
182void DasmWindow::rightBarChanged(QAction* changedTo)
183{
184   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmView->view());
185   if (changedTo->text() == "Raw Opcodes")
186   {
187      dasmView->set_right_column(DASM_RIGHTCOL_RAW);
188   }
189   else if (changedTo->text() == "Encrypted Opcodes")
190   {
191      dasmView->set_right_column(DASM_RIGHTCOL_ENCRYPTED);
192   }
193   else if (changedTo->text() == "Comments")
194   {
195      dasmView->set_right_column(DASM_RIGHTCOL_COMMENTS);
196   }
197   m_dasmView->viewport()->update();
198}
199
200
201void DasmWindow::populateComboBox()
202{
203   if (m_dasmView == NULL)
204      return;
205
206   m_cpuComboBox->clear();
207   for (const debug_view_source* source = m_dasmView->view()->first_source();
208         source != NULL;
209         source = source->next())
210   {
211      m_cpuComboBox->addItem(source->name());
212   }
213}
214
215
216//=========================================================================
217//  DasmWindowQtConfig
218//=========================================================================
219void DasmWindowQtConfig::buildFromQWidget(QWidget* widget)
220{
221   WindowQtConfig::buildFromQWidget(widget);
222   DasmWindow* window = dynamic_cast<DasmWindow*>(widget);
223   QComboBox* cpu = window->findChild<QComboBox*>("cpu");
224   m_cpu = cpu->currentIndex();
225
226   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
227   if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
228      m_rightBar = 0;
229   else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
230      m_rightBar = 1;
231   else if (rightBarGroup->checkedAction()->text() == "Comments")
232      m_rightBar = 2;
233}
234
235void DasmWindowQtConfig::applyToQWidget(QWidget* widget)
236{
237   WindowQtConfig::applyToQWidget(widget);
238   DasmWindow* window = dynamic_cast<DasmWindow*>(widget);
239   QComboBox* cpu = window->findChild<QComboBox*>("cpu");
240   cpu->setCurrentIndex(m_cpu);
241
242   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
243   rightBarGroup->actions()[m_rightBar]->trigger();
244}
245
246void DasmWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
247{
248   WindowQtConfig::addToXmlDataNode(node);
249   xml_set_attribute_int(node, "cpu", m_cpu);
250   xml_set_attribute_int(node, "rightbar", m_rightBar);
251}
252
253void DasmWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
254{
255   WindowQtConfig::recoverFromXmlNode(node);
256   m_cpu = xml_get_attribute_int(node, "cpu", m_cpu);
257   m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
258}
trunk/src/osd/modules/debugger/qt/debugqtdasmwindow.h
r243594r243595
1#ifndef __DEBUG_QT_DASM_WINDOW_H__
2#define __DEBUG_QT_DASM_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debugqtview.h"
7#include "debugqtwindow.h"
8
9
10//============================================================
11//  The Disassembly Window.
12//============================================================
13class DasmWindow : public WindowQt
14{
15   Q_OBJECT
16
17public:
18   DasmWindow(running_machine* machine, QWidget* parent=NULL);
19   virtual ~DasmWindow();
20
21
22private slots:
23   void cpuChanged(int index);
24   void expressionSubmitted();
25
26   void toggleBreakpointAtCursor(bool changedTo);
27   void runToCursor(bool changedTo);
28   void rightBarChanged(QAction* changedTo);
29
30
31private:
32   void populateComboBox();
33
34
35private:
36   // Widgets
37   QLineEdit* m_inputEdit;
38   QComboBox* m_cpuComboBox;
39   DebuggerView* m_dasmView;
40};
41
42
43//=========================================================================
44//  A way to store the configuration of a window long enough to read/write.
45//=========================================================================
46class DasmWindowQtConfig : public WindowQtConfig
47{
48public:
49   DasmWindowQtConfig() :
50      WindowQtConfig(WIN_TYPE_DASM),
51      m_cpu(0),
52      m_rightBar(0)
53   {
54   }
55
56   ~DasmWindowQtConfig() {}
57
58   // Settings
59   int m_cpu;
60   int m_rightBar;
61
62   void buildFromQWidget(QWidget* widget);
63   void applyToQWidget(QWidget* widget);
64   void addToXmlDataNode(xml_data_node* node) const;
65   void recoverFromXmlNode(xml_data_node* node);
66};
67
68
69#endif
trunk/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtdeviceinformationwindow.h"
4
5
6DeviceInformationWindow::DeviceInformationWindow(running_machine* machine, device_t* device, QWidget* parent) :
7   WindowQt(machine, NULL)
8{
9   m_device = device;
10
11   if (parent != NULL)
12   {
13      QPoint parentPos = parent->pos();
14      setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400);
15   }
16
17   if(m_device)
18      fill_device_information();
19}
20
21
22DeviceInformationWindow::~DeviceInformationWindow()
23{
24}
25
26void DeviceInformationWindow::fill_device_information()
27{
28   char title[4069];
29   sprintf(title, "Debug: Device %s", m_device->tag());
30   setWindowTitle(title);
31
32
33   QFrame *mainWindowFrame = new QFrame(this);
34   QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame);
35   vLayout->setObjectName("vlayout");
36   vLayout->setSpacing(3);
37   vLayout->setContentsMargins(2,2,2,2);
38
39   QFrame *primaryFrame = new QFrame(mainWindowFrame);
40   primaryFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
41   QGridLayout *gl1 = new QGridLayout(primaryFrame);
42   gl1->addWidget(new QLabel(QString("Tag"), primaryFrame), 0, 0);
43   gl1->addWidget(new QLabel(QString(m_device->tag()), primaryFrame), 0, 1);
44   gl1->addWidget(new QLabel(QString("Name"), primaryFrame), 1, 0);
45   gl1->addWidget(new QLabel(QString(m_device->name()), primaryFrame), 1, 1);
46   gl1->addWidget(new QLabel(QString("Shortname"), primaryFrame), 2, 0);
47   gl1->addWidget(new QLabel(QString(m_device->shortname()), primaryFrame), 2, 1);
48
49   int cpos = 3;
50   device_interface *intf = m_device->first_interface();
51   if(intf) {
52      gl1->addWidget(new QLabel(QString("Interfaces"), primaryFrame), cpos, 0);
53      while(intf) {
54         gl1->addWidget(new QLabel(QString(intf->interface_type()), primaryFrame), cpos, 1);
55         cpos++;
56         intf = intf->interface_next();
57      }
58   }
59
60   vLayout->addWidget(primaryFrame);
61
62   device_memory_interface *d_memory;
63   if(m_device->interface(d_memory)) {
64      QFrame *f = new QFrame(mainWindowFrame);
65      f->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
66      QVBoxLayout *vb = new QVBoxLayout(f);
67      bool first = true;
68      for(address_spacenum i=AS_0; i<ADDRESS_SPACES; i++)
69         if(d_memory->has_space(i)) {
70            QFrame *ff = new QFrame(f);
71            QHBoxLayout *hb = new QHBoxLayout(ff);
72            if(first) {
73               hb->addWidget(new QLabel("Memory maps"));
74               first = false;
75            }
76            hb->addStretch();
77            hb->addWidget(new QLabel(d_memory->space_config(i)->name()));
78            vb->addWidget(ff);
79         }
80      vLayout->addWidget(f);
81   }
82
83   vLayout->addStretch();
84
85   setCentralWidget(mainWindowFrame);
86}
87
88void DeviceInformationWindow::set_device(const char *tag)
89{
90   m_device = m_machine->device(tag);
91   if(!m_device)
92      m_device = &m_machine->root_device();
93   fill_device_information();
94}
95
96const char *DeviceInformationWindow::device_tag() const
97{
98   return m_device->tag();
99}
100
101
102//=========================================================================
103//  DeviceInformationWindowQtConfig
104//=========================================================================
105void DeviceInformationWindowQtConfig::buildFromQWidget(QWidget* widget)
106{
107   WindowQtConfig::buildFromQWidget(widget);
108   DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget);
109   m_device_tag = window->device_tag();
110}
111
112
113void DeviceInformationWindowQtConfig::applyToQWidget(QWidget* widget)
114{
115   WindowQtConfig::applyToQWidget(widget);
116   DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget);
117   window->set_device(m_device_tag.cstr());
118}
119
120
121void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
122{
123   WindowQtConfig::addToXmlDataNode(node);
124   xml_set_attribute(node, "device-tag", m_device_tag);
125}
126
127
128void DeviceInformationWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
129{
130   WindowQtConfig::recoverFromXmlNode(node);
131   m_device_tag = xml_get_attribute_string(node, "device-tag", ":");
132}
trunk/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h
r243594r243595
1#ifndef __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__
2#define __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debugqtwindow.h"
7
8//============================================================
9//  The Device Information Window.
10//============================================================
11class DeviceInformationWindow : public WindowQt
12{
13   Q_OBJECT
14
15public:
16   DeviceInformationWindow(running_machine* machine, device_t* device = NULL, QWidget* parent=NULL);
17   virtual ~DeviceInformationWindow();
18
19   void set_device(const char *tag);
20   const char *device_tag() const;
21
22private:
23   device_t *m_device;
24
25   void fill_device_information();
26};
27
28
29
30
31//=========================================================================
32//  A way to store the configuration of a window long enough to read/write.
33//=========================================================================
34class DeviceInformationWindowQtConfig : public WindowQtConfig
35{
36public:
37   astring m_device_tag;
38
39   DeviceInformationWindowQtConfig() :
40      WindowQtConfig(WIN_TYPE_DEVICE_INFORMATION)
41   {
42   }
43
44   ~DeviceInformationWindowQtConfig() {}
45
46   void buildFromQWidget(QWidget* widget);
47   void applyToQWidget(QWidget* widget);
48   void addToXmlDataNode(xml_data_node* node) const;
49   void recoverFromXmlNode(xml_data_node* node);
50};
51
52
53#endif
trunk/src/osd/modules/debugger/qt/debugqtdeviceswindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtdeviceswindow.h"
4#include "debugqtdeviceinformationwindow.h"
5
6DevicesWindowModel::DevicesWindowModel(running_machine *machine, QObject *parent)
7{
8   m_machine = machine;
9}
10
11DevicesWindowModel::~DevicesWindowModel()
12{
13}
14
15QVariant DevicesWindowModel::data(const QModelIndex &index, int role) const
16{
17   if(!index.isValid() || role != Qt::DisplayRole)
18      return QVariant();
19
20   device_t *dev = static_cast<device_t *>(index.internalPointer());
21   switch(index.column()) {
22   case 0: return dev == &m_machine->root_device() ? QString("<root>") : QString(dev->basetag());
23   case 1: return QString(dev->name());
24   }
25
26   return QVariant();
27}
28
29Qt::ItemFlags DevicesWindowModel::flags(const QModelIndex &index) const
30{
31   if(!index.isValid())
32      return 0;
33
34   return QAbstractItemModel::flags(index);
35}
36
37QVariant DevicesWindowModel::headerData(int section, Qt::Orientation orientation, int role) const
38{
39   if(role != Qt::DisplayRole || section < 0 || section >= 2)
40      return QVariant();
41   return QString(section ? "Name" : "Tag");
42}
43
44QModelIndex DevicesWindowModel::index(int row, int column, const QModelIndex &parent) const
45{
46   if(!hasIndex(row, column, parent))
47      return QModelIndex();
48
49   device_t *target = NULL;
50
51   if(!parent.isValid()) {
52      if(row == 0)
53         target = &m_machine->root_device();
54
55   } else {
56      device_t *dparent = static_cast<device_t *>(parent.internalPointer());
57      int count = row;
58      for(target = dparent->first_subdevice(); count && target; target = target->next())
59         count--;
60   }
61
62   if(target)
63      return createIndex(row, column, target);
64
65   return QModelIndex();
66}
67
68QModelIndex DevicesWindowModel::parent(const QModelIndex &index) const
69{
70   if(!index.isValid())
71      return QModelIndex();
72
73   device_t *dchild = static_cast<device_t *>(index.internalPointer());
74   device_t *dparent = dchild->owner();
75
76   if(!dparent)
77      return QModelIndex();
78
79   device_t *dpp = dparent->owner();
80   int row = 0;
81   if(dpp) {
82      for(device_t *child = dpp->first_subdevice(); child && child != dparent; child = child->next())
83         row++;
84   }
85   return createIndex(row, 0, dparent);
86}
87
88int DevicesWindowModel::rowCount(const QModelIndex &parent) const
89{
90   if(!parent.isValid())
91      return 1;
92
93   device_t *dparent = static_cast<device_t *>(parent.internalPointer());
94   int count = 0;
95   for(device_t *child = dparent->first_subdevice(); child; child = child->next())
96      count++;
97
98   return count;
99}
100
101int DevicesWindowModel::columnCount(const QModelIndex &parent) const
102{
103   return 2;
104}
105
106
107
108DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) :
109   WindowQt(machine, NULL),
110   m_devices_model(machine)
111{
112   m_selected_device = NULL;
113
114   setWindowTitle("Debug: All Devices");
115
116   if (parent != NULL)
117   {
118      QPoint parentPos = parent->pos();
119      setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400);
120   }
121
122   //
123   // The tree widget
124   //
125   m_devices_view = new QTreeView(this);
126   m_devices_view->setModel(&m_devices_model);
127   m_devices_view->expandAll();
128   m_devices_view->resizeColumnToContents(0);
129   connect(m_devices_view->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(currentRowChanged(const QModelIndex &,const QModelIndex &)));
130   connect(m_devices_view, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &)));
131   setCentralWidget(m_devices_view);
132}
133
134
135DevicesWindow::~DevicesWindow()
136{
137}
138
139
140void DevicesWindow::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
141{
142   m_selected_device = static_cast<device_t *>(current.internalPointer());
143}
144
145
146void DevicesWindow::activated(const QModelIndex &index)
147{
148   device_t *dev = static_cast<device_t *>(index.internalPointer());
149   (new DeviceInformationWindow(m_machine, dev, this))->show();
150}
151
152
153
154//=========================================================================
155//  DevicesWindowQtConfig
156//=========================================================================
157void DevicesWindowQtConfig::buildFromQWidget(QWidget* widget)
158{
159   WindowQtConfig::buildFromQWidget(widget);
160   //  DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
161}
162
163
164void DevicesWindowQtConfig::applyToQWidget(QWidget* widget)
165{
166   WindowQtConfig::applyToQWidget(widget);
167   //  DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
168}
169
170
171void DevicesWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
172{
173   WindowQtConfig::addToXmlDataNode(node);
174}
175
176
177void DevicesWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
178{
179   WindowQtConfig::recoverFromXmlNode(node);
180}
trunk/src/osd/modules/debugger/qt/debugqtdeviceswindow.h
r243594r243595
1#ifndef __DEBUG_QT_DEVICES_WINDOW_H__
2#define __DEBUG_QT_DEVICES_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debugqtwindow.h"
7
8
9//============================================================
10//  The model for the treeview
11//============================================================
12
13class DevicesWindowModel : public QAbstractItemModel
14{
15   Q_OBJECT
16
17public:
18   explicit DevicesWindowModel(running_machine *machine, QObject *parent = 0);
19   ~DevicesWindowModel();
20
21   QVariant data(const QModelIndex &index, int role) const;
22   Qt::ItemFlags flags(const QModelIndex &index) const;
23   QVariant headerData(int section, Qt::Orientation orientation,
24                  int role = Qt::DisplayRole) const;
25   QModelIndex index(int row, int column,
26                  const QModelIndex &parent = QModelIndex()) const;
27   QModelIndex parent(const QModelIndex &index) const;
28   int rowCount(const QModelIndex &parent = QModelIndex()) const;
29   int columnCount(const QModelIndex &parent = QModelIndex()) const;
30
31private:
32   running_machine *m_machine;
33};
34
35//============================================================
36//  The Devices Window.
37//============================================================
38class DevicesWindow : public WindowQt
39{
40   Q_OBJECT
41
42public:
43   DevicesWindow(running_machine* machine, QWidget* parent=NULL);
44   virtual ~DevicesWindow();
45
46public slots:
47   void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
48   void activated(const QModelIndex &index);
49
50private:
51   QTreeView *m_devices_view;
52   DevicesWindowModel m_devices_model;
53   device_t *m_selected_device;
54};
55
56
57
58
59//=========================================================================
60//  A way to store the configuration of a window long enough to read/write.
61//=========================================================================
62class DevicesWindowQtConfig : public WindowQtConfig
63{
64public:
65   DevicesWindowQtConfig() :
66      WindowQtConfig(WIN_TYPE_DEVICES)
67   {
68   }
69
70   ~DevicesWindowQtConfig() {}
71
72   void buildFromQWidget(QWidget* widget);
73   void applyToQWidget(QWidget* widget);
74   void addToXmlDataNode(xml_data_node* node) const;
75   void recoverFromXmlNode(xml_data_node* node);
76};
77
78
79#endif
trunk/src/osd/modules/debugger/qt/debugqtlogwindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtlogwindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvdisasm.h"
8
9
10LogWindow::LogWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL)
12{
13   setWindowTitle("Debug: Machine Log");
14
15   if (parent != NULL)
16   {
17      QPoint parentPos = parent->pos();
18      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
19   }
20
21   //
22   // The main frame and its input and log widgets
23   //
24   QFrame* mainWindowFrame = new QFrame(this);
25
26   // The main log view
27   m_logView = new DebuggerView(DVT_LOG,
28                           m_machine,
29                           this);
30
31   // Layout
32   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
33   vLayout->setSpacing(3);
34   vLayout->setContentsMargins(2,2,2,2);
35   vLayout->addWidget(m_logView);
36
37   setCentralWidget(mainWindowFrame);
38}
39
40
41LogWindow::~LogWindow()
42{
43}
44
45
46//=========================================================================
47//  LogWindowQtConfig
48//=========================================================================
49void LogWindowQtConfig::buildFromQWidget(QWidget* widget)
50{
51   WindowQtConfig::buildFromQWidget(widget);
52}
53
54
55void LogWindowQtConfig::applyToQWidget(QWidget* widget)
56{
57   WindowQtConfig::applyToQWidget(widget);
58}
59
60
61void LogWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
62{
63   WindowQtConfig::addToXmlDataNode(node);
64}
65
66
67void LogWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
68{
69   WindowQtConfig::recoverFromXmlNode(node);
70}
trunk/src/osd/modules/debugger/qt/debugqtlogwindow.h
r243594r243595
1#ifndef __DEBUG_QT_LOG_WINDOW_H__
2#define __DEBUG_QT_LOG_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debugqtview.h"
7#include "debugqtwindow.h"
8
9
10//============================================================
11//  The Log Window.
12//============================================================
13class LogWindow : public WindowQt
14{
15   Q_OBJECT
16
17public:
18   LogWindow(running_machine* machine, QWidget* parent=NULL);
19   virtual ~LogWindow();
20
21
22private:
23   // Widgets
24   DebuggerView* m_logView;
25};
26
27
28//=========================================================================
29//  A way to store the configuration of a window long enough to read/write.
30//=========================================================================
31class LogWindowQtConfig : public WindowQtConfig
32{
33public:
34   LogWindowQtConfig() :
35      WindowQtConfig(WIN_TYPE_LOG)
36   {
37   }
38
39   ~LogWindowQtConfig() {}
40
41   void buildFromQWidget(QWidget* widget);
42   void applyToQWidget(QWidget* widget);
43   void addToXmlDataNode(xml_data_node* node) const;
44   void recoverFromXmlNode(xml_data_node* node);
45};
46
47
48#endif
trunk/src/osd/modules/debugger/qt/debugqtmainwindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtmainwindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvdisasm.h"
8
9
10MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL),
12   m_historyIndex(0),
13   m_inputHistory()
14{
15   setGeometry(300, 300, 1000, 600);
16
17   //
18   // The main frame and its input and log widgets
19   //
20   QFrame* mainWindowFrame = new QFrame(this);
21
22   // The input line
23   m_inputEdit = new QLineEdit(mainWindowFrame);
24   connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(executeCommand()));
25   m_inputEdit->installEventFilter(this);
26
27
28   // The log view
29   m_consoleView = new DebuggerView(DVT_CONSOLE,
30                              m_machine,
31                              mainWindowFrame);
32   m_consoleView->setFocusPolicy(Qt::NoFocus);
33   m_consoleView->setPreferBottom(true);
34
35   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
36   vLayout->addWidget(m_consoleView);
37   vLayout->addWidget(m_inputEdit);
38   vLayout->setSpacing(3);
39   vLayout->setContentsMargins(4,0,4,2);
40
41   setCentralWidget(mainWindowFrame);
42
43   //
44   // Options Menu
45   //
46   // Create two commands
47   QAction* breakpointSetAct = new QAction("Toggle Breakpoint At Cursor", this);
48   QAction* runToCursorAct = new QAction("Run To Cursor", this);
49   breakpointSetAct->setShortcut(Qt::Key_F9);
50   runToCursorAct->setShortcut(Qt::Key_F4);
51   connect(breakpointSetAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
52   connect(runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool)));
53
54   // Right bar options
55   QActionGroup* rightBarGroup = new QActionGroup(this);
56   rightBarGroup->setObjectName("rightbargroup");
57   QAction* rightActRaw = new QAction("Raw Opcodes", this);
58   QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
59   QAction* rightActComments = new QAction("Comments", this);
60   rightActRaw->setCheckable(true);
61   rightActEncrypted->setCheckable(true);
62   rightActComments->setCheckable(true);
63   rightActRaw->setActionGroup(rightBarGroup);
64   rightActEncrypted->setActionGroup(rightBarGroup);
65   rightActComments->setActionGroup(rightBarGroup);
66   rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
67   rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
68   rightActComments->setShortcut(QKeySequence("Ctrl+C"));
69   rightActRaw->setChecked(true);
70   connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*)));
71
72   // Assemble the options menu
73   QMenu* optionsMenu = menuBar()->addMenu("&Options");
74   optionsMenu->addAction(breakpointSetAct);
75   optionsMenu->addAction(runToCursorAct);
76   optionsMenu->addSeparator();
77   optionsMenu->addActions(rightBarGroup->actions());
78
79   //
80   // Images menu
81   //
82   image_interface_iterator imageIterTest(m_machine->root_device());
83   if (imageIterTest.first() != NULL)
84   {
85      createImagesMenu();
86   }
87
88   //
89   // Dock window menu
90   //
91   QMenu* dockMenu = menuBar()->addMenu("Doc&ks");
92
93   setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
94   setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
95
96   // The processor dock
97   QDockWidget* cpuDock = new QDockWidget("processor", this);
98   cpuDock->setObjectName("cpudock");
99   cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea);
100   m_procFrame = new ProcessorDockWidget(m_machine, cpuDock);
101   cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame));
102
103   addDockWidget(Qt::LeftDockWidgetArea, cpuDock);
104   dockMenu->addAction(cpuDock->toggleViewAction());
105
106   // The disassembly dock
107   QDockWidget* dasmDock = new QDockWidget("dasm", this);
108   dasmDock->setObjectName("dasmdock");
109   dasmDock->setAllowedAreas(Qt::TopDockWidgetArea);
110   m_dasmFrame = new DasmDockWidget(m_machine, dasmDock);
111   dasmDock->setWidget(m_dasmFrame);
112
113   addDockWidget(Qt::TopDockWidgetArea, dasmDock);
114   dockMenu->addAction(dasmDock->toggleViewAction());
115}
116
117
118MainWindow::~MainWindow()
119{
120}
121
122
123void MainWindow::setProcessor(device_t* processor)
124{
125   // Cpu swap
126   m_procFrame->view()->view()->set_source(*m_procFrame->view()->view()->source_for_device(processor));
127   m_dasmFrame->view()->view()->set_source(*m_dasmFrame->view()->view()->source_for_device(processor));
128
129   // Scrollbar refresh - seems I should be able to do in the DebuggerView
130   m_dasmFrame->view()->verticalScrollBar()->setValue(m_dasmFrame->view()->view()->visible_position().y);
131   m_dasmFrame->view()->verticalScrollBar()->setValue(m_dasmFrame->view()->view()->visible_position().y);
132
133   // Window title
134   astring title;
135   title.printf("Debug: %s - %s '%s'", m_machine->system().name, processor->name(), processor->tag());
136   setWindowTitle(title.cstr());
137}
138
139
140// Used to intercept the user clicking 'X' in the upper corner
141void MainWindow::closeEvent(QCloseEvent* event)
142{
143   debugActQuit();
144
145   // Insure the window doesn't disappear before we get a chance to save its parameters
146   event->ignore();
147}
148
149
150// Used to intercept the user hitting the up arrow in the input widget
151bool MainWindow::eventFilter(QObject* obj, QEvent* event)
152{
153   // Only filter keypresses
154   QKeyEvent* keyEvent = NULL;
155   if (event->type() == QEvent::KeyPress)
156   {
157      keyEvent = static_cast<QKeyEvent*>(event);
158   }
159   else
160   {
161      return QObject::eventFilter(obj, event);
162   }
163
164   // Catch up & down keys
165   if (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)
166   {
167      if (keyEvent->key() == Qt::Key_Up)
168      {
169         if (m_historyIndex > 0)
170            m_historyIndex--;
171      }
172      else if (keyEvent->key() == Qt::Key_Down)
173      {
174         if (m_historyIndex < m_inputHistory.size())
175            m_historyIndex++;
176      }
177
178      // Populate the input edit or clear it if you're at the end
179      if (m_historyIndex == m_inputHistory.size())
180      {
181         m_inputEdit->setText("");
182      }
183      else
184      {
185         m_inputEdit->setText(m_inputHistory[m_historyIndex]);
186      }
187   }
188   else if (keyEvent->key() == Qt::Key_Enter)
189   {
190      executeCommand(false);
191   }
192   else
193   {
194      return QObject::eventFilter(obj, event);
195   }
196
197   return true;
198}
199
200
201void MainWindow::toggleBreakpointAtCursor(bool changedTo)
202{
203   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
204   if (dasmView->cursor_visible())
205   {
206      if (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())
207      {
208         offs_t address = downcast<debug_view_disasm *>(dasmView)->selected_address();
209         device_debug *cpuinfo = dasmView->source()->device()->debug();
210
211         // Find an existing breakpoint at this address
212         INT32 bpindex = -1;
213         for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
214               bp != NULL;
215               bp = bp->next())
216         {
217            if (address == bp->address())
218            {
219               bpindex = bp->index();
220               break;
221            }
222         }
223
224         // If none exists, add a new one
225         astring command;
226         if (bpindex == -1)
227         {
228            command.printf("bpset 0x%X", address);
229         }
230         else
231         {
232            command.printf("bpclear 0x%X", bpindex);
233         }
234         debug_console_execute_command(*m_machine, command, 1);
235      }
236   }
237
238   refreshAll();
239}
240
241
242void MainWindow::runToCursor(bool changedTo)
243{
244   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
245   if (dasmView->cursor_visible())
246   {
247      if (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())
248      {
249         offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address();
250         astring command;
251         command.printf("go 0x%X", address);
252         debug_console_execute_command(*m_machine, command, 1);
253      }
254   }
255}
256
257
258void MainWindow::rightBarChanged(QAction* changedTo)
259{
260   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
261   if (changedTo->text() == "Raw Opcodes")
262   {
263      dasmView->set_right_column(DASM_RIGHTCOL_RAW);
264   }
265   else if (changedTo->text() == "Encrypted Opcodes")
266   {
267      dasmView->set_right_column(DASM_RIGHTCOL_ENCRYPTED);
268   }
269   else if (changedTo->text() == "Comments")
270   {
271      dasmView->set_right_column(DASM_RIGHTCOL_COMMENTS);
272   }
273   m_dasmFrame->view()->viewport()->update();
274}
275
276
277void MainWindow::executeCommand(bool withClear)
278{
279   QString command = m_inputEdit->text();
280
281   // A blank command is a "silent step"
282   if (command == "")
283   {
284      debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
285      return;
286   }
287
288   // Send along the command
289   debug_console_execute_command(*m_machine,
290                           command.toLocal8Bit().data(),
291                           true);
292
293   // Add history & set the index to be the top of the stack
294   addToHistory(command);
295
296   // Clear out the text and reset the history pointer only if asked
297   if (withClear)
298   {
299      m_inputEdit->clear();
300      m_historyIndex = m_inputHistory.size();
301   }
302
303   // Refresh
304   m_consoleView->viewport()->update();
305   refreshAll();
306}
307
308
309void MainWindow::mountImage(bool changedTo)
310{
311   // The image interface index was assigned to the QAction's data memeber
312   const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt();
313   image_interface_iterator iter(m_machine->root_device());
314   device_image_interface *img = iter.byindex(imageIndex);
315   if (img == NULL)
316   {
317      debug_console_printf(*m_machine, "Something is wrong with the mount menu.\n");
318      refreshAll();
319      return;
320   }
321
322   // File dialog
323   QString filename = QFileDialog::getOpenFileName(this,
324                                       "Select an image file",
325                                       QDir::currentPath(),
326                                       tr("All files (*.*)"));
327
328   if (img->load(filename.toUtf8().data()) != IMAGE_INIT_PASS)
329   {
330      debug_console_printf(*m_machine, "Image could not be mounted.\n");
331      refreshAll();
332      return;
333   }
334
335   // Activate the unmount menu option
336   QAction* unmountAct = sender()->parent()->findChild<QAction*>("unmount");
337   unmountAct->setEnabled(true);
338
339   // Set the mount name
340   QMenu* parentMenuItem = dynamic_cast<QMenu*>(sender()->parent());
341   QString baseString = parentMenuItem->title();
342   baseString.truncate(baseString.lastIndexOf(QString(" : ")));
343   const QString newTitle = baseString + QString(" : ") + QString(img->filename());
344   parentMenuItem->setTitle(newTitle);
345
346   debug_console_printf(*m_machine, "Image %s mounted successfully.\n", filename.toUtf8().data());
347   refreshAll();
348}
349
350
351void MainWindow::unmountImage(bool changedTo)
352{
353   // The image interface index was assigned to the QAction's data memeber
354   const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt();
355   image_interface_iterator iter(m_machine->root_device());
356   device_image_interface *img = iter.byindex(imageIndex);
357
358   img->unload();
359
360   // Deactivate the unmount menu option
361   dynamic_cast<QAction*>(sender())->setEnabled(false);
362
363   // Set the mount name
364   QMenu* parentMenuItem = dynamic_cast<QMenu*>(sender()->parent());
365   QString baseString = parentMenuItem->title();
366   baseString.truncate(baseString.lastIndexOf(QString(" : ")));
367   const QString newTitle = baseString + QString(" : ") + QString("[empty slot]");
368   parentMenuItem->setTitle(newTitle);
369
370   debug_console_printf(*m_machine, "Image successfully unmounted.\n");
371   refreshAll();
372}
373
374
375void MainWindow::debugActClose()
376{
377   m_machine->schedule_exit();
378}
379
380
381void MainWindow::addToHistory(const QString& command)
382{
383   if (command == "")
384      return;
385
386   // Always push back when there is no previous history
387   if (m_inputHistory.size() == 0)
388   {
389      m_inputHistory.push_back(m_inputEdit->text());
390      return;
391   }
392
393   // If there is previous history, make sure it's not what you just executed
394   if (m_inputHistory.back() != m_inputEdit->text())
395   {
396      m_inputHistory.push_back(m_inputEdit->text());
397   }
398}
399
400
401void MainWindow::createImagesMenu()
402{
403   QMenu* imagesMenu = menuBar()->addMenu("&Images");
404
405   int interfaceIndex = 0;
406   image_interface_iterator iter(m_machine->root_device());
407   for (device_image_interface *img = iter.first(); img != NULL; img = iter.next())
408   {
409      astring menuName;
410      menuName.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]");
411
412      QMenu* interfaceMenu = imagesMenu->addMenu(menuName.cstr());
413      interfaceMenu->setObjectName(img->device().name());
414
415      QAction* mountAct = new QAction("Mount...", interfaceMenu);
416      QAction* unmountAct = new QAction("Unmount", interfaceMenu);
417      mountAct->setObjectName("mount");
418      mountAct->setData(QVariant(interfaceIndex));
419      unmountAct->setObjectName("unmount");
420      unmountAct->setData(QVariant(interfaceIndex));
421      connect(mountAct, SIGNAL(triggered(bool)), this, SLOT(mountImage(bool)));
422      connect(unmountAct, SIGNAL(triggered(bool)), this, SLOT(unmountImage(bool)));
423
424      if (!img->exists())
425         unmountAct->setEnabled(false);
426
427      interfaceMenu->addAction(mountAct);
428      interfaceMenu->addAction(unmountAct);
429
430      // TODO: Cassette operations
431
432      interfaceIndex++;
433   }
434}
435
436
437//=========================================================================
438//  MainWindowQtConfig
439//=========================================================================
440void MainWindowQtConfig::buildFromQWidget(QWidget* widget)
441{
442   WindowQtConfig::buildFromQWidget(widget);
443   MainWindow* window = dynamic_cast<MainWindow*>(widget);
444   m_windowState = window->saveState();
445
446   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
447   if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
448      m_rightBar = 0;
449   else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
450      m_rightBar = 1;
451   else if (rightBarGroup->checkedAction()->text() == "Comments")
452      m_rightBar = 2;
453}
454
455
456void MainWindowQtConfig::applyToQWidget(QWidget* widget)
457{
458   WindowQtConfig::applyToQWidget(widget);
459   MainWindow* window = dynamic_cast<MainWindow*>(widget);
460   window->restoreState(m_windowState);
461
462   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
463   rightBarGroup->actions()[m_rightBar]->trigger();
464}
465
466
467void MainWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
468{
469   WindowQtConfig::addToXmlDataNode(node);
470   xml_set_attribute_int(node, "rightbar", m_rightBar);
471   xml_set_attribute(node, "qtwindowstate", m_windowState.toPercentEncoding().data());
472}
473
474
475void MainWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
476{
477   WindowQtConfig::recoverFromXmlNode(node);
478   const char* state = xml_get_attribute_string(node, "qtwindowstate", "");
479   m_windowState = QByteArray::fromPercentEncoding(state);
480   m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
481}
482
483DasmDockWidget::~DasmDockWidget()
484{
485}
486
487ProcessorDockWidget::~ProcessorDockWidget()
488{
489}
trunk/src/osd/modules/debugger/qt/debugqtmainwindow.h
r243594r243595
1#ifndef __DEBUG_QT_MAIN_WINDOW_H__
2#define __DEBUG_QT_MAIN_WINDOW_H__
3
4#include <QtGui/QtGui>
5#include <vector>
6
7#include "debug/dvdisasm.h"
8
9#include "debugqtview.h"
10#include "debugqtwindow.h"
11
12class DasmDockWidget;
13class ProcessorDockWidget;
14
15
16//============================================================
17//  The Main Window.  Contains processor and dasm docks.
18//============================================================
19class MainWindow : public WindowQt
20{
21   Q_OBJECT
22
23public:
24   MainWindow(running_machine* machine, QWidget* parent=NULL);
25   virtual ~MainWindow();
26
27   void setProcessor(device_t* processor);
28
29
30protected:
31   // Used to intercept the user clicking 'X' in the upper corner
32   void closeEvent(QCloseEvent* event);
33
34   // Used to intercept the user hitting the up arrow in the input widget
35   bool eventFilter(QObject* obj, QEvent* event);
36
37
38private slots:
39   void toggleBreakpointAtCursor(bool changedTo);
40   void runToCursor(bool changedTo);
41   void rightBarChanged(QAction* changedTo);
42
43   void executeCommand(bool withClear=true);
44
45   void mountImage(bool changedTo);
46   void unmountImage(bool changedTo);
47
48   // Closing the main window actually exits the program
49   void debugActClose();
50
51
52private:
53   // Widgets and docks
54   QLineEdit* m_inputEdit;
55   DebuggerView* m_consoleView;
56   ProcessorDockWidget* m_procFrame;
57   DasmDockWidget* m_dasmFrame;
58
59   // Terminal history
60   int m_historyIndex;
61   std::vector<QString> m_inputHistory;
62   void addToHistory(const QString& command);
63
64   void createImagesMenu();
65};
66
67
68//============================================================
69//  Docks with the Main Window.  Disassembly.
70//============================================================
71class DasmDockWidget : public QWidget
72{
73   Q_OBJECT
74
75public:
76   DasmDockWidget(running_machine* machine, QWidget* parent=NULL) :
77      QWidget(parent),
78      m_machine(machine)
79   {
80      m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
81                              m_machine,
82                              this);
83
84      // Force a recompute of the disassembly region
85      downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
86
87      QVBoxLayout* dvLayout = new QVBoxLayout(this);
88      dvLayout->addWidget(m_dasmView);
89      dvLayout->setContentsMargins(4,0,4,0);
90   }
91
92
93   virtual ~DasmDockWidget();
94
95
96   DebuggerView* view() { return m_dasmView; }
97
98
99   QSize minimumSizeHint() const
100   {
101      return QSize(150,150);
102   }
103
104
105   QSize sizeHint() const
106   {
107      return QSize(150,200);
108   }
109
110
111private:
112   DebuggerView* m_dasmView;
113
114   running_machine* m_machine;
115};
116
117
118//============================================================
119//  Docks with the Main Window.  Processor information.
120//============================================================
121class ProcessorDockWidget : public QWidget
122{
123   Q_OBJECT
124
125public:
126   ProcessorDockWidget(running_machine* machine,
127                  QWidget* parent=NULL) :
128      QWidget(parent),
129      m_processorView(NULL),
130      m_machine(machine)
131   {
132      m_processorView = new DebuggerView(DVT_STATE,
133                                 m_machine,
134                                 this);
135      m_processorView->setFocusPolicy(Qt::NoFocus);
136
137      QVBoxLayout* cvLayout = new QVBoxLayout(this);
138      cvLayout->addWidget(m_processorView);
139      cvLayout->setContentsMargins(4,0,4,2);
140   }
141
142
143   virtual ~ProcessorDockWidget();
144
145
146   DebuggerView* view() { return m_processorView; }
147
148
149   QSize minimumSizeHint() const
150   {
151      return QSize(150,300);
152   }
153
154
155   QSize sizeHint() const
156   {
157      return QSize(200,300);
158   }
159
160
161private:
162   DebuggerView* m_processorView;
163
164   running_machine* m_machine;
165};
166
167
168//=========================================================================
169//  A way to store the configuration of a window long enough to read/write.
170//=========================================================================
171class MainWindowQtConfig : public WindowQtConfig
172{
173public:
174   MainWindowQtConfig() :
175      WindowQtConfig(WIN_TYPE_MAIN),
176      m_rightBar(0),
177      m_windowState()
178   {}
179
180   ~MainWindowQtConfig() {}
181
182   // Settings
183   int m_rightBar;
184   QByteArray m_windowState;
185
186   void buildFromQWidget(QWidget* widget);
187   void applyToQWidget(QWidget* widget);
188   void addToXmlDataNode(xml_data_node* node) const;
189   void recoverFromXmlNode(xml_data_node* node);
190};
191
192
193
194#endif
trunk/src/osd/modules/debugger/qt/debugqtmemorywindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtmemorywindow.h"
4
5#include "debug/dvmemory.h"
6#include "debug/debugcon.h"
7#include "debug/debugcpu.h"
8
9
10MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL)
12{
13   setWindowTitle("Debug: Memory View");
14
15   if (parent != NULL)
16   {
17      QPoint parentPos = parent->pos();
18      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
19   }
20
21   //
22   // The main frame and its input and log widgets
23   //
24   QFrame* mainWindowFrame = new QFrame(this);
25
26   // The top frame & groupbox that contains the input widgets
27   QFrame* topSubFrame = new QFrame(mainWindowFrame);
28
29   // The input edit
30   m_inputEdit = new QLineEdit(topSubFrame);
31   connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));
32
33   // The memory space combo box
34   m_memoryComboBox = new QComboBox(topSubFrame);
35   m_memoryComboBox->setObjectName("memoryregion");
36   m_memoryComboBox->setMinimumWidth(300);
37   connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int)));
38
39   // The main memory window
40   m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this);
41
42   // Layout
43   QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
44   subLayout->addWidget(m_inputEdit);
45   subLayout->addWidget(m_memoryComboBox);
46   subLayout->setSpacing(3);
47   subLayout->setContentsMargins(2,2,2,2);
48
49   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
50   vLayout->setSpacing(3);
51   vLayout->setContentsMargins(2,2,2,2);
52   vLayout->addWidget(topSubFrame);
53   vLayout->addWidget(m_memTable);
54
55   setCentralWidget(mainWindowFrame);
56
57   //
58   // Menu bars
59   //
60   // Create a byte-chunk group
61   QActionGroup* chunkGroup = new QActionGroup(this);
62   chunkGroup->setObjectName("chunkgroup");
63   QAction* chunkActOne  = new QAction("1-byte chunks", this);
64   chunkActOne->setObjectName("chunkActOne");
65   QAction* chunkActTwo  = new QAction("2-byte chunks", this);
66   chunkActTwo->setObjectName("chunkActTwo");
67   QAction* chunkActFour = new QAction("4-byte chunks", this);
68   chunkActFour->setObjectName("chunkActFour");
69   chunkActOne->setCheckable(true);
70   chunkActTwo->setCheckable(true);
71   chunkActFour->setCheckable(true);
72   chunkActOne->setActionGroup(chunkGroup);
73   chunkActTwo->setActionGroup(chunkGroup);
74   chunkActFour->setActionGroup(chunkGroup);
75   chunkActOne->setShortcut(QKeySequence("Ctrl+1"));
76   chunkActTwo->setShortcut(QKeySequence("Ctrl+2"));
77   chunkActFour->setShortcut(QKeySequence("Ctrl+4"));
78   chunkActOne->setChecked(true);
79   connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*)));
80
81   // Create a address display group
82   QActionGroup* addressGroup = new QActionGroup(this);
83   addressGroup->setObjectName("addressgroup");
84   QAction* addressActLogical = new QAction("Logical Addresses", this);
85   QAction* addressActPhysical = new QAction("Physical Addresses", this);
86   addressActLogical->setCheckable(true);
87   addressActPhysical->setCheckable(true);
88   addressActLogical->setActionGroup(addressGroup);
89   addressActPhysical->setActionGroup(addressGroup);
90   addressActLogical->setShortcut(QKeySequence("Ctrl+G"));
91   addressActPhysical->setShortcut(QKeySequence("Ctrl+Y"));
92   addressActLogical->setChecked(true);
93   connect(addressGroup, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*)));
94
95   // Create a reverse view radio
96   QAction* reverseAct = new QAction("Reverse View", this);
97   reverseAct->setObjectName("reverse");
98   reverseAct->setCheckable(true);
99   reverseAct->setShortcut(QKeySequence("Ctrl+R"));
100   connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool)));
101
102   // Create increase and decrease bytes-per-line actions
103   QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this);
104   QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this);
105   increaseBplAct->setShortcut(QKeySequence("Ctrl+P"));
106   decreaseBplAct->setShortcut(QKeySequence("Ctrl+O"));
107   connect(increaseBplAct, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool)));
108   connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool)));
109
110   // Assemble the options menu
111   QMenu* optionsMenu = menuBar()->addMenu("&Options");
112   optionsMenu->addActions(chunkGroup->actions());
113   optionsMenu->addSeparator();
114   optionsMenu->addActions(addressGroup->actions());
115   optionsMenu->addSeparator();
116   optionsMenu->addAction(reverseAct);
117   optionsMenu->addSeparator();
118   optionsMenu->addAction(increaseBplAct);
119   optionsMenu->addAction(decreaseBplAct);
120
121
122   //
123   // Initialize
124   //
125   populateComboBox();
126
127   // Set to the current CPU's memory view
128   setToCurrentCpu();
129}
130
131
132MemoryWindow::~MemoryWindow()
133{
134}
135
136
137void MemoryWindow::memoryRegionChanged(int index)
138{
139   m_memTable->view()->set_source(*m_memTable->view()->source_list().find(index));
140   m_memTable->viewport()->update();
141
142   // Update the chunk size radio buttons to the memory region's default
143   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
144   switch(memView->bytes_per_chunk())
145   {
146      case 1: chunkSizeMenuItem("chunkActOne")->setChecked(true); break;
147      case 2: chunkSizeMenuItem("chunkActTwo")->setChecked(true); break;
148      case 4: chunkSizeMenuItem("chunkActFour")->setChecked(true); break;
149      default: break;
150   }
151}
152
153
154void MemoryWindow::expressionSubmitted()
155{
156   const QString expression = m_inputEdit->text();
157   downcast<debug_view_memory*>(m_memTable->view())->set_expression(expression.toLocal8Bit().data());
158
159   // Make the cursor pop
160   m_memTable->view()->set_cursor_visible(true);
161
162   // Check where the cursor is and adjust the scroll accordingly
163   debug_view_xy cursorPosition = m_memTable->view()->cursor_position();
164   // TODO: check if the region is already visible?
165   m_memTable->verticalScrollBar()->setValue(cursorPosition.y);
166
167   m_memTable->update();
168   m_memTable->viewport()->update();
169}
170
171
172void MemoryWindow::chunkChanged(QAction* changedTo)
173{
174   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
175   if (changedTo->text() == "1-byte chunks")
176   {
177      memView->set_bytes_per_chunk(1);
178   }
179   else if (changedTo->text() == "2-byte chunks")
180   {
181      memView->set_bytes_per_chunk(2);
182   }
183   else if (changedTo->text() == "4-byte chunks")
184   {
185      memView->set_bytes_per_chunk(4);
186   }
187   m_memTable->viewport()->update();
188}
189
190
191void MemoryWindow::addressChanged(QAction* changedTo)
192{
193   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
194   if (changedTo->text() == "Logical Addresses")
195   {
196      memView->set_physical(false);
197   }
198   else if (changedTo->text() == "Physical Addresses")
199   {
200      memView->set_physical(true);
201   }
202   m_memTable->viewport()->update();
203}
204
205
206void MemoryWindow::reverseChanged(bool changedTo)
207{
208   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
209   memView->set_reverse(changedTo);
210   m_memTable->viewport()->update();
211}
212
213
214void MemoryWindow::increaseBytesPerLine(bool changedTo)
215{
216   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
217   memView->set_chunks_per_row(memView->chunks_per_row() + 1);
218   m_memTable->viewport()->update();
219}
220
221
222void MemoryWindow::decreaseBytesPerLine(bool checked)
223{
224   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
225   memView->set_chunks_per_row(memView->chunks_per_row() - 1);
226   m_memTable->viewport()->update();
227}
228
229
230void MemoryWindow::populateComboBox()
231{
232   if (m_memTable == NULL)
233      return;
234
235   m_memoryComboBox->clear();
236   for (const debug_view_source* source = m_memTable->view()->first_source();
237         source != NULL;
238         source = source->next())
239   {
240      m_memoryComboBox->addItem(source->name());
241   }
242}
243
244
245void MemoryWindow::setToCurrentCpu()
246{
247   device_t* curCpu = debug_cpu_get_visible_cpu(*m_machine);
248   const debug_view_source *source = m_memTable->view()->source_for_device(curCpu);
249   const int listIndex = m_memTable->view()->source_list().indexof(*source);
250   m_memoryComboBox->setCurrentIndex(listIndex);
251}
252
253
254// I have a hard time storing QActions as class members.  This is a substitute.
255QAction* MemoryWindow::chunkSizeMenuItem(const QString& itemName)
256{
257   QList<QMenu*> menus = menuBar()->findChildren<QMenu*>();
258   for (int i = 0; i < menus.length(); i++)
259   {
260      if (menus[i]->title() != "&Options") continue;
261      QList<QAction*> actions = menus[i]->actions();
262      for (int j = 0; j < actions.length(); j++)
263      {
264         if (actions[j]->objectName() == itemName)
265            return actions[j];
266      }
267   }
268   return NULL;
269}
270
271
272//=========================================================================
273//  DebuggerMemView
274//=========================================================================
275void DebuggerMemView::mousePressEvent(QMouseEvent* event)
276{
277   const bool leftClick = event->button() == Qt::LeftButton;
278   const bool rightClick = event->button() == Qt::RightButton;
279
280   if (leftClick || rightClick)
281   {
282      QFontMetrics actualFont = fontMetrics();
283      const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
284      const int fontHeight = MAX(1, actualFont.height());
285
286      debug_view_xy topLeft = view()->visible_position();
287      debug_view_xy clickViewPosition;
288      clickViewPosition.x = topLeft.x + (event->x() / fontWidth);
289      clickViewPosition.y = topLeft.y + (event->y() / fontHeight);
290      if (leftClick)
291      {
292         view()->process_click(DCK_LEFT_CLICK, clickViewPosition);
293      }
294      else if (rightClick)
295      {
296         // Display the last known PC to write to this memory location & copy it onto the clipboard
297         debug_view_memory* memView = downcast<debug_view_memory*>(view());
298         const offs_t address = memView->addressAtCursorPosition(clickViewPosition);
299         const debug_view_memory_source* source = downcast<const debug_view_memory_source*>(memView->source());
300         address_space* addressSpace = source->space();
301         const int nativeDataWidth = addressSpace->data_width() / 8;
302         const UINT64 memValue = debug_read_memory(*addressSpace,
303                                          addressSpace->address_to_byte(address),
304                                          nativeDataWidth,
305                                          true);
306         const offs_t pc = source->device()->debug()->track_mem_pc_from_space_address_data(addressSpace->spacenum(),
307                                                                        address,
308                                                                        memValue);
309         if (pc != (offs_t)(-1))
310         {
311            // TODO: You can specify a box that the tooltip stays alive within - might be good?
312            const QString addressAndPc = QString("Address %1 written at PC=%2").arg(address, 2, 16).arg(pc, 2, 16);
313            QToolTip::showText(QCursor::pos(), addressAndPc, NULL);
314
315            // Copy the PC into the clipboard as well
316            QClipboard *clipboard = QApplication::clipboard();
317            clipboard->setText(QString("%1").arg(pc, 2, 16));
318         }
319         else
320         {
321            QToolTip::showText(QCursor::pos(), "UNKNOWN PC", NULL);
322         }
323      }
324
325      viewport()->update();
326      update();
327   }
328}
329
330
331//=========================================================================
332//  MemoryWindowQtConfig
333//=========================================================================
334void MemoryWindowQtConfig::buildFromQWidget(QWidget* widget)
335{
336   WindowQtConfig::buildFromQWidget(widget);
337   MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget);
338   QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion");
339   m_memoryRegion = memoryRegion->currentIndex();
340
341   QAction* reverse = window->findChild<QAction*>("reverse");
342   m_reverse = reverse->isChecked();
343
344   QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup");
345   if (addressGroup->checkedAction()->text() == "Logical Addresses")
346      m_addressMode = 0;
347   else if (addressGroup->checkedAction()->text() == "Physical Addresses")
348      m_addressMode = 1;
349
350   QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup");
351   if (chunkGroup->checkedAction()->text() == "1-byte chunks")
352      m_chunkSize = 0;
353   else if (chunkGroup->checkedAction()->text() == "2-byte chunks")
354      m_chunkSize = 1;
355   else if (chunkGroup->checkedAction()->text() == "4-byte chunks")
356      m_chunkSize = 2;
357}
358
359
360void MemoryWindowQtConfig::applyToQWidget(QWidget* widget)
361{
362   WindowQtConfig::applyToQWidget(widget);
363   MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget);
364   QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion");
365   memoryRegion->setCurrentIndex(m_memoryRegion);
366
367   QAction* reverse = window->findChild<QAction*>("reverse");
368   if (m_reverse) reverse->trigger();
369
370   QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup");
371   addressGroup->actions()[m_addressMode]->trigger();
372
373   QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup");
374   chunkGroup->actions()[m_chunkSize]->trigger();
375}
376
377
378void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
379{
380   WindowQtConfig::addToXmlDataNode(node);
381   xml_set_attribute_int(node, "memoryregion", m_memoryRegion);
382   xml_set_attribute_int(node, "reverse", m_reverse);
383   xml_set_attribute_int(node, "addressmode", m_addressMode);
384   xml_set_attribute_int(node, "chunksize", m_chunkSize);
385}
386
387
388void MemoryWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
389{
390   WindowQtConfig::recoverFromXmlNode(node);
391   m_memoryRegion = xml_get_attribute_int(node, "memoryregion", m_memoryRegion);
392   m_reverse = xml_get_attribute_int(node, "reverse", m_reverse);
393   m_addressMode = xml_get_attribute_int(node, "addressmode", m_addressMode);
394   m_chunkSize = xml_get_attribute_int(node, "chunksize", m_chunkSize);
395}
trunk/src/osd/modules/debugger/qt/debugqtmemorywindow.h
r243594r243595
1#ifndef __DEBUG_QT_MEMORY_WINDOW_H__
2#define __DEBUG_QT_MEMORY_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debugqtview.h"
7#include "debugqtwindow.h"
8
9class DebuggerMemView;
10
11
12//============================================================
13//  The Memory Window.
14//============================================================
15class MemoryWindow : public WindowQt
16{
17   Q_OBJECT
18
19public:
20   MemoryWindow(running_machine* machine, QWidget* parent=NULL);
21   virtual ~MemoryWindow();
22
23
24private slots:
25   void memoryRegionChanged(int index);
26   void expressionSubmitted();
27   void chunkChanged(QAction* changedTo);
28   void addressChanged(QAction* changedTo);
29   void reverseChanged(bool changedTo);
30   void increaseBytesPerLine(bool changedTo);
31   void decreaseBytesPerLine(bool checked=false);
32
33
34private:
35   void populateComboBox();
36   void setToCurrentCpu();
37   QAction* chunkSizeMenuItem(const QString& itemName);
38
39
40private:
41   // Widgets
42   QLineEdit* m_inputEdit;
43   QComboBox* m_memoryComboBox;
44   DebuggerMemView* m_memTable;
45};
46
47
48//=========================================================================
49//  The mem window gets its own debugger view to handle right click pop-ups
50//=========================================================================
51class DebuggerMemView : public DebuggerView
52{
53public:
54   DebuggerMemView(const debug_view_type& type,
55               running_machine* machine,
56               QWidget* parent=NULL)
57      : DebuggerView(type, machine, parent)
58   {}
59   virtual ~DebuggerMemView() {}
60
61protected:
62   void mousePressEvent(QMouseEvent* event);
63};
64
65
66//=========================================================================
67//  A way to store the configuration of a window long enough to read/write.
68//=========================================================================
69class MemoryWindowQtConfig : public WindowQtConfig
70{
71public:
72   MemoryWindowQtConfig() :
73      WindowQtConfig(WIN_TYPE_MEMORY),
74      m_reverse(0),
75      m_addressMode(0),
76      m_chunkSize(0),
77      m_memoryRegion(0)
78   {
79   }
80
81   ~MemoryWindowQtConfig() {}
82
83   // Settings
84   int m_reverse;
85   int m_addressMode;
86   int m_chunkSize;
87   int m_memoryRegion;
88
89   void buildFromQWidget(QWidget* widget);
90   void applyToQWidget(QWidget* widget);
91   void addToXmlDataNode(xml_data_node* node) const;
92   void recoverFromXmlNode(xml_data_node* node);
93};
94
95
96#endif
trunk/src/osd/modules/debugger/qt/debugqtview.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtview.h"
4
5DebuggerView::DebuggerView(const debug_view_type& type,
6                     running_machine* machine,
7                     QWidget* parent) :
8   QAbstractScrollArea(parent),
9   m_preferBottom(false),
10   m_view(NULL),
11   m_machine(machine)
12{
13   // I like setting the font per-view since it doesn't override the menuing fonts.
14   QFont viewFontRequest("Courier New");
15   viewFontRequest.setFixedPitch(true);
16   viewFontRequest.setPointSize(11);
17   setFont(viewFontRequest);
18
19   m_view = m_machine->debug_view().alloc_view(type,
20                                    DebuggerView::debuggerViewUpdate,
21                                    this);
22
23   connect(verticalScrollBar(), SIGNAL(valueChanged(int)),
24         this, SLOT(verticalScrollSlot(int)));
25   connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
26         this, SLOT(horizontalScrollSlot(int)));
27}
28
29
30DebuggerView::~DebuggerView()
31{
32   if (m_machine && m_view)
33      m_machine->debug_view().free_view(*m_view);
34}
35
36// TODO: remove this version no later than January 1, 2015
37#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
38void DebuggerView::paintEvent(QPaintEvent* event)
39{
40   // Tell the MAME debug view how much real estate is available
41   QFontMetrics actualFont = fontMetrics();
42   const int fontWidth = MAX(1, actualFont.width('_'));
43   const int fontHeight = MAX(1, actualFont.height());
44   m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight));
45
46
47   // Handle the scroll bars
48   const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x;
49   const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff;
50   horizontalScrollBar()->setRange(0, horizontalScrollSize);
51
52   // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly
53   const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0;
54
55   const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y;
56   const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust;
57   bool atEnd = false;
58   if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
59   {
60      atEnd = true;
61   }
62   verticalScrollBar()->setRange(0, verticalScrollSize);
63   if (m_preferBottom && atEnd)
64   {
65      verticalScrollBar()->setValue(verticalScrollSize);
66   }
67
68
69   // Draw the viewport widget
70   QPainter painter(viewport());
71   painter.fillRect(0, 0, width(), height(), QBrush(Qt::white));
72   painter.setBackgroundMode(Qt::OpaqueMode);
73   painter.setBackground(QColor(255,255,255));
74
75   // Background control
76   QBrush bgBrush;
77   bgBrush.setStyle(Qt::SolidPattern);
78   painter.setPen(QPen(QColor(0,0,0)));
79
80   size_t viewDataOffset = 0;
81   const debug_view_xy& visibleCharDims = m_view->visible_size();
82   for (int y = 0; y < visibleCharDims.y; y++)
83   {
84      for (int x = 0; x < visibleCharDims.x; x++)
85      {
86         const unsigned char textAttr = m_view->viewdata()[viewDataOffset].attrib;
87
88         if (x == 0 || textAttr != m_view->viewdata()[viewDataOffset-1].attrib)
89         {
90            // Text color handling
91            QColor fgColor(0,0,0);
92            QColor bgColor(255,255,255);
93
94            if(textAttr & DCA_VISITED)
95            {
96               bgColor.setRgb(0xc6, 0xe2, 0xff);
97            }
98            if(textAttr & DCA_ANCILLARY)
99            {
100               bgColor.setRgb(0xe0, 0xe0, 0xe0);
101            }
102            if(textAttr & DCA_SELECTED)
103            {
104               bgColor.setRgb(0xff, 0x80, 0x80);
105            }
106            if(textAttr & DCA_CURRENT)
107            {
108               bgColor.setRgb(0xff, 0xff, 0x00);
109            }
110            if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT))
111            {
112               bgColor.setRgb(0xff,0xc0,0x80);
113            }
114            if(textAttr & DCA_CHANGED)
115            {
116               fgColor.setRgb(0xff, 0x00, 0x00);
117            }
118            if(textAttr & DCA_INVALID)
119            {
120               fgColor.setRgb(0x00, 0x00, 0xff);
121            }
122            if(textAttr & DCA_DISABLED)
123            {
124               fgColor.setRgb((fgColor.red()   + bgColor.red())   >> 1,
125                           (fgColor.green() + bgColor.green()) >> 1,
126                           (fgColor.blue()  + bgColor.blue())  >> 1);
127            }
128            if(textAttr & DCA_COMMENT)
129            {
130               fgColor.setRgb(0x00, 0x80, 0x00);
131            }
132
133            bgBrush.setColor(bgColor);
134            painter.setBackground(bgBrush);
135            painter.setPen(QPen(fgColor));
136         }
137
138         // Your character is not guaranteed to take up the entire fontWidth x fontHeight, so fill before.
139         painter.fillRect(x*fontWidth, y*fontHeight, fontWidth, fontHeight, bgBrush);
140
141         // There is a touchy interplay between font height, drawing difference, visible position, etc
142         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
143         painter.drawText(x*fontWidth,
144                        (y*fontHeight + (fontHeight*0.80)),
145                        QString(m_view->viewdata()[viewDataOffset].byte));
146         viewDataOffset++;
147      }
148   }
149}
150#else
151void DebuggerView::paintEvent(QPaintEvent* event)
152{
153   // Tell the MAME debug view how much real estate is available
154   QFontMetrics actualFont = fontMetrics();
155   const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
156   const int fontHeight = MAX(1, actualFont.height());
157   m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight));
158
159
160   // Handle the scroll bars
161   const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x;
162   const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff;
163   horizontalScrollBar()->setRange(0, horizontalScrollSize);
164
165   // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly
166   const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0;
167
168   const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y;
169   const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust;
170   bool atEnd = false;
171   if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
172   {
173      atEnd = true;
174   }
175   verticalScrollBar()->setRange(0, verticalScrollSize);
176   if (m_preferBottom && atEnd)
177   {
178      verticalScrollBar()->setValue(verticalScrollSize);
179   }
180
181
182   // Draw the viewport widget
183   QPainter painter(viewport());
184   painter.fillRect(0, 0, width(), height(), QBrush(Qt::white));
185   painter.setBackgroundMode(Qt::OpaqueMode);
186   painter.setBackground(QColor(255,255,255));
187
188   // Background control
189   QBrush bgBrush;
190   bgBrush.setStyle(Qt::SolidPattern);
191   painter.setPen(QPen(QColor(0,0,0)));
192
193   size_t viewDataOffset = 0;
194   const debug_view_xy& visibleCharDims = m_view->visible_size();
195   const debug_view_char* viewdata = m_view->viewdata();
196   for (int y = 0; y < visibleCharDims.y; y++)
197   {
198      int width = 1;
199      for (int x = 0; x < visibleCharDims.x; viewDataOffset += width, x += width)
200      {
201         const unsigned char textAttr = viewdata[viewDataOffset].attrib;
202
203         // Text color handling
204         QColor fgColor(0,0,0);
205         QColor bgColor(255,255,255);
206
207         if(textAttr & DCA_VISITED)
208         {
209            bgColor.setRgb(0xc6, 0xe2, 0xff);
210         }
211         if(textAttr & DCA_ANCILLARY)
212         {
213            bgColor.setRgb(0xe0, 0xe0, 0xe0);
214         }
215         if(textAttr & DCA_SELECTED)
216         {
217            bgColor.setRgb(0xff, 0x80, 0x80);
218         }
219         if(textAttr & DCA_CURRENT)
220         {
221            bgColor.setRgb(0xff, 0xff, 0x00);
222         }
223         if ((textAttr & DCA_SELECTED) && (textAttr & DCA_CURRENT))
224         {
225            bgColor.setRgb(0xff,0xc0,0x80);
226         }
227         if(textAttr & DCA_CHANGED)
228         {
229            fgColor.setRgb(0xff, 0x00, 0x00);
230         }
231         if(textAttr & DCA_INVALID)
232         {
233            fgColor.setRgb(0x00, 0x00, 0xff);
234         }
235         if(textAttr & DCA_DISABLED)
236         {
237            fgColor.setRgb((fgColor.red()   + bgColor.red())   >> 1,
238                        (fgColor.green() + bgColor.green()) >> 1,
239                        (fgColor.blue()  + bgColor.blue())  >> 1);
240         }
241         if(textAttr & DCA_COMMENT)
242         {
243            fgColor.setRgb(0x00, 0x80, 0x00);
244         }
245
246         bgBrush.setColor(bgColor);
247         painter.setBackground(bgBrush);
248         painter.setPen(QPen(fgColor));
249
250         QString text(QChar(viewdata[viewDataOffset].byte));
251         for (width = 1; x + width < visibleCharDims.x; width++)
252         {
253            if (textAttr != viewdata[viewDataOffset + width].attrib)
254               break;
255            text.append(QChar(viewdata[viewDataOffset + width].byte));
256         }
257
258         // Your characters are not guaranteed to take up the entire length x fontWidth x fontHeight, so fill before.
259         painter.fillRect(x*fontWidth, y*fontHeight, width*fontWidth, fontHeight, bgBrush);
260
261         // There is a touchy interplay between font height, drawing difference, visible position, etc
262         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
263         painter.drawText(x*fontWidth, (y*fontHeight + (fontHeight*0.80)), text);
264      }
265   }
266}
267#endif
268
269void DebuggerView::keyPressEvent(QKeyEvent* event)
270{
271   if (m_view == NULL)
272      return QWidget::keyPressEvent(event);
273
274   Qt::KeyboardModifiers keyMods = QApplication::keyboardModifiers();
275   const bool ctrlDown = keyMods.testFlag(Qt::ControlModifier);
276
277   int keyPress = -1;
278   switch (event->key())
279   {
280      case Qt::Key_Up:
281         keyPress = DCH_UP;
282         break;
283      case Qt::Key_Down:
284         keyPress = DCH_DOWN;
285         break;
286      case Qt::Key_Left:
287         keyPress = DCH_LEFT;
288         if (ctrlDown) keyPress = DCH_CTRLLEFT;
289         break;
290      case Qt::Key_Right:
291         keyPress = DCH_RIGHT;
292         if (ctrlDown) keyPress = DCH_CTRLRIGHT;
293         break;
294      case Qt::Key_PageUp:
295         keyPress = DCH_PUP;
296         break;
297      case Qt::Key_PageDown:
298         keyPress = DCH_PDOWN;
299         break;
300      case Qt::Key_Home:
301         keyPress = DCH_HOME;
302         if (ctrlDown) keyPress = DCH_CTRLHOME;
303         break;
304      case Qt::Key_End:
305         keyPress = DCH_END;
306         if (ctrlDown) keyPress = DCH_CTRLEND;
307         break;
308      case Qt::Key_0: keyPress = '0'; break;
309      case Qt::Key_1: keyPress = '1'; break;
310      case Qt::Key_2: keyPress = '2'; break;
311      case Qt::Key_3: keyPress = '3'; break;
312      case Qt::Key_4: keyPress = '4'; break;
313      case Qt::Key_5: keyPress = '5'; break;
314      case Qt::Key_6: keyPress = '6'; break;
315      case Qt::Key_7: keyPress = '7'; break;
316      case Qt::Key_8: keyPress = '8'; break;
317      case Qt::Key_9: keyPress = '9'; break;
318      case Qt::Key_A: keyPress = 'a'; break;
319      case Qt::Key_B: keyPress = 'b'; break;
320      case Qt::Key_C: keyPress = 'c'; break;
321      case Qt::Key_D: keyPress = 'd'; break;
322      case Qt::Key_E: keyPress = 'e'; break;
323      case Qt::Key_F: keyPress = 'f'; break;
324      default:
325         return QWidget::keyPressEvent(event);
326   }
327
328   m_view->set_cursor_visible(true);
329   m_view->process_char(keyPress);
330
331   // Catch the view up with the cursor
332   verticalScrollBar()->setValue(m_view->visible_position().y);
333
334   viewport()->update();
335   update();
336}
337
338
339void DebuggerView::mousePressEvent(QMouseEvent* event)
340{
341   if (m_view == NULL)
342      return;
343
344   if (event->button() == Qt::LeftButton)
345   {
346      QFontMetrics actualFont = fontMetrics();
347      const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
348      const int fontHeight = MAX(1, actualFont.height());
349
350      debug_view_xy topLeft = m_view->visible_position();
351      debug_view_xy clickViewPosition;
352      clickViewPosition.x = topLeft.x + (event->x() / fontWidth);
353      clickViewPosition.y = topLeft.y + (event->y() / fontHeight);
354      m_view->process_click(DCK_LEFT_CLICK, clickViewPosition);
355
356      viewport()->update();
357      update();
358   }
359}
360
361
362void DebuggerView::verticalScrollSlot(int value)
363{
364   m_view->set_visible_position(debug_view_xy(horizontalScrollBar()->value(), value));
365}
366
367
368void DebuggerView::horizontalScrollSlot(int value)
369{
370   m_view->set_visible_position(debug_view_xy(value, verticalScrollBar()->value()));
371}
372
373
374void DebuggerView::debuggerViewUpdate(debug_view& debugView, void* osdPrivate)
375{
376   // Get a handle to the DebuggerView being updated & redraw
377   DebuggerView* dView = (DebuggerView*)osdPrivate;
378   dView->verticalScrollBar()->setValue(dView->view()->visible_position().y);
379   dView->horizontalScrollBar()->setValue(dView->view()->visible_position().x);
380   dView->viewport()->update();
381   dView->update();
382}
trunk/src/osd/modules/debugger/qt/debugqtview.h
r243594r243595
1#ifndef __DEBUG_QT_VIEW_H__
2#define __DEBUG_QT_VIEW_H__
3
4#include <QtGui/QtGui>
5
6#include "debug/debugvw.h"
7
8
9class DebuggerView : public QAbstractScrollArea
10{
11   Q_OBJECT
12
13public:
14   DebuggerView(const debug_view_type& type,
15               running_machine* machine,
16               QWidget* parent=NULL);
17   virtual ~DebuggerView();
18
19   void paintEvent(QPaintEvent* event);
20
21   // Callback to allow MAME to refresh the view
22   static void debuggerViewUpdate(debug_view& debugView, void* osdPrivate);
23
24   // Setters and accessors
25   void setPreferBottom(bool pb) { m_preferBottom = pb; }
26   debug_view* view() { return m_view; }
27
28
29protected:
30   void keyPressEvent(QKeyEvent* event);
31   void mousePressEvent(QMouseEvent* event);
32
33private slots:
34   void verticalScrollSlot(int value);
35   void horizontalScrollSlot(int value);
36
37
38private:
39   bool m_preferBottom;
40
41   debug_view* m_view;
42   running_machine* m_machine;
43};
44
45
46#endif
trunk/src/osd/modules/debugger/qt/debugqtwindow.c
r243594r243595
1#define NO_MEM_TRACKING
2
3#include "debugqtwindow.h"
4#include "debugqtlogwindow.h"
5#include "debugqtdasmwindow.h"
6#include "debugqtmemorywindow.h"
7#include "debugqtbreakpointswindow.h"
8#include "debugqtdeviceswindow.h"
9
10bool WindowQt::s_refreshAll = false;
11bool WindowQt::s_hideAll = false;
12
13
14// Since all debug windows are intended to be top-level, this inherited
15// constructor is always called with a NULL parent.  The passed-in parent widget,
16// however, is often used to place each child window & the code to do this can
17// be found in most of the inherited classes.
18
19WindowQt::WindowQt(running_machine* machine, QWidget* parent) :
20   QMainWindow(parent),
21   m_machine(machine)
22{
23   setAttribute(Qt::WA_DeleteOnClose, true);
24
25   // The Debug menu bar
26   QAction* debugActOpenMemory = new QAction("New &Memory Window", this);
27   debugActOpenMemory->setShortcut(QKeySequence("Ctrl+M"));
28   connect(debugActOpenMemory, SIGNAL(triggered()), this, SLOT(debugActOpenMemory()));
29
30   QAction* debugActOpenDasm = new QAction("New &Dasm Window", this);
31   debugActOpenDasm->setShortcut(QKeySequence("Ctrl+D"));
32   connect(debugActOpenDasm, SIGNAL(triggered()), this, SLOT(debugActOpenDasm()));
33
34   QAction* debugActOpenLog = new QAction("New &Log Window", this);
35   debugActOpenLog->setShortcut(QKeySequence("Ctrl+L"));
36   connect(debugActOpenLog, SIGNAL(triggered()), this, SLOT(debugActOpenLog()));
37
38   QAction* debugActOpenPoints = new QAction("New &Break|Watchpoints Window", this);
39   debugActOpenPoints->setShortcut(QKeySequence("Ctrl+B"));
40   connect(debugActOpenPoints, SIGNAL(triggered()), this, SLOT(debugActOpenPoints()));
41
42   QAction* debugActOpenDevices = new QAction("New D&evices Window", this);
43   debugActOpenDevices->setShortcut(QKeySequence("Shift+Ctrl+D"));
44   connect(debugActOpenDevices, SIGNAL(triggered()), this, SLOT(debugActOpenDevices()));
45
46   QAction* dbgActRun = new QAction("Run", this);
47   dbgActRun->setShortcut(Qt::Key_F5);
48   connect(dbgActRun, SIGNAL(triggered()), this, SLOT(debugActRun()));
49
50   QAction* dbgActRunAndHide = new QAction("Run And Hide Debugger", this);
51   dbgActRunAndHide->setShortcut(Qt::Key_F12);
52   connect(dbgActRunAndHide, SIGNAL(triggered()), this, SLOT(debugActRunAndHide()));
53
54   QAction* dbgActRunToNextCpu = new QAction("Run to Next CPU", this);
55   dbgActRunToNextCpu->setShortcut(Qt::Key_F6);
56   connect(dbgActRunToNextCpu, SIGNAL(triggered()), this, SLOT(debugActRunToNextCpu()));
57
58   QAction* dbgActRunNextInt = new QAction("Run to Next Interrupt on This CPU", this);
59   dbgActRunNextInt->setShortcut(Qt::Key_F7);
60   connect(dbgActRunNextInt, SIGNAL(triggered()), this, SLOT(debugActRunNextInt()));
61
62   QAction* dbgActRunNextVBlank = new QAction("Run to Next VBlank", this);
63   dbgActRunNextVBlank->setShortcut(Qt::Key_F8);
64   connect(dbgActRunNextVBlank, SIGNAL(triggered()), this, SLOT(debugActRunNextVBlank()));
65
66   QAction* dbgActStepInto = new QAction("Step Into", this);
67   dbgActStepInto->setShortcut(Qt::Key_F11);
68   connect(dbgActStepInto, SIGNAL(triggered()), this, SLOT(debugActStepInto()));
69
70   QAction* dbgActStepOver = new QAction("Step Over", this);
71   dbgActStepOver->setShortcut(Qt::Key_F10);
72   connect(dbgActStepOver, SIGNAL(triggered()), this, SLOT(debugActStepOver()));
73
74   QAction* dbgActStepOut = new QAction("Step Out", this);
75   dbgActStepOut->setShortcut(QKeySequence("Shift+F11"));
76   connect(dbgActStepOut, SIGNAL(triggered()), this, SLOT(debugActStepOut()));
77
78   QAction* dbgActSoftReset = new QAction("Soft Reset", this);
79   dbgActSoftReset->setShortcut(Qt::Key_F3);
80   connect(dbgActSoftReset, SIGNAL(triggered()), this, SLOT(debugActSoftReset()));
81
82   QAction* dbgActHardReset = new QAction("Hard Reset", this);
83   dbgActHardReset->setShortcut(QKeySequence("Shift+F3"));
84   connect(dbgActHardReset, SIGNAL(triggered()), this, SLOT(debugActHardReset()));
85
86   QAction* dbgActClose = new QAction("Close &Window", this);
87   dbgActClose->setShortcut(QKeySequence::Close);
88   connect(dbgActClose, SIGNAL(triggered()), this, SLOT(debugActClose()));
89
90   QAction* dbgActQuit = new QAction("&Quit", this);
91   dbgActQuit->setShortcut(QKeySequence::Quit);
92   connect(dbgActQuit, SIGNAL(triggered()), this, SLOT(debugActQuit()));
93
94   // Construct the menu
95   QMenu* debugMenu = menuBar()->addMenu("&Debug");
96   debugMenu->addAction(debugActOpenMemory);
97   debugMenu->addAction(debugActOpenDasm);
98   debugMenu->addAction(debugActOpenLog);
99   debugMenu->addAction(debugActOpenPoints);
100   debugMenu->addAction(debugActOpenDevices);
101   debugMenu->addSeparator();
102   debugMenu->addAction(dbgActRun);
103   debugMenu->addAction(dbgActRunAndHide);
104   debugMenu->addAction(dbgActRunToNextCpu);
105   debugMenu->addAction(dbgActRunNextInt);
106   debugMenu->addAction(dbgActRunNextVBlank);
107   debugMenu->addSeparator();
108   debugMenu->addAction(dbgActStepInto);
109   debugMenu->addAction(dbgActStepOver);
110   debugMenu->addAction(dbgActStepOut);
111   debugMenu->addSeparator();
112   debugMenu->addAction(dbgActSoftReset);
113   debugMenu->addAction(dbgActHardReset);
114   debugMenu->addSeparator();
115   debugMenu->addAction(dbgActClose);
116   debugMenu->addAction(dbgActQuit);
117}
118
119
120WindowQt::~WindowQt()
121{
122}
123
124void WindowQt::debugActOpenMemory()
125{
126   MemoryWindow* foo = new MemoryWindow(m_machine, this);
127   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
128   // foo->setWindowFlags(Qt::Dialog);
129   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
130   foo->show();
131}
132
133
134void WindowQt::debugActOpenDasm()
135{
136   DasmWindow* foo = new DasmWindow(m_machine, this);
137   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
138   // foo->setWindowFlags(Qt::Dialog);
139   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
140   foo->show();
141}
142
143
144void WindowQt::debugActOpenLog()
145{
146   LogWindow* foo = new LogWindow(m_machine, this);
147   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
148   // foo->setWindowFlags(Qt::Dialog);
149   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
150   foo->show();
151}
152
153
154void WindowQt::debugActOpenPoints()
155{
156   BreakpointsWindow* foo = new BreakpointsWindow(m_machine, this);
157   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
158   // foo->setWindowFlags(Qt::Dialog);
159   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
160   foo->show();
161}
162
163
164void WindowQt::debugActOpenDevices()
165{
166   DevicesWindow* foo = new DevicesWindow(m_machine, this);
167   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
168   // foo->setWindowFlags(Qt::Dialog);
169   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
170   foo->show();
171}
172
173
174void WindowQt::debugActRun()
175{
176   debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
177}
178
179void WindowQt::debugActRunAndHide()
180{
181   debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
182   hideAll();
183}
184
185void WindowQt::debugActRunToNextCpu()
186{
187   debug_cpu_get_visible_cpu(*m_machine)->debug()->go_next_device();
188}
189
190void WindowQt::debugActRunNextInt()
191{
192   debug_cpu_get_visible_cpu(*m_machine)->debug()->go_interrupt();
193}
194
195void WindowQt::debugActRunNextVBlank()
196{
197   debug_cpu_get_visible_cpu(*m_machine)->debug()->go_vblank();
198}
199
200void WindowQt::debugActStepInto()
201{
202   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
203}
204
205void WindowQt::debugActStepOver()
206{
207   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_over();
208}
209
210void WindowQt::debugActStepOut()
211{
212   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_out();
213}
214
215void WindowQt::debugActSoftReset()
216{
217   m_machine->schedule_soft_reset();
218   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
219}
220
221void WindowQt::debugActHardReset()
222{
223   m_machine->schedule_hard_reset();
224}
225
226void WindowQt::debugActClose()
227{
228   close();
229}
230
231void WindowQt::debugActQuit()
232{
233   m_machine->schedule_exit();
234}
235
236
237//=========================================================================
238//  WindowQtConfig
239//=========================================================================
240void WindowQtConfig::buildFromQWidget(QWidget* widget)
241{
242   m_position.setX(widget->geometry().topLeft().x());
243   m_position.setY(widget->geometry().topLeft().y());
244   m_size.setX(widget->size().width());
245   m_size.setY(widget->size().height());
246}
247
248
249void WindowQtConfig::applyToQWidget(QWidget* widget)
250{
251   widget->setGeometry(m_position.x(), m_position.y(), m_size.x(), m_size.y());
252}
253
254
255void WindowQtConfig::addToXmlDataNode(xml_data_node* node) const
256{
257   xml_set_attribute_int(node, "type", m_type);
258   xml_set_attribute_int(node, "position_x", m_position.x());
259   xml_set_attribute_int(node, "position_y", m_position.y());
260   xml_set_attribute_int(node, "size_x", m_size.x());
261   xml_set_attribute_int(node, "size_y", m_size.y());
262}
263
264
265void WindowQtConfig::recoverFromXmlNode(xml_data_node* node)
266{
267   m_size.setX(xml_get_attribute_int(node, "size_x", m_size.x()));
268   m_size.setY(xml_get_attribute_int(node, "size_y", m_size.y()));
269   m_position.setX(xml_get_attribute_int(node, "position_x", m_position.x()));
270   m_position.setY(xml_get_attribute_int(node, "position_y", m_position.y()));
271   m_type = (WindowQtConfig::WindowType)xml_get_attribute_int(node, "type", m_type);
272}
trunk/src/osd/modules/debugger/qt/debugqtwindow.h
r243594r243595
1#ifndef __DEBUG_QT_WINDOW_H__
2#define __DEBUG_QT_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "emu.h"
7#include "config.h"
8#include "debugger.h"
9
10
11//============================================================
12//  The Qt window that everyone derives from.
13//============================================================
14class WindowQt : public QMainWindow
15{
16   Q_OBJECT
17
18public:
19   WindowQt(running_machine* machine, QWidget* parent=NULL);
20   virtual ~WindowQt();
21
22   // The interface to an all-window refresh
23   void refreshAll() { s_refreshAll = true; }
24   bool wantsRefresh() { return s_refreshAll; }
25   void clearRefreshFlag() { s_refreshAll = false; }
26
27   void hideAll() { s_hideAll = true; }
28   bool wantsHide() { return s_hideAll; }
29   void clearHideFlag() { s_hideAll = false; }
30
31
32protected slots:
33   void debugActOpenMemory();
34   void debugActOpenDasm();
35   void debugActOpenLog();
36   void debugActOpenPoints();
37   void debugActOpenDevices();
38   void debugActRun();
39   void debugActRunAndHide();
40   void debugActRunToNextCpu();
41   void debugActRunNextInt();
42   void debugActRunNextVBlank();
43   void debugActStepInto();
44   void debugActStepOver();
45   void debugActStepOut();
46   void debugActSoftReset();
47   void debugActHardReset();
48   virtual void debugActClose();
49   void debugActQuit();
50
51
52protected:
53   running_machine* m_machine;
54
55   static bool s_refreshAll;
56   static bool s_hideAll;
57};
58
59
60//=========================================================================
61//  A way to store the configuration of a window long enough to read/write.
62//=========================================================================
63class WindowQtConfig
64{
65public:
66   enum WindowType
67   {
68      WIN_TYPE_UNKNOWN,
69      WIN_TYPE_MAIN,
70      WIN_TYPE_MEMORY,
71      WIN_TYPE_DASM,
72      WIN_TYPE_LOG,
73      WIN_TYPE_BREAK_POINTS,
74      WIN_TYPE_DEVICES,
75      WIN_TYPE_DEVICE_INFORMATION
76   };
77
78public:
79   WindowQtConfig(const WindowType& type=WIN_TYPE_UNKNOWN) :
80      m_type(type),
81      m_size(800, 600),
82      m_position(120, 120)
83   {}
84   virtual ~WindowQtConfig() {}
85
86   // Settings
87   WindowType m_type;
88   QPoint m_size;
89   QPoint m_position;
90
91   virtual void buildFromQWidget(QWidget* widget);
92   virtual void applyToQWidget(QWidget* widget);
93   virtual void addToXmlDataNode(xml_data_node* node) const;
94   virtual void recoverFromXmlNode(xml_data_node* node);
95};
96
97
98#endif
trunk/src/osd/modules/debugger/qt/deviceinformationwindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "deviceinformationwindow.h"
4
5
6DeviceInformationWindow::DeviceInformationWindow(running_machine* machine, device_t* device, QWidget* parent) :
7   WindowQt(machine, NULL)
8{
9   m_device = device;
10
11   if (parent != NULL)
12   {
13      QPoint parentPos = parent->pos();
14      setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400);
15   }
16
17   if(m_device)
18      fill_device_information();
19}
20
21
22DeviceInformationWindow::~DeviceInformationWindow()
23{
24}
25
26void DeviceInformationWindow::fill_device_information()
27{
28   char title[4069];
29   sprintf(title, "Debug: Device %s", m_device->tag());
30   setWindowTitle(title);
31
32
33   QFrame *mainWindowFrame = new QFrame(this);
34   QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame);
35   vLayout->setObjectName("vlayout");
36   vLayout->setSpacing(3);
37   vLayout->setContentsMargins(2,2,2,2);
38
39   QFrame *primaryFrame = new QFrame(mainWindowFrame);
40   primaryFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
41   QGridLayout *gl1 = new QGridLayout(primaryFrame);
42   gl1->addWidget(new QLabel(QString("Tag"), primaryFrame), 0, 0);
43   gl1->addWidget(new QLabel(QString(m_device->tag()), primaryFrame), 0, 1);
44   gl1->addWidget(new QLabel(QString("Name"), primaryFrame), 1, 0);
45   gl1->addWidget(new QLabel(QString(m_device->name()), primaryFrame), 1, 1);
46   gl1->addWidget(new QLabel(QString("Shortname"), primaryFrame), 2, 0);
47   gl1->addWidget(new QLabel(QString(m_device->shortname()), primaryFrame), 2, 1);
48
49   int cpos = 3;
50   device_interface *intf = m_device->first_interface();
51   if(intf) {
52      gl1->addWidget(new QLabel(QString("Interfaces"), primaryFrame), cpos, 0);
53      while(intf) {
54         gl1->addWidget(new QLabel(QString(intf->interface_type()), primaryFrame), cpos, 1);
55         cpos++;
56         intf = intf->interface_next();
57      }
58   }
59
60   vLayout->addWidget(primaryFrame);
61
62   device_memory_interface *d_memory;
63   if(m_device->interface(d_memory)) {
64      QFrame *f = new QFrame(mainWindowFrame);
65      f->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
66      QVBoxLayout *vb = new QVBoxLayout(f);
67      bool first = true;
68      for(address_spacenum i=AS_0; i<ADDRESS_SPACES; i++)
69         if(d_memory->has_space(i)) {
70            QFrame *ff = new QFrame(f);
71            QHBoxLayout *hb = new QHBoxLayout(ff);
72            if(first) {
73               hb->addWidget(new QLabel("Memory maps"));
74               first = false;
75            }
76            hb->addStretch();
77            hb->addWidget(new QLabel(d_memory->space_config(i)->name()));
78            vb->addWidget(ff);
79         }
80      vLayout->addWidget(f);
81   }
82
83   vLayout->addStretch();
84
85   setCentralWidget(mainWindowFrame);
86}
87
88void DeviceInformationWindow::set_device(const char *tag)
89{
90   m_device = m_machine->device(tag);
91   if(!m_device)
92      m_device = &m_machine->root_device();
93   fill_device_information();
94}
95
96const char *DeviceInformationWindow::device_tag() const
97{
98   return m_device->tag();
99}
100
101
102//=========================================================================
103//  DeviceInformationWindowQtConfig
104//=========================================================================
105void DeviceInformationWindowQtConfig::buildFromQWidget(QWidget* widget)
106{
107   WindowQtConfig::buildFromQWidget(widget);
108   DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget);
109   m_device_tag = window->device_tag();
110}
111
112
113void DeviceInformationWindowQtConfig::applyToQWidget(QWidget* widget)
114{
115   WindowQtConfig::applyToQWidget(widget);
116   DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget);
117   window->set_device(m_device_tag.cstr());
118}
119
120
121void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
122{
123   WindowQtConfig::addToXmlDataNode(node);
124   xml_set_attribute(node, "device-tag", m_device_tag);
125}
126
127
128void DeviceInformationWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
129{
130   WindowQtConfig::recoverFromXmlNode(node);
131   m_device_tag = xml_get_attribute_string(node, "device-tag", ":");
132}
trunk/src/osd/modules/debugger/qt/deviceinformationwindow.h
r0r243595
1#ifndef __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__
2#define __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "windowqt.h"
7
8//============================================================
9//  The Device Information Window.
10//============================================================
11class DeviceInformationWindow : public WindowQt
12{
13   Q_OBJECT
14
15public:
16   DeviceInformationWindow(running_machine* machine, device_t* device = NULL, QWidget* parent=NULL);
17   virtual ~DeviceInformationWindow();
18
19   void set_device(const char *tag);
20   const char *device_tag() const;
21
22private:
23   device_t *m_device;
24
25   void fill_device_information();
26};
27
28
29
30
31//=========================================================================
32//  A way to store the configuration of a window long enough to read/write.
33//=========================================================================
34class DeviceInformationWindowQtConfig : public WindowQtConfig
35{
36public:
37   astring m_device_tag;
38
39   DeviceInformationWindowQtConfig() :
40      WindowQtConfig(WIN_TYPE_DEVICE_INFORMATION)
41   {
42   }
43
44   ~DeviceInformationWindowQtConfig() {}
45
46   void buildFromQWidget(QWidget* widget);
47   void applyToQWidget(QWidget* widget);
48   void addToXmlDataNode(xml_data_node* node) const;
49   void recoverFromXmlNode(xml_data_node* node);
50};
51
52
53#endif
trunk/src/osd/modules/debugger/qt/deviceswindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "deviceswindow.h"
4#include "deviceinformationwindow.h"
5
6DevicesWindowModel::DevicesWindowModel(running_machine *machine, QObject *parent)
7{
8   m_machine = machine;
9}
10
11DevicesWindowModel::~DevicesWindowModel()
12{
13}
14
15QVariant DevicesWindowModel::data(const QModelIndex &index, int role) const
16{
17   if(!index.isValid() || role != Qt::DisplayRole)
18      return QVariant();
19
20   device_t *dev = static_cast<device_t *>(index.internalPointer());
21   switch(index.column()) {
22   case 0: return dev == &m_machine->root_device() ? QString("<root>") : QString(dev->basetag());
23   case 1: return QString(dev->name());
24   }
25
26   return QVariant();
27}
28
29Qt::ItemFlags DevicesWindowModel::flags(const QModelIndex &index) const
30{
31   if(!index.isValid())
32      return 0;
33
34   return QAbstractItemModel::flags(index);
35}
36
37QVariant DevicesWindowModel::headerData(int section, Qt::Orientation orientation, int role) const
38{
39   if(role != Qt::DisplayRole || section < 0 || section >= 2)
40      return QVariant();
41   return QString(section ? "Name" : "Tag");
42}
43
44QModelIndex DevicesWindowModel::index(int row, int column, const QModelIndex &parent) const
45{
46   if(!hasIndex(row, column, parent))
47      return QModelIndex();
48
49   device_t *target = NULL;
50
51   if(!parent.isValid()) {
52      if(row == 0)
53         target = &m_machine->root_device();
54
55   } else {
56      device_t *dparent = static_cast<device_t *>(parent.internalPointer());
57      int count = row;
58      for(target = dparent->first_subdevice(); count && target; target = target->next())
59         count--;
60   }
61
62   if(target)
63      return createIndex(row, column, target);
64
65   return QModelIndex();
66}
67
68QModelIndex DevicesWindowModel::parent(const QModelIndex &index) const
69{
70   if(!index.isValid())
71      return QModelIndex();
72
73   device_t *dchild = static_cast<device_t *>(index.internalPointer());
74   device_t *dparent = dchild->owner();
75
76   if(!dparent)
77      return QModelIndex();
78
79   device_t *dpp = dparent->owner();
80   int row = 0;
81   if(dpp) {
82      for(device_t *child = dpp->first_subdevice(); child && child != dparent; child = child->next())
83         row++;
84   }
85   return createIndex(row, 0, dparent);
86}
87
88int DevicesWindowModel::rowCount(const QModelIndex &parent) const
89{
90   if(!parent.isValid())
91      return 1;
92
93   device_t *dparent = static_cast<device_t *>(parent.internalPointer());
94   int count = 0;
95   for(device_t *child = dparent->first_subdevice(); child; child = child->next())
96      count++;
97
98   return count;
99}
100
101int DevicesWindowModel::columnCount(const QModelIndex &parent) const
102{
103   return 2;
104}
105
106
107
108DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) :
109   WindowQt(machine, NULL),
110   m_devices_model(machine)
111{
112   m_selected_device = NULL;
113
114   setWindowTitle("Debug: All Devices");
115
116   if (parent != NULL)
117   {
118      QPoint parentPos = parent->pos();
119      setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400);
120   }
121
122   //
123   // The tree widget
124   //
125   m_devices_view = new QTreeView(this);
126   m_devices_view->setModel(&m_devices_model);
127   m_devices_view->expandAll();
128   m_devices_view->resizeColumnToContents(0);
129   connect(m_devices_view->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(currentRowChanged(const QModelIndex &,const QModelIndex &)));
130   connect(m_devices_view, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &)));
131   setCentralWidget(m_devices_view);
132}
133
134
135DevicesWindow::~DevicesWindow()
136{
137}
138
139
140void DevicesWindow::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
141{
142   m_selected_device = static_cast<device_t *>(current.internalPointer());
143}
144
145
146void DevicesWindow::activated(const QModelIndex &index)
147{
148   device_t *dev = static_cast<device_t *>(index.internalPointer());
149   (new DeviceInformationWindow(m_machine, dev, this))->show();
150}
151
152
153
154//=========================================================================
155//  DevicesWindowQtConfig
156//=========================================================================
157void DevicesWindowQtConfig::buildFromQWidget(QWidget* widget)
158{
159   WindowQtConfig::buildFromQWidget(widget);
160   //  DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
161}
162
163
164void DevicesWindowQtConfig::applyToQWidget(QWidget* widget)
165{
166   WindowQtConfig::applyToQWidget(widget);
167   //  DevicesWindow* window = dynamic_cast<DevicesWindow*>(widget);
168}
169
170
171void DevicesWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
172{
173   WindowQtConfig::addToXmlDataNode(node);
174}
175
176
177void DevicesWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
178{
179   WindowQtConfig::recoverFromXmlNode(node);
180}
trunk/src/osd/modules/debugger/qt/deviceswindow.h
r0r243595
1#ifndef __DEBUG_QT_DEVICES_WINDOW_H__
2#define __DEBUG_QT_DEVICES_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "windowqt.h"
7
8
9//============================================================
10//  The model for the treeview
11//============================================================
12
13class DevicesWindowModel : public QAbstractItemModel
14{
15   Q_OBJECT
16
17public:
18   explicit DevicesWindowModel(running_machine *machine, QObject *parent = 0);
19   ~DevicesWindowModel();
20
21   QVariant data(const QModelIndex &index, int role) const;
22   Qt::ItemFlags flags(const QModelIndex &index) const;
23   QVariant headerData(int section, Qt::Orientation orientation,
24                  int role = Qt::DisplayRole) const;
25   QModelIndex index(int row, int column,
26                  const QModelIndex &parent = QModelIndex()) const;
27   QModelIndex parent(const QModelIndex &index) const;
28   int rowCount(const QModelIndex &parent = QModelIndex()) const;
29   int columnCount(const QModelIndex &parent = QModelIndex()) const;
30
31private:
32   running_machine *m_machine;
33};
34
35//============================================================
36//  The Devices Window.
37//============================================================
38class DevicesWindow : public WindowQt
39{
40   Q_OBJECT
41
42public:
43   DevicesWindow(running_machine* machine, QWidget* parent=NULL);
44   virtual ~DevicesWindow();
45
46public slots:
47   void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
48   void activated(const QModelIndex &index);
49
50private:
51   QTreeView *m_devices_view;
52   DevicesWindowModel m_devices_model;
53   device_t *m_selected_device;
54};
55
56
57
58
59//=========================================================================
60//  A way to store the configuration of a window long enough to read/write.
61//=========================================================================
62class DevicesWindowQtConfig : public WindowQtConfig
63{
64public:
65   DevicesWindowQtConfig() :
66      WindowQtConfig(WIN_TYPE_DEVICES)
67   {
68   }
69
70   ~DevicesWindowQtConfig() {}
71
72   void buildFromQWidget(QWidget* widget);
73   void applyToQWidget(QWidget* widget);
74   void addToXmlDataNode(xml_data_node* node) const;
75   void recoverFromXmlNode(xml_data_node* node);
76};
77
78
79#endif
trunk/src/osd/modules/debugger/qt/logwindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "logwindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvdisasm.h"
8
9
10LogWindow::LogWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL)
12{
13   setWindowTitle("Debug: Machine Log");
14
15   if (parent != NULL)
16   {
17      QPoint parentPos = parent->pos();
18      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
19   }
20
21   //
22   // The main frame and its input and log widgets
23   //
24   QFrame* mainWindowFrame = new QFrame(this);
25
26   // The main log view
27   m_logView = new DebuggerView(DVT_LOG,
28                           m_machine,
29                           this);
30
31   // Layout
32   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
33   vLayout->setSpacing(3);
34   vLayout->setContentsMargins(2,2,2,2);
35   vLayout->addWidget(m_logView);
36
37   setCentralWidget(mainWindowFrame);
38}
39
40
41LogWindow::~LogWindow()
42{
43}
44
45
46//=========================================================================
47//  LogWindowQtConfig
48//=========================================================================
49void LogWindowQtConfig::buildFromQWidget(QWidget* widget)
50{
51   WindowQtConfig::buildFromQWidget(widget);
52}
53
54
55void LogWindowQtConfig::applyToQWidget(QWidget* widget)
56{
57   WindowQtConfig::applyToQWidget(widget);
58}
59
60
61void LogWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
62{
63   WindowQtConfig::addToXmlDataNode(node);
64}
65
66
67void LogWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
68{
69   WindowQtConfig::recoverFromXmlNode(node);
70}
trunk/src/osd/modules/debugger/qt/logwindow.h
r0r243595
1#ifndef __DEBUG_QT_LOG_WINDOW_H__
2#define __DEBUG_QT_LOG_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debuggerview.h"
7#include "windowqt.h"
8
9
10//============================================================
11//  The Log Window.
12//============================================================
13class LogWindow : public WindowQt
14{
15   Q_OBJECT
16
17public:
18   LogWindow(running_machine* machine, QWidget* parent=NULL);
19   virtual ~LogWindow();
20
21
22private:
23   // Widgets
24   DebuggerView* m_logView;
25};
26
27
28//=========================================================================
29//  A way to store the configuration of a window long enough to read/write.
30//=========================================================================
31class LogWindowQtConfig : public WindowQtConfig
32{
33public:
34   LogWindowQtConfig() :
35      WindowQtConfig(WIN_TYPE_LOG)
36   {
37   }
38
39   ~LogWindowQtConfig() {}
40
41   void buildFromQWidget(QWidget* widget);
42   void applyToQWidget(QWidget* widget);
43   void addToXmlDataNode(xml_data_node* node) const;
44   void recoverFromXmlNode(xml_data_node* node);
45};
46
47
48#endif
trunk/src/osd/modules/debugger/qt/mainwindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "mainwindow.h"
4
5#include "debug/debugcon.h"
6#include "debug/debugcpu.h"
7#include "debug/dvdisasm.h"
8
9
10MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL),
12   m_historyIndex(0),
13   m_inputHistory()
14{
15   setGeometry(300, 300, 1000, 600);
16
17   //
18   // The main frame and its input and log widgets
19   //
20   QFrame* mainWindowFrame = new QFrame(this);
21
22   // The input line
23   m_inputEdit = new QLineEdit(mainWindowFrame);
24   connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(executeCommand()));
25   m_inputEdit->installEventFilter(this);
26
27
28   // The log view
29   m_consoleView = new DebuggerView(DVT_CONSOLE,
30                              m_machine,
31                              mainWindowFrame);
32   m_consoleView->setFocusPolicy(Qt::NoFocus);
33   m_consoleView->setPreferBottom(true);
34
35   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
36   vLayout->addWidget(m_consoleView);
37   vLayout->addWidget(m_inputEdit);
38   vLayout->setSpacing(3);
39   vLayout->setContentsMargins(4,0,4,2);
40
41   setCentralWidget(mainWindowFrame);
42
43   //
44   // Options Menu
45   //
46   // Create two commands
47   QAction* breakpointSetAct = new QAction("Toggle Breakpoint At Cursor", this);
48   QAction* runToCursorAct = new QAction("Run To Cursor", this);
49   breakpointSetAct->setShortcut(Qt::Key_F9);
50   runToCursorAct->setShortcut(Qt::Key_F4);
51   connect(breakpointSetAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
52   connect(runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool)));
53
54   // Right bar options
55   QActionGroup* rightBarGroup = new QActionGroup(this);
56   rightBarGroup->setObjectName("rightbargroup");
57   QAction* rightActRaw = new QAction("Raw Opcodes", this);
58   QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
59   QAction* rightActComments = new QAction("Comments", this);
60   rightActRaw->setCheckable(true);
61   rightActEncrypted->setCheckable(true);
62   rightActComments->setCheckable(true);
63   rightActRaw->setActionGroup(rightBarGroup);
64   rightActEncrypted->setActionGroup(rightBarGroup);
65   rightActComments->setActionGroup(rightBarGroup);
66   rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
67   rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
68   rightActComments->setShortcut(QKeySequence("Ctrl+C"));
69   rightActRaw->setChecked(true);
70   connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*)));
71
72   // Assemble the options menu
73   QMenu* optionsMenu = menuBar()->addMenu("&Options");
74   optionsMenu->addAction(breakpointSetAct);
75   optionsMenu->addAction(runToCursorAct);
76   optionsMenu->addSeparator();
77   optionsMenu->addActions(rightBarGroup->actions());
78
79   //
80   // Images menu
81   //
82   image_interface_iterator imageIterTest(m_machine->root_device());
83   if (imageIterTest.first() != NULL)
84   {
85      createImagesMenu();
86   }
87
88   //
89   // Dock window menu
90   //
91   QMenu* dockMenu = menuBar()->addMenu("Doc&ks");
92
93   setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
94   setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
95
96   // The processor dock
97   QDockWidget* cpuDock = new QDockWidget("processor", this);
98   cpuDock->setObjectName("cpudock");
99   cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea);
100   m_procFrame = new ProcessorDockWidget(m_machine, cpuDock);
101   cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame));
102
103   addDockWidget(Qt::LeftDockWidgetArea, cpuDock);
104   dockMenu->addAction(cpuDock->toggleViewAction());
105
106   // The disassembly dock
107   QDockWidget* dasmDock = new QDockWidget("dasm", this);
108   dasmDock->setObjectName("dasmdock");
109   dasmDock->setAllowedAreas(Qt::TopDockWidgetArea);
110   m_dasmFrame = new DasmDockWidget(m_machine, dasmDock);
111   dasmDock->setWidget(m_dasmFrame);
112
113   addDockWidget(Qt::TopDockWidgetArea, dasmDock);
114   dockMenu->addAction(dasmDock->toggleViewAction());
115}
116
117
118MainWindow::~MainWindow()
119{
120}
121
122
123void MainWindow::setProcessor(device_t* processor)
124{
125   // Cpu swap
126   m_procFrame->view()->view()->set_source(*m_procFrame->view()->view()->source_for_device(processor));
127   m_dasmFrame->view()->view()->set_source(*m_dasmFrame->view()->view()->source_for_device(processor));
128
129   // Scrollbar refresh - seems I should be able to do in the DebuggerView
130   m_dasmFrame->view()->verticalScrollBar()->setValue(m_dasmFrame->view()->view()->visible_position().y);
131   m_dasmFrame->view()->verticalScrollBar()->setValue(m_dasmFrame->view()->view()->visible_position().y);
132
133   // Window title
134   astring title;
135   title.printf("Debug: %s - %s '%s'", m_machine->system().name, processor->name(), processor->tag());
136   setWindowTitle(title.cstr());
137}
138
139
140// Used to intercept the user clicking 'X' in the upper corner
141void MainWindow::closeEvent(QCloseEvent* event)
142{
143   debugActQuit();
144
145   // Insure the window doesn't disappear before we get a chance to save its parameters
146   event->ignore();
147}
148
149
150// Used to intercept the user hitting the up arrow in the input widget
151bool MainWindow::eventFilter(QObject* obj, QEvent* event)
152{
153   // Only filter keypresses
154   QKeyEvent* keyEvent = NULL;
155   if (event->type() == QEvent::KeyPress)
156   {
157      keyEvent = static_cast<QKeyEvent*>(event);
158   }
159   else
160   {
161      return QObject::eventFilter(obj, event);
162   }
163
164   // Catch up & down keys
165   if (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)
166   {
167      if (keyEvent->key() == Qt::Key_Up)
168      {
169         if (m_historyIndex > 0)
170            m_historyIndex--;
171      }
172      else if (keyEvent->key() == Qt::Key_Down)
173      {
174         if (m_historyIndex < m_inputHistory.size())
175            m_historyIndex++;
176      }
177
178      // Populate the input edit or clear it if you're at the end
179      if (m_historyIndex == m_inputHistory.size())
180      {
181         m_inputEdit->setText("");
182      }
183      else
184      {
185         m_inputEdit->setText(m_inputHistory[m_historyIndex]);
186      }
187   }
188   else if (keyEvent->key() == Qt::Key_Enter)
189   {
190      executeCommand(false);
191   }
192   else
193   {
194      return QObject::eventFilter(obj, event);
195   }
196
197   return true;
198}
199
200
201void MainWindow::toggleBreakpointAtCursor(bool changedTo)
202{
203   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
204   if (dasmView->cursor_visible())
205   {
206      if (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())
207      {
208         offs_t address = downcast<debug_view_disasm *>(dasmView)->selected_address();
209         device_debug *cpuinfo = dasmView->source()->device()->debug();
210
211         // Find an existing breakpoint at this address
212         INT32 bpindex = -1;
213         for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
214               bp != NULL;
215               bp = bp->next())
216         {
217            if (address == bp->address())
218            {
219               bpindex = bp->index();
220               break;
221            }
222         }
223
224         // If none exists, add a new one
225         astring command;
226         if (bpindex == -1)
227         {
228            command.printf("bpset 0x%X", address);
229         }
230         else
231         {
232            command.printf("bpclear 0x%X", bpindex);
233         }
234         debug_console_execute_command(*m_machine, command, 1);
235      }
236   }
237
238   refreshAll();
239}
240
241
242void MainWindow::runToCursor(bool changedTo)
243{
244   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
245   if (dasmView->cursor_visible())
246   {
247      if (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())
248      {
249         offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address();
250         astring command;
251         command.printf("go 0x%X", address);
252         debug_console_execute_command(*m_machine, command, 1);
253      }
254   }
255}
256
257
258void MainWindow::rightBarChanged(QAction* changedTo)
259{
260   debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
261   if (changedTo->text() == "Raw Opcodes")
262   {
263      dasmView->set_right_column(DASM_RIGHTCOL_RAW);
264   }
265   else if (changedTo->text() == "Encrypted Opcodes")
266   {
267      dasmView->set_right_column(DASM_RIGHTCOL_ENCRYPTED);
268   }
269   else if (changedTo->text() == "Comments")
270   {
271      dasmView->set_right_column(DASM_RIGHTCOL_COMMENTS);
272   }
273   m_dasmFrame->view()->viewport()->update();
274}
275
276
277void MainWindow::executeCommand(bool withClear)
278{
279   QString command = m_inputEdit->text();
280
281   // A blank command is a "silent step"
282   if (command == "")
283   {
284      debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
285      return;
286   }
287
288   // Send along the command
289   debug_console_execute_command(*m_machine,
290                           command.toLocal8Bit().data(),
291                           true);
292
293   // Add history & set the index to be the top of the stack
294   addToHistory(command);
295
296   // Clear out the text and reset the history pointer only if asked
297   if (withClear)
298   {
299      m_inputEdit->clear();
300      m_historyIndex = m_inputHistory.size();
301   }
302
303   // Refresh
304   m_consoleView->viewport()->update();
305   refreshAll();
306}
307
308
309void MainWindow::mountImage(bool changedTo)
310{
311   // The image interface index was assigned to the QAction's data memeber
312   const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt();
313   image_interface_iterator iter(m_machine->root_device());
314   device_image_interface *img = iter.byindex(imageIndex);
315   if (img == NULL)
316   {
317      debug_console_printf(*m_machine, "Something is wrong with the mount menu.\n");
318      refreshAll();
319      return;
320   }
321
322   // File dialog
323   QString filename = QFileDialog::getOpenFileName(this,
324                                       "Select an image file",
325                                       QDir::currentPath(),
326                                       tr("All files (*.*)"));
327
328   if (img->load(filename.toUtf8().data()) != IMAGE_INIT_PASS)
329   {
330      debug_console_printf(*m_machine, "Image could not be mounted.\n");
331      refreshAll();
332      return;
333   }
334
335   // Activate the unmount menu option
336   QAction* unmountAct = sender()->parent()->findChild<QAction*>("unmount");
337   unmountAct->setEnabled(true);
338
339   // Set the mount name
340   QMenu* parentMenuItem = dynamic_cast<QMenu*>(sender()->parent());
341   QString baseString = parentMenuItem->title();
342   baseString.truncate(baseString.lastIndexOf(QString(" : ")));
343   const QString newTitle = baseString + QString(" : ") + QString(img->filename());
344   parentMenuItem->setTitle(newTitle);
345
346   debug_console_printf(*m_machine, "Image %s mounted successfully.\n", filename.toUtf8().data());
347   refreshAll();
348}
349
350
351void MainWindow::unmountImage(bool changedTo)
352{
353   // The image interface index was assigned to the QAction's data memeber
354   const int imageIndex = dynamic_cast<QAction*>(sender())->data().toInt();
355   image_interface_iterator iter(m_machine->root_device());
356   device_image_interface *img = iter.byindex(imageIndex);
357
358   img->unload();
359
360   // Deactivate the unmount menu option
361   dynamic_cast<QAction*>(sender())->setEnabled(false);
362
363   // Set the mount name
364   QMenu* parentMenuItem = dynamic_cast<QMenu*>(sender()->parent());
365   QString baseString = parentMenuItem->title();
366   baseString.truncate(baseString.lastIndexOf(QString(" : ")));
367   const QString newTitle = baseString + QString(" : ") + QString("[empty slot]");
368   parentMenuItem->setTitle(newTitle);
369
370   debug_console_printf(*m_machine, "Image successfully unmounted.\n");
371   refreshAll();
372}
373
374
375void MainWindow::debugActClose()
376{
377   m_machine->schedule_exit();
378}
379
380
381void MainWindow::addToHistory(const QString& command)
382{
383   if (command == "")
384      return;
385
386   // Always push back when there is no previous history
387   if (m_inputHistory.size() == 0)
388   {
389      m_inputHistory.push_back(m_inputEdit->text());
390      return;
391   }
392
393   // If there is previous history, make sure it's not what you just executed
394   if (m_inputHistory.back() != m_inputEdit->text())
395   {
396      m_inputHistory.push_back(m_inputEdit->text());
397   }
398}
399
400
401void MainWindow::createImagesMenu()
402{
403   QMenu* imagesMenu = menuBar()->addMenu("&Images");
404
405   int interfaceIndex = 0;
406   image_interface_iterator iter(m_machine->root_device());
407   for (device_image_interface *img = iter.first(); img != NULL; img = iter.next())
408   {
409      astring menuName;
410      menuName.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]");
411
412      QMenu* interfaceMenu = imagesMenu->addMenu(menuName.cstr());
413      interfaceMenu->setObjectName(img->device().name());
414
415      QAction* mountAct = new QAction("Mount...", interfaceMenu);
416      QAction* unmountAct = new QAction("Unmount", interfaceMenu);
417      mountAct->setObjectName("mount");
418      mountAct->setData(QVariant(interfaceIndex));
419      unmountAct->setObjectName("unmount");
420      unmountAct->setData(QVariant(interfaceIndex));
421      connect(mountAct, SIGNAL(triggered(bool)), this, SLOT(mountImage(bool)));
422      connect(unmountAct, SIGNAL(triggered(bool)), this, SLOT(unmountImage(bool)));
423
424      if (!img->exists())
425         unmountAct->setEnabled(false);
426
427      interfaceMenu->addAction(mountAct);
428      interfaceMenu->addAction(unmountAct);
429
430      // TODO: Cassette operations
431
432      interfaceIndex++;
433   }
434}
435
436
437//=========================================================================
438//  MainWindowQtConfig
439//=========================================================================
440void MainWindowQtConfig::buildFromQWidget(QWidget* widget)
441{
442   WindowQtConfig::buildFromQWidget(widget);
443   MainWindow* window = dynamic_cast<MainWindow*>(widget);
444   m_windowState = window->saveState();
445
446   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
447   if (rightBarGroup->checkedAction()->text() == "Raw Opcodes")
448      m_rightBar = 0;
449   else if (rightBarGroup->checkedAction()->text() == "Encrypted Opcodes")
450      m_rightBar = 1;
451   else if (rightBarGroup->checkedAction()->text() == "Comments")
452      m_rightBar = 2;
453}
454
455
456void MainWindowQtConfig::applyToQWidget(QWidget* widget)
457{
458   WindowQtConfig::applyToQWidget(widget);
459   MainWindow* window = dynamic_cast<MainWindow*>(widget);
460   window->restoreState(m_windowState);
461
462   QActionGroup* rightBarGroup = window->findChild<QActionGroup*>("rightbargroup");
463   rightBarGroup->actions()[m_rightBar]->trigger();
464}
465
466
467void MainWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
468{
469   WindowQtConfig::addToXmlDataNode(node);
470   xml_set_attribute_int(node, "rightbar", m_rightBar);
471   xml_set_attribute(node, "qtwindowstate", m_windowState.toPercentEncoding().data());
472}
473
474
475void MainWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
476{
477   WindowQtConfig::recoverFromXmlNode(node);
478   const char* state = xml_get_attribute_string(node, "qtwindowstate", "");
479   m_windowState = QByteArray::fromPercentEncoding(state);
480   m_rightBar = xml_get_attribute_int(node, "rightbar", m_rightBar);
481}
482
483DasmDockWidget::~DasmDockWidget()
484{
485}
486
487ProcessorDockWidget::~ProcessorDockWidget()
488{
489}
trunk/src/osd/modules/debugger/qt/mainwindow.h
r0r243595
1#ifndef __DEBUG_QT_MAIN_WINDOW_H__
2#define __DEBUG_QT_MAIN_WINDOW_H__
3
4#include <QtGui/QtGui>
5#include <vector>
6
7#include "debug/dvdisasm.h"
8
9#include "debuggerview.h"
10#include "windowqt.h"
11
12class DasmDockWidget;
13class ProcessorDockWidget;
14
15
16//============================================================
17//  The Main Window.  Contains processor and dasm docks.
18//============================================================
19class MainWindow : public WindowQt
20{
21   Q_OBJECT
22
23public:
24   MainWindow(running_machine* machine, QWidget* parent=NULL);
25   virtual ~MainWindow();
26
27   void setProcessor(device_t* processor);
28
29
30protected:
31   // Used to intercept the user clicking 'X' in the upper corner
32   void closeEvent(QCloseEvent* event);
33
34   // Used to intercept the user hitting the up arrow in the input widget
35   bool eventFilter(QObject* obj, QEvent* event);
36
37
38private slots:
39   void toggleBreakpointAtCursor(bool changedTo);
40   void runToCursor(bool changedTo);
41   void rightBarChanged(QAction* changedTo);
42
43   void executeCommand(bool withClear=true);
44
45   void mountImage(bool changedTo);
46   void unmountImage(bool changedTo);
47
48   // Closing the main window actually exits the program
49   void debugActClose();
50
51
52private:
53   // Widgets and docks
54   QLineEdit* m_inputEdit;
55   DebuggerView* m_consoleView;
56   ProcessorDockWidget* m_procFrame;
57   DasmDockWidget* m_dasmFrame;
58
59   // Terminal history
60   int m_historyIndex;
61   std::vector<QString> m_inputHistory;
62   void addToHistory(const QString& command);
63
64   void createImagesMenu();
65};
66
67
68//============================================================
69//  Docks with the Main Window.  Disassembly.
70//============================================================
71class DasmDockWidget : public QWidget
72{
73   Q_OBJECT
74
75public:
76   DasmDockWidget(running_machine* machine, QWidget* parent=NULL) :
77      QWidget(parent),
78      m_machine(machine)
79   {
80      m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
81                              m_machine,
82                              this);
83
84      // Force a recompute of the disassembly region
85      downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
86
87      QVBoxLayout* dvLayout = new QVBoxLayout(this);
88      dvLayout->addWidget(m_dasmView);
89      dvLayout->setContentsMargins(4,0,4,0);
90   }
91
92
93   virtual ~DasmDockWidget();
94
95
96   DebuggerView* view() { return m_dasmView; }
97
98
99   QSize minimumSizeHint() const
100   {
101      return QSize(150,150);
102   }
103
104
105   QSize sizeHint() const
106   {
107      return QSize(150,200);
108   }
109
110
111private:
112   DebuggerView* m_dasmView;
113
114   running_machine* m_machine;
115};
116
117
118//============================================================
119//  Docks with the Main Window.  Processor information.
120//============================================================
121class ProcessorDockWidget : public QWidget
122{
123   Q_OBJECT
124
125public:
126   ProcessorDockWidget(running_machine* machine,
127                  QWidget* parent=NULL) :
128      QWidget(parent),
129      m_processorView(NULL),
130      m_machine(machine)
131   {
132      m_processorView = new DebuggerView(DVT_STATE,
133                                 m_machine,
134                                 this);
135      m_processorView->setFocusPolicy(Qt::NoFocus);
136
137      QVBoxLayout* cvLayout = new QVBoxLayout(this);
138      cvLayout->addWidget(m_processorView);
139      cvLayout->setContentsMargins(4,0,4,2);
140   }
141
142
143   virtual ~ProcessorDockWidget();
144
145
146   DebuggerView* view() { return m_processorView; }
147
148
149   QSize minimumSizeHint() const
150   {
151      return QSize(150,300);
152   }
153
154
155   QSize sizeHint() const
156   {
157      return QSize(200,300);
158   }
159
160
161private:
162   DebuggerView* m_processorView;
163
164   running_machine* m_machine;
165};
166
167
168//=========================================================================
169//  A way to store the configuration of a window long enough to read/write.
170//=========================================================================
171class MainWindowQtConfig : public WindowQtConfig
172{
173public:
174   MainWindowQtConfig() :
175      WindowQtConfig(WIN_TYPE_MAIN),
176      m_rightBar(0),
177      m_windowState()
178   {}
179
180   ~MainWindowQtConfig() {}
181
182   // Settings
183   int m_rightBar;
184   QByteArray m_windowState;
185
186   void buildFromQWidget(QWidget* widget);
187   void applyToQWidget(QWidget* widget);
188   void addToXmlDataNode(xml_data_node* node) const;
189   void recoverFromXmlNode(xml_data_node* node);
190};
191
192
193
194#endif
trunk/src/osd/modules/debugger/qt/memorywindow.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "memorywindow.h"
4
5#include "debug/dvmemory.h"
6#include "debug/debugcon.h"
7#include "debug/debugcpu.h"
8
9
10MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) :
11   WindowQt(machine, NULL)
12{
13   setWindowTitle("Debug: Memory View");
14
15   if (parent != NULL)
16   {
17      QPoint parentPos = parent->pos();
18      setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
19   }
20
21   //
22   // The main frame and its input and log widgets
23   //
24   QFrame* mainWindowFrame = new QFrame(this);
25
26   // The top frame & groupbox that contains the input widgets
27   QFrame* topSubFrame = new QFrame(mainWindowFrame);
28
29   // The input edit
30   m_inputEdit = new QLineEdit(topSubFrame);
31   connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));
32
33   // The memory space combo box
34   m_memoryComboBox = new QComboBox(topSubFrame);
35   m_memoryComboBox->setObjectName("memoryregion");
36   m_memoryComboBox->setMinimumWidth(300);
37   connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int)));
38
39   // The main memory window
40   m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this);
41
42   // Layout
43   QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
44   subLayout->addWidget(m_inputEdit);
45   subLayout->addWidget(m_memoryComboBox);
46   subLayout->setSpacing(3);
47   subLayout->setContentsMargins(2,2,2,2);
48
49   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
50   vLayout->setSpacing(3);
51   vLayout->setContentsMargins(2,2,2,2);
52   vLayout->addWidget(topSubFrame);
53   vLayout->addWidget(m_memTable);
54
55   setCentralWidget(mainWindowFrame);
56
57   //
58   // Menu bars
59   //
60   // Create a byte-chunk group
61   QActionGroup* chunkGroup = new QActionGroup(this);
62   chunkGroup->setObjectName("chunkgroup");
63   QAction* chunkActOne  = new QAction("1-byte chunks", this);
64   chunkActOne->setObjectName("chunkActOne");
65   QAction* chunkActTwo  = new QAction("2-byte chunks", this);
66   chunkActTwo->setObjectName("chunkActTwo");
67   QAction* chunkActFour = new QAction("4-byte chunks", this);
68   chunkActFour->setObjectName("chunkActFour");
69   chunkActOne->setCheckable(true);
70   chunkActTwo->setCheckable(true);
71   chunkActFour->setCheckable(true);
72   chunkActOne->setActionGroup(chunkGroup);
73   chunkActTwo->setActionGroup(chunkGroup);
74   chunkActFour->setActionGroup(chunkGroup);
75   chunkActOne->setShortcut(QKeySequence("Ctrl+1"));
76   chunkActTwo->setShortcut(QKeySequence("Ctrl+2"));
77   chunkActFour->setShortcut(QKeySequence("Ctrl+4"));
78   chunkActOne->setChecked(true);
79   connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*)));
80
81   // Create a address display group
82   QActionGroup* addressGroup = new QActionGroup(this);
83   addressGroup->setObjectName("addressgroup");
84   QAction* addressActLogical = new QAction("Logical Addresses", this);
85   QAction* addressActPhysical = new QAction("Physical Addresses", this);
86   addressActLogical->setCheckable(true);
87   addressActPhysical->setCheckable(true);
88   addressActLogical->setActionGroup(addressGroup);
89   addressActPhysical->setActionGroup(addressGroup);
90   addressActLogical->setShortcut(QKeySequence("Ctrl+G"));
91   addressActPhysical->setShortcut(QKeySequence("Ctrl+Y"));
92   addressActLogical->setChecked(true);
93   connect(addressGroup, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*)));
94
95   // Create a reverse view radio
96   QAction* reverseAct = new QAction("Reverse View", this);
97   reverseAct->setObjectName("reverse");
98   reverseAct->setCheckable(true);
99   reverseAct->setShortcut(QKeySequence("Ctrl+R"));
100   connect(reverseAct, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool)));
101
102   // Create increase and decrease bytes-per-line actions
103   QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this);
104   QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this);
105   increaseBplAct->setShortcut(QKeySequence("Ctrl+P"));
106   decreaseBplAct->setShortcut(QKeySequence("Ctrl+O"));
107   connect(increaseBplAct, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool)));
108   connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool)));
109
110   // Assemble the options menu
111   QMenu* optionsMenu = menuBar()->addMenu("&Options");
112   optionsMenu->addActions(chunkGroup->actions());
113   optionsMenu->addSeparator();
114   optionsMenu->addActions(addressGroup->actions());
115   optionsMenu->addSeparator();
116   optionsMenu->addAction(reverseAct);
117   optionsMenu->addSeparator();
118   optionsMenu->addAction(increaseBplAct);
119   optionsMenu->addAction(decreaseBplAct);
120
121
122   //
123   // Initialize
124   //
125   populateComboBox();
126
127   // Set to the current CPU's memory view
128   setToCurrentCpu();
129}
130
131
132MemoryWindow::~MemoryWindow()
133{
134}
135
136
137void MemoryWindow::memoryRegionChanged(int index)
138{
139   m_memTable->view()->set_source(*m_memTable->view()->source_list().find(index));
140   m_memTable->viewport()->update();
141
142   // Update the chunk size radio buttons to the memory region's default
143   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
144   switch(memView->bytes_per_chunk())
145   {
146      case 1: chunkSizeMenuItem("chunkActOne")->setChecked(true); break;
147      case 2: chunkSizeMenuItem("chunkActTwo")->setChecked(true); break;
148      case 4: chunkSizeMenuItem("chunkActFour")->setChecked(true); break;
149      default: break;
150   }
151}
152
153
154void MemoryWindow::expressionSubmitted()
155{
156   const QString expression = m_inputEdit->text();
157   downcast<debug_view_memory*>(m_memTable->view())->set_expression(expression.toLocal8Bit().data());
158
159   // Make the cursor pop
160   m_memTable->view()->set_cursor_visible(true);
161
162   // Check where the cursor is and adjust the scroll accordingly
163   debug_view_xy cursorPosition = m_memTable->view()->cursor_position();
164   // TODO: check if the region is already visible?
165   m_memTable->verticalScrollBar()->setValue(cursorPosition.y);
166
167   m_memTable->update();
168   m_memTable->viewport()->update();
169}
170
171
172void MemoryWindow::chunkChanged(QAction* changedTo)
173{
174   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
175   if (changedTo->text() == "1-byte chunks")
176   {
177      memView->set_bytes_per_chunk(1);
178   }
179   else if (changedTo->text() == "2-byte chunks")
180   {
181      memView->set_bytes_per_chunk(2);
182   }
183   else if (changedTo->text() == "4-byte chunks")
184   {
185      memView->set_bytes_per_chunk(4);
186   }
187   m_memTable->viewport()->update();
188}
189
190
191void MemoryWindow::addressChanged(QAction* changedTo)
192{
193   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
194   if (changedTo->text() == "Logical Addresses")
195   {
196      memView->set_physical(false);
197   }
198   else if (changedTo->text() == "Physical Addresses")
199   {
200      memView->set_physical(true);
201   }
202   m_memTable->viewport()->update();
203}
204
205
206void MemoryWindow::reverseChanged(bool changedTo)
207{
208   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
209   memView->set_reverse(changedTo);
210   m_memTable->viewport()->update();
211}
212
213
214void MemoryWindow::increaseBytesPerLine(bool changedTo)
215{
216   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
217   memView->set_chunks_per_row(memView->chunks_per_row() + 1);
218   m_memTable->viewport()->update();
219}
220
221
222void MemoryWindow::decreaseBytesPerLine(bool checked)
223{
224   debug_view_memory* memView = downcast<debug_view_memory*>(m_memTable->view());
225   memView->set_chunks_per_row(memView->chunks_per_row() - 1);
226   m_memTable->viewport()->update();
227}
228
229
230void MemoryWindow::populateComboBox()
231{
232   if (m_memTable == NULL)
233      return;
234
235   m_memoryComboBox->clear();
236   for (const debug_view_source* source = m_memTable->view()->first_source();
237         source != NULL;
238         source = source->next())
239   {
240      m_memoryComboBox->addItem(source->name());
241   }
242}
243
244
245void MemoryWindow::setToCurrentCpu()
246{
247   device_t* curCpu = debug_cpu_get_visible_cpu(*m_machine);
248   const debug_view_source *source = m_memTable->view()->source_for_device(curCpu);
249   const int listIndex = m_memTable->view()->source_list().indexof(*source);
250   m_memoryComboBox->setCurrentIndex(listIndex);
251}
252
253
254// I have a hard time storing QActions as class members.  This is a substitute.
255QAction* MemoryWindow::chunkSizeMenuItem(const QString& itemName)
256{
257   QList<QMenu*> menus = menuBar()->findChildren<QMenu*>();
258   for (int i = 0; i < menus.length(); i++)
259   {
260      if (menus[i]->title() != "&Options") continue;
261      QList<QAction*> actions = menus[i]->actions();
262      for (int j = 0; j < actions.length(); j++)
263      {
264         if (actions[j]->objectName() == itemName)
265            return actions[j];
266      }
267   }
268   return NULL;
269}
270
271
272//=========================================================================
273//  DebuggerMemView
274//=========================================================================
275void DebuggerMemView::mousePressEvent(QMouseEvent* event)
276{
277   const bool leftClick = event->button() == Qt::LeftButton;
278   const bool rightClick = event->button() == Qt::RightButton;
279
280   if (leftClick || rightClick)
281   {
282      QFontMetrics actualFont = fontMetrics();
283      const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
284      const int fontHeight = MAX(1, actualFont.height());
285
286      debug_view_xy topLeft = view()->visible_position();
287      debug_view_xy clickViewPosition;
288      clickViewPosition.x = topLeft.x + (event->x() / fontWidth);
289      clickViewPosition.y = topLeft.y + (event->y() / fontHeight);
290      if (leftClick)
291      {
292         view()->process_click(DCK_LEFT_CLICK, clickViewPosition);
293      }
294      else if (rightClick)
295      {
296         // Display the last known PC to write to this memory location & copy it onto the clipboard
297         debug_view_memory* memView = downcast<debug_view_memory*>(view());
298         const offs_t address = memView->addressAtCursorPosition(clickViewPosition);
299         const debug_view_memory_source* source = downcast<const debug_view_memory_source*>(memView->source());
300         address_space* addressSpace = source->space();
301         const int nativeDataWidth = addressSpace->data_width() / 8;
302         const UINT64 memValue = debug_read_memory(*addressSpace,
303                                          addressSpace->address_to_byte(address),
304                                          nativeDataWidth,
305                                          true);
306         const offs_t pc = source->device()->debug()->track_mem_pc_from_space_address_data(addressSpace->spacenum(),
307                                                                        address,
308                                                                        memValue);
309         if (pc != (offs_t)(-1))
310         {
311            // TODO: You can specify a box that the tooltip stays alive within - might be good?
312            const QString addressAndPc = QString("Address %1 written at PC=%2").arg(address, 2, 16).arg(pc, 2, 16);
313            QToolTip::showText(QCursor::pos(), addressAndPc, NULL);
314
315            // Copy the PC into the clipboard as well
316            QClipboard *clipboard = QApplication::clipboard();
317            clipboard->setText(QString("%1").arg(pc, 2, 16));
318         }
319         else
320         {
321            QToolTip::showText(QCursor::pos(), "UNKNOWN PC", NULL);
322         }
323      }
324
325      viewport()->update();
326      update();
327   }
328}
329
330
331//=========================================================================
332//  MemoryWindowQtConfig
333//=========================================================================
334void MemoryWindowQtConfig::buildFromQWidget(QWidget* widget)
335{
336   WindowQtConfig::buildFromQWidget(widget);
337   MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget);
338   QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion");
339   m_memoryRegion = memoryRegion->currentIndex();
340
341   QAction* reverse = window->findChild<QAction*>("reverse");
342   m_reverse = reverse->isChecked();
343
344   QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup");
345   if (addressGroup->checkedAction()->text() == "Logical Addresses")
346      m_addressMode = 0;
347   else if (addressGroup->checkedAction()->text() == "Physical Addresses")
348      m_addressMode = 1;
349
350   QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup");
351   if (chunkGroup->checkedAction()->text() == "1-byte chunks")
352      m_chunkSize = 0;
353   else if (chunkGroup->checkedAction()->text() == "2-byte chunks")
354      m_chunkSize = 1;
355   else if (chunkGroup->checkedAction()->text() == "4-byte chunks")
356      m_chunkSize = 2;
357}
358
359
360void MemoryWindowQtConfig::applyToQWidget(QWidget* widget)
361{
362   WindowQtConfig::applyToQWidget(widget);
363   MemoryWindow* window = dynamic_cast<MemoryWindow*>(widget);
364   QComboBox* memoryRegion = window->findChild<QComboBox*>("memoryregion");
365   memoryRegion->setCurrentIndex(m_memoryRegion);
366
367   QAction* reverse = window->findChild<QAction*>("reverse");
368   if (m_reverse) reverse->trigger();
369
370   QActionGroup* addressGroup = window->findChild<QActionGroup*>("addressgroup");
371   addressGroup->actions()[m_addressMode]->trigger();
372
373   QActionGroup* chunkGroup = window->findChild<QActionGroup*>("chunkgroup");
374   chunkGroup->actions()[m_chunkSize]->trigger();
375}
376
377
378void MemoryWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
379{
380   WindowQtConfig::addToXmlDataNode(node);
381   xml_set_attribute_int(node, "memoryregion", m_memoryRegion);
382   xml_set_attribute_int(node, "reverse", m_reverse);
383   xml_set_attribute_int(node, "addressmode", m_addressMode);
384   xml_set_attribute_int(node, "chunksize", m_chunkSize);
385}
386
387
388void MemoryWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
389{
390   WindowQtConfig::recoverFromXmlNode(node);
391   m_memoryRegion = xml_get_attribute_int(node, "memoryregion", m_memoryRegion);
392   m_reverse = xml_get_attribute_int(node, "reverse", m_reverse);
393   m_addressMode = xml_get_attribute_int(node, "addressmode", m_addressMode);
394   m_chunkSize = xml_get_attribute_int(node, "chunksize", m_chunkSize);
395}
trunk/src/osd/modules/debugger/qt/memorywindow.h
r0r243595
1#ifndef __DEBUG_QT_MEMORY_WINDOW_H__
2#define __DEBUG_QT_MEMORY_WINDOW_H__
3
4#include <QtGui/QtGui>
5
6#include "debuggerview.h"
7#include "windowqt.h"
8
9class DebuggerMemView;
10
11
12//============================================================
13//  The Memory Window.
14//============================================================
15class MemoryWindow : public WindowQt
16{
17   Q_OBJECT
18
19public:
20   MemoryWindow(running_machine* machine, QWidget* parent=NULL);
21   virtual ~MemoryWindow();
22
23
24private slots:
25   void memoryRegionChanged(int index);
26   void expressionSubmitted();
27   void chunkChanged(QAction* changedTo);
28   void addressChanged(QAction* changedTo);
29   void reverseChanged(bool changedTo);
30   void increaseBytesPerLine(bool changedTo);
31   void decreaseBytesPerLine(bool checked=false);
32
33
34private:
35   void populateComboBox();
36   void setToCurrentCpu();
37   QAction* chunkSizeMenuItem(const QString& itemName);
38
39
40private:
41   // Widgets
42   QLineEdit* m_inputEdit;
43   QComboBox* m_memoryComboBox;
44   DebuggerMemView* m_memTable;
45};
46
47
48//=========================================================================
49//  The mem window gets its own debugger view to handle right click pop-ups
50//=========================================================================
51class DebuggerMemView : public DebuggerView
52{
53public:
54   DebuggerMemView(const debug_view_type& type,
55               running_machine* machine,
56               QWidget* parent=NULL)
57      : DebuggerView(type, machine, parent)
58   {}
59   virtual ~DebuggerMemView() {}
60
61protected:
62   void mousePressEvent(QMouseEvent* event);
63};
64
65
66//=========================================================================
67//  A way to store the configuration of a window long enough to read/write.
68//=========================================================================
69class MemoryWindowQtConfig : public WindowQtConfig
70{
71public:
72   MemoryWindowQtConfig() :
73      WindowQtConfig(WIN_TYPE_MEMORY),
74      m_reverse(0),
75      m_addressMode(0),
76      m_chunkSize(0),
77      m_memoryRegion(0)
78   {
79   }
80
81   ~MemoryWindowQtConfig() {}
82
83   // Settings
84   int m_reverse;
85   int m_addressMode;
86   int m_chunkSize;
87   int m_memoryRegion;
88
89   void buildFromQWidget(QWidget* widget);
90   void applyToQWidget(QWidget* widget);
91   void addToXmlDataNode(xml_data_node* node) const;
92   void recoverFromXmlNode(xml_data_node* node);
93};
94
95
96#endif
trunk/src/osd/modules/debugger/qt/windowqt.c
r0r243595
1#define NO_MEM_TRACKING
2
3#include "windowqt.h"
4#include "logwindow.h"
5#include "dasmwindow.h"
6#include "memorywindow.h"
7#include "breakpointswindow.h"
8#include "deviceswindow.h"
9
10bool WindowQt::s_refreshAll = false;
11bool WindowQt::s_hideAll = false;
12
13
14// Since all debug windows are intended to be top-level, this inherited
15// constructor is always called with a NULL parent.  The passed-in parent widget,
16// however, is often used to place each child window & the code to do this can
17// be found in most of the inherited classes.
18
19WindowQt::WindowQt(running_machine* machine, QWidget* parent) :
20   QMainWindow(parent),
21   m_machine(machine)
22{
23   setAttribute(Qt::WA_DeleteOnClose, true);
24
25   // The Debug menu bar
26   QAction* debugActOpenMemory = new QAction("New &Memory Window", this);
27   debugActOpenMemory->setShortcut(QKeySequence("Ctrl+M"));
28   connect(debugActOpenMemory, SIGNAL(triggered()), this, SLOT(debugActOpenMemory()));
29
30   QAction* debugActOpenDasm = new QAction("New &Dasm Window", this);
31   debugActOpenDasm->setShortcut(QKeySequence("Ctrl+D"));
32   connect(debugActOpenDasm, SIGNAL(triggered()), this, SLOT(debugActOpenDasm()));
33
34   QAction* debugActOpenLog = new QAction("New &Log Window", this);
35   debugActOpenLog->setShortcut(QKeySequence("Ctrl+L"));
36   connect(debugActOpenLog, SIGNAL(triggered()), this, SLOT(debugActOpenLog()));
37
38   QAction* debugActOpenPoints = new QAction("New &Break|Watchpoints Window", this);
39   debugActOpenPoints->setShortcut(QKeySequence("Ctrl+B"));
40   connect(debugActOpenPoints, SIGNAL(triggered()), this, SLOT(debugActOpenPoints()));
41
42   QAction* debugActOpenDevices = new QAction("New D&evices Window", this);
43   debugActOpenDevices->setShortcut(QKeySequence("Shift+Ctrl+D"));
44   connect(debugActOpenDevices, SIGNAL(triggered()), this, SLOT(debugActOpenDevices()));
45
46   QAction* dbgActRun = new QAction("Run", this);
47   dbgActRun->setShortcut(Qt::Key_F5);
48   connect(dbgActRun, SIGNAL(triggered()), this, SLOT(debugActRun()));
49
50   QAction* dbgActRunAndHide = new QAction("Run And Hide Debugger", this);
51   dbgActRunAndHide->setShortcut(Qt::Key_F12);
52   connect(dbgActRunAndHide, SIGNAL(triggered()), this, SLOT(debugActRunAndHide()));
53
54   QAction* dbgActRunToNextCpu = new QAction("Run to Next CPU", this);
55   dbgActRunToNextCpu->setShortcut(Qt::Key_F6);
56   connect(dbgActRunToNextCpu, SIGNAL(triggered()), this, SLOT(debugActRunToNextCpu()));
57
58   QAction* dbgActRunNextInt = new QAction("Run to Next Interrupt on This CPU", this);
59   dbgActRunNextInt->setShortcut(Qt::Key_F7);
60   connect(dbgActRunNextInt, SIGNAL(triggered()), this, SLOT(debugActRunNextInt()));
61
62   QAction* dbgActRunNextVBlank = new QAction("Run to Next VBlank", this);
63   dbgActRunNextVBlank->setShortcut(Qt::Key_F8);
64   connect(dbgActRunNextVBlank, SIGNAL(triggered()), this, SLOT(debugActRunNextVBlank()));
65
66   QAction* dbgActStepInto = new QAction("Step Into", this);
67   dbgActStepInto->setShortcut(Qt::Key_F11);
68   connect(dbgActStepInto, SIGNAL(triggered()), this, SLOT(debugActStepInto()));
69
70   QAction* dbgActStepOver = new QAction("Step Over", this);
71   dbgActStepOver->setShortcut(Qt::Key_F10);
72   connect(dbgActStepOver, SIGNAL(triggered()), this, SLOT(debugActStepOver()));
73
74   QAction* dbgActStepOut = new QAction("Step Out", this);
75   dbgActStepOut->setShortcut(QKeySequence("Shift+F11"));
76   connect(dbgActStepOut, SIGNAL(triggered()), this, SLOT(debugActStepOut()));
77
78   QAction* dbgActSoftReset = new QAction("Soft Reset", this);
79   dbgActSoftReset->setShortcut(Qt::Key_F3);
80   connect(dbgActSoftReset, SIGNAL(triggered()), this, SLOT(debugActSoftReset()));
81
82   QAction* dbgActHardReset = new QAction("Hard Reset", this);
83   dbgActHardReset->setShortcut(QKeySequence("Shift+F3"));
84   connect(dbgActHardReset, SIGNAL(triggered()), this, SLOT(debugActHardReset()));
85
86   QAction* dbgActClose = new QAction("Close &Window", this);
87   dbgActClose->setShortcut(QKeySequence::Close);
88   connect(dbgActClose, SIGNAL(triggered()), this, SLOT(debugActClose()));
89
90   QAction* dbgActQuit = new QAction("&Quit", this);
91   dbgActQuit->setShortcut(QKeySequence::Quit);
92   connect(dbgActQuit, SIGNAL(triggered()), this, SLOT(debugActQuit()));
93
94   // Construct the menu
95   QMenu* debugMenu = menuBar()->addMenu("&Debug");
96   debugMenu->addAction(debugActOpenMemory);
97   debugMenu->addAction(debugActOpenDasm);
98   debugMenu->addAction(debugActOpenLog);
99   debugMenu->addAction(debugActOpenPoints);
100   debugMenu->addAction(debugActOpenDevices);
101   debugMenu->addSeparator();
102   debugMenu->addAction(dbgActRun);
103   debugMenu->addAction(dbgActRunAndHide);
104   debugMenu->addAction(dbgActRunToNextCpu);
105   debugMenu->addAction(dbgActRunNextInt);
106   debugMenu->addAction(dbgActRunNextVBlank);
107   debugMenu->addSeparator();
108   debugMenu->addAction(dbgActStepInto);
109   debugMenu->addAction(dbgActStepOver);
110   debugMenu->addAction(dbgActStepOut);
111   debugMenu->addSeparator();
112   debugMenu->addAction(dbgActSoftReset);
113   debugMenu->addAction(dbgActHardReset);
114   debugMenu->addSeparator();
115   debugMenu->addAction(dbgActClose);
116   debugMenu->addAction(dbgActQuit);
117}
118
119
120WindowQt::~WindowQt()
121{
122}
123
124void WindowQt::debugActOpenMemory()
125{
126   MemoryWindow* foo = new MemoryWindow(m_machine, this);
127   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
128   // foo->setWindowFlags(Qt::Dialog);
129   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
130   foo->show();
131}
132
133
134void WindowQt::debugActOpenDasm()
135{
136   DasmWindow* foo = new DasmWindow(m_machine, this);
137   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
138   // foo->setWindowFlags(Qt::Dialog);
139   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
140   foo->show();
141}
142
143
144void WindowQt::debugActOpenLog()
145{
146   LogWindow* foo = new LogWindow(m_machine, this);
147   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
148   // foo->setWindowFlags(Qt::Dialog);
149   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
150   foo->show();
151}
152
153
154void WindowQt::debugActOpenPoints()
155{
156   BreakpointsWindow* foo = new BreakpointsWindow(m_machine, this);
157   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
158   // foo->setWindowFlags(Qt::Dialog);
159   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
160   foo->show();
161}
162
163
164void WindowQt::debugActOpenDevices()
165{
166   DevicesWindow* foo = new DevicesWindow(m_machine, this);
167   // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon
168   // foo->setWindowFlags(Qt::Dialog);
169   // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint);
170   foo->show();
171}
172
173
174void WindowQt::debugActRun()
175{
176   debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
177}
178
179void WindowQt::debugActRunAndHide()
180{
181   debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
182   hideAll();
183}
184
185void WindowQt::debugActRunToNextCpu()
186{
187   debug_cpu_get_visible_cpu(*m_machine)->debug()->go_next_device();
188}
189
190void WindowQt::debugActRunNextInt()
191{
192   debug_cpu_get_visible_cpu(*m_machine)->debug()->go_interrupt();
193}
194
195void WindowQt::debugActRunNextVBlank()
196{
197   debug_cpu_get_visible_cpu(*m_machine)->debug()->go_vblank();
198}
199
200void WindowQt::debugActStepInto()
201{
202   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
203}
204
205void WindowQt::debugActStepOver()
206{
207   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_over();
208}
209
210void WindowQt::debugActStepOut()
211{
212   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_out();
213}
214
215void WindowQt::debugActSoftReset()
216{
217   m_machine->schedule_soft_reset();
218   debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
219}
220
221void WindowQt::debugActHardReset()
222{
223   m_machine->schedule_hard_reset();
224}
225
226void WindowQt::debugActClose()
227{
228   close();
229}
230
231void WindowQt::debugActQuit()
232{
233   m_machine->schedule_exit();
234}
235
236
237//=========================================================================
238//  WindowQtConfig
239//=========================================================================
240void WindowQtConfig::buildFromQWidget(QWidget* widget)
241{
242   m_position.setX(widget->geometry().topLeft().x());
243   m_position.setY(widget->geometry().topLeft().y());
244   m_size.setX(widget->size().width());
245   m_size.setY(widget->size().height());
246}
247
248
249void WindowQtConfig::applyToQWidget(QWidget* widget)
250{
251   widget->setGeometry(m_position.x(), m_position.y(), m_size.x(), m_size.y());
252}
253
254
255void WindowQtConfig::addToXmlDataNode(xml_data_node* node) const
256{
257   xml_set_attribute_int(node, "type", m_type);
258   xml_set_attribute_int(node, "position_x", m_position.x());
259   xml_set_attribute_int(node, "position_y", m_position.y());
260   xml_set_attribute_int(node, "size_x", m_size.x());
261   xml_set_attribute_int(node, "size_y", m_size.y());
262}
263
264
265void WindowQtConfig::recoverFromXmlNode(xml_data_node* node)
266{
267   m_size.setX(xml_get_attribute_int(node, "size_x", m_size.x()));
268   m_size.setY(xml_get_attribute_int(node, "size_y", m_size.y()));
269   m_position.setX(xml_get_attribute_int(node, "position_x", m_position.x()));
270   m_position.setY(xml_get_attribute_int(node, "position_y", m_position.y()));
271   m_type = (WindowQtConfig::WindowType)xml_get_attribute_int(node, "type", m_type);
272}
trunk/src/osd/modules/debugger/qt/windowqt.h
r0r243595
1#ifndef __DEBUG_QT_WINDOW_QT_H__
2#define __DEBUG_QT_WINDOW_QT_H__
3
4#include <QtGui/QtGui>
5
6#include "emu.h"
7#include "config.h"
8#include "debugger.h"
9
10
11//============================================================
12//  The Qt window that everyone derives from.
13//============================================================
14class WindowQt : public QMainWindow
15{
16   Q_OBJECT
17
18public:
19   WindowQt(running_machine* machine, QWidget* parent=NULL);
20   virtual ~WindowQt();
21
22   // The interface to an all-window refresh
23   void refreshAll() { s_refreshAll = true; }
24   bool wantsRefresh() { return s_refreshAll; }
25   void clearRefreshFlag() { s_refreshAll = false; }
26
27   void hideAll() { s_hideAll = true; }
28   bool wantsHide() { return s_hideAll; }
29   void clearHideFlag() { s_hideAll = false; }
30
31
32protected slots:
33   void debugActOpenMemory();
34   void debugActOpenDasm();
35   void debugActOpenLog();
36   void debugActOpenPoints();
37   void debugActOpenDevices();
38   void debugActRun();
39   void debugActRunAndHide();
40   void debugActRunToNextCpu();
41   void debugActRunNextInt();
42   void debugActRunNextVBlank();
43   void debugActStepInto();
44   void debugActStepOver();
45   void debugActStepOut();
46   void debugActSoftReset();
47   void debugActHardReset();
48   virtual void debugActClose();
49   void debugActQuit();
50
51
52protected:
53   running_machine* m_machine;
54
55   static bool s_refreshAll;
56   static bool s_hideAll;
57};
58
59
60//=========================================================================
61//  A way to store the configuration of a window long enough to read/write.
62//=========================================================================
63class WindowQtConfig
64{
65public:
66   enum WindowType
67   {
68      WIN_TYPE_UNKNOWN,
69      WIN_TYPE_MAIN,
70      WIN_TYPE_MEMORY,
71      WIN_TYPE_DASM,
72      WIN_TYPE_LOG,
73      WIN_TYPE_BREAK_POINTS,
74      WIN_TYPE_DEVICES,
75      WIN_TYPE_DEVICE_INFORMATION
76   };
77
78public:
79   WindowQtConfig(const WindowType& type=WIN_TYPE_UNKNOWN) :
80      m_type(type),
81      m_size(800, 600),
82      m_position(120, 120)
83   {}
84   virtual ~WindowQtConfig() {}
85
86   // Settings
87   WindowType m_type;
88   QPoint m_size;
89   QPoint m_position;
90
91   virtual void buildFromQWidget(QWidget* widget);
92   virtual void applyToQWidget(QWidget* widget);
93   virtual void addToXmlDataNode(xml_data_node* node) const;
94   virtual void recoverFromXmlNode(xml_data_node* node);
95};
96
97
98#endif
trunk/src/osd/modules/sound/sdl_sound.c
r243594r243595
1212#include "sound_module.h"
1313#include "modules/osdmodule.h"
1414
15#if (defined(OSD_SDL) || defined(USE_SDL_SOUND))
15#if (!defined(OSD_WINDOWS) || defined(USE_SDL_SOUND))
1616
1717// standard sdl header
1818#include "../../sdl/sdlinc.h"
trunk/src/osd/osdmini/osdmini.mak
r243594r243595
3939
4040# add a define identifying the target osd
4141DEFS += -DOSD_MINI
42DEFS += -DUSE_QTDEBUG=0
43DEFS += -DUSE_SDL=0
42
4443#-------------------------------------------------
4544# object and source roots
4645#-------------------------------------------------
r243594r243595
5453OBJDIRS += $(MINIOBJ) \
5554   $(OSDOBJ)/modules/sync \
5655   $(OSDOBJ)/modules/lib \
57   $(OSDOBJ)/modules/sound \
58   $(OSDOBJ)/modules/midi \
59   $(OSDOBJ)/modules/font \
60   $(OSDOBJ)/modules/netdev
56   $(OSDOBJ)/modules/midi
6157
6258#-------------------------------------------------
6359# OSD core library
r243594r243595
6965   $(MINIOBJ)/minimisc.o \
7066   $(MINIOBJ)/minisync.o \
7167   $(MINIOBJ)/minitime.o \
72   $(OSDOBJ)/modules/sync/work_mini.o \
73   $(OSDOBJ)/modules/osdmodule.o \
7468
7569#-------------------------------------------------
7670# OSD mini library
r243594r243595
7872
7973OSDOBJS = \
8074   $(MINIOBJ)/minimain.o \
75   $(OSDOBJ)/modules/sync/work_mini.o \
8176   $(OSDOBJ)/modules/lib/osdobj_common.o  \
82   $(OSDOBJ)/modules/midi/portmidi.o \
8377   $(OSDOBJ)/modules/midi/none.o \
84   $(OSDOBJ)/modules/lib/osdobj_common.o  \
85   $(OSDOBJ)/modules/sound/js_sound.o  \
86   $(OSDOBJ)/modules/sound/direct_sound.o  \
87   $(OSDOBJ)/modules/sound/sdl_sound.o  \
88   $(OSDOBJ)/modules/sound/none.o  \
89   $(OSDOBJ)/modules/font/font_sdl.o \
90   $(OSDOBJ)/modules/font/font_windows.o \
91   $(OSDOBJ)/modules/font/font_osx.o \
92   $(OSDOBJ)/modules/font/font_none.o \
93   $(OSDOBJ)/modules/netdev/pcap.o \
94   $(OSDOBJ)/modules/netdev/taptun.o \
95   $(OSDOBJ)/modules/netdev/none.o \
96   $(OSDOBJ)/modules/debugger/debugwin.o \
97   $(OSDOBJ)/modules/debugger/debugint.o \
98   $(OSDOBJ)/modules/debugger/debugqt.o \
99   $(OSDOBJ)/modules/debugger/none.o \
10078
10179ifeq ($(OS),Windows_NT)
10280LIBS += -lwinmm -lwsock32
trunk/src/osd/sdl/sdl.mak
r243594r243595
558558CCOMFLAGS += -DNO_SDL_GLEXT
559559# Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
560560LIBS += `$(SDL_CONFIG) --libs | sed 's/-lSDLmain//'` -lpthread -framework Cocoa -framework OpenGL
561BASELIBS += `$(SDL_CONFIG) --libs | sed 's/-lSDLmain//'` -lpthread -framework Cocoa -framework OpenGL
562561DEFS += -DMACOSX_USE_LIBSDL
563562endif   # MACOSX_USE_LIBSDL
564563
r243594r243595
729728   $(MOC) $(MOCINCPATH) $(DEFS) $< -o $@
730729
731730DEBUGOBJS = \
732   $(OSDOBJ)/modules/debugger/qt/debugqtview.o \
733   $(OSDOBJ)/modules/debugger/qt/debugqtwindow.o \
734   $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.o \
735   $(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.o \
736   $(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.o \
737   $(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.o \
738   $(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.o \
739   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceswindow.o \
740   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.o \
741   $(OSDOBJ)/modules/debugger/qt/debugqtview.moc.o \
742   $(OSDOBJ)/modules/debugger/qt/debugqtwindow.moc.o \
743   $(OSDOBJ)/modules/debugger/qt/debugqtlogwindow.moc.o \
744   $(OSDOBJ)/modules/debugger/qt/debugqtdasmwindow.moc.o \
745   $(OSDOBJ)/modules/debugger/qt/debugqtmainwindow.moc.o \
746   $(OSDOBJ)/modules/debugger/qt/debugqtmemorywindow.moc.o \
747   $(OSDOBJ)/modules/debugger/qt/debugqtbreakpointswindow.moc.o \
748   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceswindow.moc.o \
749   $(OSDOBJ)/modules/debugger/qt/debugqtdeviceinformationwindow.moc.o
731   $(OSDOBJ)/modules/debugger/qt/debuggerview.o \
732   $(OSDOBJ)/modules/debugger/qt/windowqt.o \
733   $(OSDOBJ)/modules/debugger/qt/logwindow.o \
734   $(OSDOBJ)/modules/debugger/qt/dasmwindow.o \
735   $(OSDOBJ)/modules/debugger/qt/mainwindow.o \
736   $(OSDOBJ)/modules/debugger/qt/memorywindow.o \
737   $(OSDOBJ)/modules/debugger/qt/breakpointswindow.o \
738   $(OSDOBJ)/modules/debugger/qt/deviceswindow.o \
739   $(OSDOBJ)/modules/debugger/qt/deviceinformationwindow.o \
740   $(OSDOBJ)/modules/debugger/qt/debuggerview.moc.o \
741   $(OSDOBJ)/modules/debugger/qt/windowqt.moc.o \
742   $(OSDOBJ)/modules/debugger/qt/logwindow.moc.o \
743   $(OSDOBJ)/modules/debugger/qt/dasmwindow.moc.o \
744   $(OSDOBJ)/modules/debugger/qt/mainwindow.moc.o \
745   $(OSDOBJ)/modules/debugger/qt/memorywindow.moc.o \
746   $(OSDOBJ)/modules/debugger/qt/breakpointswindow.moc.o \
747   $(OSDOBJ)/modules/debugger/qt/deviceswindow.moc.o \
748   $(OSDOBJ)/modules/debugger/qt/deviceinformationwindow.moc.o
750749
751750DEFS += -DUSE_QTDEBUG=1
752751


Previous 199869 Revisions Next


© 1997-2024 The MAME Team