summaryrefslogtreecommitdiffhomepage
path: root/mixutils
diff options
context:
space:
mode:
authorjaortega <jaortega>2000-12-20 01:02:47 +0000
committerjaortega <jaortega>2000-12-20 01:02:47 +0000
commitfc53d569d4f9b926c54fcecc39e93f9be92b3a42 (patch)
treee0a3b01433bc80ca13275a65b4958f3bd76a271c /mixutils
parentf18a9fd4d5d1c80950c126dad266c69a7646aaf4 (diff)
downloadmdk-fc53d569d4f9b926c54fcecc39e93f9be92b3a42.tar.gz
mdk-fc53d569d4f9b926c54fcecc39e93f9be92b3a42.tar.bz2
(cmd_run_, cmd_next_) correct use of mix_vm_reset_program to restart a
halted program.
Diffstat (limited to 'mixutils')
-rw-r--r--mixutils/mixvm_command.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mixutils/mixvm_command.c b/mixutils/mixvm_command.c
index 3d783e1..2c07be7 100644
--- a/mixutils/mixvm_command.c
+++ b/mixutils/mixvm_command.c
@@ -274,14 +274,16 @@ cmd_load_ (char *arg)
static void
trace_ ()
{
+ enum {BUFFER_LEN = 128};
+ static gchar STRINS[BUFFER_LEN];
+
const mix_src_file_t *file = mix_vm_get_src_file (vm_);
const gchar *line = "";
- gchar *strins;
mix_address_t loc = mix_vm_get_prog_count (vm_);
mix_word_t ins = mix_vm_get_addr_contents (vm_, loc);
mix_ins_t fins;
mix_word_to_ins_uncheck (ins, fins);
- strins = mix_ins_to_string (&fins);
+ mix_ins_to_string_in_buffer (&fins, STRINS, BUFFER_LEN);
if (file != NULL)
{
@@ -289,8 +291,7 @@ trace_ ()
if (b > 0) line = mix_src_file_get_line (file, b);
}
- printf ("%d: [%s]\t%s", (gint)loc, strins, line);
- if (strins != NULL) g_free (strins);
+ printf ("%d: [%s]\t%s", (gint)loc, STRINS, line);
}
static int
@@ -313,6 +314,9 @@ cmd_run_ (char *arg)
if (arg != NULL && *arg != '\0' && cmd_load_ (arg) != TRUE)
return TRUE;
puts (_("Running ..."));
+
+ if (mix_vm_is_halted (vm_)) mix_vm_reset_program (vm_);
+
switch (run_and_trace_ ())
{
case MIX_VM_HALT: