branches/alto2/src/emu/debug/dvdisasm.c
r26401 | r26402 | |
340 | 340 | bool changed = false; |
341 | 341 | const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); |
342 | 342 | int char_num = source.is_octal() ? 3 : 2; |
| 343 | UINT32 need_dasm_width = m_dasm_width; |
343 | 344 | |
344 | 345 | // determine how many characters we need for an address and set the divider |
345 | 346 | m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1; |
r26401 | r26402 | |
420 | 421 | |
421 | 422 | // append the UTF-8 decoded disassembly to the buffer |
422 | 423 | const char* src = buffer; |
| 424 | size_t avail = strlen(buffer); |
423 | 425 | for (UINT32 offs = 0; offs < m_dasm_width + 2; offs++) |
424 | 426 | { |
425 | 427 | destbuf[m_divider1 + 1 + offs] = ' '; |
426 | 428 | if (!*src) |
427 | 429 | 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) { |
430 | 432 | src += len; |
| 433 | avail -= len; |
| 434 | } |
431 | 435 | } |
| 436 | // do we need to increase m_dasm_width? |
| 437 | if (*src) |
| 438 | need_dasm_width = utf8_width(buffer); |
432 | 439 | |
433 | 440 | // output the right column |
434 | 441 | if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED) |
r26401 | r26402 | |
459 | 466 | |
460 | 467 | // now longer need to recompute |
461 | 468 | 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); |
462 | 472 | return changed; |
463 | 473 | } |
464 | 474 | |