    val = A; 
 // Z = val; 
 // N = val; 
 // V = 0; 
    ea = DP|0x9e; 
    wr_mem(ea, val); 
                                                     mon("         CMPA  #$02                    ; 00AB: 81 02         \n");
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
                                                     mon("         BNE   $B3                     ; 00AD: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    goto L00B3;
    }
                                                     mon("         CLRA                          ; 00AF: 4F            \n");
    A = 0; 
 // V = 0; 
 // Z = 0; 
 // N = 0; 
 // C = 0; 
                                                     mon("         CLRB                          ; 00B0: 5F            \n");
    B = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
                                                     mon("         BRA   $DA                     ; 00B1: 20 27         \n");
    goto L00DA;
    
  case 0x00B3:
L00B3:
                                                     mon("L00B3    JSR   Random                  ; 00B3: BD F5 17      \n");
    S = S - 1; 
    wr_mem(S, 0xb6); 
    S = S - 1; 
    wr_mem(S, 0x00); 
    PC = 0xf517; 
    JUMP;
  case 0x00B6:
L00B6:
                                                     mon("L00B6    TFR   CC,B                    ; 00B6: 1F A9         \n");
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    B = (UINT8)CC; 
                                                     mon("         STB   <$A0                    ; 00B8: D7 A0         \n");
    val = B; 
 // Z = val; 
 // N = val; 
 // V = 0; 
    ea = DP|0xa0; 
    wr_mem(ea, val); 
                                                     mon("         JSR   $10F6                   ; 00BA: BD 10 F6      \n");
    S = S - 1; 
    wr_mem(S, 0xbd); 
    S = S - 1; 
    wr_mem(S, 0x00); 
    PC = 0x10f6; 
    JUMP;
  case 0x00BD:
L00BD:
                                                     mon("L00BD    TSTA                          ; 00BD: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
                                                     mon("         BPL   $C3                     ; 00BE: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    goto L00C3;
    }
                                                     mon("         JSR   $19CB                   ; 00C0: BD 19 CB      \n");
    S = S - 1; 
    wr_mem(S, 0xc3); 
    S = S - 1; 
    wr_mem(S, 0x00); 
    PC = 0x19cb; 
    JUMP;
  case 0x00C3:
L00C3:
                                                     mon("L00C3    CMPD  <$F5                    ; 00C3: 10 93 F5      \n");
    ea = rd_mem(DP|0xf5)<<8; 
    ea = ea | rd_mem(DP|0xf6); 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
                                                     mon("         BCS   $B3                     ; 00C6: 25 EB         \n");
    // temp fix to ensure flags synched
    if (C) {
    goto L00B3;
    }
    arg = ea; 
    res = val - arg; 
