TX-0 simulator: unrecognized instruction in halt message prints as (), should show memory contents
dpeschel opened this issue · 0 comments
-
Context
I have been looking at the TX-0 simulator and I plan to send in some pull requests soon.
When the TX-0 simulator halts, it has already incremented the PC and it disassembles the instruction at the new PC. If it can't disassemble the instruction, it prints an empty pair of parentheses. The user needs more information about the instruction.
-
the output of "sim> SHOW VERSION" while running the simulator which is having the issue
TX-0 simulator Open SIMH V4.1-0 Current
Simulator Framework Capabilities:
32b data
32b addresses
no Ethernet
Idle/Throttling support is available
Virtual Hard Disk (VHD) support
RAW disk and CD/DVD ROM support
Asynchronous I/O support (Lock free asynchronous event queue)
Asynchronous Clock support
FrontPanel API Version 12
Host Platform:
Compiler: GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)
Simulator Compiled as C arch: x64 (Release Build) on Sep 12 2023 at 00:22:58
Build Tool: simh-makefile
Memory Access: Little Endian
Memory Pointer Size: 64 bits
Large File (>2GB) support
SDL Video support: No Video Support
No RegEx support for EXPECT commands
OS clock resolution: 1ms
Time taken by msleep(1): 1ms
OS: Darwin Dereks-MacBook-Pro.local 16.1.0 Darwin Kernel Version 16.1.0: Wed Oct 19 20:31:56 PDT 2016; root:xnu-3789.21.4~4/RELEASE_X86_64 x86_64
Processor Name: Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
tar tool: bsdtar 2.8.3 - libarchive 2.8.3
curl tool: curl 7.49.1 (x86_64-apple-darwin16.0) libcurl/7.49.1 SecureTransport zlib/1.2.8
git commit id: d4f85d01
git commit time: 2023-09-03T18:39:17-1000
-
how you built the simulator or that you're using prebuilt binaries
git clone https://github.com/open-simh/simh.git
cd simh
make BIN/tx-0
Make output:
*** Info *** simh dependent packages on macOS must be provided by either the
*** Info *** MacPorts package system or by the HomeBrew package system.
*** Info *** Neither of these seem to be installed on the local system.
*** Info ***
*** Info *** Users wanting to build simulators with locally built dependent
*** Info *** packages or packages provided by an unsupported package
*** Info *** management system may be able to override where this procedure
*** Info *** looks for include files and/or libraries. Overrides can be
*** Info *** specified by defining exported environment variables or GNU make
*** Info *** command line arguments which specify INCLUDES and/or LIBRARIES.
*** Info *** If this works, that's great, if it doesn't you are on your own!
lib paths are: /usr/lib /usr/lib/
include paths are: /usr/local/include /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/include /Library/Developer/CommandLineTools/usr/include /usr/include
using libm: /usr/lib/libm.dylib
using libpthread: /usr/lib/libpthread.dylib /usr/include/pthread.h
using libdl: /usr/lib/libdl.dylib /usr/include/dlfcn.h
using libedit: /usr/include/editline/readline.h
using mman: /usr/include/sys/mman.h
*** Info ***
*** Info *** The simulator you are building could provide more functionality
*** Info *** if video support was available on your system.
*** Info *** To gain this functionality:
*** Info *** Install MacPorts or HomeBrew and rerun this make for
*** Info *** specific advice
*** Info ***
***
*** BIN/tx-0 Simulator being built with:
*** - compiler optimizations and no debugging support. Apple LLVM version 8.0.0.
*** - Per simulator tests will be run.
***
*** git commit id is d4f85d01bdf7301d5f7a2c4e51c3a84024561b26.
*** git commit time is 2023-09-03T18:39:17-1000.
***
gcc -std=c99 -U__STRICT_ANSI__ -O2 -DNDEBUG=1 -fno-strict-overflow -DSIM_GIT_COMMIT_ID=d4f85d01bdf7301d5f7a2c4e51c3a84024561b26 -DSIM_GIT_COMMIT_TIME=2023-09-03T18:39:17-1000 -DSIM_COMPILER="Apple LLVM version 8.0.0" -DSIM_BUILD_TOOL=simh-makefile -I . -Werror -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO -DHAVE_SYS_IOCTL -DSIM_HAVE_DLOPEN=dylib -DHAVE_EDITLINE -DHAVE_UTIME -DHAVE_GLOB -DHAVE_SHM_OPEN ./TX-0/tx0_cpu.c ./TX-0/tx0_dpy.c ./TX-0/tx0_stddev.c ./TX-0/tx0_sys.c ./TX-0/tx0_sys_orig.c ./scp.c ./sim_console.c ./sim_fio.c ./sim_timer.c ./sim_sock.c ./sim_tmxr.c ./sim_ether.c ./sim_tape.c ./sim_disk.c ./sim_serial.c ./sim_video.c ./sim_imd.c ./sim_card.c -I ./TX-0 -o BIN/tx-0 -lm -lpthread -ldl -ledit
BIN/tx-0 RegisterSanityCheck </dev/null
Running internal register sanity checks on TX-0 simulator.
*** Good Registers in TX-0 simulator.
-
the simulator configuration file (or commands) which were used when the problem occurred.
This .ini
file reproduces the bug:
set cpu tx0ext
set cpu normal
deposit 0 630000
deposit 1 600000
deposit pc 0
continue
examine 1
deposit 1 600002
deposit pc 0
continue
examine 1
exit
The output is:
TX-0 simulator Open SIMH V4.1-0 Current git commit id: d4f85d01
Set CPU Extended Mode
HALT instruction, PC: 000001 (opr opr (No operation))
1: 600000
HALT instruction, PC: 000001 ()
1: 600002
Goodbye
-
the expected behavior and the actual behavior
In the second HALT printout, it prints ()
. It should print (600002)
or (opr 2)
or some other interpretation of the contents.
Changing fprint_sym
to return SCPE_ARG
on unhandled cases is one way to create the (600002)
printout; when fprint_stopped_gen
gets the SCPE_ARG
return, it automatically calls fprint_val
. Creating the (opr 2)
printout requires a more sophisticated disassembler.