diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2002-03-24 00:23:28 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2002-03-24 00:23:28 +0000 |
commit | 49e90a3bde782e564118d5673f3a86de7489a62b (patch) | |
tree | ab80be6a1704dc03ac6df3c343febd7142e885d9 | |
parent | bcea0b1b22b0cb56fcc58a33147ebb5555a171d0 (diff) | |
download | mdk-49e90a3bde782e564118d5673f3a86de7489a62b.tar.gz mdk-49e90a3bde782e564118d5673f3a86de7489a62b.tar.bz2 |
wrapping up location pointer when address 3999 is reached
-rw-r--r-- | mixlib/xmix_vm.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/mixlib/xmix_vm.h b/mixlib/xmix_vm.h index 60185df..019dfd6 100644 --- a/mixlib/xmix_vm.h +++ b/mixlib/xmix_vm.h @@ -2,9 +2,9 @@ * This file contains internal declarations used in the implementation * of the mix_vm_t type. * ------------------------------------------------------------------ - * $Id: xmix_vm.h,v 1.6 2001/09/16 22:38:43 jao Exp $ + * $Id: xmix_vm.h,v 1.7 2002/03/24 00:23:28 jao Exp $ * ------------------------------------------------------------------ - * Copyright (C) 2000 Free Software Foundation, Inc. + * Copyright (C) 2000, 2002 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 @@ -35,7 +35,13 @@ #include "mix_vm.h" /* The mix_vm_t type */ -enum {IREG_NO_ = 6, BD_NO_ = 21, MEM_CELLS_NO_ = MIX_VM_CELL_NO}; +enum { + IREG_NO_ = 6, + BD_NO_ = 21, + MEM_CELLS_NO_ = MIX_VM_CELL_NO, + MEM_CELLS_MAX_ = MIX_VM_CELL_NO - 1 +}; + struct mix_vm_t { mix_word_t reg[IREG_NO_+3]; @@ -98,14 +104,14 @@ do { \ #define set_cmp_(vm,x) (vm)->cmpflag = (x) #define set_over_(vm,x) (vm)->overflow = (x) -#define set_loc_(vm,x) (vm)->loc_count = (x)&MIX_SHORT_MAX +#define set_loc_(vm,x) (vm)->loc_count = (MEMOK_(x)? (x) : MIX_SHORT_ZERO) #define set_status_(vm,s) ((vm)->status = (s)) -#define inc_loc_(vm) \ +#define inc_loc_(vm) \ do { \ - vm->loc_count++; \ - vm->loc_count &= MIX_SHORT_MAX; \ + if (vm->loc_count++ == MEM_CELLS_MAX_) \ + vm->loc_count = MIX_SHORT_ZERO; \ } while(FALSE) #define is_halted_(vm) ((vm)->status == MIX_VM_HALT) |