Previous 199869 Revisions Next

r26113 Tuesday 12th November, 2013 at 04:39:19 UTC by Jürgen Buchmüller
A first try at making debugvw and friends use src/lib/util/unicode.c|h type unicode_char
[/branches/alto2/src/emu/cpu/alto2]alto2.c alto2.h alto2dsm.c
[/branches/alto2/src/emu/debug]debugvw.h dvbpoints.c dvdisasm.c dvdisasm.h dvmemory.c dvstate.c dvtext.c dvwpoints.c textbuf.c textbuf.h
[/branches/alto2/src/emu/debugint]debugint.c
[/branches/alto2/src/emu/imagedev]diablo.c
[/branches/alto2/src/mess/drivers]alto2.c
[/branches/alto2/src/mess/includes]alto2.h
[/branches/alto2/src/osd/sdl]debugqtview.c

branches/alto2/src/osd/sdl/debugqtview.c
r26112r26113
135135         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
136136         painter.drawText(x*fontWidth,
137137                        (y*fontHeight + (fontHeight*0.80)),
138                        QString(m_view->viewdata()[viewDataOffset].byte));
138                        QString(QChar(m_view->viewdata()[viewDataOffset].uchar)));
139139         viewDataOffset++;
140140      }
141141   }
branches/alto2/src/emu/debug/dvbpoints.c
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvbpoints.c
5   dvbpoints.c
66
7    Breakpoint debugger view.
7   Breakpoint debugger view.
88
99***************************************************************************/
1010
r26112r26113
380380
381381         for (int i = 0; i < m_visible.x; i++)
382382         {
383            dest->byte = (i < header.len()) ? header[i] : ' ';
383            dest->uchar = (i < header.len()) ? header[i] : ' ';
384384            dest->attrib = DCA_ANCILLARY;
385385            dest++;
386386         }
r26112r26113
415415
416416         for (int i = 0; i < m_visible.x; i++)
417417         {
418            dest->byte = (i < buffer.len()) ? buffer[i] : ' ';
418            dest->uchar = (i < buffer.len()) ? buffer[i] : ' ';
419419            dest->attrib = DCA_NORMAL;
420420
421421            // Color disabled breakpoints red
422            if (i == 5 && dest->byte == 'O')
422            if (i == 5 && dest->uchar == 'O')
423423               dest->attrib = DCA_CHANGED;
424424
425425            dest++;
r26112r26113
430430      // Fill the remaining vertical space
431431      for (int i = 0; i < m_visible.x; i++)
432432      {
433         dest->byte = ' ';
433         dest->uchar = ' ';
434434         dest->attrib = DCA_NORMAL;
435435         dest++;
436436      }
branches/alto2/src/emu/debug/debugvw.h
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    debugvw.h
5   debugvw.h
66
7    Debugger view engine.
7   Debugger view engine.
88
99***************************************************************************/
1010
r26112r26113
1212#define __DEBUGVIEW_H__
1313
1414#include "express.h"
15#include "unicode.h"
1516
1617
1718//**************************************************************************
r26112r26113
9293// a single "character" in the debug view has an ASCII value and an attribute byte
9394struct debug_view_char
9495{
95   UINT8               byte;
96   unicode_char        uchar;
9697   UINT8               attrib;
9798};
9899
branches/alto2/src/emu/debug/dvdisasm.c
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvdisasm.c
5   dvdisasm.c
66
7    Disassembly debugger view.
7   Disassembly debugger view.
88
99***************************************************************************/
1010
r26112r26113
1414#include "debugcpu.h"
1515
1616
17//**************************************************************************
18//  UNICODE HELPERS
19//**************************************************************************
20static int unicode_strlen(const unicode_char* src)
21{
22   int len = 0;
23   while (*src++)
24      len++;
25   return len;
26}
1727
28static int unicode_strncmp(const unicode_char* dst, const unicode_char* src, size_t len)
29{
30   while (*src && *dst && *src == *dst && len > 0) {
31      src++;
32      dst++;
33      len--;
34   }
35   if (*src != *dst)
36      return *src < *dst ? -1 : +1;
37   return 0;
38}
39
40static int unicode_sprintf(unicode_char* dst, const char* format, ...)
41{
42   va_list ap;
43   char buff[256];
44   va_start(ap, format);
45   int len = vsnprintf(buff, sizeof(buff), format, ap);
46   va_end(ap);
47   for (int i = 0; i < len; i++)
48      *dst++ = buff[i];
49   *dst = 0;
50   return len;
51}
52
53static unicode_char* unicode_strncpy(unicode_char* dst, const unicode_char* src, size_t len)
54{
55   unicode_char* str = dst;
56   while (*src && len > 0) {
57      *dst++ = *src++;
58      len--;
59   }
60   if (len > 0)
61      *dst = 0;
62   return str;
63}
64
1865//**************************************************************************
1966//  DEBUG VIEW DISASM SOURCE
2067//**************************************************************************
r26112r26113
334381//  disassembly view
335382//-------------------------------------------------
336383
384#define   DISASM_BUFFSIZE   128
337385bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
338386{
339387   bool changed = false;
r26112r26113
376424
377425      // allocate disassembly buffer
378426      auto_free(machine(), m_dasm);
379      m_dasm = auto_alloc_array(machine(), char, m_allocated.x * m_allocated.y);
427      m_dasm = auto_alloc_array(machine(), unicode_char, m_allocated.x * m_allocated.y);
380428   }
381429
382430   // iterate over lines
r26112r26113
387435
388436      // save a copy of the previous line as a backup if we're only doing one line
389437      int instr = startline + line;
390      char *destbuf = &m_dasm[instr * m_allocated.x];
391      char oldbuf[100];
438      unicode_char *destbuf = &m_dasm[instr * m_allocated.x];
439      unicode_char oldbuf[DISASM_BUFFSIZE];
392440      if (lines == 1)
393         strncpy(oldbuf, destbuf, MIN(sizeof(oldbuf), m_allocated.x));
441         unicode_strncpy(oldbuf, destbuf, MIN(DISASM_BUFFSIZE, m_allocated.x));
394442
395443      // convert back and set the address of this instruction
396444      m_byteaddress[instr] = pcbyte;
397      sprintf(&destbuf[0], " %s  ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal()));
445      unicode_sprintf(&destbuf[0], " %s  ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal()));
398446
399447      // make sure we can translate the address, and then disassemble the result
400      char buffer[100];
448      char buffer[DISASM_BUFFSIZE];
401449      int numbytes = 0;
402450      offs_t physpcbyte = pcbyte;
403451      if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
r26112r26113
418466         strcpy(buffer, "<unmapped>");
419467
420468      // append the disassembly to the buffer
421      sprintf(&destbuf[m_divider1 + 1], "%-*s  ", m_dasm_width, buffer);
469      const char* src = buffer;
470      for (UINT32 offs = 0; offs < m_dasm_width + 2; offs++)
471      {
472         destbuf[m_divider1 + 1 + offs] = ' ';
473         if (!*src)
474            continue;
475         int len = uchar_from_utf8(&destbuf[m_divider1 + 1 + offs], src, strlen(src));
476         if (len > 0)
477            src += len;
478      }
422479
423480      // output the right column
424481      if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
425482      {
426483         // get the bytes
427484         numbytes = source.m_space.address_to_byte(numbytes) & source.m_space.logbytemask();
428         generate_bytes(pcbyte, numbytes, minbytes, &destbuf[m_divider2], m_allocated.x - m_divider2, m_right_column == DASM_RIGHTCOL_ENCRYPTED);
485         generate_bytes(pcbyte, numbytes, minbytes, buffer, m_allocated.x - m_divider2, m_right_column == DASM_RIGHTCOL_ENCRYPTED);
486         unicode_sprintf(&destbuf[m_divider2], "%s", buffer);
429487      }
430488      else if (m_right_column == DASM_RIGHTCOL_COMMENTS)
431489      {
r26112r26113
433491         offs_t comment_address = source.m_space.byte_to_address(m_byteaddress[instr]);
434492         const char *text = source.m_device.debug()->comment_text(comment_address);
435493         if (text != NULL)
436            sprintf(&destbuf[m_divider2], "// %.*s", m_allocated.x - m_divider2 - 1, text);
494            unicode_sprintf(&destbuf[m_divider2], "// %.*s", m_allocated.x - m_divider2 - 1, text);
437495      }
438496
439497      // see if the line changed at all
440      if (lines == 1 && strncmp(oldbuf, destbuf, MIN(sizeof(oldbuf), m_allocated.x)) != 0)
498      if (lines == 1 && unicode_strncmp(oldbuf, destbuf, MIN(DISASM_BUFFSIZE, m_allocated.x)) != 0)
441499         changed = true;
442500   }
443501
r26112r26113
585643            attrib |= DCA_VISITED;
586644
587645         // get the effective string
588         const char *data = &m_dasm[effrow * m_allocated.x];
589         UINT32 len = (UINT32)strlen(data);
646         const unicode_char *data = &m_dasm[effrow * m_allocated.x];
647         UINT32 len = unicode_strlen(data);
590648
591649         // copy data
592650         UINT32 effcol = m_topleft.x;
593651         while (col < m_visible.x && effcol < len)
594652         {
595            dest->byte = data[effcol++];
653            dest->uchar = data[effcol++];
596654            dest->attrib = (effcol <= m_divider1 || effcol >= m_divider2) ? (attrib | DCA_ANCILLARY) : attrib;
597655
598656            // comments are just green for now - maybe they shouldn't even be this?
r26112r26113
607665      // fill the rest with blanks
608666      while (col < m_visible.x)
609667      {
610         dest->byte = ' ';
668         dest->uchar = ' ';
611669         dest->attrib = (effrow < m_total.y) ? (attrib | DCA_ANCILLARY) : attrib;
612670         dest++;
613671         col++;
branches/alto2/src/emu/debug/dvstate.c
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvstate.c
5   dvstate.c
66
7    State debugger view.
7   State debugger view.
88
99***************************************************************************/
1010
r26112r26113
306306         // copy data
307307         while (col < m_visible.x && effcol < len)
308308         {
309            dest->byte = temp[effcol++];
309            dest->uchar = temp[effcol++];
310310            dest->attrib = attrib | ((effcol <= m_divider) ? DCA_ANCILLARY : DCA_NORMAL);
311311            dest++;
312312            col++;
r26112r26113
319319      // fill the rest with blanks
320320      while (col < m_visible.x)
321321      {
322         dest->byte = ' ';
322         dest->uchar = ' ';
323323         dest->attrib = DCA_NORMAL;
324324         dest++;
325325         col++;
branches/alto2/src/emu/debug/dvtext.c
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvtext.c
5   dvtext.c
66
7    Debugger simple text-based views.
7   Debugger simple text-based views.
88
99***************************************************************************/
1010
r26112r26113
1414#include "debugcon.h"
1515
1616
17//**************************************************************************
18//  UNICODE HELPERS
19//**************************************************************************
20static int unicode_strlen(const unicode_char* src)
21{
22   int len = 0;
23   while (*src++)
24      len++;
25   return len;
26}
1727
28
1829//**************************************************************************
1930//  DEBUG VIEW TEXTBUF
2031//**************************************************************************
r26112r26113
7586   debug_view_char *dest = m_viewdata;
7687   for (UINT32 row = 0; row < m_visible.y; row++)
7788   {
78      const char *line = text_buffer_get_seqnum_line(&m_textbuf, curseq++);
89      const unicode_char *line = text_buffer_get_seqnum_line(&m_textbuf, curseq++);
7990      UINT32 col = 0;
8091
8192      // if this visible row is valid, add it to the buffer
8293      if (line != NULL)
8394      {
84         size_t len = strlen(line);
95         size_t len = unicode_strlen(line);
8596         UINT32 effcol = m_topleft.x;
8697
8798         // copy data
8899         while (col < m_visible.x && effcol < len)
89100         {
90            dest->byte = line[effcol++];
101            dest->uchar = line[effcol++];
91102            dest->attrib = DCA_NORMAL;
92103            dest++;
93104            col++;
r26112r26113
97108      // fill the rest with blanks
98109      while (col < m_visible.x)
99110      {
100         dest->byte = ' ';
111         dest->uchar = ' ';
101112         dest->attrib = DCA_NORMAL;
102113         dest++;
103114         col++;
branches/alto2/src/emu/debug/dvdisasm.h
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvdisasm.h
5   dvdisasm.h
66
7    Disassembly debugger view.
7   Disassembly debugger view.
88
99***************************************************************************/
1010
r26112r26113
106106   debug_view_expression m_expression;         // expression-related information
107107   debug_view_xy       m_allocated;            // allocated rows/columns
108108   offs_t *            m_byteaddress;          // addresses of the instructions
109   char *              m_dasm;                 // disassembled instructions
109   unicode_char *      m_dasm;                 // disassembled instructions
110110
111111   // constants
112112   static const int DEFAULT_DASM_LINES = 1000;
branches/alto2/src/emu/debug/textbuf.c
r26112r26113
11/***************************************************************************
22
3    textbuf.c
3   textbuf.c
44
5    Debugger text buffering engine.
5   Debugger text buffering engine.
66
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
7   Copyright Nicola Salmoria and the MAME Team.
8   Visit http://mamedev.org for licensing and usage restrictions.
99
1010***************************************************************************/
1111
r26112r26113
1313#include "textbuf.h"
1414
1515
16
1716/***************************************************************************
18    CONSTANTS
17   CONSTANTS
1918***************************************************************************/
2019
2120#define MAX_LINE_LENGTH         250
r26112r26113
2322
2423
2524/***************************************************************************
26    TYPE DEFINITIONS
25   TYPE DEFINITIONS
2726***************************************************************************/
2827
2928struct text_buffer
3029{
31   char *                  buffer;
30   unicode_char *          buffer;
3231   INT32 *                 lineoffs;
3332   INT32                   bufsize;
3433   INT32                   bufstart;
r26112r26113
4342
4443
4544/***************************************************************************
46    INLINE FUNCTIONS
45   INLINE FUNCTIONS
4746***************************************************************************/
4847
4948/*-------------------------------------------------
50    buffer_used - return the number of bytes
51    currently held in the buffer
49   utf8_strlen - return the number of unicode
50   characters in UTF-8 encoded string
5251-------------------------------------------------*/
52INLINE int utf8_strlen(const char* src)
53{
54   int total = 0;
55   while (*src) {
56      UINT32 uchar;
57      int len = uchar_from_utf8(&uchar, src, strlen(src));
58      if (len < 0)
59         break;   // invalid UTF-8
60      total++;
61      src += len;
62   }
63   return total;
64}
5365
66/*-------------------------------------------------
67   buffer_used - return the number of bytes
68   currently held in the buffer
69-------------------------------------------------*/
70
5471INLINE INT32 buffer_used(text_buffer *text)
5572{
5673   INT32 used = text->bufend - text->bufstart;
r26112r26113
6178
6279
6380/*-------------------------------------------------
64    buffer_space - return the number of bytes
65    available in the buffer
81   buffer_space - return the number of bytes
82   available in the buffer
6683-------------------------------------------------*/
6784
6885INLINE INT32 buffer_space(text_buffer *text)
r26112r26113
7491
7592/***************************************************************************
7693
77    Buffer object management
94   Buffer object management
7895
7996***************************************************************************/
8097
8198/*-------------------------------------------------
82    text_buffer_alloc - allocate a new text buffer
99   text_buffer_alloc - allocate a new text buffer
83100-------------------------------------------------*/
84101
85102text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines)
r26112r26113
92109      return NULL;
93110
94111   /* allocate memory for the buffer itself */
95   text->buffer = (char *)osd_malloc_array(bytes);
112   text->buffer = (unicode_char *)osd_malloc_array(sizeof(unicode_char) * bytes);
96113   if (!text->buffer)
97114   {
98115      osd_free(text);
r26112r26113
118135
119136
120137/*-------------------------------------------------
121    text_buffer_free - free a previously allocated
122    text buffer
138   text_buffer_free - free a previously allocated
139   text buffer
123140-------------------------------------------------*/
124141
125142void text_buffer_free(text_buffer *text)
r26112r26113
133150
134151
135152/*-------------------------------------------------
136    text_buffer_clear - clear a text buffer
153   text_buffer_clear - clear a text buffer
137154-------------------------------------------------*/
138155
139156void text_buffer_clear(text_buffer *text)
r26112r26113
157174
158175/***************************************************************************
159176
160    Adding data to the buffer
177   Adding data to the buffer
161178
162179***************************************************************************/
163180
164181/*-------------------------------------------------
165    text_buffer_print - print data to the text
166    buffer
182   text_buffer_print - print data to the text
183   buffer
167184-------------------------------------------------*/
168185
169186void text_buffer_print(text_buffer *text, const char *data)
r26112r26113
173190
174191
175192/*-------------------------------------------------
176    text_buffer_print_wrap - print data to the
177    text buffer with word wrapping to a given
178    column
193   text_buffer_print_wrap - print data to the
194   text buffer with word wrapping to a given
195   column
179196-------------------------------------------------*/
180197
181198void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol)
r26112r26113
184201   INT32 needed_space;
185202
186203   /* we need to ensure there is enough space for this string plus enough for the max line length */
187   needed_space = (INT32)strlen(data) + MAX_LINE_LENGTH;
204   needed_space = utf8_strlen(data) + MAX_LINE_LENGTH;
188205
189206   /* make space in the buffer if we need to */
190207   while (buffer_space(text) < needed_space && text->linestart != text->lineend)
r26112r26113
196213   }
197214
198215   /* now add the data */
199   for ( ; *data; data++)
216   while (*data)
200217   {
201      int ch = *data;
218      unicode_char ch;
202219      int linelen;
220      int utf8len = uchar_from_utf8(&ch, data, strlen(data));
221      if (utf8len > 0)
222         data += utf8len;
203223
204224      /* a CR resets our position */
205225      if (ch == '\r')
r26112r26113
270290
271291/***************************************************************************
272292
273    Reading data from the buffer
293   Reading data from the buffer
274294
275295***************************************************************************/
276296
277297/*-------------------------------------------------
278    text_buffer_max_width - return the maximum
279    width of all lines seen so far
298   text_buffer_max_width - return the maximum
299   width of all lines seen so far
280300-------------------------------------------------*/
281301
282302UINT32 text_buffer_max_width(text_buffer *text)
r26112r26113
286306
287307
288308/*-------------------------------------------------
289    text_buffer_num_lines - return the number of
290    lines in the text buffer
309   text_buffer_num_lines - return the number of
310   lines in the text buffer
291311-------------------------------------------------*/
292312
293313UINT32 text_buffer_num_lines(text_buffer *text)
r26112r26113
300320
301321
302322/*-------------------------------------------------
303    text_buffer_line_index_to_seqnum - convert a
304    line index into a sequence number
323   text_buffer_line_index_to_seqnum - convert a
324   line index into a sequence number
305325-------------------------------------------------*/
306326
307327UINT32 text_buffer_line_index_to_seqnum(text_buffer *text, UINT32 index)
r26112r26113
311331
312332
313333/*-------------------------------------------------
314    text_buffer_get_seqnum_line - get a pointer to
315    an indexed line in the buffer
334   text_buffer_get_seqnum_line - get a pointer to
335   an indexed line in the buffer
316336-------------------------------------------------*/
317337
318const char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum)
338const unicode_char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum)
319339{
320340   UINT32 numlines = text_buffer_num_lines(text);
321341   UINT32 index = seqnum - text->linestartseq;
branches/alto2/src/emu/debug/textbuf.h
r26112r26113
11/***************************************************************************
22
3    textbuf.h
3   textbuf.h
44
5    Debugger text buffering engine.
5   Debugger text buffering engine.
66
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
7   Copyright Nicola Salmoria and the MAME Team.
8   Visit http://mamedev.org for licensing and usage restrictions.
99
1010***************************************************************************/
1111
1212#ifndef __TEXTBUF_H__
1313#define __TEXTBUF_H__
1414
15#include "unicode.h"
1516
1617/***************************************************************************
17    TYPE DEFINITIONS
18   TYPE DEFINITIONS
1819***************************************************************************/
1920
2021struct text_buffer;
r26112r26113
2223
2324
2425/***************************************************************************
25    FUNCTION PROTOTYPES
26   FUNCTION PROTOTYPES
2627***************************************************************************/
2728
2829/* allocate a new text buffer */
r26112r26113
5051UINT32 text_buffer_line_index_to_seqnum(text_buffer *text, UINT32 index);
5152
5253/* get a sequenced line from the text buffer */
53const char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum);
54const unicode_char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum);
5455
5556
5657#endif  /* __TEXTBUF_H__ */
branches/alto2/src/emu/debug/dvwpoints.c
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvwpoints.c
5   dvwpoints.c
66
7    Watchpoint debugger view.
7   Watchpoint debugger view.
88
99***************************************************************************/
1010
r26112r26113
444444
445445         for (int i = 0; i < m_visible.x; i++)
446446         {
447            dest->byte = (i < header.len()) ? header[i] : ' ';
447            dest->uchar = (i < header.len()) ? header[i] : ' ';
448448            dest->attrib = DCA_ANCILLARY;
449449            dest++;
450450         }
r26112r26113
486486
487487         for (int i = 0; i < m_visible.x; i++)
488488         {
489            dest->byte = (i < buffer.len()) ? buffer[i] : ' ';
489            dest->uchar = (i < buffer.len()) ? buffer[i] : ' ';
490490            dest->attrib = DCA_NORMAL;
491491
492492            // Color disabled watchpoints red
493            if (i == 5 && dest->byte == 'O')
493            if (i == 5 && dest->uchar == 'O')
494494               dest->attrib = DCA_CHANGED;
495495
496496            dest++;
r26112r26113
501501      // Fill the remaining vertical space
502502      for (int i = 0; i < m_visible.x; i++)
503503      {
504         dest->byte = ' ';
504         dest->uchar = ' ';
505505         dest->attrib = DCA_NORMAL;
506506         dest++;
507507      }
branches/alto2/src/emu/debug/dvmemory.c
r26112r26113
22// copyright-holders:Aaron Giles
33/*********************************************************************
44
5    dvmemory.c
5   dvmemory.c
66
7    Memory debugger view.
7   Memory debugger view.
88
99***************************************************************************/
1010
r26112r26113
220220      for (int ch = 0; ch < m_visible.x; ch++, dest++)
221221      {
222222         UINT32 effcol = m_topleft.x + ch;
223         dest->byte = ' ';
223         dest->uchar = ' ';
224224         dest->attrib = DCA_ANCILLARY;
225225         if (m_section[1].contains(effcol))
226226         {
r26112r26113
242242         dest = destrow + m_section[0].m_pos + 1;
243243         for (int ch = 0; addrtext[ch] != 0 && ch < m_section[0].m_width - 1; ch++, dest++)
244244            if (dest >= destmin && dest < destmax)
245               dest->byte = addrtext[ch];
245               dest->uchar = addrtext[ch];
246246
247247         // generate the data
248248         for (int chunknum = 0; chunknum < m_chunks_per_row; chunknum++)
r26112r26113
257257               {
258258                  UINT8 shift = posdata.m_shift[ch];
259259                  if (shift < 64)
260                     dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*';
260                     dest->uchar = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*';
261261               }
262262         }
263263
r26112r26113
270270               {
271271                  UINT64 chval;
272272                  bool ismapped = read(1, addrbyte + ch, chval);
273                  dest->byte = (ismapped && isprint(chval)) ? chval : '.';
273                  dest->uchar = (ismapped && isprint(chval)) ? chval : '.';
274274               }
275275         }
276276      }
branches/alto2/src/emu/debugint/debugint.c
r26112r26113
11/*********************************************************************
22
3    debugint.c
3   debugint.c
44
5    Internal debugger frontend using render interface.
5   Internal debugger frontend using render interface.
66
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
7   Copyright Nicola Salmoria and the MAME Team.
8   Visit http://mamedev.org for licensing and usage restrictions.
99
1010*********************************************************************/
1111
r26112r26113
2424
2525
2626/***************************************************************************
27    CONSTANTS
27   CONSTANTS
2828***************************************************************************/
2929
3030#define BORDER_YTHICKNESS 1
r26112r26113
5353};
5454
5555/***************************************************************************
56    MACROS
56   MACROS
5757***************************************************************************/
5858
5959//#define NX(_dv, _x) ((float) (_x)/(float)(_dv)->bounds.width())
r26112r26113
105105   } while (0)
106106
107107/***************************************************************************
108    TYPE DEFINITIONS
108   TYPE DEFINITIONS
109109***************************************************************************/
110110
111111struct adjustment
r26112r26113
136136};
137137
138138/***************************************************************************
139    FUNCTION PROTOTYPES
139   FUNCTION PROTOTYPES
140140***************************************************************************/
141141
142142static void dview_update(debug_view &dw, void *osdprivate);
r26112r26113
212212
213213
214214/***************************************************************************
215    INLINE FUNCTIONS
215   INLINE FUNCTIONS
216216***************************************************************************/
217217
218218INLINE int dview_is_state(DView *dv, int state)
r26112r26113
234234}
235235
236236/***************************************************************************
237    LOCAL VARIABLES
237   LOCAL VARIABLES
238238***************************************************************************/
239239
240240static render_font *    debug_font;
r26112r26113
709709      for(i=0; i<vsize.x; i++)
710710      {
711711         UINT16 s;
712         unsigned char v = viewdata->byte;
712         unsigned char v = viewdata->uchar;   // FIXME: uchar is 32 bit unicode
713713
714714         if (v != ' ')
715715         {
r26112r26113
908908#endif
909909
910910/*-------------------------------------------------
911    Menu Callbacks
911   Menu Callbacks
912912  -------------------------------------------------*/
913913
914914static void process_string(DView *dv, const char *str)
r26112r26113
10801080}
10811081
10821082/*-------------------------------------------------
1083    editor
1083   editor
10841084  -------------------------------------------------*/
10851085
10861086static void render_editor(DView_edit *editor)
r26112r26113
11171117}
11181118
11191119/*-------------------------------------------------
1120    menu_main_populate - populate the main menu
1120   menu_main_populate - populate the main menu
11211121  -------------------------------------------------*/
11221122
11231123class ui_menu_debug : public ui_menu {
r26112r26113
12561256
12571257
12581258/*-------------------------------------------------
1259    handle_editor - handle the editor
1259   handle_editor - handle the editor
12601260-------------------------------------------------*/
12611261
12621262static void handle_editor(running_machine &machine)
r26112r26113
13121312
13131313
13141314/*-------------------------------------------------
1315    menu_main - handle the main menu
1315   menu_main - handle the main menu
13161316-------------------------------------------------*/
13171317
13181318static void handle_menus(running_machine &machine)
branches/alto2/src/emu/cpu/alto2/alto2.c
r26112r26113
14361436void alto2_cpu_device::bs_read_r_0()
14371437{
14381438   UINT16 r = m_r[m_rsel];
1439   LOG((LOG_CPU,2,"   <-R%02o; %s (%#o)\n", m_rsel, r_name(m_rsel), r));
1439   LOG((LOG_CPU,2,"   R%02o; %s (%#o)\n", m_rsel, r_name(m_rsel), r));
14401440   m_bus &= r;
14411441}
14421442
r26112r26113
14461446void alto2_cpu_device::bs_load_r_0()
14471447{
14481448   UINT16 r = 0;
1449   LOG((LOG_CPU,2,"   R%02o<-; %s (BUS&=0)\n", m_rsel, r_name(m_rsel)));
1449   LOG((LOG_CPU,2,"   R%02o; %s (BUS&=0)\n", m_rsel, r_name(m_rsel)));
14501450   m_bus &= r;
14511451}
14521452
r26112r26113
14571457{
14581458   if (MIR_F2(m_mir) != f2_emu_load_dns) {
14591459      m_r[m_rsel] = m_shifter;
1460      LOG((LOG_CPU,2,"   R%02o<-; %s = SHIFTER (%#o)\n", m_rsel, r_name(m_rsel), m_shifter));
1460      LOG((LOG_CPU,2,"   R%02o; %s = SHIFTER (%#o)\n", m_rsel, r_name(m_rsel), m_shifter));
14611461      /* HACK: programs writing r37 with xxx3 make the cursor
14621462       * display go nuts. Until I found the real reason for this
14631463       * obviously buggy display, I just clear the two
r26112r26113
14791479   UINT32 mar = m_mem.mar;
14801480#endif
14811481   UINT16 md = read_mem();
1482   LOG((LOG_CPU,2,"   <-MD; BUS&=MD (%#o=[%#o])\n", md, mar));
1482   LOG((LOG_CPU,2,"   MD; BUS&=MD (%#o=[%#o])\n", md, mar));
14831483   m_bus &= md;
14841484}
14851485
r26112r26113
14891489void alto2_cpu_device::bs_mouse_0()
14901490{
14911491   UINT16 r = mouse_read();
1492   LOG((LOG_CPU,2,"   <-MOUSE; BUS&=MOUSE (%#o)\n", r));
1492   LOG((LOG_CPU,2,"   MOUSE; BUS&=MOUSE (%#o)\n", r));
14931493   m_bus &= r;
14941494}
14951495
r26112r26113
14991499void alto2_cpu_device::bs_disp_0()
15001500{
15011501   UINT16 r = 0177777;
1502   LOG((LOG_CPU,0,"BS <-DISP not handled by task %s mpc:%04x\n", task_name(m_task), m_mpc));
1503   LOG((LOG_CPU,2,"   <-DISP; BUS&=DISP ?? (%#o)\n", r));
1502   LOG((LOG_CPU,0,"BS ←DISP not handled by task %s mpc:%04x\n", task_name(m_task), m_mpc));
1503   LOG((LOG_CPU,2,"   ←DISP; BUS&=DISP ?? (%#o)\n", r));
15041504   m_bus &= r;
15051505}
15061506
r26112r26113
18851885      LOG((LOG_CPU,2, "   XMAR %#o (%#o)\n", mar, m_bus));
18861886   } else {
18871887      write_mem(m_bus);
1888      LOG((LOG_CPU,2, "   MD<- BUS ([%#o]=%#o)\n", mar, m_bus));
1888      LOG((LOG_CPU,2, "   MD BUS ([%#o]=%#o)\n", mar, m_bus));
18891889   }
18901890}
18911891
r26112r26113
24112411      /* nano seconds per cycle */
24122412      m_ntime[m_task] += ALTO2_UCYCLE;
24132413
2414      debugger_instruction_hook(this, m_mpc);
24142415      /* next instruction's mpc */
2415      debugger_instruction_hook(this, m_mpc);
24162416      m_mpc = m_next;
24172417      m_mir = m_ucode->read_dword(m_mpc);
24182418      m_rsel = MIR_RSEL(m_mir);
r26112r26113
24342434
24352435      if (f1 == f1_load_mar) {
24362436         if (check_mem_load_mar_stall(m_rsel)) {
2437            LOG((LOG_CPU,3, "   MAR<- stall\n"));
2437            LOG((LOG_CPU,3, "   MAR stall\n"));
24382438            m_next2 = m_next;
24392439            m_next = m_mpc;
24402440            continue;
24412441         }
24422442      } else if (f2 == f2_load_md) {
24432443         if (check_mem_write_stall()) {
2444            LOG((LOG_CPU,3, "   MD<- stall\n"));
2444            LOG((LOG_CPU,3, "   MD stall\n"));
24452445            m_next2 = m_next;
24462446            m_next = m_mpc;
24472447            continue;
r26112r26113
24492449      }
24502450      if (do_bs && bs == bs_read_md) {
24512451         if (check_mem_read_stall()) {
2452            LOG((LOG_CPU,3, "   <-MD stall\n"));
2452            LOG((LOG_CPU,3, "   MD stall\n"));
24532453            m_next2 = m_next;
24542454            m_next = m_mpc;
24552455            continue;
r26112r26113
24942494      /* compute the ALU function */
24952495      switch (aluf) {
24962496      /**
2497       * 00: ALU <- BUS
2497       * 00: ALU BUS
24982498       * PROM data for S3-0:1111 M:1 C:0
24992499       * 74181 function F=A
25002500       * T source is ALU
r26112r26113
25072507         m_aluc0 = 1;
25082508#endif
25092509         flags = TSELECT;
2510         LOG((LOG_CPU,2,"   ALU<- BUS (%#o := %#o)\n", alu, m_bus));
2510         LOG((LOG_CPU,2,"   ALU BUS (%#o := %#o)\n", alu, m_bus));
25112511         break;
25122512
25132513      /**
2514       * 01: ALU <- T
2514       * 01: ALU T
25152515       * PROM data for S3-0:1010 M:1 C:0
25162516       * 74181 function F=B
25172517       * T source is BUS
r26112r26113
25242524         m_aluc0 = 1;
25252525#endif
25262526         flags = 0;
2527         LOG((LOG_CPU,2,"   ALU<- T (%#o := %#o)\n", alu, m_t));
2527         LOG((LOG_CPU,2,"   ALU T (%#o := %#o)\n", alu, m_t));
25282528         break;
25292529
25302530      /**
2531       * 02: ALU <- BUS | T
2531       * 02: ALU BUS | T
25322532       * PROM data for S3-0:1110 M:1 C:0
25332533       * 74181 function F=A|B
25342534       * T source is ALU
r26112r26113
25412541         m_aluc0 = 1;
25422542#endif
25432543         flags = TSELECT;
2544         LOG((LOG_CPU,2,"   ALU<- BUS OR T (%#o := %#o | %#o)\n", alu, m_bus, m_t));
2544         LOG((LOG_CPU,2,"   ALU BUS OR T (%#o := %#o | %#o)\n", alu, m_bus, m_t));
25452545         break;
25462546
25472547      /**
2548       * 03: ALU <- BUS & T
2548       * 03: ALU BUS & T
25492549       * PROM data for S3-0:1011 M:1 C:0
25502550       * 74181 function F=A&B
25512551       * T source is BUS
r26112r26113
25582558         m_aluc0 = 1;
25592559#endif
25602560         flags = 0;
2561         LOG((LOG_CPU,2,"   ALU<- BUS AND T (%#o := %#o & %#o)\n", alu, m_bus, m_t));
2561         LOG((LOG_CPU,2,"   ALU BUS AND T (%#o := %#o & %#o)\n", alu, m_bus, m_t));
25622562         break;
25632563
25642564      /**
2565       * 04: ALU <- BUS ^ T
2565       * 04: ALU BUS ^ T
25662566       * PROM data for S3-0:0110 M:1 C:0
25672567       * 74181 function F=A^B
25682568       * T source is BUS
r26112r26113
25752575         m_aluc0 = 1;
25762576#endif
25772577         flags = 0;
2578         LOG((LOG_CPU,2,"   ALU<- BUS XOR T (%#o := %#o ^ %#o)\n", alu, m_bus, m_t));
2578         LOG((LOG_CPU,2,"   ALU BUS XOR T (%#o := %#o ^ %#o)\n", alu, m_bus, m_t));
25792579         break;
25802580
25812581      /**
2582       * 05: ALU <- BUS + 1
2582       * 05: ALU BUS + 1
25832583       * PROM data for S3-0:0000 M:0 C:0
25842584       * 74181 function F=A+1
25852585       * T source is ALU
r26112r26113
25922592         m_aluc0 = (alu >> 16) & 1;
25932593#endif
25942594         flags = ALUM2 | TSELECT;
2595         LOG((LOG_CPU,2,"   ALU<- BUS + 1 (%#o := %#o + 1)\n", alu, m_bus));
2595         LOG((LOG_CPU,2,"   ALU BUS + 1 (%#o := %#o + 1)\n", alu, m_bus));
25962596         break;
25972597
25982598      /**
2599       * 06: ALU <- BUS - 1
2599       * 06: ALU BUS - 1
26002600       * PROM data for S3-0:1111 M:0 C:1
26012601       * 74181 function F=A-1
26022602       * T source is ALU
r26112r26113
26092609         m_aluc0 = (~m_alu >> 16) & 1;
26102610#endif
26112611         flags = ALUM2 | TSELECT;
2612         LOG((LOG_CPU,2,"   ALU<- BUS - 1 (%#o := %#o - 1)\n", alu, m_bus));
2612         LOG((LOG_CPU,2,"   ALU BUS - 1 (%#o := %#o - 1)\n", alu, m_bus));
26132613         break;
26142614
26152615      /**
2616       * 07: ALU <- BUS + T
2616       * 07: ALU BUS + T
26172617       * PROM data for S3-0:1001 M:0 C:1
26182618       * 74181 function F=A+B
26192619       * T source is BUS
r26112r26113
26262626         m_aluc0 = (m_alu >> 16) & 1;
26272627#endif
26282628         flags = ALUM2;
2629         LOG((LOG_CPU,2,"   ALU<- BUS + T (%#o := %#o + %#o)\n", alu, m_bus, m_t));
2629         LOG((LOG_CPU,2,"   ALU BUS + T (%#o := %#o + %#o)\n", alu, m_bus, m_t));
26302630         break;
26312631
26322632      /**
2633       * 10: ALU <- BUS - T
2633       * 10: ALU BUS - T
26342634       * PROM data for S3-0:0110 M:0 C:0
26352635       * 74181 function F=A-B
26362636       * T source is BUS
r26112r26113
26432643         m_aluc0 = (~m_alu >> 16) & 1;
26442644#endif
26452645         flags = ALUM2;
2646         LOG((LOG_CPU,2,"   ALU<- BUS - T (%#o := %#o - %#o)\n", alu, m_bus, m_t));
2646         LOG((LOG_CPU,2,"   ALU BUS - T (%#o := %#o - %#o)\n", alu, m_bus, m_t));
26472647         break;
26482648
26492649      /**
2650       * 11: ALU <- BUS - T - 1
2650       * 11: ALU BUS - T - 1
26512651       * PROM data for S3-0:0110 M:0 C:1
26522652       * 74181 function F=A-B-1
26532653       * T source is BUS
r26112r26113
26602660         m_aluc0 = (~m_alu >> 16) & 1;
26612661#endif
26622662         flags = ALUM2;
2663         LOG((LOG_CPU,2,"   ALU<- BUS - T - 1 (%#o := %#o - %#o - 1)\n", alu, m_bus, m_t));
2663         LOG((LOG_CPU,2,"   ALU BUS - T - 1 (%#o := %#o - %#o - 1)\n", alu, m_bus, m_t));
26642664         break;
26652665
26662666      /**
2667       * 12: ALU <- BUS + T + 1
2667       * 12: ALU BUS + T + 1
26682668       * PROM data for S3-0:1001 M:0 C:0
26692669       * 74181 function F=A+B+1
26702670       * T source is ALU
r26112r26113
26772677         m_aluc0 = (m_alu >> 16) & 1;
26782678#endif
26792679         flags = ALUM2 | TSELECT;
2680         LOG((LOG_CPU,2,"   ALU<- BUS + T + 1 (%#o := %#o + %#o + 1)\n", alu, m_bus, m_t));
2680         LOG((LOG_CPU,2,"   ALU BUS + T + 1 (%#o := %#o + %#o + 1)\n", alu, m_bus, m_t));
26812681         break;
26822682
26832683      /**
2684       * 13: ALU <- BUS + SKIP
2684       * 13: ALU BUS + SKIP
26852685       * PROM data for S3-0:0000 M:0 C:SKIP
26862686       * 74181 function F=A (SKIP=1) or F=A+1 (SKIP=0)
26872687       * T source is ALU
r26112r26113
26942694         m_aluc0 = (m_alu >> 16) & 1;
26952695#endif
26962696         flags = ALUM2 | TSELECT;
2697         LOG((LOG_CPU,2,"   ALU<- BUS + SKIP (%#o := %#o + %#o)\n", alu, m_bus, m_emu.skip));
2697         LOG((LOG_CPU,2,"   ALU BUS + SKIP (%#o := %#o + %#o)\n", alu, m_bus, m_emu.skip));
26982698         break;
26992699
27002700      /**
2701       * 14: ALU <- BUS,T
2701       * 14: ALU BUS,T
27022702       * PROM data for S3-0:1011 M:1 C:0
27032703       * 74181 function F=A&B
27042704       * T source is ALU
r26112r26113
27112711         m_aluc0 = 1;
27122712#endif
27132713         flags = TSELECT;
2714         LOG((LOG_CPU,2,"   ALU<- BUS,T (%#o := %#o & %#o)\n", alu, m_bus, m_t));
2714         LOG((LOG_CPU,2,"   ALU BUS,T (%#o := %#o & %#o)\n", alu, m_bus, m_t));
27152715         break;
27162716
27172717      /**
2718       * 15: ALU <- BUS & ~T
2718       * 15: ALU BUS & ~T
27192719       * PROM data for S3-0:0111 M:1 C:0
27202720       * 74181 function F=A&~B
27212721       * T source is BUS
r26112r26113
27282728         m_aluc0 = 1;
27292729#endif
27302730         flags = 0;
2731         LOG((LOG_CPU,2,"   ALU<- BUS AND NOT T (%#o := %#o & ~%#o)\n", alu, m_bus, m_t));
2731         LOG((LOG_CPU,2,"   ALU BUS AND NOT T (%#o := %#o & ~%#o)\n", alu, m_bus, m_t));
27322732         break;
27332733
27342734      /**
2735       * 16: ALU <- ???
2735       * 16: ALU ???
27362736       * PROM data for S3-0:???? M:? C:?
27372737       * 74181 perhaps F=0 (0011/0/0)
27382738       * T source is BUS
r26112r26113
27452745         m_aluc0 = 1;
27462746#endif
27472747         flags = ALUM2;
2748         LOG((LOG_CPU,0,"   ALU<- 0 (illegal aluf in task %s, mpc:%05o aluf:%02o)\n", task_name(m_task), m_mpc, aluf));
2748         LOG((LOG_CPU,0,"   ALU 0 (illegal aluf in task %s, mpc:%05o aluf:%02o)\n", task_name(m_task), m_mpc, aluf));
27492749         break;
27502750
27512751      /**
2752       * 17: ALU <- ???
2752       * 17: ALU ???
27532753       * PROM data for S3-0:???? M:? C:?
27542754       * 74181 perhaps F=~0 (0011/0/1)
27552755       * T source is BUS
r26112r26113
27632763         m_aluc0 = 1;
27642764#endif
27652765         flags = ALUM2;
2766         LOG((LOG_CPU,0,"   ALU<- 0 (illegal aluf in task %s, mpc:%05o aluf:%02o)\n", task_name(m_task), m_mpc, aluf));
2766         LOG((LOG_CPU,0,"   ALU 0 (illegal aluf in task %s, mpc:%05o aluf:%02o)\n", task_name(m_task), m_mpc, aluf));
27672767      }
27682768      m_alu = static_cast<UINT16>(alu);
27692769
r26112r26113
27762776         if (m_task == task_emu) {
27772777            if (f2 == f2_emu_magic) {
27782778               m_shifter = ((m_l << 1) | (m_t >> 15)) & 0177777;
2779               LOG((LOG_CPU,2,"   SHIFTER <-L MLSH 1 (%#o := %#o<<1|%#o)\n", m_shifter, m_l, m_t >> 15));
2779               LOG((LOG_CPU,2,"   SHIFTER L MLSH 1 (%#o := %#o<<1|%#o)\n", m_shifter, m_l, m_t >> 15));
27802780               break;
27812781            }
27822782            if (f2 == f2_emu_load_dns) {
r26112r26113
27852785            }
27862786         }
27872787         m_shifter = (m_l << 1) & 0177777;
2788         LOG((LOG_CPU,2,"   SHIFTER <-L LSH 1 (%#o := %#o<<1)\n", m_shifter, m_l));
2788         LOG((LOG_CPU,2,"   SHIFTER L LSH 1 (%#o := %#o<<1)\n", m_shifter, m_l));
27892789         break;
27902790
27912791      case f1_l_rsh_1:
27922792         if (m_task == task_emu) {
27932793            if (f2 == f2_emu_magic) {
27942794               m_shifter = ((m_l >> 1) | (m_t << 15)) & 0177777;
2795               LOG((LOG_CPU,2,"   SHIFTER <-L MRSH 1 (%#o := %#o>>1|%#o)\n", m_shifter, m_l, (m_t << 15) & 0100000));
2795               LOG((LOG_CPU,2,"   SHIFTER L MRSH 1 (%#o := %#o>>1|%#o)\n", m_shifter, m_l, (m_t << 15) & 0100000));
27962796               break;
27972797            }
27982798            if (f2 == f2_emu_load_dns) {
r26112r26113
28012801            }
28022802         }
28032803         m_shifter = m_l >> 1;
2804         LOG((LOG_CPU,2,"   SHIFTER <-L RSH 1 (%#o := %#o>>1)\n", m_shifter, m_l));
2804         LOG((LOG_CPU,2,"   SHIFTER L RSH 1 (%#o := %#o>>1)\n", m_shifter, m_l));
28052805         break;
28062806
28072807      case f1_l_lcy_8:
28082808         m_shifter = ((m_l >> 8) | (m_l << 8)) & 0177777;
2809         LOG((LOG_CPU,2,"   SHIFTER <-L LCY 8 (%#o := bswap %#o)\n", m_shifter, m_l));
2809         LOG((LOG_CPU,2,"   SHIFTER L LCY 8 (%#o := bswap %#o)\n", m_shifter, m_l));
28102810         break;
28112811
28122812      default:
r26112r26113
28362836         m_l = m_alu;
28372837         if (flags & ALUM2) {
28382838            m_laluc0 = m_aluc0;
2839            LOG((LOG_CPU,2, "   L<- ALU (%#o); LALUC0<- ALUC0 (%o)\n", m_alu, m_laluc0));
2839            LOG((LOG_CPU,2, "   L ALU (%#o); LALUC0 ALUC0 (%o)\n", m_alu, m_aluc0));
28402840         } else {
28412841            m_laluc0 = 0;
2842            LOG((LOG_CPU,2, "   L<- ALU (%#o); LALUC0<- %o\n", m_alu, m_laluc0));
2842            LOG((LOG_CPU,2, "   L ALU (%#o); LALUC0 %o\n", m_alu, 0));
28432843         }
28442844         if (m_ram_related[m_task]) {
28452845            /* load M from ALU, if 'GOODTASK' */
28462846            m_m = m_alu;
28472847            /* also writes to S[bank][0], which can't be read */
28482848            m_s[m_s_reg_bank[m_task]][0] = m_alu;
2849            LOG((LOG_CPU,2, "   M<- ALU (%#o)\n", m_alu));
2849            LOG((LOG_CPU,2, "   M ALU (%#o)\n", m_alu));
28502850         }
28512851      }
28522852
r26112r26113
28542854      if (MIR_T(m_mir)) {
28552855         m_cram_addr = m_alu;
28562856         if (flags & TSELECT) {
2857            LOG((LOG_CPU,2, "   T<- ALU (%#o)\n", m_alu));
2857            LOG((LOG_CPU,2, "   T ALU (%#o)\n", m_alu));
28582858            m_t = m_alu;
28592859         } else {
2860            LOG((LOG_CPU,2, "   T<- BUS (%#o)\n", m_bus));
2860            LOG((LOG_CPU,2, "   T BUS (%#o)\n", m_bus));
28612861            m_t = m_bus;
28622862         }
28632863      }
branches/alto2/src/emu/cpu/alto2/alto2dsm.c
r26112r26113
194194   UINT32 mir = (static_cast<UINT32>(oprom[0]) << 24) |
195195         (static_cast<UINT32>(oprom[1]) << 16) |
196196         (static_cast<UINT32>(oprom[2]) << 8) |
197         (static_cast<UINT32>(oprom[3]));
197         (static_cast<UINT32>(oprom[3]) << 0);
198198   UINT8 rsel = static_cast<UINT8>((mir >> 27) & 31);
199199   UINT8 aluf = static_cast<UINT8>((mir >> 23) & 15);
200200   UINT8 bs = static_cast<UINT8>((mir >> 20) & 7);
r26112r26113
203203   UINT8 t = static_cast<UINT8>((mir >> 11) & 1);
204204   UINT8 l = static_cast<UINT8>((mir >> 10) & 1);
205205   offs_t next = static_cast<offs_t>(mir & 1023);
206   const UINT8* src = oprom + 4 * next;
206   const UINT8* src = oprom - 4 * pc + 4 * next;
207207   UINT32 next2 =  (static_cast<UINT32>(src[0]) << 24) |
208208         (static_cast<UINT32>(src[1]) << 16) |
209209         (static_cast<UINT32>(src[2]) << 8) |
210         (static_cast<UINT32>(src[3]));
210         (static_cast<UINT32>(src[3]) << 0);
211211   UINT16 prefetch = next2 & 1023;
212212   char *dst = buffer;
213213   offs_t result = 1 | DASMFLAG_SUPPORTED;
r26112r26113
219219   switch (aluf) {
220220   case  0: // T?: BUS
221221      if (t)
222         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
222         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
223223      if (l)
224         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
224         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
225225      if (bs == 1)
226         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
226         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
227227      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS) ");
228228      break;
229229   case  1: //   : T
230230      if (t)
231         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
231         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
232232      if (l)
233         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
233         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
234234      if (bs == 1)
235         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
235         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
236236      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(T) ");
237237      break;
238238   case  2: // T?: BUS OR T
239239      if (t)
240         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
240         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
241241      if (l)
242         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
242         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
243243      if (bs == 1)
244         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
244         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
245245      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS OR T) ");
246246      break;
247247   case  3: //   : BUS AND T
248248      if (t)
249         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
249         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
250250      if (l)
251         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
251         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
252252      if (bs == 1)
253         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
253         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
254254      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS AND T) ");
255255      break;
256256   case  4: //   : BUS XOR T
257257      if (t)
258         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
258         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
259259      if (l)
260         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
260         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
261261      if (bs == 1)
262         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
262         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
263263      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS XOR T) ");
264264      break;
265265   case  5: // T?: BUS + 1
266266      if (t)
267         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
267         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
268268      if (l)
269         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
269         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
270270      if (bs == 1)
271         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
271         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
272272      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + 1) ");
273273      break;
274274   case  6: // T?: BUS - 1
275275      if (t)
276         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
276         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
277277      if (l)
278         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
278         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
279279      if (bs == 1)
280         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
280         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
281281      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS - 1) ");
282282      break;
283283   case  7: //   : BUS + T
284284      if (t)
285         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
285         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
286286      if (l)
287         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
287         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
288288      if (bs == 1)
289         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
289         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
290290      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + T) ");
291291      break;
292292   case  8: //   : BUS - T
293293      if (t)
294         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
294         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
295295      if (l)
296         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
296         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
297297      if (bs == 1)
298         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
298         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
299299      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS - T) ");
300300      break;
301301   case  9: //   : BUS - T - 1
302302      if (t)
303         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
303         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
304304      if (l)
305         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
305         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
306306      if (bs == 1)
307         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
307         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
308308      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS - T - 1) ");
309309      break;
310310   case 10: // T?: BUS + T + 1
311311      if (t)
312         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
312         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
313313      if (l)
314         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
314         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
315315      if (bs == 1)
316         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
316         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
317317      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + T + 1) ");
318318      break;
319319   case 11: // T?: BUS + SKIP
320320      if (t)
321         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
321         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
322322      if (l)
323         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
323         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
324324      if (bs == 1)
325         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
325         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
326326      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + SKIP) ");
327327      break;
328328   case 12: // T?: BUS, T (AND)
329329      if (t)
330         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU ");
330         dst += snprintf(dst, len - (size_t)(dst - buffer), "TALU ");
331331      if (l)
332         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
332         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
333333      if (bs == 1)
334         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
334         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
335335      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS AND T) ");
336336      break;
337337   case 13: //   : BUS AND NOT T
338338      if (t)
339         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
339         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
340340      if (l)
341         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
341         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
342342      if (bs == 1)
343         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
343         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
344344      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS AND NOT T) ");
345345      break;
346346   case 14: //   : undefined
347347      if (t)
348         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
348         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
349349      if (l)
350         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
350         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
351351      if (bs == 1)
352         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
352         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
353353      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(14) ");
354354      break;
355355   case 15: //   : undefined
356356      if (t)
357         dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS ");
357         dst += snprintf(dst, len - (size_t)(dst - buffer), "TBUS ");
358358      if (l)
359         dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- ");
359         dst += snprintf(dst, len - (size_t)(dst - buffer), "L ");
360360      if (bs == 1)
361         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s<- ", regname[rsel]);
361         dst += snprintf(dst, len - (size_t)(dst - buffer), "%s ", regname[rsel]);
362362      dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(15) ");
363363      break;
364364   }
365365
366366   switch (bs) {
367367   case 0:   // read R
368      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-%s ", regname[rsel]);
368      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS%s ", regname[rsel]);
369369      break;
370370   case 1:   // load R from shifter output
371      // dst += snprintf(dst, len - (size_t)(dst - buffer), "; %s<-", rn[rsel]);
371      // dst += snprintf(dst, len - (size_t)(dst - buffer), "; %s", rn[rsel]);
372372      break;
373373   case 2: // enables no source to the BUS, leaving it all ones
374      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-177777 ");
374      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS177777 ");
375375      break;
376376   case 3:   // performs different functions in different tasks
377      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-BS3 ");
377      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUSBS3 ");
378378      break;
379379   case 4:   // performs different functions in different tasks
380      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-BS4 ");
380      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUSBS4 ");
381381      break;
382382   case 5:   // memory data
383      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-MD ");
383      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUSMD ");
384384      break;
385   case 6:   // BUS[3-0] <- MOUSE; BUS[15-4] <- -1
386      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-MOUSE ");
385   case 6:   // BUS[3-0] ← MOUSE; BUS[15-4] ← -1
386      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS←MOUSE ");
387387      break;
388388   case 7:   // IR[7-0], possibly sign extended
389      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-DISP ");
389      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUSDISP ");
390390      break;
391391   }
392392
r26112r26113
395395   case 0:   // no operation
396396      break;
397397   case 1:   // load MAR from ALU output; start main memory reference
398      dst += snprintf(dst, len - (size_t)(dst - buffer), "MAR<-ALU ");
398      dst += snprintf(dst, len - (size_t)(dst - buffer), "MARALU ");
399399      break;
400400   case 2:   // switch tasks if higher priority wakeup is pending
401401      dst += snprintf(dst, len - (size_t)(dst - buffer), "[TASK] ");
r26112r26113
404404      dst += snprintf(dst, len - (size_t)(dst - buffer), "[BLOCK] ");
405405      break;
406406   case 4:   // SHIFTER output will be L shifted left one place
407      dst += snprintf(dst, len - (size_t)(dst - buffer), "SHIFTER<-L(LSH1) ");
407      dst += snprintf(dst, len - (size_t)(dst - buffer), "SHIFTERL(LSH1) ");
408408      break;
409409   case 5:   // SHIFTER output will be L shifted right one place
410      dst += snprintf(dst, len - (size_t)(dst - buffer), "SHIFTER<-L(RSH1) ");
410      dst += snprintf(dst, len - (size_t)(dst - buffer), "SHIFTERL(RSH1) ");
411411      break;
412412   case 6:   // SHIFTER output will be L rotated left 8 places
413      dst += snprintf(dst, len - (size_t)(dst - buffer), "SHIFTER<-L(LCY8) ");
413      dst += snprintf(dst, len - (size_t)(dst - buffer), "SHIFTERL(LCY8) ");
414414      break;
415415   case 7:   // put the constant from PROM (RSELECT,BS) on the bus
416416      pa = (rsel << 3) | bs;
417      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-[%03o]%05o ", pa, const_prom[pa]);
417      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS[%03o]%05o ", pa, const_prom[pa]);
418418      break;
419419   default:
420420      dst += snprintf(dst, len - (size_t)(dst - buffer), "F1_%02o ", f1);
r26112r26113
424424   switch (f2) {
425425   case 0:   // no operation
426426      break;
427   case 1:   // NEXT <- NEXT OR (if (BUS=0) then 1 else 0)
427   case 1:   // NEXT NEXT OR (if (BUS=0) then 1 else 0)
428428      dst += snprintf(dst, len - (size_t)(dst - buffer), "[(BUS=0) ? %s : %s] ",
429429         addrname((prefetch | 1) & MCODE_MASK),
430430         addrname(prefetch & MCODE_MASK));
431431      break;
432   case 2:   // NEXT <- NEXT OR (if (SHIFTER OUTPUT<0) then 1 else 0)
432   case 2:   // NEXT NEXT OR (if (SHIFTER OUTPUT<0) then 1 else 0)
433433      dst += snprintf(dst, len - (size_t)(dst - buffer), "[(SH=0) ? %s : %s] ",
434434         addrname((prefetch | 1) & MCODE_MASK),
435435         addrname(prefetch & MCODE_MASK));
436436      break;
437   case 3:   // NEXT <- NEXT OR (if (SHIFTER OUTPUT<0) then 1 else 0)
437   case 3:   // NEXT NEXT OR (if (SHIFTER OUTPUT<0) then 1 else 0)
438438      dst += snprintf(dst, len - (size_t)(dst - buffer), "[(SH<0) ? %s : %s] ",
439439         addrname((prefetch | 1) & MCODE_MASK),
440440         addrname(prefetch & MCODE_MASK));
441441      break;
442   case 4:   // NEXT <- NEXT OR BUS
443      dst += snprintf(dst, len - (size_t)(dst - buffer), "NEXT<-BUS ");
442   case 4:   // NEXT ← NEXT OR BUS
443      dst += snprintf(dst, len - (size_t)(dst - buffer), "NEXT←BUS ");
444444      break;
445   case 5:   // NEXT <- NEXT OR ALUC0. ALUC0 is the carry produced by last L loading microinstruction.
445   case 5:   // NEXT NEXT OR ALUC0. ALUC0 is the carry produced by last L loading microinstruction.
446446      dst += snprintf(dst, len - (size_t)(dst - buffer), "[(ALUC0) ? %s : %s] ",
447447         addrname((prefetch | 1) & MCODE_MASK),
448448         addrname(prefetch & MCODE_MASK));
449449      break;
450450   case 6:   // deliver BUS data to memory
451      dst += snprintf(dst, len - (size_t)(dst - buffer), "MD<-BUS ");
451      dst += snprintf(dst, len - (size_t)(dst - buffer), "MDBUS ");
452452      break;
453453   case 7:   // put on the bus the constant from PROM (RSELECT,BS)
454454      pa = (rsel << 3) | bs;
455      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-[%03o]%05o ", pa, const_prom[pa]);
455      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS[%03o]%05o ", pa, const_prom[pa]);
456456      break;
457457   default:
458      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-F2_%02o ", f2);
458      dst += snprintf(dst, len - (size_t)(dst - buffer), "BUSF2_%02o ", f2);
459459      break;
460460   }
461461   return result;
branches/alto2/src/emu/cpu/alto2/alto2.h
r26112r26113
2525#endif
2626
2727#define   USE_PRIO_F9318   0         //!< define to 1 to use the F9318 priority encoder code
28#define   USE_ALU_74181   1         //!< define to 1 to use the SN74181 ALU code
28#define   USE_ALU_74181   0         //!< define to 1 to use the SN74181 ALU code
2929#define   DEBUG_DISPLAY_TIMING   0   //!< define to 1 to debug the display timing
3030
3131#define   ALTO2_TASKS      16         //!< 16 task slots
branches/alto2/src/emu/imagedev/diablo.c
r26112r26113
145145   cylinders   = option_resolution_lookup_int(create_args, 'C');
146146   heads       = option_resolution_lookup_int(create_args, 'H');
147147   sectors     = option_resolution_lookup_int(create_args, 'S');
148   sectorsize  = option_resolution_lookup_int(create_args, 'L');
148   sectorsize  = option_resolution_lookup_int(create_args, 'L') * sizeof(UINT16);
149149   hunksize    = option_resolution_lookup_int(create_args, 'K');
150150
151151   totalsectors = cylinders * heads * sectors;
branches/alto2/src/mess/includes/alto2.h
r26112r26113
1717   alto2_state(const machine_config &mconfig, device_type type, const char *tag)
1818      : driver_device(mconfig, type, tag),
1919      m_maincpu(*this, "maincpu"),
20      m_diablo0(*this, DIABLO_TAG(0)),
21      m_diablo1(*this, DIABLO_TAG(1)),
2022      m_io_row0(*this, "ROW0"),
2123      m_io_row1(*this, "ROW1"),
2224      m_io_row2(*this, "ROW2"),
r26112r26113
2527      m_io_row5(*this, "ROW5"),
2628      m_io_row6(*this, "ROW6"),
2729      m_io_row7(*this, "ROW7"),
28      m_disk0(*this, DIABLO_TAG(0)),
29      m_disk1(*this, DIABLO_TAG(1)),
3030      m_io_config(*this, "CONFIG")
3131      { }
3232
r26112r26113
4444
4545protected:
4646   required_device<cpu_device> m_maincpu;
47   optional_device<diablo_image_device> m_diablo0;
48   optional_device<diablo_image_device> m_diablo1;
4749   required_ioport m_io_row0;
4850   required_ioport m_io_row1;
4951   required_ioport m_io_row2;
r26112r26113
5254   required_ioport m_io_row5;
5355   required_ioport m_io_row6;
5456   required_ioport m_io_row7;
55   optional_device<diablo_image_device> m_disk0;
56   optional_device<diablo_image_device> m_disk1;
5757   optional_ioport m_io_config;
5858
5959   // FIXME: use device timers instead of individual emu_timer* in alto2 code(?)
branches/alto2/src/mess/drivers/alto2.c
r26112r26113
77 ***************************************************************************/
88
99#include "includes/alto2.h"
10#include "cpu/alto2/alto2.h"
11#include "cpu/alto2/a2roms.h"
1210
1311// FIXME: Is this required? The driver does not have/need access to RAM
1412READ16_MEMBER( alto2_state::alto2_ram_r )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team