branches/alto2/src/emu/debug/dvdisasm.c
| r26112 | r26113 | |
| 2 | 2 | // copyright-holders:Aaron Giles |
| 3 | 3 | /********************************************************************* |
| 4 | 4 | |
| 5 | | dvdisasm.c |
| 5 | dvdisasm.c |
| 6 | 6 | |
| 7 | | Disassembly debugger view. |
| 7 | Disassembly debugger view. |
| 8 | 8 | |
| 9 | 9 | ***************************************************************************/ |
| 10 | 10 | |
| r26112 | r26113 | |
| 14 | 14 | #include "debugcpu.h" |
| 15 | 15 | |
| 16 | 16 | |
| 17 | //************************************************************************** |
| 18 | // UNICODE HELPERS |
| 19 | //************************************************************************** |
| 20 | static int unicode_strlen(const unicode_char* src) |
| 21 | { |
| 22 | int len = 0; |
| 23 | while (*src++) |
| 24 | len++; |
| 25 | return len; |
| 26 | } |
| 17 | 27 | |
| 28 | static 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 | |
| 40 | static 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 | |
| 53 | static 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 | |
| 18 | 65 | //************************************************************************** |
| 19 | 66 | // DEBUG VIEW DISASM SOURCE |
| 20 | 67 | //************************************************************************** |
| r26112 | r26113 | |
| 334 | 381 | // disassembly view |
| 335 | 382 | //------------------------------------------------- |
| 336 | 383 | |
| 384 | #define DISASM_BUFFSIZE 128 |
| 337 | 385 | bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) |
| 338 | 386 | { |
| 339 | 387 | bool changed = false; |
| r26112 | r26113 | |
| 376 | 424 | |
| 377 | 425 | // allocate disassembly buffer |
| 378 | 426 | 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); |
| 380 | 428 | } |
| 381 | 429 | |
| 382 | 430 | // iterate over lines |
| r26112 | r26113 | |
| 387 | 435 | |
| 388 | 436 | // save a copy of the previous line as a backup if we're only doing one line |
| 389 | 437 | 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]; |
| 392 | 440 | if (lines == 1) |
| 393 | | strncpy(oldbuf, destbuf, MIN(sizeof(oldbuf), m_allocated.x)); |
| 441 | unicode_strncpy(oldbuf, destbuf, MIN(DISASM_BUFFSIZE, m_allocated.x)); |
| 394 | 442 | |
| 395 | 443 | // convert back and set the address of this instruction |
| 396 | 444 | 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())); |
| 398 | 446 | |
| 399 | 447 | // make sure we can translate the address, and then disassemble the result |
| 400 | | char buffer[100]; |
| 448 | char buffer[DISASM_BUFFSIZE]; |
| 401 | 449 | int numbytes = 0; |
| 402 | 450 | offs_t physpcbyte = pcbyte; |
| 403 | 451 | if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte)) |
| r26112 | r26113 | |
| 418 | 466 | strcpy(buffer, "<unmapped>"); |
| 419 | 467 | |
| 420 | 468 | // 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 | } |
| 422 | 479 | |
| 423 | 480 | // output the right column |
| 424 | 481 | if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED) |
| 425 | 482 | { |
| 426 | 483 | // get the bytes |
| 427 | 484 | 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); |
| 429 | 487 | } |
| 430 | 488 | else if (m_right_column == DASM_RIGHTCOL_COMMENTS) |
| 431 | 489 | { |
| r26112 | r26113 | |
| 433 | 491 | offs_t comment_address = source.m_space.byte_to_address(m_byteaddress[instr]); |
| 434 | 492 | const char *text = source.m_device.debug()->comment_text(comment_address); |
| 435 | 493 | 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); |
| 437 | 495 | } |
| 438 | 496 | |
| 439 | 497 | // 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) |
| 441 | 499 | changed = true; |
| 442 | 500 | } |
| 443 | 501 | |
| r26112 | r26113 | |
| 585 | 643 | attrib |= DCA_VISITED; |
| 586 | 644 | |
| 587 | 645 | // 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); |
| 590 | 648 | |
| 591 | 649 | // copy data |
| 592 | 650 | UINT32 effcol = m_topleft.x; |
| 593 | 651 | while (col < m_visible.x && effcol < len) |
| 594 | 652 | { |
| 595 | | dest->byte = data[effcol++]; |
| 653 | dest->uchar = data[effcol++]; |
| 596 | 654 | dest->attrib = (effcol <= m_divider1 || effcol >= m_divider2) ? (attrib | DCA_ANCILLARY) : attrib; |
| 597 | 655 | |
| 598 | 656 | // comments are just green for now - maybe they shouldn't even be this? |
| r26112 | r26113 | |
| 607 | 665 | // fill the rest with blanks |
| 608 | 666 | while (col < m_visible.x) |
| 609 | 667 | { |
| 610 | | dest->byte = ' '; |
| 668 | dest->uchar = ' '; |
| 611 | 669 | dest->attrib = (effrow < m_total.y) ? (attrib | DCA_ANCILLARY) : attrib; |
| 612 | 670 | dest++; |
| 613 | 671 | col++; |
branches/alto2/src/emu/debug/textbuf.c
| r26112 | r26113 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | textbuf.c |
| 3 | textbuf.c |
| 4 | 4 | |
| 5 | | Debugger text buffering engine. |
| 5 | Debugger text buffering engine. |
| 6 | 6 | |
| 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. |
| 9 | 9 | |
| 10 | 10 | ***************************************************************************/ |
| 11 | 11 | |
| r26112 | r26113 | |
| 13 | 13 | #include "textbuf.h" |
| 14 | 14 | |
| 15 | 15 | |
| 16 | | |
| 17 | 16 | /*************************************************************************** |
| 18 | | CONSTANTS |
| 17 | CONSTANTS |
| 19 | 18 | ***************************************************************************/ |
| 20 | 19 | |
| 21 | 20 | #define MAX_LINE_LENGTH 250 |
| r26112 | r26113 | |
| 23 | 22 | |
| 24 | 23 | |
| 25 | 24 | /*************************************************************************** |
| 26 | | TYPE DEFINITIONS |
| 25 | TYPE DEFINITIONS |
| 27 | 26 | ***************************************************************************/ |
| 28 | 27 | |
| 29 | 28 | struct text_buffer |
| 30 | 29 | { |
| 31 | | char * buffer; |
| 30 | unicode_char * buffer; |
| 32 | 31 | INT32 * lineoffs; |
| 33 | 32 | INT32 bufsize; |
| 34 | 33 | INT32 bufstart; |
| r26112 | r26113 | |
| 43 | 42 | |
| 44 | 43 | |
| 45 | 44 | /*************************************************************************** |
| 46 | | INLINE FUNCTIONS |
| 45 | INLINE FUNCTIONS |
| 47 | 46 | ***************************************************************************/ |
| 48 | 47 | |
| 49 | 48 | /*------------------------------------------------- |
| 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 |
| 52 | 51 | -------------------------------------------------*/ |
| 52 | INLINE 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 | } |
| 53 | 65 | |
| 66 | /*------------------------------------------------- |
| 67 | buffer_used - return the number of bytes |
| 68 | currently held in the buffer |
| 69 | -------------------------------------------------*/ |
| 70 | |
| 54 | 71 | INLINE INT32 buffer_used(text_buffer *text) |
| 55 | 72 | { |
| 56 | 73 | INT32 used = text->bufend - text->bufstart; |
| r26112 | r26113 | |
| 61 | 78 | |
| 62 | 79 | |
| 63 | 80 | /*------------------------------------------------- |
| 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 |
| 66 | 83 | -------------------------------------------------*/ |
| 67 | 84 | |
| 68 | 85 | INLINE INT32 buffer_space(text_buffer *text) |
| r26112 | r26113 | |
| 74 | 91 | |
| 75 | 92 | /*************************************************************************** |
| 76 | 93 | |
| 77 | | Buffer object management |
| 94 | Buffer object management |
| 78 | 95 | |
| 79 | 96 | ***************************************************************************/ |
| 80 | 97 | |
| 81 | 98 | /*------------------------------------------------- |
| 82 | | text_buffer_alloc - allocate a new text buffer |
| 99 | text_buffer_alloc - allocate a new text buffer |
| 83 | 100 | -------------------------------------------------*/ |
| 84 | 101 | |
| 85 | 102 | text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) |
| r26112 | r26113 | |
| 92 | 109 | return NULL; |
| 93 | 110 | |
| 94 | 111 | /* 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); |
| 96 | 113 | if (!text->buffer) |
| 97 | 114 | { |
| 98 | 115 | osd_free(text); |
| r26112 | r26113 | |
| 118 | 135 | |
| 119 | 136 | |
| 120 | 137 | /*------------------------------------------------- |
| 121 | | text_buffer_free - free a previously allocated |
| 122 | | text buffer |
| 138 | text_buffer_free - free a previously allocated |
| 139 | text buffer |
| 123 | 140 | -------------------------------------------------*/ |
| 124 | 141 | |
| 125 | 142 | void text_buffer_free(text_buffer *text) |
| r26112 | r26113 | |
| 133 | 150 | |
| 134 | 151 | |
| 135 | 152 | /*------------------------------------------------- |
| 136 | | text_buffer_clear - clear a text buffer |
| 153 | text_buffer_clear - clear a text buffer |
| 137 | 154 | -------------------------------------------------*/ |
| 138 | 155 | |
| 139 | 156 | void text_buffer_clear(text_buffer *text) |
| r26112 | r26113 | |
| 157 | 174 | |
| 158 | 175 | /*************************************************************************** |
| 159 | 176 | |
| 160 | | Adding data to the buffer |
| 177 | Adding data to the buffer |
| 161 | 178 | |
| 162 | 179 | ***************************************************************************/ |
| 163 | 180 | |
| 164 | 181 | /*------------------------------------------------- |
| 165 | | text_buffer_print - print data to the text |
| 166 | | buffer |
| 182 | text_buffer_print - print data to the text |
| 183 | buffer |
| 167 | 184 | -------------------------------------------------*/ |
| 168 | 185 | |
| 169 | 186 | void text_buffer_print(text_buffer *text, const char *data) |
| r26112 | r26113 | |
| 173 | 190 | |
| 174 | 191 | |
| 175 | 192 | /*------------------------------------------------- |
| 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 |
| 179 | 196 | -------------------------------------------------*/ |
| 180 | 197 | |
| 181 | 198 | void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) |
| r26112 | r26113 | |
| 184 | 201 | INT32 needed_space; |
| 185 | 202 | |
| 186 | 203 | /* 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; |
| 188 | 205 | |
| 189 | 206 | /* make space in the buffer if we need to */ |
| 190 | 207 | while (buffer_space(text) < needed_space && text->linestart != text->lineend) |
| r26112 | r26113 | |
| 196 | 213 | } |
| 197 | 214 | |
| 198 | 215 | /* now add the data */ |
| 199 | | for ( ; *data; data++) |
| 216 | while (*data) |
| 200 | 217 | { |
| 201 | | int ch = *data; |
| 218 | unicode_char ch; |
| 202 | 219 | int linelen; |
| 220 | int utf8len = uchar_from_utf8(&ch, data, strlen(data)); |
| 221 | if (utf8len > 0) |
| 222 | data += utf8len; |
| 203 | 223 | |
| 204 | 224 | /* a CR resets our position */ |
| 205 | 225 | if (ch == '\r') |
| r26112 | r26113 | |
| 270 | 290 | |
| 271 | 291 | /*************************************************************************** |
| 272 | 292 | |
| 273 | | Reading data from the buffer |
| 293 | Reading data from the buffer |
| 274 | 294 | |
| 275 | 295 | ***************************************************************************/ |
| 276 | 296 | |
| 277 | 297 | /*------------------------------------------------- |
| 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 |
| 280 | 300 | -------------------------------------------------*/ |
| 281 | 301 | |
| 282 | 302 | UINT32 text_buffer_max_width(text_buffer *text) |
| r26112 | r26113 | |
| 286 | 306 | |
| 287 | 307 | |
| 288 | 308 | /*------------------------------------------------- |
| 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 |
| 291 | 311 | -------------------------------------------------*/ |
| 292 | 312 | |
| 293 | 313 | UINT32 text_buffer_num_lines(text_buffer *text) |
| r26112 | r26113 | |
| 300 | 320 | |
| 301 | 321 | |
| 302 | 322 | /*------------------------------------------------- |
| 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 |
| 305 | 325 | -------------------------------------------------*/ |
| 306 | 326 | |
| 307 | 327 | UINT32 text_buffer_line_index_to_seqnum(text_buffer *text, UINT32 index) |
| r26112 | r26113 | |
| 311 | 331 | |
| 312 | 332 | |
| 313 | 333 | /*------------------------------------------------- |
| 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 |
| 316 | 336 | -------------------------------------------------*/ |
| 317 | 337 | |
| 318 | | const char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum) |
| 338 | const unicode_char *text_buffer_get_seqnum_line(text_buffer *text, UINT32 seqnum) |
| 319 | 339 | { |
| 320 | 340 | UINT32 numlines = text_buffer_num_lines(text); |
| 321 | 341 | UINT32 index = seqnum - text->linestartseq; |
branches/alto2/src/emu/cpu/alto2/alto2.c
| r26112 | r26113 | |
| 1436 | 1436 | void alto2_cpu_device::bs_read_r_0() |
| 1437 | 1437 | { |
| 1438 | 1438 | 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)); |
| 1440 | 1440 | m_bus &= r; |
| 1441 | 1441 | } |
| 1442 | 1442 | |
| r26112 | r26113 | |
| 1446 | 1446 | void alto2_cpu_device::bs_load_r_0() |
| 1447 | 1447 | { |
| 1448 | 1448 | 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))); |
| 1450 | 1450 | m_bus &= r; |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| r26112 | r26113 | |
| 1457 | 1457 | { |
| 1458 | 1458 | if (MIR_F2(m_mir) != f2_emu_load_dns) { |
| 1459 | 1459 | 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)); |
| 1461 | 1461 | /* HACK: programs writing r37 with xxx3 make the cursor |
| 1462 | 1462 | * display go nuts. Until I found the real reason for this |
| 1463 | 1463 | * obviously buggy display, I just clear the two |
| r26112 | r26113 | |
| 1479 | 1479 | UINT32 mar = m_mem.mar; |
| 1480 | 1480 | #endif |
| 1481 | 1481 | 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)); |
| 1483 | 1483 | m_bus &= md; |
| 1484 | 1484 | } |
| 1485 | 1485 | |
| r26112 | r26113 | |
| 1489 | 1489 | void alto2_cpu_device::bs_mouse_0() |
| 1490 | 1490 | { |
| 1491 | 1491 | 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)); |
| 1493 | 1493 | m_bus &= r; |
| 1494 | 1494 | } |
| 1495 | 1495 | |
| r26112 | r26113 | |
| 1499 | 1499 | void alto2_cpu_device::bs_disp_0() |
| 1500 | 1500 | { |
| 1501 | 1501 | 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)); |
| 1504 | 1504 | m_bus &= r; |
| 1505 | 1505 | } |
| 1506 | 1506 | |
| r26112 | r26113 | |
| 1885 | 1885 | LOG((LOG_CPU,2, " XMAR %#o (%#o)\n", mar, m_bus)); |
| 1886 | 1886 | } else { |
| 1887 | 1887 | 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)); |
| 1889 | 1889 | } |
| 1890 | 1890 | } |
| 1891 | 1891 | |
| r26112 | r26113 | |
| 2411 | 2411 | /* nano seconds per cycle */ |
| 2412 | 2412 | m_ntime[m_task] += ALTO2_UCYCLE; |
| 2413 | 2413 | |
| 2414 | debugger_instruction_hook(this, m_mpc); |
| 2414 | 2415 | /* next instruction's mpc */ |
| 2415 | | debugger_instruction_hook(this, m_mpc); |
| 2416 | 2416 | m_mpc = m_next; |
| 2417 | 2417 | m_mir = m_ucode->read_dword(m_mpc); |
| 2418 | 2418 | m_rsel = MIR_RSEL(m_mir); |
| r26112 | r26113 | |
| 2434 | 2434 | |
| 2435 | 2435 | if (f1 == f1_load_mar) { |
| 2436 | 2436 | if (check_mem_load_mar_stall(m_rsel)) { |
| 2437 | | LOG((LOG_CPU,3, " MAR<- stall\n")); |
| 2437 | LOG((LOG_CPU,3, " MAR← stall\n")); |
| 2438 | 2438 | m_next2 = m_next; |
| 2439 | 2439 | m_next = m_mpc; |
| 2440 | 2440 | continue; |
| 2441 | 2441 | } |
| 2442 | 2442 | } else if (f2 == f2_load_md) { |
| 2443 | 2443 | if (check_mem_write_stall()) { |
| 2444 | | LOG((LOG_CPU,3, " MD<- stall\n")); |
| 2444 | LOG((LOG_CPU,3, " MD← stall\n")); |
| 2445 | 2445 | m_next2 = m_next; |
| 2446 | 2446 | m_next = m_mpc; |
| 2447 | 2447 | continue; |
| r26112 | r26113 | |
| 2449 | 2449 | } |
| 2450 | 2450 | if (do_bs && bs == bs_read_md) { |
| 2451 | 2451 | if (check_mem_read_stall()) { |
| 2452 | | LOG((LOG_CPU,3, " <-MD stall\n")); |
| 2452 | LOG((LOG_CPU,3, " ←MD stall\n")); |
| 2453 | 2453 | m_next2 = m_next; |
| 2454 | 2454 | m_next = m_mpc; |
| 2455 | 2455 | continue; |
| r26112 | r26113 | |
| 2494 | 2494 | /* compute the ALU function */ |
| 2495 | 2495 | switch (aluf) { |
| 2496 | 2496 | /** |
| 2497 | | * 00: ALU <- BUS |
| 2497 | * 00: ALU ← BUS |
| 2498 | 2498 | * PROM data for S3-0:1111 M:1 C:0 |
| 2499 | 2499 | * 74181 function F=A |
| 2500 | 2500 | * T source is ALU |
| r26112 | r26113 | |
| 2507 | 2507 | m_aluc0 = 1; |
| 2508 | 2508 | #endif |
| 2509 | 2509 | 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)); |
| 2511 | 2511 | break; |
| 2512 | 2512 | |
| 2513 | 2513 | /** |
| 2514 | | * 01: ALU <- T |
| 2514 | * 01: ALU ← T |
| 2515 | 2515 | * PROM data for S3-0:1010 M:1 C:0 |
| 2516 | 2516 | * 74181 function F=B |
| 2517 | 2517 | * T source is BUS |
| r26112 | r26113 | |
| 2524 | 2524 | m_aluc0 = 1; |
| 2525 | 2525 | #endif |
| 2526 | 2526 | 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)); |
| 2528 | 2528 | break; |
| 2529 | 2529 | |
| 2530 | 2530 | /** |
| 2531 | | * 02: ALU <- BUS | T |
| 2531 | * 02: ALU ← BUS | T |
| 2532 | 2532 | * PROM data for S3-0:1110 M:1 C:0 |
| 2533 | 2533 | * 74181 function F=A|B |
| 2534 | 2534 | * T source is ALU |
| r26112 | r26113 | |
| 2541 | 2541 | m_aluc0 = 1; |
| 2542 | 2542 | #endif |
| 2543 | 2543 | 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)); |
| 2545 | 2545 | break; |
| 2546 | 2546 | |
| 2547 | 2547 | /** |
| 2548 | | * 03: ALU <- BUS & T |
| 2548 | * 03: ALU ← BUS & T |
| 2549 | 2549 | * PROM data for S3-0:1011 M:1 C:0 |
| 2550 | 2550 | * 74181 function F=A&B |
| 2551 | 2551 | * T source is BUS |
| r26112 | r26113 | |
| 2558 | 2558 | m_aluc0 = 1; |
| 2559 | 2559 | #endif |
| 2560 | 2560 | 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)); |
| 2562 | 2562 | break; |
| 2563 | 2563 | |
| 2564 | 2564 | /** |
| 2565 | | * 04: ALU <- BUS ^ T |
| 2565 | * 04: ALU ← BUS ^ T |
| 2566 | 2566 | * PROM data for S3-0:0110 M:1 C:0 |
| 2567 | 2567 | * 74181 function F=A^B |
| 2568 | 2568 | * T source is BUS |
| r26112 | r26113 | |
| 2575 | 2575 | m_aluc0 = 1; |
| 2576 | 2576 | #endif |
| 2577 | 2577 | 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)); |
| 2579 | 2579 | break; |
| 2580 | 2580 | |
| 2581 | 2581 | /** |
| 2582 | | * 05: ALU <- BUS + 1 |
| 2582 | * 05: ALU ← BUS + 1 |
| 2583 | 2583 | * PROM data for S3-0:0000 M:0 C:0 |
| 2584 | 2584 | * 74181 function F=A+1 |
| 2585 | 2585 | * T source is ALU |
| r26112 | r26113 | |
| 2592 | 2592 | m_aluc0 = (alu >> 16) & 1; |
| 2593 | 2593 | #endif |
| 2594 | 2594 | 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)); |
| 2596 | 2596 | break; |
| 2597 | 2597 | |
| 2598 | 2598 | /** |
| 2599 | | * 06: ALU <- BUS - 1 |
| 2599 | * 06: ALU ← BUS - 1 |
| 2600 | 2600 | * PROM data for S3-0:1111 M:0 C:1 |
| 2601 | 2601 | * 74181 function F=A-1 |
| 2602 | 2602 | * T source is ALU |
| r26112 | r26113 | |
| 2609 | 2609 | m_aluc0 = (~m_alu >> 16) & 1; |
| 2610 | 2610 | #endif |
| 2611 | 2611 | 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)); |
| 2613 | 2613 | break; |
| 2614 | 2614 | |
| 2615 | 2615 | /** |
| 2616 | | * 07: ALU <- BUS + T |
| 2616 | * 07: ALU ← BUS + T |
| 2617 | 2617 | * PROM data for S3-0:1001 M:0 C:1 |
| 2618 | 2618 | * 74181 function F=A+B |
| 2619 | 2619 | * T source is BUS |
| r26112 | r26113 | |
| 2626 | 2626 | m_aluc0 = (m_alu >> 16) & 1; |
| 2627 | 2627 | #endif |
| 2628 | 2628 | 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)); |
| 2630 | 2630 | break; |
| 2631 | 2631 | |
| 2632 | 2632 | /** |
| 2633 | | * 10: ALU <- BUS - T |
| 2633 | * 10: ALU ← BUS - T |
| 2634 | 2634 | * PROM data for S3-0:0110 M:0 C:0 |
| 2635 | 2635 | * 74181 function F=A-B |
| 2636 | 2636 | * T source is BUS |
| r26112 | r26113 | |
| 2643 | 2643 | m_aluc0 = (~m_alu >> 16) & 1; |
| 2644 | 2644 | #endif |
| 2645 | 2645 | 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)); |
| 2647 | 2647 | break; |
| 2648 | 2648 | |
| 2649 | 2649 | /** |
| 2650 | | * 11: ALU <- BUS - T - 1 |
| 2650 | * 11: ALU ← BUS - T - 1 |
| 2651 | 2651 | * PROM data for S3-0:0110 M:0 C:1 |
| 2652 | 2652 | * 74181 function F=A-B-1 |
| 2653 | 2653 | * T source is BUS |
| r26112 | r26113 | |
| 2660 | 2660 | m_aluc0 = (~m_alu >> 16) & 1; |
| 2661 | 2661 | #endif |
| 2662 | 2662 | 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)); |
| 2664 | 2664 | break; |
| 2665 | 2665 | |
| 2666 | 2666 | /** |
| 2667 | | * 12: ALU <- BUS + T + 1 |
| 2667 | * 12: ALU ← BUS + T + 1 |
| 2668 | 2668 | * PROM data for S3-0:1001 M:0 C:0 |
| 2669 | 2669 | * 74181 function F=A+B+1 |
| 2670 | 2670 | * T source is ALU |
| r26112 | r26113 | |
| 2677 | 2677 | m_aluc0 = (m_alu >> 16) & 1; |
| 2678 | 2678 | #endif |
| 2679 | 2679 | 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)); |
| 2681 | 2681 | break; |
| 2682 | 2682 | |
| 2683 | 2683 | /** |
| 2684 | | * 13: ALU <- BUS + SKIP |
| 2684 | * 13: ALU ← BUS + SKIP |
| 2685 | 2685 | * PROM data for S3-0:0000 M:0 C:SKIP |
| 2686 | 2686 | * 74181 function F=A (SKIP=1) or F=A+1 (SKIP=0) |
| 2687 | 2687 | * T source is ALU |
| r26112 | r26113 | |
| 2694 | 2694 | m_aluc0 = (m_alu >> 16) & 1; |
| 2695 | 2695 | #endif |
| 2696 | 2696 | 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)); |
| 2698 | 2698 | break; |
| 2699 | 2699 | |
| 2700 | 2700 | /** |
| 2701 | | * 14: ALU <- BUS,T |
| 2701 | * 14: ALU ← BUS,T |
| 2702 | 2702 | * PROM data for S3-0:1011 M:1 C:0 |
| 2703 | 2703 | * 74181 function F=A&B |
| 2704 | 2704 | * T source is ALU |
| r26112 | r26113 | |
| 2711 | 2711 | m_aluc0 = 1; |
| 2712 | 2712 | #endif |
| 2713 | 2713 | 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)); |
| 2715 | 2715 | break; |
| 2716 | 2716 | |
| 2717 | 2717 | /** |
| 2718 | | * 15: ALU <- BUS & ~T |
| 2718 | * 15: ALU ← BUS & ~T |
| 2719 | 2719 | * PROM data for S3-0:0111 M:1 C:0 |
| 2720 | 2720 | * 74181 function F=A&~B |
| 2721 | 2721 | * T source is BUS |
| r26112 | r26113 | |
| 2728 | 2728 | m_aluc0 = 1; |
| 2729 | 2729 | #endif |
| 2730 | 2730 | 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)); |
| 2732 | 2732 | break; |
| 2733 | 2733 | |
| 2734 | 2734 | /** |
| 2735 | | * 16: ALU <- ??? |
| 2735 | * 16: ALU ← ??? |
| 2736 | 2736 | * PROM data for S3-0:???? M:? C:? |
| 2737 | 2737 | * 74181 perhaps F=0 (0011/0/0) |
| 2738 | 2738 | * T source is BUS |
| r26112 | r26113 | |
| 2745 | 2745 | m_aluc0 = 1; |
| 2746 | 2746 | #endif |
| 2747 | 2747 | 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)); |
| 2749 | 2749 | break; |
| 2750 | 2750 | |
| 2751 | 2751 | /** |
| 2752 | | * 17: ALU <- ??? |
| 2752 | * 17: ALU ← ??? |
| 2753 | 2753 | * PROM data for S3-0:???? M:? C:? |
| 2754 | 2754 | * 74181 perhaps F=~0 (0011/0/1) |
| 2755 | 2755 | * T source is BUS |
| r26112 | r26113 | |
| 2763 | 2763 | m_aluc0 = 1; |
| 2764 | 2764 | #endif |
| 2765 | 2765 | 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)); |
| 2767 | 2767 | } |
| 2768 | 2768 | m_alu = static_cast<UINT16>(alu); |
| 2769 | 2769 | |
| r26112 | r26113 | |
| 2776 | 2776 | if (m_task == task_emu) { |
| 2777 | 2777 | if (f2 == f2_emu_magic) { |
| 2778 | 2778 | 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)); |
| 2780 | 2780 | break; |
| 2781 | 2781 | } |
| 2782 | 2782 | if (f2 == f2_emu_load_dns) { |
| r26112 | r26113 | |
| 2785 | 2785 | } |
| 2786 | 2786 | } |
| 2787 | 2787 | 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)); |
| 2789 | 2789 | break; |
| 2790 | 2790 | |
| 2791 | 2791 | case f1_l_rsh_1: |
| 2792 | 2792 | if (m_task == task_emu) { |
| 2793 | 2793 | if (f2 == f2_emu_magic) { |
| 2794 | 2794 | 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)); |
| 2796 | 2796 | break; |
| 2797 | 2797 | } |
| 2798 | 2798 | if (f2 == f2_emu_load_dns) { |
| r26112 | r26113 | |
| 2801 | 2801 | } |
| 2802 | 2802 | } |
| 2803 | 2803 | 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)); |
| 2805 | 2805 | break; |
| 2806 | 2806 | |
| 2807 | 2807 | case f1_l_lcy_8: |
| 2808 | 2808 | 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)); |
| 2810 | 2810 | break; |
| 2811 | 2811 | |
| 2812 | 2812 | default: |
| r26112 | r26113 | |
| 2836 | 2836 | m_l = m_alu; |
| 2837 | 2837 | if (flags & ALUM2) { |
| 2838 | 2838 | 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)); |
| 2840 | 2840 | } else { |
| 2841 | 2841 | 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)); |
| 2843 | 2843 | } |
| 2844 | 2844 | if (m_ram_related[m_task]) { |
| 2845 | 2845 | /* load M from ALU, if 'GOODTASK' */ |
| 2846 | 2846 | m_m = m_alu; |
| 2847 | 2847 | /* also writes to S[bank][0], which can't be read */ |
| 2848 | 2848 | 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)); |
| 2850 | 2850 | } |
| 2851 | 2851 | } |
| 2852 | 2852 | |
| r26112 | r26113 | |
| 2854 | 2854 | if (MIR_T(m_mir)) { |
| 2855 | 2855 | m_cram_addr = m_alu; |
| 2856 | 2856 | 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)); |
| 2858 | 2858 | m_t = m_alu; |
| 2859 | 2859 | } else { |
| 2860 | | LOG((LOG_CPU,2, " T<- BUS (%#o)\n", m_bus)); |
| 2860 | LOG((LOG_CPU,2, " T← BUS (%#o)\n", m_bus)); |
| 2861 | 2861 | m_t = m_bus; |
| 2862 | 2862 | } |
| 2863 | 2863 | } |
branches/alto2/src/emu/cpu/alto2/alto2dsm.c
| r26112 | r26113 | |
| 194 | 194 | UINT32 mir = (static_cast<UINT32>(oprom[0]) << 24) | |
| 195 | 195 | (static_cast<UINT32>(oprom[1]) << 16) | |
| 196 | 196 | (static_cast<UINT32>(oprom[2]) << 8) | |
| 197 | | (static_cast<UINT32>(oprom[3])); |
| 197 | (static_cast<UINT32>(oprom[3]) << 0); |
| 198 | 198 | UINT8 rsel = static_cast<UINT8>((mir >> 27) & 31); |
| 199 | 199 | UINT8 aluf = static_cast<UINT8>((mir >> 23) & 15); |
| 200 | 200 | UINT8 bs = static_cast<UINT8>((mir >> 20) & 7); |
| r26112 | r26113 | |
| 203 | 203 | UINT8 t = static_cast<UINT8>((mir >> 11) & 1); |
| 204 | 204 | UINT8 l = static_cast<UINT8>((mir >> 10) & 1); |
| 205 | 205 | 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; |
| 207 | 207 | UINT32 next2 = (static_cast<UINT32>(src[0]) << 24) | |
| 208 | 208 | (static_cast<UINT32>(src[1]) << 16) | |
| 209 | 209 | (static_cast<UINT32>(src[2]) << 8) | |
| 210 | | (static_cast<UINT32>(src[3])); |
| 210 | (static_cast<UINT32>(src[3]) << 0); |
| 211 | 211 | UINT16 prefetch = next2 & 1023; |
| 212 | 212 | char *dst = buffer; |
| 213 | 213 | offs_t result = 1 | DASMFLAG_SUPPORTED; |
| r26112 | r26113 | |
| 219 | 219 | switch (aluf) { |
| 220 | 220 | case 0: // T?: BUS |
| 221 | 221 | if (t) |
| 222 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 222 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 223 | 223 | if (l) |
| 224 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 224 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 225 | 225 | 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]); |
| 227 | 227 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS) "); |
| 228 | 228 | break; |
| 229 | 229 | case 1: // : T |
| 230 | 230 | if (t) |
| 231 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 231 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 232 | 232 | if (l) |
| 233 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 233 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 234 | 234 | 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]); |
| 236 | 236 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(T) "); |
| 237 | 237 | break; |
| 238 | 238 | case 2: // T?: BUS OR T |
| 239 | 239 | if (t) |
| 240 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 240 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 241 | 241 | if (l) |
| 242 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 242 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 243 | 243 | 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]); |
| 245 | 245 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS OR T) "); |
| 246 | 246 | break; |
| 247 | 247 | case 3: // : BUS AND T |
| 248 | 248 | if (t) |
| 249 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 249 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 250 | 250 | if (l) |
| 251 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 251 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 252 | 252 | 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]); |
| 254 | 254 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS AND T) "); |
| 255 | 255 | break; |
| 256 | 256 | case 4: // : BUS XOR T |
| 257 | 257 | if (t) |
| 258 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 258 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 259 | 259 | if (l) |
| 260 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 260 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 261 | 261 | 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]); |
| 263 | 263 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS XOR T) "); |
| 264 | 264 | break; |
| 265 | 265 | case 5: // T?: BUS + 1 |
| 266 | 266 | if (t) |
| 267 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 267 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 268 | 268 | if (l) |
| 269 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 269 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 270 | 270 | 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]); |
| 272 | 272 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + 1) "); |
| 273 | 273 | break; |
| 274 | 274 | case 6: // T?: BUS - 1 |
| 275 | 275 | if (t) |
| 276 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 276 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 277 | 277 | if (l) |
| 278 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 278 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 279 | 279 | 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]); |
| 281 | 281 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS - 1) "); |
| 282 | 282 | break; |
| 283 | 283 | case 7: // : BUS + T |
| 284 | 284 | if (t) |
| 285 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 285 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 286 | 286 | if (l) |
| 287 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 287 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 288 | 288 | 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]); |
| 290 | 290 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + T) "); |
| 291 | 291 | break; |
| 292 | 292 | case 8: // : BUS - T |
| 293 | 293 | if (t) |
| 294 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 294 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 295 | 295 | if (l) |
| 296 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 296 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 297 | 297 | 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]); |
| 299 | 299 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS - T) "); |
| 300 | 300 | break; |
| 301 | 301 | case 9: // : BUS - T - 1 |
| 302 | 302 | if (t) |
| 303 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 303 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 304 | 304 | if (l) |
| 305 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 305 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 306 | 306 | 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]); |
| 308 | 308 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS - T - 1) "); |
| 309 | 309 | break; |
| 310 | 310 | case 10: // T?: BUS + T + 1 |
| 311 | 311 | if (t) |
| 312 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 312 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 313 | 313 | if (l) |
| 314 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 314 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 315 | 315 | 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]); |
| 317 | 317 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + T + 1) "); |
| 318 | 318 | break; |
| 319 | 319 | case 11: // T?: BUS + SKIP |
| 320 | 320 | if (t) |
| 321 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 321 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 322 | 322 | if (l) |
| 323 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 323 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 324 | 324 | 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]); |
| 326 | 326 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS + SKIP) "); |
| 327 | 327 | break; |
| 328 | 328 | case 12: // T?: BUS, T (AND) |
| 329 | 329 | if (t) |
| 330 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-ALU "); |
| 330 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←ALU "); |
| 331 | 331 | if (l) |
| 332 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 332 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 333 | 333 | 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]); |
| 335 | 335 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS AND T) "); |
| 336 | 336 | break; |
| 337 | 337 | case 13: // : BUS AND NOT T |
| 338 | 338 | if (t) |
| 339 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 339 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 340 | 340 | if (l) |
| 341 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 341 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 342 | 342 | 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]); |
| 344 | 344 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(BUS AND NOT T) "); |
| 345 | 345 | break; |
| 346 | 346 | case 14: // : undefined |
| 347 | 347 | if (t) |
| 348 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 348 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 349 | 349 | if (l) |
| 350 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 350 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 351 | 351 | 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]); |
| 353 | 353 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(14) "); |
| 354 | 354 | break; |
| 355 | 355 | case 15: // : undefined |
| 356 | 356 | if (t) |
| 357 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "T<-BUS "); |
| 357 | dst += snprintf(dst, len - (size_t)(dst - buffer), "T←BUS "); |
| 358 | 358 | if (l) |
| 359 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "L<- "); |
| 359 | dst += snprintf(dst, len - (size_t)(dst - buffer), "L← "); |
| 360 | 360 | 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]); |
| 362 | 362 | dst += snprintf(dst, len - (size_t)(dst - buffer), "ALUF(15) "); |
| 363 | 363 | break; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | switch (bs) { |
| 367 | 367 | 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]); |
| 369 | 369 | break; |
| 370 | 370 | 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]); |
| 372 | 372 | break; |
| 373 | 373 | 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), "BUS←177777 "); |
| 375 | 375 | break; |
| 376 | 376 | 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), "BUS←BS3 "); |
| 378 | 378 | break; |
| 379 | 379 | 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), "BUS←BS4 "); |
| 381 | 381 | break; |
| 382 | 382 | case 5: // memory data |
| 383 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-MD "); |
| 383 | dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS←MD "); |
| 384 | 384 | 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 "); |
| 387 | 387 | break; |
| 388 | 388 | 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), "BUS←DISP "); |
| 390 | 390 | break; |
| 391 | 391 | } |
| 392 | 392 | |
| r26112 | r26113 | |
| 395 | 395 | case 0: // no operation |
| 396 | 396 | break; |
| 397 | 397 | 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), "MAR←ALU "); |
| 399 | 399 | break; |
| 400 | 400 | case 2: // switch tasks if higher priority wakeup is pending |
| 401 | 401 | dst += snprintf(dst, len - (size_t)(dst - buffer), "[TASK] "); |
| r26112 | r26113 | |
| 404 | 404 | dst += snprintf(dst, len - (size_t)(dst - buffer), "[BLOCK] "); |
| 405 | 405 | break; |
| 406 | 406 | 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), "SHIFTER←L(LSH1) "); |
| 408 | 408 | break; |
| 409 | 409 | 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), "SHIFTER←L(RSH1) "); |
| 411 | 411 | break; |
| 412 | 412 | 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), "SHIFTER←L(LCY8) "); |
| 414 | 414 | break; |
| 415 | 415 | case 7: // put the constant from PROM (RSELECT,BS) on the bus |
| 416 | 416 | 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]); |
| 418 | 418 | break; |
| 419 | 419 | default: |
| 420 | 420 | dst += snprintf(dst, len - (size_t)(dst - buffer), "F1_%02o ", f1); |
| r26112 | r26113 | |
| 424 | 424 | switch (f2) { |
| 425 | 425 | case 0: // no operation |
| 426 | 426 | 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) |
| 428 | 428 | dst += snprintf(dst, len - (size_t)(dst - buffer), "[(BUS=0) ? %s : %s] ", |
| 429 | 429 | addrname((prefetch | 1) & MCODE_MASK), |
| 430 | 430 | addrname(prefetch & MCODE_MASK)); |
| 431 | 431 | 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) |
| 433 | 433 | dst += snprintf(dst, len - (size_t)(dst - buffer), "[(SH=0) ? %s : %s] ", |
| 434 | 434 | addrname((prefetch | 1) & MCODE_MASK), |
| 435 | 435 | addrname(prefetch & MCODE_MASK)); |
| 436 | 436 | 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) |
| 438 | 438 | dst += snprintf(dst, len - (size_t)(dst - buffer), "[(SH<0) ? %s : %s] ", |
| 439 | 439 | addrname((prefetch | 1) & MCODE_MASK), |
| 440 | 440 | addrname(prefetch & MCODE_MASK)); |
| 441 | 441 | 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 "); |
| 444 | 444 | 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. |
| 446 | 446 | dst += snprintf(dst, len - (size_t)(dst - buffer), "[(ALUC0) ? %s : %s] ", |
| 447 | 447 | addrname((prefetch | 1) & MCODE_MASK), |
| 448 | 448 | addrname(prefetch & MCODE_MASK)); |
| 449 | 449 | break; |
| 450 | 450 | 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), "MD←BUS "); |
| 452 | 452 | break; |
| 453 | 453 | case 7: // put on the bus the constant from PROM (RSELECT,BS) |
| 454 | 454 | 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]); |
| 456 | 456 | break; |
| 457 | 457 | default: |
| 458 | | dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS<-F2_%02o ", f2); |
| 458 | dst += snprintf(dst, len - (size_t)(dst - buffer), "BUS←F2_%02o ", f2); |
| 459 | 459 | break; |
| 460 | 460 | } |
| 461 | 461 | return result; |