diff options
-rw-r--r-- | mixlib/mix_vm.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/mixlib/mix_vm.c b/mixlib/mix_vm.c index 8e8a065..c73e848 100644 --- a/mixlib/mix_vm.c +++ b/mixlib/mix_vm.c @@ -32,40 +32,50 @@ vm_reset_reload_ (mix_vm_t *vm, gboolean is_reload) set_rA_ (vm, MIX_WORD_ZERO); set_rX_ (vm, MIX_WORD_ZERO); set_rJ_ (vm, MIX_WORD_ZERO); - for ( k = 1; k < IREG_NO_+1; ++k ) - set_rI_ (vm, k, MIX_WORD_ZERO); + for ( k = 1; k < IREG_NO_+1; ++k ) set_rI_ (vm, k, MIX_WORD_ZERO); set_over_ (vm, FALSE); set_cmp_ (vm, mix_EQ); set_loc_ (vm, MIX_WORD_ZERO); set_last_error_ (vm, MIX_VM_ERROR_NONE); - for ( k = 0; k < MEM_CELLS_NO_; ++k) - set_cell_ (vm, k, MIX_WORD_ZERO); + for ( k = 0; k < MEM_CELLS_NO_; ++k) set_cell_ (vm, k, MIX_WORD_ZERO); + if (vm->symbol_table != NULL ) { mix_symbol_table_delete (vm->symbol_table); vm->symbol_table = NULL; } + if (vm->line_table != NULL) { g_tree_destroy (vm->line_table); vm->line_table = NULL; } + if (vm->address_table != NULL) { g_tree_destroy (vm->address_table); vm->address_table = NULL; } + if (vm->src_file != NULL) { mix_src_file_delete (vm->src_file); vm->src_file = NULL; } + for (k = 0; k < BD_NO_; ++k) if (vm->devices[k] != NULL) { - mix_device_delete (vm->devices[k]); - vm->devices[k] = NULL; + mix_device_type_t type = mix_device_type (vm->devices[k]); + if (!is_reload || (type != mix_dev_CONSOLE + && type != mix_dev_PRINTER + && type != mix_dev_CARD_WR)) + { + mix_device_delete (vm->devices[k]); + vm->devices[k] = NULL; + } } + if (!is_reload) mix_vm_clear_all_breakpoints (vm); |