From 490fd83cb00b8c73b65f9a561fb799e0776884bd Mon Sep 17 00:00:00 2001 From: crc <> Date: Tue, 10 Oct 2023 09:50:07 +0000 Subject: [PATCH] retro.c: -v now mentioned in help text; show sp, rp, core as part of verbose output FossilOrigin-Name: a78c3d5b49a7f0dd484a8a42ff6b1dd263572bd6b73b787d2481d222c0fe0354 --- vm/nga-c/retro.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/vm/nga-c/retro.c b/vm/nga-c/retro.c index 02338f1..e4157a1 100644 --- a/vm/nga-c/retro.c +++ b/vm/nga-c/retro.c @@ -181,6 +181,7 @@ void inst_iq(NgaState *); void inst_ii(NgaState *); /* Global Variables -------------------------------------------------- */ int verbose; + void guard(NgaState *vm, int n, int m, int diff) { if (vm->cpu[vm->active].sp < n) { #ifdef ENABLE_ERROR @@ -965,6 +966,8 @@ void help(char *exename) { printf(" Use the image in the specified file instead of the internal one and run the code in it\n"); printf(" -t filename\n"); printf(" Run the contents of the specified file, including any tests (in ``` blocks)\n\n"); + printf(" -v\n"); + printf(" Run in verbose mode\n"); } /* Signal Handler -----------------------------------------------------*/ @@ -1585,10 +1588,18 @@ int validate_opcode_bundle(CELL opcode) { return valid; } +void verbose_details(NgaState *vm, CELL opcode) { + printf("ip: %lld ", vm->cpu[vm->active].ip); + printf("sp: %lld ", vm->cpu[vm->active].sp); + printf("rp: %lld ", vm->cpu[vm->active].rp); + printf("core: %d ", vm->active); + printf("opcode: %lld\n", opcode); +} + void process_opcode_bundle(NgaState *vm, CELL opcode) { CELL raw = opcode; int i; - if (verbose) { printf("ip: %lld <%lld>\n", vm->cpu[vm->active].ip, opcode); } + if (verbose) { verbose_details(vm, opcode); } for (i = 0; i < 4; i++) { process_opcode(vm, raw & 0xFF); raw = raw >> 8;