Changed BRZ behavior to chomp a test word from stack instead of checking PSW_Z bit.
[ned1] / nedsim / nedsim.c
index aa9b7c4..b88328b 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "../common/a.out.h"
 
 
 #include "../common/a.out.h"
 
-#define VERSION 3
+#define VERSION 4
 
 /* Bytes per word. */
 #define BPW 4
 
 /* Bytes per word. */
 #define BPW 4
@@ -437,7 +437,8 @@ void
 ned_instruction_brz(struct NEDstate * state)
 {
     uint32_t new_pc = stack_pop(state->active_thread);
 ned_instruction_brz(struct NEDstate * state)
 {
     uint32_t new_pc = stack_pop(state->active_thread);
-    if (state->active_thread->psw->zero == true) {
+    uint32_t test_word = stack_pop(state->active_thread);
+    if (test_word == 0) {
         state->active_thread->pc = new_pc;
         /* TODO: Find better way to communicate we're skipping ahead to the next word. */
         state->active_thread->sc = 4;
         state->active_thread->pc = new_pc;
         /* TODO: Find better way to communicate we're skipping ahead to the next word. */
         state->active_thread->sc = 4;