diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2003-01-12 21:05:01 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2003-01-12 21:05:01 +0000 |
commit | febce8be6f8365efe21f62d3276a45136318c518 (patch) | |
tree | 1dc6d3d81124763f7dcf3867e1ec50984e937290 | |
parent | 1f16b61e3c858e019042a41fafebf3520a3e0c9c (diff) | |
download | mdk-febce8be6f8365efe21f62d3276a45136318c518.tar.gz mdk-febce8be6f8365efe21f62d3276a45136318c518.tar.bz2 |
(inc_loc_): Stop program execution if the
program counter is incremented beyond the maximum address (3999).
-rw-r--r-- | mixlib/xmix_vm.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mixlib/xmix_vm.h b/mixlib/xmix_vm.h index 019dfd6..45805e8 100644 --- a/mixlib/xmix_vm.h +++ b/mixlib/xmix_vm.h @@ -2,24 +2,24 @@ * This file contains internal declarations used in the implementation * of the mix_vm_t type. * ------------------------------------------------------------------ - * $Id: xmix_vm.h,v 1.7 2002/03/24 00:23:28 jao Exp $ + * $Id: xmix_vm.h,v 1.8 2003/01/12 21:05:01 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2000, 2002 Free Software Foundation, Inc. - * + * Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * + * */ @@ -42,7 +42,7 @@ enum { MEM_CELLS_MAX_ = MIX_VM_CELL_NO - 1 }; -struct mix_vm_t +struct mix_vm_t { mix_word_t reg[IREG_NO_+3]; mix_word_t cell[MEM_CELLS_NO_]; @@ -50,7 +50,7 @@ struct mix_vm_t mix_cmpflag_t cmpflag; mix_short_t loc_count; mix_vm_status_t status; - mix_device_t * devices[BD_NO_]; + mix_device_t * devices[BD_NO_]; mix_address_t start_addr; /* start address of loaded file */ GTree *line_table; /* source line no -> address */ GTree *address_table; /* adress -> source line no */ @@ -107,15 +107,15 @@ do { \ #define set_loc_(vm,x) (vm)->loc_count = (MEMOK_(x)? (x) : MIX_SHORT_ZERO) #define set_status_(vm,s) ((vm)->status = (s)) +#define is_halted_(vm) ((vm)->status == MIX_VM_HALT) +#define halt_(vm,val) ((vm)->status = (val)? MIX_VM_HALT : MIX_VM_RUNNING) #define inc_loc_(vm) \ do { \ - if (vm->loc_count++ == MEM_CELLS_MAX_) \ - vm->loc_count = MIX_SHORT_ZERO; \ + if (++(vm->loc_count) == MEM_CELLS_NO_) \ + { vm->loc_count--; halt_(vm, TRUE); } \ } while(FALSE) -#define is_halted_(vm) ((vm)->status == MIX_VM_HALT) -#define halt_(vm,val) ((vm)->status = (val)? MIX_VM_HALT : MIX_VM_RUNNING) #define set_start_(vm,val) ((vm)->start_addr = (val)) #define reset_loc_(vm) set_loc_ (vm, vm->start_addr) #define update_time_(vm,ins) mix_vm_clock_add_lapse (get_clock_(vm), ins) |