Previous 199869 Revisions Next

r26402 Sunday 24th November, 2013 at 22:09:14 UTC by Jürgen Buchmüller
Make the debug_view_disasm auto-increase the disasm_width, if the disassembler output doesn't fit.
[/branches/alto2/src/emu/debug]dvdisasm.c

branches/alto2/src/emu/debug/dvdisasm.c
r26401r26402
340340   bool changed = false;
341341   const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
342342   int char_num =  source.is_octal() ? 3 : 2;
343   UINT32 need_dasm_width = m_dasm_width;
343344
344345   // determine how many characters we need for an address and set the divider
345346   m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1;
r26401r26402
420421
421422      // append the UTF-8 decoded disassembly to the buffer
422423      const char* src = buffer;
424      size_t avail = strlen(buffer);
423425      for (UINT32 offs = 0; offs < m_dasm_width + 2; offs++)
424426      {
425427         destbuf[m_divider1 + 1 + offs] = ' ';
426428         if (!*src)
427429            continue;
428         int len = uchar_from_utf8(&destbuf[m_divider1 + 1 + offs], src, strlen(src));
429         if (len > 0)
430         int len = uchar_from_utf8(&destbuf[m_divider1 + 1 + offs], src, avail);
431         if (len > 0) {
430432            src += len;
433            avail -= len;
434         }
431435      }
436      // do we need to increase m_dasm_width?
437      if (*src)
438         need_dasm_width = utf8_width(buffer);
432439
433440      // output the right column
434441      if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
r26401r26402
459466
460467   // now longer need to recompute
461468   m_recompute = false;
469   // except we need more columns for the disassembler's output
470   if (need_dasm_width > m_dasm_width)
471      set_disasm_width(need_dasm_width);
462472   return changed;
463473}
464474

Previous 199869 Revisions Next


© 1997-2024 The MAME Team