                   // ORG   $8000
  case 0x8000:
                                                     mon("L8000    NEG   <$00                    ; 8000: 00 00         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x00); 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    wr_mem(DP|0x00, val); 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
                   // FCB   $05                     ; 8002:  ' ' 05             Invalid ; 
    // =============== S U B R O U T I N E =======================================
    // Entering trench
    PC = 0x8341; JUMP; // sstep
case 0x8341:
                                                     mon("L8341    LDA   #$00                    ; 8341: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8343; JUMP; // sstep
case 0x8343:
                                                     mon("         STA   <$44                    ; 8343: 97 44         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x44; 
    wr_mem(ea, val); 
    PC = 0x8345; JUMP; // sstep
case 0x8345:
                                                     mon("         STA   <$45                    ; 8345: 97 45         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x45; 
    wr_mem(ea, val); 
    PC = 0x8347; JUMP; // sstep
case 0x8347:
                                                     mon("         LDX   #$4989                  ; 8347: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x834A; JUMP; // sstep
case 0x834A:
                                                     mon("         LDA   #$00                    ; 834A: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x834C; JUMP; // sstep
case 0x834C:
                                                     mon("L834C    STA   ,X+                     ; 834C: A7 80         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0x834E; JUMP; // sstep
case 0x834E:
                                                     mon("         CMPX  #$49A9                  ; 834E: 8C 49 A9      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x49a9; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8351; JUMP; // sstep
case 0x8351:
                                                     mon("         BCS   L834C                   ; 8351: 25 F9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x834c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8353; JUMP; // sstep
case 0x8353:
                                                     mon("         LDB   $4B12                   ; 8353: F6 4B 12      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b12); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8356; JUMP; // sstep
case 0x8356:
                                                     mon("         ASLB                          ; 8356: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8357; JUMP; // sstep
case 0x8357:
                                                     mon("         LDX   #$7CC0                  ; 8357: 8E 7C C0      \n"); // Trench catwalk/turrets data?
    clockticks = clockticks + 3; 
    X = 0x7cc0; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x835A; JUMP; // sstep
case 0x835A:
                                                     mon("         ABX                           ; 835A: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0x835B; JUMP; // sstep
case 0x835B:
                                                     mon("         CMPX  #$7CD6                  ; 835B: 8C 7C D6      \n"); // Trench catwalk/turrets data?
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x7cd6; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x835E; JUMP; // sstep
case 0x835E:
                                                     mon("         BCS   L8365                   ; 835E: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8365; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8360; JUMP; // sstep
case 0x8360:
                                                     mon("         LDU   #$4B3F                  ; 8360: CE 4B 3F      \n");
    clockticks = clockticks + 3; 
    U = 0x4b3f; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8363; JUMP; // sstep
case 0x8363:
                                                     mon("         BRA   L8367                   ; 8363: 20 02         \n");
    PC = 0x8367; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8365:
                                                     mon("L8365    LDU   ,X                      ; 8365: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8367; JUMP; // sstep
case 0x8367:
                                                     mon("L8367    STU   $49A9                   ; 8367: FF 49 A9      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49a9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49aa, (UINT8)val); 
    PC = 0x836A; JUMP; // sstep
case 0x836A:
                                                     mon("         STU   $49AB                   ; 836A: FF 49 AB      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49ab, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49ac, (UINT8)val); 
    PC = 0x836D; JUMP; // sstep
case 0x836D:
                                                     mon("         LDU   ,U                      ; 836D: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x836F; JUMP; // sstep
case 0x836F:
                                                     mon("         LDD   #$00                    ; 836F: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8372; JUMP; // sstep
case 0x8372:
                                                     mon("         STA   $49C0                   ; 8372: B7 49 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c0, val); 
    PC = 0x8375; JUMP; // sstep
case 0x8375:
                                                     mon("         STD   $49B1                   ; 8375: FD 49 B1      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b1, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b2, B); 
    PC = 0x8378; JUMP; // sstep
case 0x8378:
                                                     mon("         STD   $49B5                   ; 8378: FD 49 B5      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b5, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b6, B); 
    PC = 0x837B; JUMP; // sstep
case 0x837B:
                                                     mon("         STA   <$92                    ; 837B: 97 92         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x92; 
    wr_mem(ea, val); 
    PC = 0x837D; JUMP; // sstep
case 0x837D:
                                                     mon("         STA   <$95                    ; 837D: 97 95         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x95; 
    wr_mem(ea, val); 
    PC = 0x837F; JUMP; // sstep
case 0x837F:
                                                     mon("         STU   $49AF                   ; 837F: FF 49 AF      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49af, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b0, (UINT8)val); 
    PC = 0x8382; JUMP; // sstep
case 0x8382:
                                                     mon("         STU   $49B3                   ; 8382: FF 49 B3      \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x49b3, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b4, (UINT8)val); 
    PC = 0x8385; JUMP; // sstep
case 0x8385:
                                                     mon("         JSR   L8434                   ; 8385: BD 84 34      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x8434; 
    JUMP;
  case 0x8388:
                                                     mon("L8388    JSR   L8408                   ; 8388: BD 84 08      \n"); // Trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x8408; 
    JUMP;
  case 0x838B:
                                                     mon("L838B    JSR   L83CE                   ; 838B: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x838E:
                                                     mon("L838E    JSR   L83CE                   ; 838E: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x91); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x8391:
                                                     mon("L8391    JSR   L83CE                   ; 8391: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x8394:
                                                     mon("L8394    JSR   L83CE                   ; 8394: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x8397:
                                                     mon("L8397    JSR   L83CE                   ; 8397: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x839A:
                                                     mon("L839A    JSR   L83CE                   ; 839A: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x839D:
                                                     mon("L839D    JSR   L83CE                   ; 839D: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x83A0:
                                                     mon("L83A0    JSR   L83CE                   ; 83A0: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
    // End of function sub_8341
  case 0x83A3:
                                                     mon("L83A3    RTS                           ; 83A3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Called when starting trench
  case 0x83A4:
                                                     mon("L83A4    LDU   #$4B3F                  ; 83A4: CE 4B 3F      \n");
    clockticks = clockticks + 3; 
    U = 0x4b3f; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83A7; JUMP; // sstep
case 0x83A7:
                                                     mon("         LDX   #$7C7E                  ; 83A7: 8E 7C 7E      \n"); // Copy pointers from ROM to RAM starting at word_4B3F
    clockticks = clockticks + 3; 
    X = 0x7c7e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x83AA; JUMP; // sstep
case 0x83AA:
                                                     mon("L83AA    LDD   ,X++                    ; 83AA: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x83AC; JUMP; // sstep
case 0x83AC:
                                                     mon("         STD   ,U++                    ; 83AC: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0x83AE; JUMP; // sstep
case 0x83AE:
                                                     mon("         CMPU  #$4B5F                  ; 83AE: 11 83 4B 5F   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x4b5f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x83B2; JUMP; // sstep
case 0x83B2:
                                                     mon("         BCS   L83AA                   ; 83B2: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x83aa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83B4; JUMP; // sstep
case 0x83B4:
                                                     mon("         LDU   #$4B43                  ; 83B4: CE 4B 43      \n");
    clockticks = clockticks + 3; 
    U = 0x4b43; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83B7; JUMP; // sstep
case 0x83B7:
                                                     mon("         LDX   #$7C9E                  ; 83B7: 8E 7C 9E      \n");
    clockticks = clockticks + 3; 
    X = 0x7c9e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x83BA; JUMP; // sstep
case 0x83BA:
                                                     mon("L83BA    LDA   #$11                    ; 83BA: 86 11         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x11; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83BC; JUMP; // sstep
case 0x83BC:
                                                     mon("         LDB   $4703                   ; 83BC: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83BF; JUMP; // sstep
case 0x83BF:
                                                     mon("         MUL                           ; 83BF: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x83C0; JUMP; // sstep
case 0x83C0:
                                                     mon("         ASLA                          ; 83C0: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x83C1; JUMP; // sstep
case 0x83C1:
                                                     mon("         LDD   A,X                     ; 83C1: EC 86         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)A); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x83C3; JUMP; // sstep
case 0x83C3:
                                                     mon("         STD   ,U                      ; 83C3: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x83C5; JUMP; // sstep
case 0x83C5:
                                                     mon("         LEAU  $04,U                   ; 83C5: 33 44         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0004); 
    PC = 0x83C7; JUMP; // sstep
case 0x83C7:
                                                     mon("         CMPU  #$4B5F                  ; 83C7: 11 83 4B 5F   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x4b5f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x83CB; JUMP; // sstep
case 0x83CB:
                                                     mon("         BCS   L83BA                   ; 83CB: 25 ED         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x83ba; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_83A4
    PC = 0x83CD; JUMP; // sstep
case 0x83CD:
                                                     mon("         RTS                           ; 83CD: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x83CE:
                                                     mon("L83CE    LDA   <$92                    ; 83CE: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x83D0; JUMP; // sstep
case 0x83D0:
                                                     mon("         BNE   locret_8407             ; 83D0: 26 35         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8407; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83D2; JUMP; // sstep
case 0x83D2:
                                                     mon("         LDU   $49B3                   ; 83D2: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83D5; JUMP; // sstep
case 0x83D5:
                                                     mon("         LEAU  $03,U                   ; 83D5: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x83D7; JUMP; // sstep
case 0x83D7:
                                                     mon("         LDA   ,U                      ; 83D7: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83D9; JUMP; // sstep
case 0x83D9:
                                                     mon("         CMPA  #$05                    ; 83D9: 81 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x83DB; JUMP; // sstep
case 0x83DB:
                                                     mon("         BNE   L83E2                   ; 83DB: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x83e2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83DD; JUMP; // sstep
case 0x83DD:
                                                     mon("         LDU   $49AB                   ; 83DD: FE 49 AB      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49ab)<<8; 
    ea = ea | rd_mem(0x49ac); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83E0; JUMP; // sstep
case 0x83E0:
                                                     mon("         LDU   $02,U                   ; 83E0: EE 42         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83E2; JUMP; // sstep
case 0x83E2:
                                                     mon("L83E2    LDB   ,U                      ; 83E2: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83E4; JUMP; // sstep
case 0x83E4:
                                                     mon("         CMPB  #$01                    ; 83E4: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x83E6; JUMP; // sstep
case 0x83E6:
                                                     mon("         BNE   L83ED                   ; 83E6: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x83ed; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83E8; JUMP; // sstep
case 0x83E8:
                                                     mon("         LDD   #$0800                  ; 83E8: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x83EB; JUMP; // sstep
case 0x83EB:
                                                     mon("         BRA   L83F9                   ; 83EB: 20 0C         \n");
    PC = 0x83f9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x83ED:
                                                     mon("L83ED    CMPB  #$03                    ; 83ED: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x83EF; JUMP; // sstep
case 0x83EF:
                                                     mon("         BNE   L83F6                   ; 83EF: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x83f6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83F1; JUMP; // sstep
case 0x83F1:
                                                     mon("         LDD   #$00                    ; 83F1: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x83F4; JUMP; // sstep
case 0x83F4:
                                                     mon("         BRA   L83F9                   ; 83F4: 20 03         \n");
    PC = 0x83f9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x83F6:
                                                     mon("L83F6    LDD   #$1000                  ; 83F6: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x83F9; JUMP; // sstep
case 0x83F9:
                                                     mon("L83F9    ADDD  $49B7                   ; 83F9: F3 49 B7      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b7)<<8; 
    ea = ea | rd_mem(0x49b8); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x83FC; JUMP; // sstep
case 0x83FC:
                                                     mon("         SUBD  $49B1                   ; 83FC: B3 49 B1      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b1)<<8; 
    ea = ea | rd_mem(0x49b2); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x83FF; JUMP; // sstep
case 0x83FF:
                                                     mon("         SUBD  #$6000                  ; 83FF: 83 60 00      \n");
    clockticks = clockticks + 4; 
    val = 0x6000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8402; JUMP; // sstep
case 0x8402:
                                                     mon("         BHI   locret_8407             ; 8402: 22 03         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x8407; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8404; JUMP; // sstep
case 0x8404:
                                                     mon("         JSR   L8408                   ; 8404: BD 84 08      \n"); // Trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    PC = 0x8408; 
    JUMP;
    // End of function sub_83CE
  case 0x8407:
                                                     mon("locret_8407 RTS                           ; 8407: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench
  case 0x8408:
                                                     mon("L8408    LDU   $49B3                   ; 8408: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x840B; JUMP; // sstep
case 0x840B:
                                                     mon("         LDB   ,U                      ; 840B: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x840D; JUMP; // sstep
case 0x840D:
                                                     mon("         CMPB  #$01                    ; 840D: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x840F; JUMP; // sstep
case 0x840F:
                                                     mon("         BNE   L8416                   ; 840F: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8416; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8411; JUMP; // sstep
case 0x8411:
                                                     mon("         LDD   #$0800                  ; 8411: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8414; JUMP; // sstep
case 0x8414:
                                                     mon("         BRA   L8419                   ; 8414: 20 03         \n");
    PC = 0x8419; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8416:
                                                     mon("L8416    LDD   #$1000                  ; 8416: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8419; JUMP; // sstep
case 0x8419:
                                                     mon("L8419    ADDD  $49B5                   ; 8419: F3 49 B5      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b5)<<8; 
    ea = ea | rd_mem(0x49b6); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x841C; JUMP; // sstep
case 0x841C:
                                                     mon("         STD   $49B5                   ; 841C: FD 49 B5      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b5, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b6, B); 
    PC = 0x841F; JUMP; // sstep
case 0x841F:
                                                     mon("         LEAU  $03,U                   ; 841F: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8421; JUMP; // sstep
case 0x8421:
                                                     mon("         LDB   ,U                      ; 8421: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8423; JUMP; // sstep
case 0x8423:
                                                     mon("         CMPB  #$05                    ; 8423: C1 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8425; JUMP; // sstep
case 0x8425:
                                                     mon("L8425    BNE   L8431                   ; 8425: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8431; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8427; JUMP; // sstep
case 0x8427:
                                                     mon("         LDU   $49AB                   ; 8427: FE 49 AB      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49ab)<<8; 
    ea = ea | rd_mem(0x49ac); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x842A; JUMP; // sstep
case 0x842A:
                                                     mon("         LEAU  $02,U                   ; 842A: 33 42         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0002); 
    PC = 0x842C; JUMP; // sstep
case 0x842C:
                                                     mon("         STU   $49AB                   ; 842C: FF 49 AB      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49ab, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49ac, (UINT8)val); 
    PC = 0x842F; JUMP; // sstep
case 0x842F:
                                                     mon("         LDU   ,U                      ; 842F: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8431; JUMP; // sstep
case 0x8431:
                                                     mon("L8431    STU   $49B3                   ; 8431: FF 49 B3      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49b3, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b4, (UINT8)val); 
    PC = 0x8434; JUMP; // sstep
case 0x8434:
                                                     mon("L8434    LDU   $49B3                   ; 8434: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8437; JUMP; // sstep
case 0x8437:
                                                     mon("         LDB   ,U                      ; 8437: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8439; JUMP; // sstep
case 0x8439:
                                                     mon("         CMPB  #$03                    ; 8439: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x843B; JUMP; // sstep
case 0x843B:
                                                     mon("         BNE   L8447                   ; 843B: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8447; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x843D; JUMP; // sstep
case 0x843D:
                                                     mon("         LDD   $49B5                   ; 843D: FC 49 B5      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49b5); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8440; JUMP; // sstep
case 0x8440:
                                                     mon("         STD   <$93                    ; 8440: DD 93         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x93; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8442; JUMP; // sstep
case 0x8442:
                                                     mon("         LDA   #$FF                    ; 8442: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8444; JUMP; // sstep
case 0x8444:
                                                     mon("         STA   <$92                    ; 8444: 97 92         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x92; 
    wr_mem(ea, val); 
    PC = 0x8446; JUMP; // sstep
case 0x8446:
                                                     mon("         RTS                           ; 8446: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8447:
                                                     mon("L8447    LDB   ,U                      ; 8447: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8449; JUMP; // sstep
case 0x8449:
                                                     mon("         CMPB  #$04                    ; 8449: C1 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x844B; JUMP; // sstep
case 0x844B:
                                                     mon("         BNE   L846A                   ; 844B: 26 1D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x846a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x844D; JUMP; // sstep
case 0x844D:
                                                     mon("         LDD   $49B5                   ; 844D: FC 49 B5      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49b5); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8450; JUMP; // sstep
case 0x8450:
                                                     mon("         STD   <$96                    ; 8450: DD 96         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x96; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8452; JUMP; // sstep
case 0x8452:
                                                     mon("         LDA   #$FF                    ; 8452: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8454; JUMP; // sstep
case 0x8454:
                                                     mon("         STA   <$95                    ; 8454: 97 95         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x95; 
    wr_mem(ea, val); 
    PC = 0x8456; JUMP; // sstep
case 0x8456:
                                                     mon("         LDA   #$00                    ; 8456: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8458; JUMP; // sstep
case 0x8458:
                                                     mon("         STA   <$44                    ; 8458: 97 44         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x44; 
    wr_mem(ea, val); 
    PC = 0x845A; JUMP; // sstep
case 0x845A:
                                                     mon("         STA   <$45                    ; 845A: 97 45         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x45; 
    wr_mem(ea, val); 
    PC = 0x845C; JUMP; // sstep
case 0x845C:
                                                     mon("         LDA   $4B36                   ; 845C: B6 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x845F; JUMP; // sstep
case 0x845F:
                                                     mon("         BNE   L846A                   ; 845F: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x846a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8461; JUMP; // sstep
case 0x8461:
                                                     mon("         INC   $4B36                   ; 8461: 7C 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x4b36, res); 
    clockticks = clockticks + 2; 
    PC = 0x8464; JUMP; // sstep
case 0x8464:
                                                     mon("         JSR   L97E3                   ; 8464: BD 97 E3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    PC = 0x97e3; 
    JUMP;
  case 0x8467:
                                                     mon("L8467    LDU   $49B3                   ; 8467: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x846A; JUMP; // sstep
case 0x846A:
                                                     mon("L846A    LDB   ,U                      ; 846A: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x846C; JUMP; // sstep
case 0x846C:
                                                     mon("         CMPB  #$01                    ; 846C: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x846E; JUMP; // sstep
case 0x846E:
                                                     mon("         BNE   L8475                   ; 846E: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8475; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8470; JUMP; // sstep
case 0x8470:
                                                     mon("         LDD   #$0800                  ; 8470: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8473; JUMP; // sstep
case 0x8473:
                                                     mon("         BRA   L8478                   ; 8473: 20 03         \n");
    PC = 0x8478; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8475:
                                                     mon("L8475    LDD   #$1000                  ; 8475: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8478; JUMP; // sstep
case 0x8478:
                                                     mon("L8478    ADDD  $49B5                   ; 8478: F3 49 B5      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b5)<<8; 
    ea = ea | rd_mem(0x49b6); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x847B; JUMP; // sstep
case 0x847B:
                                                     mon("         STD   $49B7                   ; 847B: FD 49 B7      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b7, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b8, B); 
    PC = 0x847E; JUMP; // sstep
case 0x847E:
                                                     mon("         LDB   $49B5                   ; 847E: F6 49 B5      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49b5); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8481; JUMP; // sstep
case 0x8481:
                                                     mon("         LSRB                          ; 8481: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8482; JUMP; // sstep
case 0x8482:
                                                     mon("         LSRB                          ; 8482: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8483; JUMP; // sstep
case 0x8483:
                                                     mon("         LSRB                          ; 8483: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8484; JUMP; // sstep
case 0x8484:
                                                     mon("         ANDB  #$0F                    ; 8484: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8486; JUMP; // sstep
case 0x8486:
                                                     mon("         LDX   #$4989                  ; 8486: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8489; JUMP; // sstep
case 0x8489:
                                                     mon("         LDA   $01,U                   ; 8489: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x848B; JUMP; // sstep
case 0x848B:
                                                     mon("         STA   B,X                     ; 848B: A7 85         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)B); 
    wr_mem(ea, val); 
    PC = 0x848D; JUMP; // sstep
case 0x848D:
                                                     mon("         LDX   #$4999                  ; 848D: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8490; JUMP; // sstep
case 0x8490:
                                                     mon("         LDA   $02,U                   ; 8490: A6 42         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8492; JUMP; // sstep
case 0x8492:
                                                     mon("         STA   B,X                     ; 8492: A7 85         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + (SINT8)B); 
    wr_mem(ea, val); 
    // End of function sub_8408
    PC = 0x8494; JUMP; // sstep
case 0x8494:
                                                     mon("         RTS                           ; 8494: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8495:
                                                     mon("L8495    LDA   <$45                    ; 8495: 96 45         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x45); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8497; JUMP; // sstep
case 0x8497:
                                                     mon("         BNE   locret_84B5             ; 8497: 26 1C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x84b5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8499; JUMP; // sstep
case 0x8499:
                                                     mon("         LDB   $4B19                   ; 8499: F6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x849C; JUMP; // sstep
case 0x849C:
                                                     mon("         CMPB  #$07                    ; 849C: C1 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x07; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x849E; JUMP; // sstep
case 0x849E:
                                                     mon("         BLS   L84A2                   ; 849E: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x84a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84A0; JUMP; // sstep
case 0x84A0:
                                                     mon("         LDB   #$07                    ; 84A0: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84A2; JUMP; // sstep
case 0x84A2:
                                                     mon("L84A2    ASLB                          ; 84A2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x84A3; JUMP; // sstep
case 0x84A3:
                                                     mon("         LDU   #byte_84B6              ; 84A3: CE 84 B6      \n");
    clockticks = clockticks + 3; 
    U = 0x84b6; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x84A6; JUMP; // sstep
case 0x84A6:
                                                     mon("         LEAU  B,U                     ; 84A6: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0x84A8; JUMP; // sstep
case 0x84A8:
                                                     mon("         LDA   <$43                    ; 84A8: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84AA; JUMP; // sstep
case 0x84AA:
                                                     mon("         ANDA  ,U                      ; 84AA: A4 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(U); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x84AC; JUMP; // sstep
case 0x84AC:
                                                     mon("         BNE   locret_84B5             ; 84AC: 26 07         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x84b5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84AE; JUMP; // sstep
case 0x84AE:
                                                     mon("         LDA   $01,U                   ; 84AE: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84B0; JUMP; // sstep
case 0x84B0:
                                                     mon("         STA   <$9B                    ; 84B0: 97 9B         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x9b; 
    wr_mem(ea, val); 
    PC = 0x84B2; JUMP; // sstep
case 0x84B2:
                                                     mon("         JSR   L84C6                   ; 84B2: BD 84 C6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    PC = 0x84c6; 
    JUMP;
    // End of function sub_8495
    // ---------------------------------------------------------------------------
  case 0x84B5:
                                                     mon("locret_84B5 RTS                           ; 84B5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x84C6:
                                                     mon("L84C6    LDD   #$F800                  ; 84C6: CC F8 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf8; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84C9; JUMP; // sstep
case 0x84C9:
                                                     mon("         ANDA  $5098                   ; 84C9: B4 50 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    res = val & rd_mem(0x5098); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x84CC; JUMP; // sstep
case 0x84CC:
                                                     mon("         ADDA  #$24                    ; 84CC: 8B 24         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x24; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x84CE; JUMP; // sstep
case 0x84CE:
                                                     mon("         STD   $5078                   ; 84CE: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x84D1; JUMP; // sstep
case 0x84D1:
                                                     mon("L84D1    LDA   $5078                   ; 84D1: B6 50 78      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5078); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84D4; JUMP; // sstep
case 0x84D4:
                                                     mon("         LSRA                          ; 84D4: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x84D5; JUMP; // sstep
case 0x84D5:
                                                     mon("         LSRA                          ; 84D5: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x84D6; JUMP; // sstep
case 0x84D6:
                                                     mon("         LSRA                          ; 84D6: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x84D7; JUMP; // sstep
case 0x84D7:
                                                     mon("         ANDA  #$0F                    ; 84D7: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x84D9; JUMP; // sstep
case 0x84D9:
                                                     mon("         STA   <$99                    ; 84D9: 97 99         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x99; 
    wr_mem(ea, val); 
    PC = 0x84DB; JUMP; // sstep
case 0x84DB:
                                                     mon("         LDD   #$FE00                  ; 84DB: CC FE 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84DE; JUMP; // sstep
case 0x84DE:
                                                     mon("         STD   $507C                   ; 84DE: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x84E1; JUMP; // sstep
case 0x84E1:
                                                     mon("         LDD   #$FC80                  ; 84E1: CC FC 80      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84E4; JUMP; // sstep
case 0x84E4:
                                                     mon("         STD   $507A                   ; 84E4: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x84E7; JUMP; // sstep
case 0x84E7:
                                                     mon("         LDX   #$4989                  ; 84E7: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x84EA; JUMP; // sstep
case 0x84EA:
                                                     mon("         LDB   <$99                    ; 84EA: D6 99         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x99); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84EC; JUMP; // sstep
case 0x84EC:
                                                     mon("         LDA   B,X                     ; 84EC: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84EE; JUMP; // sstep
case 0x84EE:
                                                     mon("L84EE    STA   <$9A                    ; 84EE: 97 9A         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9a; 
    wr_mem(ea, val); 
    PC = 0x84F0; JUMP; // sstep
case 0x84F0:
                                                     mon("         ANDA  #$C0                    ; 84F0: 84 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xc0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x84F2; JUMP; // sstep
case 0x84F2:
                                                     mon("         CMPA  #$C0                    ; 84F2: 81 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xc0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x84F4; JUMP; // sstep
case 0x84F4:
                                                     mon("         BNE   L8522                   ; 84F4: 26 2C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84F6; JUMP; // sstep
case 0x84F6:
                                                     mon("         LDD   $509C                   ; 84F6: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84F9; JUMP; // sstep
case 0x84F9:
                                                     mon("         SUBD  $507C                   ; 84F9: B3 50 7C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x507c)<<8; 
    ea = ea | rd_mem(0x507d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x84FC; JUMP; // sstep
case 0x84FC:
                                                     mon("         BLT   L8522                   ; 84FC: 2D 24         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84FE; JUMP; // sstep
case 0x84FE:
                                                     mon("L84FE    SUBD  #$0400                  ; 84FE: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8501; JUMP; // sstep
case 0x8501:
                                                     mon("         BGE   L850F                   ; 8501: 2C 0C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x850f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8503; JUMP; // sstep
case 0x8503:
                                                     mon("L8503    LDA   $4703                   ; 8503: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8506; JUMP; // sstep
case 0x8506:
                                                     mon("         CMPA  <$9B                    ; 8506: 91 9B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9b); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8508; JUMP; // sstep
case 0x8508:
                                                     mon("         BCS   L850D                   ; 8508: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x850d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x850A; JUMP; // sstep
case 0x850A:
                                                     mon("         JSR   LA7F7                   ; 850A: BD A7 F7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xa7f7; 
    JUMP;
  case 0x850D:
                                                     mon("L850D    BRA   L8522                   ; 850D: 20 13         \n");
    PC = 0x8522; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x850F:
                                                     mon("L850F    SUBD  #$0400                  ; 850F: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8512; JUMP; // sstep
case 0x8512:
                                                     mon("         BGE   L8522                   ; 8512: 2C 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8514; JUMP; // sstep
case 0x8514:
                                                     mon("         LDA   $4703                   ; 8514: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8517; JUMP; // sstep
case 0x8517:
                                                     mon("         LDB   $4703                   ; 8517: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x851A; JUMP; // sstep
case 0x851A:
                                                     mon("         MUL                           ; 851A: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x851B; JUMP; // sstep
case 0x851B:
                                                     mon("         CMPA  <$9B                    ; 851B: 91 9B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9b); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x851D; JUMP; // sstep
case 0x851D:
                                                     mon("         BCS   L8522                   ; 851D: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x851F; JUMP; // sstep
case 0x851F:
                                                     mon("         JSR   LA7F7                   ; 851F: BD A7 F7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x22); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xa7f7; 
    JUMP;
  case 0x8522:
                                                     mon("L8522    LDD   $507C                   ; 8522: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8525; JUMP; // sstep
case 0x8525:
                                                     mon("         SUBD  #$0400                  ; 8525: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8528; JUMP; // sstep
case 0x8528:
                                                     mon("         STD   $507C                   ; 8528: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x852B; JUMP; // sstep
case 0x852B:
                                                     mon("         LDA   <$9A                    ; 852B: 96 9A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x852D; JUMP; // sstep
case 0x852D:
                                                     mon("         ASLA                          ; 852D: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x852E; JUMP; // sstep
case 0x852E:
                                                     mon("         ASLA                          ; 852E: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x852F; JUMP; // sstep
case 0x852F:
                                                     mon("         BNE   L84EE                   ; 852F: 26 BD         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x84ee; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8531; JUMP; // sstep
case 0x8531:
                                                     mon("         LDD   #$FE00                  ; 8531: CC FE 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8534; JUMP; // sstep
case 0x8534:
                                                     mon("         STD   $507C                   ; 8534: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x8537; JUMP; // sstep
case 0x8537:
                                                     mon("         LDD   #$0380                  ; 8537: CC 03 80      \n");
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x853A; JUMP; // sstep
case 0x853A:
                                                     mon("         STD   $507A                   ; 853A: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x853D; JUMP; // sstep
case 0x853D:
                                                     mon("         LDX   #$4999                  ; 853D: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8540; JUMP; // sstep
case 0x8540:
                                                     mon("         LDB   <$99                    ; 8540: D6 99         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x99); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8542; JUMP; // sstep
case 0x8542:
                                                     mon("         LDA   B,X                     ; 8542: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8544; JUMP; // sstep
case 0x8544:
                                                     mon("L8544    STA   <$9A                    ; 8544: 97 9A         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9a; 
    wr_mem(ea, val); 
    PC = 0x8546; JUMP; // sstep
case 0x8546:
                                                     mon("         ANDA  #$C0                    ; 8546: 84 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xc0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8548; JUMP; // sstep
case 0x8548:
                                                     mon("         CMPA  #$C0                    ; 8548: 81 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xc0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x854A; JUMP; // sstep
case 0x854A:
                                                     mon("         BNE   L8578                   ; 854A: 26 2C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8578; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x854C; JUMP; // sstep
case 0x854C:
                                                     mon("         LDD   $509C                   ; 854C: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x854F; JUMP; // sstep
case 0x854F:
                                                     mon("         SUBD  $507C                   ; 854F: B3 50 7C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x507c)<<8; 
    ea = ea | rd_mem(0x507d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8552; JUMP; // sstep
case 0x8552:
                                                     mon("         BLT   L8578                   ; 8552: 2D 24         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8578; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8554; JUMP; // sstep
case 0x8554:
                                                     mon("         SUBD  #$0400                  ; 8554: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8557; JUMP; // sstep
case 0x8557:
                                                     mon("         BGE   L8565                   ; 8557: 2C 0C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x8565; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8559; JUMP; // sstep
case 0x8559:
                                                     mon("         LDA   $4703                   ; 8559: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x855C; JUMP; // sstep
case 0x855C:
                                                     mon("         CMPA  <$9B                    ; 855C: 91 9B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9b); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x855E; JUMP; // sstep
case 0x855E:
                                                     mon("         BCS   L8563                   ; 855E: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8563; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8560; JUMP; // sstep
case 0x8560:
                                                     mon("         JSR   LA80B                   ; 8560: BD A8 0B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xa80b; 
    JUMP;
  case 0x8563:
                                                     mon("L8563    BRA   L8578                   ; 8563: 20 13         \n");
    PC = 0x8578; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8565:
                                                     mon("L8565    SUBD  #$0400                  ; 8565: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8568; JUMP; // sstep
case 0x8568:
                                                     mon("         BGE   L8578                   ; 8568: 2C 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x8578; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x856A; JUMP; // sstep
case 0x856A:
                                                     mon("         LDA   $4703                   ; 856A: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x856D; JUMP; // sstep
case 0x856D:
                                                     mon("         LDB   $4703                   ; 856D: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8570; JUMP; // sstep
case 0x8570:
                                                     mon("         MUL                           ; 8570: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x8571; JUMP; // sstep
case 0x8571:
                                                     mon("         CMPA  <$9B                    ; 8571: 91 9B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9b); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8573; JUMP; // sstep
case 0x8573:
                                                     mon("         BCS   L8578                   ; 8573: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8578; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8575; JUMP; // sstep
case 0x8575:
                                                     mon("         JSR   LA80B                   ; 8575: BD A8 0B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xa80b; 
    JUMP;
  case 0x8578:
                                                     mon("L8578    LDD   $507C                   ; 8578: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x857B; JUMP; // sstep
case 0x857B:
                                                     mon("         SUBD  #$0400                  ; 857B: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x857E; JUMP; // sstep
case 0x857E:
                                                     mon("         STD   $507C                   ; 857E: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x8581; JUMP; // sstep
case 0x8581:
                                                     mon("         LDA   <$9A                    ; 8581: 96 9A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8583; JUMP; // sstep
case 0x8583:
                                                     mon("         ASLA                          ; 8583: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x8584; JUMP; // sstep
case 0x8584:
                                                     mon("         ASLA                          ; 8584: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x8585; JUMP; // sstep
case 0x8585:
                                                     mon("         BNE   L8544                   ; 8585: 26 BD         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8544; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8587; JUMP; // sstep
case 0x8587:
                                                     mon("         LDD   $5078                   ; 8587: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x858A; JUMP; // sstep
case 0x858A:
                                                     mon("         ADDD  #$0800                  ; 858A: C3 08 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0800; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x858D; JUMP; // sstep
case 0x858D:
                                                     mon("         STD   $5078                   ; 858D: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x8590; JUMP; // sstep
case 0x8590:
                                                     mon("         SUBD  $5098                   ; 8590: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8593; JUMP; // sstep
case 0x8593:
                                                     mon("         SUBD  #$6000                  ; 8593: 83 60 00      \n");
    clockticks = clockticks + 4; 
    val = 0x6000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8596; JUMP; // sstep
case 0x8596:
                                                     mon("         LBCS  L84D1                   ; 8596: 10 25 FF 37   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0x84d1; 
    JUMP;
    }
    // End of function sub_84C6
    PC = 0x859A; JUMP; // sstep
case 0x859A:
                                                     mon("         RTS                           ; 859A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x859B:
                                                     mon("L859B    LDA   $5040                   ; 859B: B6 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5040); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x859E; JUMP; // sstep
case 0x859E:
                                                     mon("         LSRA                          ; 859E: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x859F; JUMP; // sstep
case 0x859F:
                                                     mon("         LSRA                          ; 859F: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x85A0; JUMP; // sstep
case 0x85A0:
                                                     mon("         LSRA                          ; 85A0: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x85A1; JUMP; // sstep
case 0x85A1:
                                                     mon("         ANDA  #$0F                    ; 85A1: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x85A3; JUMP; // sstep
case 0x85A3:
                                                     mon("         CMPA  $49BF                   ; 85A3: B1 49 BF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x49bf); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x85A6; JUMP; // sstep
case 0x85A6:
                                                     mon("         BEQ   L85DE                   ; 85A6: 27 36         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x85de; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85A8; JUMP; // sstep
case 0x85A8:
                                                     mon("         LDB   $49BF                   ; 85A8: F6 49 BF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bf); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x85AB; JUMP; // sstep
case 0x85AB:
                                                     mon("         STA   $49BF                   ; 85AB: B7 49 BF      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49bf, val); 
    PC = 0x85AE; JUMP; // sstep
case 0x85AE:
                                                     mon("         LDX   #$4989                  ; 85AE: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x85B1; JUMP; // sstep
case 0x85B1:
                                                     mon("         LDA   B,X                     ; 85B1: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x85B3; JUMP; // sstep
case 0x85B3:
                                                     mon("L85B3    ASLA                          ; 85B3: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x85B4; JUMP; // sstep
case 0x85B4:
                                                     mon("         BCC   L85BD                   ; 85B4: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x85bd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85B6; JUMP; // sstep
case 0x85B6:
                                                     mon("         BMI   L85BD                   ; 85B6: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x85bd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85B8; JUMP; // sstep
case 0x85B8:
                                                     mon("         INC   $49C0                   ; 85B8: 7C 49 C0      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c0); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x49c0, res); 
    clockticks = clockticks + 2; 
    PC = 0x85BB; JUMP; // sstep
case 0x85BB:
                                                     mon("L85BB    BRA   L85D2                   ; 85BB: 20 15         \n");
    PC = 0x85d2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x85BD:
                                                     mon("L85BD    ASLA                          ; 85BD: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x85BE; JUMP; // sstep
case 0x85BE:
                                                     mon("         BNE   L85B3                   ; 85BE: 26 F3         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x85b3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85C0; JUMP; // sstep
case 0x85C0:
                                                     mon("         LDX   #$4999                  ; 85C0: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x85C3; JUMP; // sstep
case 0x85C3:
                                                     mon("         LDA   B,X                     ; 85C3: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x85C5; JUMP; // sstep
case 0x85C5:
                                                     mon("L85C5    ASLA                          ; 85C5: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x85C6; JUMP; // sstep
case 0x85C6:
                                                     mon("         BCC   L85CF                   ; 85C6: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x85cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85C8; JUMP; // sstep
case 0x85C8:
                                                     mon("         BMI   L85CF                   ; 85C8: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x85cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85CA; JUMP; // sstep
case 0x85CA:
                                                     mon("         INC   $49C0                   ; 85CA: 7C 49 C0      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c0); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x49c0, res); 
    clockticks = clockticks + 2; 
    PC = 0x85CD; JUMP; // sstep
case 0x85CD:
                                                     mon("         BRA   L85D2                   ; 85CD: 20 03         \n");
    PC = 0x85d2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x85CF:
                                                     mon("L85CF    ASLA                          ; 85CF: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x85D0; JUMP; // sstep
case 0x85D0:
                                                     mon("         BNE   L85C5                   ; 85D0: 26 F3         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x85c5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85D2; JUMP; // sstep
case 0x85D2:
                                                     mon("L85D2    LDA   #$00                    ; 85D2: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x85D4; JUMP; // sstep
case 0x85D4:
                                                     mon("         LDX   #$4989                  ; 85D4: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x85D7; JUMP; // sstep
case 0x85D7:
                                                     mon("         STA   B,X                     ; 85D7: A7 85         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)B); 
    wr_mem(ea, val); 
    PC = 0x85D9; JUMP; // sstep
case 0x85D9:
                                                     mon("         LDX   #$4999                  ; 85D9: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x85DC; JUMP; // sstep
case 0x85DC:
                                                     mon("         STA   B,X                     ; 85DC: A7 85         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + (SINT8)B); 
    wr_mem(ea, val); 
    PC = 0x85DE; JUMP; // sstep
case 0x85DE:
                                                     mon("L85DE    JSR   LB3E4                   ; 85DE: BD B3 E4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xb3e4; 
    JUMP;
  case 0x85E1:
                                                     mon("L85E1    JSR   L85F9                   ; 85E1: BD 85 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0x85f9; 
    JUMP;
  case 0x85E4:
                                                     mon("L85E4    JSR   L8735                   ; 85E4: BD 87 35      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0x8735; 
    JUMP;
  case 0x85E7:
                                                     mon("L85E7    JSR   L86AE                   ; 85E7: BD 86 AE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xea); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0x86ae; 
    JUMP;
  case 0x85EA:
                                                     mon("L85EA    LDA   <$95                    ; 85EA: 96 95         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x95); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x85EC; JUMP; // sstep
case 0x85EC:
                                                     mon("         BEQ   L85F1                   ; 85EC: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x85f1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85EE; JUMP; // sstep
case 0x85EE:
                                                     mon("         JSR   L889F                   ; 85EE: BD 88 9F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0x889f; 
    JUMP;
  case 0x85F1:
                                                     mon("L85F1    LDA   <$92                    ; 85F1: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x85F3; JUMP; // sstep
case 0x85F3:
                                                     mon("         BEQ   locret_85F8             ; 85F3: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x85f8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x85F5; JUMP; // sstep
case 0x85F5:
                                                     mon("         JSR   L88F5                   ; 85F5: BD 88 F5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0x88f5; 
    JUMP;
    // End of function sub_859B
  case 0x85F8:
                                                     mon("locret_85F8 RTS                           ; 85F8: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x85F9:
                                                     mon("L85F9    LDD   #$00                    ; 85F9: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x85FC; JUMP; // sstep
case 0x85FC:
                                                     mon("         STD   $5040                   ; 85FC: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0x85FF; JUMP; // sstep
case 0x85FF:
                                                     mon("         LDD   #$6270                  ; 85FF: CC 62 70      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x70; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8602; JUMP; // sstep
case 0x8602:
                                                     mon("         STD   ,Y++                    ; 8602: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x8604; JUMP; // sstep
case 0x8604:
                                                     mon("         LDU   #word_8696              ; 8604: CE 86 96      \n");
    clockticks = clockticks + 3; 
    U = 0x8696; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8607; JUMP; // sstep
case 0x8607:
                                                     mon("L8607    LDA   <$92                    ; 8607: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8609; JUMP; // sstep
case 0x8609:
                                                     mon("         BEQ   L8618                   ; 8609: 27 0D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8618; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x860B; JUMP; // sstep
case 0x860B:
                                                     mon("         LDD   <$93                    ; 860B: DC 93         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x93); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x94); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x860D; JUMP; // sstep
case 0x860D:
                                                     mon("         SUBD  $5098                   ; 860D: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8610; JUMP; // sstep
case 0x8610:
                                                     mon("         CMPD  #$7000                  ; 8610: 10 83 70 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x7000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8614; JUMP; // sstep
case 0x8614:
                                                     mon("         BHI   L8618                   ; 8614: 22 02         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x8618; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8616; JUMP; // sstep
case 0x8616:
                                                     mon("         BRA   L861B                   ; 8616: 20 03         \n");
    PC = 0x861b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8618:
                                                     mon("L8618    LDD   #$7000                  ; 8618: CC 70 00      \n");
    clockticks = clockticks + 3; 
    A = 0x70; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x861B; JUMP; // sstep
case 0x861B:
                                                     mon("L861B    STD   $5078                   ; 861B: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x861E; JUMP; // sstep
case 0x861E:
                                                     mon("         LDD   ,U                      ; 861E: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8620; JUMP; // sstep
case 0x8620:
                                                     mon("         STD   $507A                   ; 8620: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x8623; JUMP; // sstep
case 0x8623:
                                                     mon("L8623    LDD   $02,U                   ; 8623: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8625; JUMP; // sstep
case 0x8625:
                                                     mon("         STD   $507C                   ; 8625: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x8628; JUMP; // sstep
case 0x8628:
                                                     mon("         LDD   #$0F                    ; 8628: CC 00 0F      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x862B; JUMP; // sstep
case 0x862B:
                                                     mon("         STD   $4701                   ; 862B: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x862E; JUMP; // sstep
case 0x862E:
                                                     mon("         LDA   #$67                    ; 862E: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8630; JUMP; // sstep
case 0x8630:
                                                     mon("         JSR   LCDBA                   ; 8630: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x33); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8633:
                                                     mon("L8633    LDD   $5000                   ; 8633: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8636; JUMP; // sstep
case 0x8636:
                                                     mon("         STD   $4704                   ; 8636: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x8639; JUMP; // sstep
case 0x8639:
                                                     mon("         JSR   LCCE4                   ; 8639: BD CC E4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    PC = 0xcce4; 
    JUMP;
  case 0x863C:
                                                     mon("L863C    LDD   #$0200                  ; 863C: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x863F; JUMP; // sstep
case 0x863F:
                                                     mon("         STD   $5078                   ; 863F: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x8642; JUMP; // sstep
case 0x8642:
                                                     mon("         LDD   $507A                   ; 8642: FC 50 7A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507a); // Care needed with I/O space and word fetches
    B = rd_mem(0x507b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8645; JUMP; // sstep
case 0x8645:
                                                     mon("         SUBD  $509A                   ; 8645: B3 50 9A      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8648; JUMP; // sstep
case 0x8648:
                                                     mon("         BPL   L864E                   ; 8648: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x864e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x864A; JUMP; // sstep
case 0x864A:
                                                     mon("         COMA                          ; 864A: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x864B; JUMP; // sstep
case 0x864B:
                                                     mon("         NEGB                          ; 864B: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x864C; JUMP; // sstep
case 0x864C:
                                                     mon("         SBCA  #$FF                    ; 864C: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0x864E; JUMP; // sstep
case 0x864E:
                                                     mon("L864E    CMPD  $5078                   ; 864E: 10 B3 50 78   \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5078)<<8; 
    ea = ea | rd_mem(0x5079); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0x8652; JUMP; // sstep
case 0x8652:
                                                     mon("         BLE   L8657                   ; 8652: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x8657; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8654; JUMP; // sstep
case 0x8654:
                                                     mon("         STD   $5078                   ; 8654: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x8657; JUMP; // sstep
case 0x8657:
                                                     mon("L8657    LDD   $507C                   ; 8657: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x865A; JUMP; // sstep
case 0x865A:
                                                     mon("         SUBD  $509C                   ; 865A: B3 50 9C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509c)<<8; 
    ea = ea | rd_mem(0x509d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x865D; JUMP; // sstep
case 0x865D:
                                                     mon("         BPL   L8663                   ; 865D: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x8663; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x865F; JUMP; // sstep
case 0x865F:
                                                     mon("         COMA                          ; 865F: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x8660; JUMP; // sstep
case 0x8660:
                                                     mon("         NEGB                          ; 8660: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x8661; JUMP; // sstep
case 0x8661:
                                                     mon("         SBCA  #$FF                    ; 8661: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0x8663; JUMP; // sstep
case 0x8663:
                                                     mon("L8663    CMPD  $5078                   ; 8663: 10 B3 50 78   \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5078)<<8; 
    ea = ea | rd_mem(0x5079); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0x8667; JUMP; // sstep
case 0x8667:
                                                     mon("         BLE   L866C                   ; 8667: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x866c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8669; JUMP; // sstep
case 0x8669:
                                                     mon("         STD   $5078                   ; 8669: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x866C; JUMP; // sstep
case 0x866C:
                                                     mon("L866C    LDD   #$0F                    ; 866C: CC 00 0F      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x866F; JUMP; // sstep
case 0x866F:
                                                     mon("         STD   $4701                   ; 866F: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x8672; JUMP; // sstep
case 0x8672:
                                                     mon("         LDA   #$67                    ; 8672: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8674; JUMP; // sstep
case 0x8674:
                                                     mon("         JSR   LCDBA                   ; 8674: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8677:
                                                     mon("L8677    LDD   $5000                   ; 8677: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x867A; JUMP; // sstep
case 0x867A:
                                                     mon("         STD   $4704                   ; 867A: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x867D; JUMP; // sstep
case 0x867D:
                                                     mon("         JSR   LCCFC                   ; 867D: BD CC FC      \n"); // Trench floor lines calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x80); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    PC = 0xccfc; 
    JUMP;
  case 0x8680:
                                                     mon("L8680    LDD   #$8040                  ; 8680: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8683; JUMP; // sstep
case 0x8683:
                                                     mon("         STD   ,Y++                    ; 8683: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x8685; JUMP; // sstep
case 0x8685:
                                                     mon("         LEAU  $04,U                   ; 8685: 33 44         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0004); 
    PC = 0x8687; JUMP; // sstep
case 0x8687:
                                                     mon("         CMPU  #L86AE                  ; 8687: 11 83 86 AE   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x86ae; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x868B; JUMP; // sstep
case 0x868B:
                                                     mon("         LBCS  L8607                   ; 868B: 10 25 FF 78   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0x8607; 
    JUMP;
    }
    PC = 0x868F; JUMP; // sstep
case 0x868F:
                                                     mon("         LDD   $5098                   ; 868F: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8692; JUMP; // sstep
case 0x8692:
                                                     mon("         STD   $5040                   ; 8692: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    // End of function sub_85F9
    // ---------------------------------------------------------------------------
    PC = 0x8695; JUMP; // sstep
case 0x8695:
                                                     mon("         RTS                           ; 8695: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x86AE:
                                                     mon("L86AE    LDD   #$00                    ; 86AE: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86B1; JUMP; // sstep
case 0x86B1:
                                                     mon("         STD   $5040                   ; 86B1: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0x86B4; JUMP; // sstep
case 0x86B4:
                                                     mon("         LDD   #$6250                  ; 86B4: CC 62 50      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86B7; JUMP; // sstep
case 0x86B7:
                                                     mon("         STD   ,Y++                    ; 86B7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x86B9; JUMP; // sstep
case 0x86B9:
                                                     mon("         LDU   #word_8725              ; 86B9: CE 87 25      \n");
    clockticks = clockticks + 3; 
    U = 0x8725; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x86BC; JUMP; // sstep
case 0x86BC:
                                                     mon("         LDA   <$92                    ; 86BC: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x86BE; JUMP; // sstep
case 0x86BE:
                                                     mon("         BEQ   L86CD                   ; 86BE: 27 0D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x86cd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x86C0; JUMP; // sstep
case 0x86C0:
                                                     mon("         LDD   <$93                    ; 86C0: DC 93         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x93); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x94); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86C2; JUMP; // sstep
case 0x86C2:
                                                     mon("         SUBD  $5098                   ; 86C2: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x86C5; JUMP; // sstep
case 0x86C5:
                                                     mon("         CMPD  #$7000                  ; 86C5: 10 83 70 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x7000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x86C9; JUMP; // sstep
case 0x86C9:
                                                     mon("         BHI   L86CD                   ; 86C9: 22 02         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x86cd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x86CB; JUMP; // sstep
case 0x86CB:
                                                     mon("         BRA   L86D0                   ; 86CB: 20 03         \n");
    PC = 0x86d0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x86CD:
                                                     mon("L86CD    LDD   #$7000                  ; 86CD: CC 70 00      \n");
    clockticks = clockticks + 3; 
    A = 0x70; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86D0; JUMP; // sstep
case 0x86D0:
                                                     mon("L86D0    STD   $5078                   ; 86D0: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x86D3; JUMP; // sstep
case 0x86D3:
                                                     mon("         LDD   ,U                      ; 86D3: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86D5; JUMP; // sstep
case 0x86D5:
                                                     mon("         STD   $507A                   ; 86D5: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x86D8; JUMP; // sstep
case 0x86D8:
                                                     mon("         LDD   $02,U                   ; 86D8: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86DA; JUMP; // sstep
case 0x86DA:
                                                     mon("         STD   $507C                   ; 86DA: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x86DD; JUMP; // sstep
case 0x86DD:
                                                     mon("         LDD   #$0F                    ; 86DD: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86E0; JUMP; // sstep
case 0x86E0:
                                                     mon("         STD   $4701                   ; 86E0: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x86E3; JUMP; // sstep
case 0x86E3:
                                                     mon("         LDA   #$67                    ; 86E3: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x86E5; JUMP; // sstep
case 0x86E5:
                                                     mon("         JSR   LCDBA                   ; 86E5: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x86E8:
                                                     mon("L86E8    LDD   $5000                   ; 86E8: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86EB; JUMP; // sstep
case 0x86EB:
                                                     mon("         STD   $4704                   ; 86EB: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x86EE; JUMP; // sstep
case 0x86EE:
                                                     mon("         JSR   LCCE4                   ; 86EE: BD CC E4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    PC = 0xcce4; 
    JUMP;
  case 0x86F1:
                                                     mon("L86F1    BRA   L8711                   ; 86F1: 20 1E         \n");
    PC = 0x8711; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x86F3:
                                                     mon("L86F3    LDD   ,U                      ; 86F3: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86F5; JUMP; // sstep
case 0x86F5:
                                                     mon("         STD   $507A                   ; 86F5: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x86F8; JUMP; // sstep
case 0x86F8:
                                                     mon("         LDD   $02,U                   ; 86F8: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x86FA; JUMP; // sstep
case 0x86FA:
                                                     mon("         STD   $507C                   ; 86FA: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x86FD; JUMP; // sstep
case 0x86FD:
                                                     mon("         LDD   #$0F                    ; 86FD: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8700; JUMP; // sstep
case 0x8700:
                                                     mon("         STD   $4701                   ; 8700: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x8703; JUMP; // sstep
case 0x8703:
                                                     mon("         LDA   #$67                    ; 8703: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8705; JUMP; // sstep
case 0x8705:
                                                     mon("         JSR   LCDBA                   ; 8705: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x08); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8708:
                                                     mon("L8708    LDD   $5000                   ; 8708: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x870B; JUMP; // sstep
case 0x870B:
                                                     mon("         STD   $4704                   ; 870B: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x870E; JUMP; // sstep
case 0x870E:
                                                     mon("         JSR   LCCFC                   ; 870E: BD CC FC      \n"); // Trench floor lines calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x11); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    PC = 0xccfc; 
    JUMP;
  case 0x8711:
                                                     mon("L8711    LEAU  $04,U                   ; 8711: 33 44         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0004); 
    PC = 0x8713; JUMP; // sstep
case 0x8713:
                                                     mon("         CMPU  #L8735                  ; 8713: 11 83 87 35   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x8735; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8717; JUMP; // sstep
case 0x8717:
                                                     mon("         BCS   L86F3                   ; 8717: 25 DA         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x86f3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8719; JUMP; // sstep
case 0x8719:
                                                     mon("         LDD   #$8040                  ; 8719: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x871C; JUMP; // sstep
case 0x871C:
                                                     mon("         STD   ,Y++                    ; 871C: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x871E; JUMP; // sstep
case 0x871E:
                                                     mon("         LDD   $5098                   ; 871E: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8721; JUMP; // sstep
case 0x8721:
                                                     mon("         STD   $5040                   ; 8721: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    // End of function sub_86AE
    // ---------------------------------------------------------------------------
    PC = 0x8724; JUMP; // sstep
case 0x8724:
                                                     mon("         RTS                           ; 8724: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8735:
                                                     mon("L8735    LDU   $49AF                   ; 8735: FE 49 AF      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49af)<<8; 
    ea = ea | rd_mem(0x49b0); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8738; JUMP; // sstep
case 0x8738:
                                                     mon("         LDB   ,U                      ; 8738: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x873A; JUMP; // sstep
case 0x873A:
                                                     mon("         CMPB  #$03                    ; 873A: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x873C; JUMP; // sstep
case 0x873C:
                                                     mon("         BNE   L873F                   ; 873C: 26 01         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x873f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x873E; JUMP; // sstep
case 0x873E:
                                                     mon("         RTS                           ; 873E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x873F:
                                                     mon("L873F    CMPB  #$01                    ; 873F: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8741; JUMP; // sstep
case 0x8741:
                                                     mon("         BNE   L8748                   ; 8741: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8748; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8743; JUMP; // sstep
case 0x8743:
                                                     mon("         LDD   #$0800                  ; 8743: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8746; JUMP; // sstep
case 0x8746:
                                                     mon("         BRA   L874B                   ; 8746: 20 03         \n");
    PC = 0x874b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8748:
                                                     mon("L8748    LDD   #$1000                  ; 8748: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x874B; JUMP; // sstep
case 0x874B:
                                                     mon("L874B    ADDD  $49B1                   ; 874B: F3 49 B1      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b1)<<8; 
    ea = ea | rd_mem(0x49b2); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x874E; JUMP; // sstep
case 0x874E:
                                                     mon("         SUBD  $5040                   ; 874E: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8751; JUMP; // sstep
case 0x8751:
                                                     mon("         BPL   L8786                   ; 8751: 2A 33         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x8786; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8753; JUMP; // sstep
case 0x8753:
                                                     mon("         LDB   ,U                      ; 8753: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8755; JUMP; // sstep
case 0x8755:
                                                     mon("L8755    CMPB  #$01                    ; 8755: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8757; JUMP; // sstep
case 0x8757:
                                                     mon("         BNE   L875E                   ; 8757: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x875e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8759; JUMP; // sstep
case 0x8759:
                                                     mon("         LDD   #$0800                  ; 8759: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x875C; JUMP; // sstep
case 0x875C:
                                                     mon("         BRA   L8761                   ; 875C: 20 03         \n");
    PC = 0x8761; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x875E:
                                                     mon("L875E    LDD   #$1000                  ; 875E: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8761; JUMP; // sstep
case 0x8761:
                                                     mon("L8761    ADDD  $49B1                   ; 8761: F3 49 B1      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b1)<<8; 
    ea = ea | rd_mem(0x49b2); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8764; JUMP; // sstep
case 0x8764:
                                                     mon("         STD   $49B1                   ; 8764: FD 49 B1      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b1, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b2, B); 
    PC = 0x8767; JUMP; // sstep
case 0x8767:
                                                     mon("         LEAU  $03,U                   ; 8767: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8769; JUMP; // sstep
case 0x8769:
                                                     mon("         STU   $49AF                   ; 8769: FF 49 AF      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49af, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b0, (UINT8)val); 
    PC = 0x876C; JUMP; // sstep
case 0x876C:
                                                     mon("         LDB   ,U                      ; 876C: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x876E; JUMP; // sstep
case 0x876E:
                                                     mon("         CMPB  #$03                    ; 876E: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8770; JUMP; // sstep
case 0x8770:
                                                     mon("         BNE   L8773                   ; 8770: 26 01         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8773; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8772; JUMP; // sstep
case 0x8772:
                                                     mon("         RTS                           ; 8772: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8773:
                                                     mon("L8773    LDB   ,U                      ; 8773: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8775; JUMP; // sstep
case 0x8775:
                                                     mon("         CMPB  #$05                    ; 8775: C1 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8777; JUMP; // sstep
case 0x8777:
                                                     mon("         BNE   L8783                   ; 8777: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8783; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8779; JUMP; // sstep
case 0x8779:
                                                     mon("         LDU   $49A9                   ; 8779: FE 49 A9      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49a9)<<8; 
    ea = ea | rd_mem(0x49aa); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x877C; JUMP; // sstep
case 0x877C:
                                                     mon("         LEAU  $02,U                   ; 877C: 33 42         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0002); 
    PC = 0x877E; JUMP; // sstep
case 0x877E:
                                                     mon("         STU   $49A9                   ; 877E: FF 49 A9      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49a9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49aa, (UINT8)val); 
    PC = 0x8781; JUMP; // sstep
case 0x8781:
                                                     mon("         LDU   ,U                      ; 8781: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8783; JUMP; // sstep
case 0x8783:
                                                     mon("L8783    STU   $49AF                   ; 8783: FF 49 AF      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49af, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b0, (UINT8)val); 
    PC = 0x8786; JUMP; // sstep
case 0x8786:
                                                     mon("L8786    LDD   #$6260                  ; 8786: CC 62 60      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x60; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8789; JUMP; // sstep
case 0x8789:
                                                     mon("         STD   ,Y++                    ; 8789: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x878B; JUMP; // sstep
case 0x878B:
                                                     mon("         JSR   L83CE                   ; 878B: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x878E:
                                                     mon("L878E    LDD   $49A9                   ; 878E: FC 49 A9      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49a9); // Care needed with I/O space and word fetches
    B = rd_mem(0x49aa); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8791; JUMP; // sstep
case 0x8791:
                                                     mon("         STD   $49AD                   ; 8791: FD 49 AD      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49ad, A); // Care needed with I/O space and word fetches
    wr_mem(0x49ae, B); 
    PC = 0x8794; JUMP; // sstep
case 0x8794:
                                                     mon("         LDD   $49AF                   ; 8794: FC 49 AF      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49af); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8797; JUMP; // sstep
case 0x8797:
                                                     mon("         STD   $49B9                   ; 8797: FD 49 B9      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b9, A); // Care needed with I/O space and word fetches
    wr_mem(0x49ba, B); 
    PC = 0x879A; JUMP; // sstep
case 0x879A:
                                                     mon("         LDD   $49B1                   ; 879A: FC 49 B1      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49b1); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b2); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x879D; JUMP; // sstep
case 0x879D:
                                                     mon("         STD   $49BB                   ; 879D: FD 49 BB      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49bb, A); // Care needed with I/O space and word fetches
    wr_mem(0x49bc, B); 
    PC = 0x87A0; JUMP; // sstep
case 0x87A0:
                                                     mon("         STD   $5078                   ; 87A0: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x87A3; JUMP; // sstep
case 0x87A3:
                                                     mon("         LDD   #$FC00                  ; 87A3: CC FC 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87A6; JUMP; // sstep
case 0x87A6:
                                                     mon("         STD   $507A                   ; 87A6: FD 50 7A      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x87A9; JUMP; // sstep
case 0x87A9:
                                                     mon("L87A9    JSR   L87CB                   ; 87A9: BD 87 CB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    PC = 0x87cb; 
    JUMP;
  case 0x87AC:
                                                     mon("L87AC    LDD   $49A9                   ; 87AC: FC 49 A9      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49a9); // Care needed with I/O space and word fetches
    B = rd_mem(0x49aa); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87AF; JUMP; // sstep
case 0x87AF:
                                                     mon("         STD   $49AD                   ; 87AF: FD 49 AD      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49ad, A); // Care needed with I/O space and word fetches
    wr_mem(0x49ae, B); 
    PC = 0x87B2; JUMP; // sstep
case 0x87B2:
                                                     mon("         LDD   $49AF                   ; 87B2: FC 49 AF      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49af); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87B5; JUMP; // sstep
case 0x87B5:
                                                     mon("         STD   $49B9                   ; 87B5: FD 49 B9      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b9, A); // Care needed with I/O space and word fetches
    wr_mem(0x49ba, B); 
    PC = 0x87B8; JUMP; // sstep
case 0x87B8:
                                                     mon("         LDD   $49B1                   ; 87B8: FC 49 B1      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49b1); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b2); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87BB; JUMP; // sstep
case 0x87BB:
                                                     mon("         STD   $49BB                   ; 87BB: FD 49 BB      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49bb, A); // Care needed with I/O space and word fetches
    wr_mem(0x49bc, B); 
    PC = 0x87BE; JUMP; // sstep
case 0x87BE:
                                                     mon("         STD   $5078                   ; 87BE: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x87C1; JUMP; // sstep
case 0x87C1:
                                                     mon("         LDD   #$0400                  ; 87C1: CC 04 00      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87C4; JUMP; // sstep
case 0x87C4:
                                                     mon("         STD   $507A                   ; 87C4: FD 50 7A      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x87C7; JUMP; // sstep
case 0x87C7:
                                                     mon("         JSR   L87CB                   ; 87C7: BD 87 CB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xca); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    PC = 0x87cb; 
    JUMP;
    // End of function sub_8735
  case 0x87CA:
                                                     mon("L87CA    RTS                           ; 87CA: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x87CB:
                                                     mon("L87CB    LDD   $49BB                   ; 87CB: FC 49 BB      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49bb); // Care needed with I/O space and word fetches
    B = rd_mem(0x49bc); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87CE; JUMP; // sstep
case 0x87CE:
                                                     mon("         STD   $5078                   ; 87CE: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x87D1; JUMP; // sstep
case 0x87D1:
                                                     mon("         SUBD  $5040                   ; 87D1: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x87D4; JUMP; // sstep
case 0x87D4:
                                                     mon("         LBMI  L8866                   ; 87D4: 10 2B 00 8E   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N <  0) {
    clockticks = clockticks + 1; 
    PC = 0x8866; 
    JUMP;
    }
    PC = 0x87D8; JUMP; // sstep
case 0x87D8:
                                                     mon("         CMPD  #$0800                  ; 87D8: 10 83 08 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0800; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x87DC; JUMP; // sstep
case 0x87DC:
                                                     mon("         BGE   L87F5                   ; 87DC: 2C 17         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x87f5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x87DE; JUMP; // sstep
case 0x87DE:
                                                     mon("         ASLB                          ; 87DE: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x87DF; JUMP; // sstep
case 0x87DF:
                                                     mon("         ROLA                          ; 87DF: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0x87E0; JUMP; // sstep
case 0x87E0:
                                                     mon("         COMA                          ; 87E0: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x87E1; JUMP; // sstep
case 0x87E1:
                                                     mon("         NEGB                          ; 87E1: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x87E2; JUMP; // sstep
case 0x87E2:
                                                     mon("         SBCA  #$FF                    ; 87E2: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0x87E4; JUMP; // sstep
case 0x87E4:
                                                     mon("         ADDD  $5044                   ; 87E4: F3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x87E7; JUMP; // sstep
case 0x87E7:
                                                     mon("         CMPD  #$F000                  ; 87E7: 10 83 F0 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xf000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x87EB; JUMP; // sstep
case 0x87EB:
                                                     mon("         BGE   L87F0                   ; 87EB: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x87f0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x87ED; JUMP; // sstep
case 0x87ED:
                                                     mon("         LDD   #$F000                  ; 87ED: CC F0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87F0; JUMP; // sstep
case 0x87F0:
                                                     mon("L87F0    STD   $507C                   ; 87F0: FD 50 7C      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x87F3; JUMP; // sstep
case 0x87F3:
                                                     mon("         BRA   L8801                   ; 87F3: 20 0C         \n");
    PC = 0x8801; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x87F5:
                                                     mon("L87F5    LDD   $49BB                   ; 87F5: FC 49 BB      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49bb); // Care needed with I/O space and word fetches
    B = rd_mem(0x49bc); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87F8; JUMP; // sstep
case 0x87F8:
                                                     mon("         STD   $5078                   ; 87F8: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x87FB; JUMP; // sstep
case 0x87FB:
                                                     mon("         LDD   #$F000                  ; 87FB: CC F0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x87FE; JUMP; // sstep
case 0x87FE:
                                                     mon("         STD   $507C                   ; 87FE: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x8801; JUMP; // sstep
case 0x8801:
                                                     mon("L8801    LDA   <$92                    ; 8801: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8803; JUMP; // sstep
case 0x8803:
                                                     mon("         BEQ   L880E                   ; 8803: 27 09         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x880e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8805; JUMP; // sstep
case 0x8805:
                                                     mon("         LDD   $5078                   ; 8805: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8808; JUMP; // sstep
case 0x8808:
                                                     mon("         SUBD  <$93                    ; 8808: 93 93         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x93)<<8; 
    ea = ea | rd_mem(DP|0x94); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x880A; JUMP; // sstep
case 0x880A:
                                                     mon("         LBPL  locret_889E             ; 880A: 10 2A 00 90   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N >= 0) {
    clockticks = clockticks + 1; 
    PC = 0x889e; 
    JUMP;
    }
    PC = 0x880E; JUMP; // sstep
case 0x880E:
                                                     mon("L880E    LDD   $5078                   ; 880E: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8811; JUMP; // sstep
case 0x8811:
                                                     mon("         SUBD  $5098                   ; 8811: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8814; JUMP; // sstep
case 0x8814:
                                                     mon("         SUBD  #$7000                  ; 8814: 83 70 00      \n");
    clockticks = clockticks + 4; 
    val = 0x7000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8817; JUMP; // sstep
case 0x8817:
                                                     mon("         LBPL  locret_889E             ; 8817: 10 2A 00 83   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N >= 0) {
    clockticks = clockticks + 1; 
    PC = 0x889e; 
    JUMP;
    }
    PC = 0x881B; JUMP; // sstep
case 0x881B:
                                                     mon("         LDD   #$0F                    ; 881B: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x881E; JUMP; // sstep
case 0x881E:
                                                     mon("         STD   $4701                   ; 881E: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x8821; JUMP; // sstep
case 0x8821:
                                                     mon("         LDA   #$67                    ; 8821: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8823; JUMP; // sstep
case 0x8823:
                                                     mon("         JSR   LCDBA                   ; 8823: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x26); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8826:
                                                     mon("L8826    LDD   $5002                   ; 8826: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8829; JUMP; // sstep
case 0x8829:
                                                     mon("         BPL   L882F                   ; 8829: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x882f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x882B; JUMP; // sstep
case 0x882B:
                                                     mon("         COMA                          ; 882B: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x882C; JUMP; // sstep
case 0x882C:
                                                     mon("         NEGB                          ; 882C: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x882D; JUMP; // sstep
case 0x882D:
                                                     mon("         SBCA  #$FF                    ; 882D: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0x882F; JUMP; // sstep
case 0x882F:
                                                     mon("L882F    SUBD  $5000                   ; 882F: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8832; JUMP; // sstep
case 0x8832:
                                                     mon("         BGT   L8866                   ; 8832: 2E 32         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8866; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8834; JUMP; // sstep
case 0x8834:
                                                     mon("         LDD   $5000                   ; 8834: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8837; JUMP; // sstep
case 0x8837:
                                                     mon("         STD   $4704                   ; 8837: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x883A; JUMP; // sstep
case 0x883A:
                                                     mon("         LDD   #$00                    ; 883A: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x883D; JUMP; // sstep
case 0x883D:
                                                     mon("         STD   <$D6                    ; 883D: DD D6         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xd6; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x883F; JUMP; // sstep
case 0x883F:
                                                     mon("         LDD   #$68                    ; 883F: CC 00 68      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x68; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8842; JUMP; // sstep
case 0x8842:
                                                     mon("         STD   <$D8                    ; 8842: DD D8         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0xd8; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8844; JUMP; // sstep
case 0x8844:
                                                     mon("         JSR   LCD08                   ; 8844: BD CD 08      \n"); // Trench side vertical lines calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x47); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcd08; 
    JUMP;
  case 0x8847:
                                                     mon("L8847    LDD   #$00                    ; 8847: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x884A; JUMP; // sstep
case 0x884A:
                                                     mon("         STD   $507C                   ; 884A: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x884D; JUMP; // sstep
case 0x884D:
                                                     mon("         LDD   #$0F                    ; 884D: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8850; JUMP; // sstep
case 0x8850:
                                                     mon("         STD   $4701                   ; 8850: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x8853; JUMP; // sstep
case 0x8853:
                                                     mon("         LDA   #$67                    ; 8853: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8855; JUMP; // sstep
case 0x8855:
                                                     mon("         JSR   LCDBA                   ; 8855: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8858:
                                                     mon("L8858    LDD   $5000                   ; 8858: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x885B; JUMP; // sstep
case 0x885B:
                                                     mon("         STD   $4704                   ; 885B: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x885E; JUMP; // sstep
case 0x885E:
                                                     mon("         JSR   LCCFC                   ; 885E: BD CC FC      \n"); // Trench floor lines calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xccfc; 
    JUMP;
  case 0x8861:
                                                     mon("L8861    LDD   #$8040                  ; 8861: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8864; JUMP; // sstep
case 0x8864:
                                                     mon("         STD   ,Y++                    ; 8864: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x8866; JUMP; // sstep
case 0x8866:
                                                     mon("L8866    LDU   $49B9                   ; 8866: FE 49 B9      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b9)<<8; 
    ea = ea | rd_mem(0x49ba); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8869; JUMP; // sstep
case 0x8869:
                                                     mon("         LDB   ,U                      ; 8869: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x886B; JUMP; // sstep
case 0x886B:
                                                     mon("         CMPB  #$01                    ; 886B: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x886D; JUMP; // sstep
case 0x886D:
                                                     mon("         BNE   L8874                   ; 886D: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8874; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x886F; JUMP; // sstep
case 0x886F:
                                                     mon("         LDD   #$0800                  ; 886F: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8872; JUMP; // sstep
case 0x8872:
                                                     mon("         BRA   L8877                   ; 8872: 20 03         \n");
    PC = 0x8877; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8874:
                                                     mon("L8874    LDD   #$1000                  ; 8874: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8877; JUMP; // sstep
case 0x8877:
                                                     mon("L8877    ADDD  $49BB                   ; 8877: F3 49 BB      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49bb)<<8; 
    ea = ea | rd_mem(0x49bc); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x887A; JUMP; // sstep
case 0x887A:
                                                     mon("         STD   $49BB                   ; 887A: FD 49 BB      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49bb, A); // Care needed with I/O space and word fetches
    wr_mem(0x49bc, B); 
    PC = 0x887D; JUMP; // sstep
case 0x887D:
                                                     mon("         SUBD  $5040                   ; 887D: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8880; JUMP; // sstep
case 0x8880:
                                                     mon("         BMI   locret_889E             ; 8880: 2B 1C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x889e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8882; JUMP; // sstep
case 0x8882:
                                                     mon("         LEAU  $03,U                   ; 8882: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8884; JUMP; // sstep
case 0x8884:
                                                     mon("         LDB   ,U                      ; 8884: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8886; JUMP; // sstep
case 0x8886:
                                                     mon("         CMPB  #$03                    ; 8886: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8888; JUMP; // sstep
case 0x8888:
                                                     mon("L8888    BEQ   locret_889E             ; 8888: 27 14         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x889e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x888A; JUMP; // sstep
case 0x888A:
                                                     mon("         CMPB  #$05                    ; 888A: C1 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x888C; JUMP; // sstep
case 0x888C:
                                                     mon("         BNE   L8898                   ; 888C: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8898; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x888E; JUMP; // sstep
case 0x888E:
                                                     mon("         LDU   $49AD                   ; 888E: FE 49 AD      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49ad)<<8; 
    ea = ea | rd_mem(0x49ae); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8891; JUMP; // sstep
case 0x8891:
                                                     mon("         LEAU  $02,U                   ; 8891: 33 42         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0002); 
    PC = 0x8893; JUMP; // sstep
case 0x8893:
                                                     mon("         STU   $49AD                   ; 8893: FF 49 AD      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49ad, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49ae, (UINT8)val); 
    PC = 0x8896; JUMP; // sstep
case 0x8896:
                                                     mon("         LDU   ,U                      ; 8896: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8898; JUMP; // sstep
case 0x8898:
                                                     mon("L8898    STU   $49B9                   ; 8898: FF 49 B9      \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x49b9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49ba, (UINT8)val); 
    PC = 0x889B; JUMP; // sstep
case 0x889B:
                                                     mon("         JMP   L87F5                   ; 889B: 7E 87 F5      \n");
    clockticks = clockticks + 4; 
    PC = 0x87f5; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // End of function sub_87CB
  case 0x889E:
                                                     mon("locret_889E RTS                           ; 889E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x889F:
                                                     mon("L889F    LDB   #$10                    ; 889F: C6 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x88A1; JUMP; // sstep
case 0x88A1:
                                                     mon("         STB   <$DC                    ; 88A1: D7 DC         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0x88A3; JUMP; // sstep
case 0x88A3:
                                                     mon("         JSR   LCD38                   ; 88A3: BD CD 38      \n"); // Trench left side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcd38; 
    JUMP;
  case 0x88A6:
                                                     mon("L88A6    LDD   #$F000                  ; 88A6: CC F0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88A9; JUMP; // sstep
case 0x88A9:
                                                     mon("         STD   $5E04                   ; 88A9: FD 5E 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e04, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e05, B); 
    PC = 0x88AC; JUMP; // sstep
case 0x88AC:
                                                     mon("         LDD   #$00                    ; 88AC: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88AF; JUMP; // sstep
case 0x88AF:
                                                     mon("         STD   $5E02                   ; 88AF: FD 5E 02      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e02, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e03, B); 
    PC = 0x88B2; JUMP; // sstep
case 0x88B2:
                                                     mon("         LDD   <$96                    ; 88B2: DC 96         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x96); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x97); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88B4; JUMP; // sstep
case 0x88B4:
                                                     mon("         STD   $5E00                   ; 88B4: FD 5E 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e00, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e01, B); 
    PC = 0x88B7; JUMP; // sstep
case 0x88B7:
                                                     mon("         LDD   #$01C0                  ; 88B7: CC 01 C0      \n"); // Point BIC to math $5E00
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88BA; JUMP; // sstep
case 0x88BA:
                                                     mon("         STD   $4701                   ; 88BA: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x88BD; JUMP; // sstep
case 0x88BD:
                                                     mon("         LDA   #$67                    ; 88BD: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x88BF; JUMP; // sstep
case 0x88BF:
                                                     mon("         JSR   LCDBA                   ; 88BF: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x88C2:
                                                     mon("L88C2    LDD   $5000                   ; 88C2: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88C5; JUMP; // sstep
case 0x88C5:
                                                     mon("         CMPD  #$FE00                  ; 88C5: 10 83 FE 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfe00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x88C9; JUMP; // sstep
case 0x88C9:
                                                     mon("         BGT   L88D0                   ; 88C9: 2E 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x88d0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x88CB; JUMP; // sstep
case 0x88CB:
                                                     mon("         LDA   #$00                    ; 88CB: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x88CD; JUMP; // sstep
case 0x88CD:
                                                     mon("         STA   <$95                    ; 88CD: 97 95         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x95; 
    wr_mem(ea, val); 
    PC = 0x88CF; JUMP; // sstep
case 0x88CF:
                                                     mon("         RTS                           ; 88CF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x88D0:
                                                     mon("L88D0    SUBD  #$7000                  ; 88D0: 83 70 00      \n");
    clockticks = clockticks + 4; 
    val = 0x7000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x88D3; JUMP; // sstep
case 0x88D3:
                                                     mon("         BGT   locret_88F4             ; 88D3: 2E 1F         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x88f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x88D5; JUMP; // sstep
case 0x88D5:
                                                     mon("         LDD   #$A018                  ; 88D5: CC A0 18      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x18; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88D8; JUMP; // sstep
case 0x88D8:
                                                     mon("         STD   $5E00                   ; 88D8: FD 5E 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e00, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e01, B); 
    PC = 0x88DB; JUMP; // sstep
case 0x88DB:
                                                     mon("         LDD   #$7200                  ; 88DB: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88DE; JUMP; // sstep
case 0x88DE:
                                                     mon("         STD   $5E04                   ; 88DE: FD 5E 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e04, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e05, B); 
    PC = 0x88E1; JUMP; // sstep
case 0x88E1:
                                                     mon("         LDD   $5000                   ; 88E1: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88E4; JUMP; // sstep
case 0x88E4:
                                                     mon("         SUBD  #$1000                  ; 88E4: 83 10 00      \n");
    clockticks = clockticks + 4; 
    val = 0x1000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x88E7; JUMP; // sstep
case 0x88E7:
                                                     mon("         BGE   L88EE                   ; 88E7: 2C 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x88ee; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x88E9; JUMP; // sstep
case 0x88E9:
                                                     mon("         JSR   LCD5C                   ; 88E9: BD CD 5C      \n"); // Trench calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xec); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcd5c; 
    JUMP;
  case 0x88EC:
                                                     mon("L88EC    BRA   L88F1                   ; 88EC: 20 03         \n");
    PC = 0x88f1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x88EE:
                                                     mon("L88EE    JSR   LCD50                   ; 88EE: BD CD 50      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcd50; 
    JUMP;
  case 0x88F1:
                                                     mon("L88F1    JSR   LCD74                   ; 88F1: BD CD 74      \n"); // Function select for an object
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    PC = 0xcd74; 
    JUMP;
    // End of function sub_889F
  case 0x88F4:
                                                     mon("locret_88F4 RTS                           ; 88F4: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x88F5:
                                                     mon("L88F5    LDD   #$6280                  ; 88F5: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x88F8; JUMP; // sstep
case 0x88F8:
                                                     mon("         STD   ,Y++                    ; 88F8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x88FA; JUMP; // sstep
case 0x88FA:
                                                     mon("         LDA   <$92                    ; 88FA: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x88FC; JUMP; // sstep
case 0x88FC:
                                                     mon("         BEQ   locret_8950             ; 88FC: 27 52         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8950; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x88FE; JUMP; // sstep
case 0x88FE:
                                                     mon("         LDD   <$93                    ; 88FE: DC 93         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x93); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x94); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8900; JUMP; // sstep
case 0x8900:
                                                     mon("         STD   $5078                   ; 8900: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x8903; JUMP; // sstep
case 0x8903:
                                                     mon("         SUBD  $5098                   ; 8903: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8906; JUMP; // sstep
case 0x8906:
                                                     mon("         SUBD  #$7000                  ; 8906: 83 70 00      \n");
    clockticks = clockticks + 4; 
    val = 0x7000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8909; JUMP; // sstep
case 0x8909:
                                                     mon("         BMI   L8911                   ; 8909: 2B 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8911; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x890B; JUMP; // sstep
case 0x890B:
                                                     mon("         COMA                          ; 890B: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x890C; JUMP; // sstep
case 0x890C:
                                                     mon("         NEGB                          ; 890C: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x890D; JUMP; // sstep
case 0x890D:
                                                     mon("         SBCA  #$FF                    ; 890D: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0x890F; JUMP; // sstep
case 0x890F:
                                                     mon("         BRA   L8914                   ; 890F: 20 03         \n");
    PC = 0x8914; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8911:
                                                     mon("L8911    LDD   #$00                    ; 8911: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8914; JUMP; // sstep
case 0x8914:
                                                     mon("L8914    STD   $507C                   ; 8914: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x8917; JUMP; // sstep
case 0x8917:
                                                     mon("         LDD   #$FC00                  ; 8917: CC FC 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x891A; JUMP; // sstep
case 0x891A:
                                                     mon("         STD   $507A                   ; 891A: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x891D; JUMP; // sstep
case 0x891D:
                                                     mon("         LDD   #$0F                    ; 891D: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8920; JUMP; // sstep
case 0x8920:
                                                     mon("         STD   $4701                   ; 8920: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x8923; JUMP; // sstep
case 0x8923:
                                                     mon("         LDA   #$67                    ; 8923: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8925; JUMP; // sstep
case 0x8925:
                                                     mon("         JSR   LCDBA                   ; 8925: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8928:
                                                     mon("L8928    LDD   $5000                   ; 8928: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x892B; JUMP; // sstep
case 0x892B:
                                                     mon("         STD   $4704                   ; 892B: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x892E; JUMP; // sstep
case 0x892E:
                                                     mon("         JSR   LCCE4                   ; 892E: BD CC E4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x31); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0xcce4; 
    JUMP;
  case 0x8931:
                                                     mon("L8931    LDD   #$0400                  ; 8931: CC 04 00      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8934; JUMP; // sstep
case 0x8934:
                                                     mon("         STD   $507A                   ; 8934: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x8937; JUMP; // sstep
case 0x8937:
                                                     mon("         LDD   #$0F                    ; 8937: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x893A; JUMP; // sstep
case 0x893A:
                                                     mon("         STD   $4701                   ; 893A: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x893D; JUMP; // sstep
case 0x893D:
                                                     mon("         LDA   #$67                    ; 893D: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x893F; JUMP; // sstep
case 0x893F:
                                                     mon("         JSR   LCDBA                   ; 893F: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x42); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8942:
                                                     mon("L8942    LDD   $5000                   ; 8942: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8945; JUMP; // sstep
case 0x8945:
                                                     mon("         STD   $4704                   ; 8945: FD 47 04      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0x8948; JUMP; // sstep
case 0x8948:
                                                     mon("         JSR   LCCFC                   ; 8948: BD CC FC      \n"); // Trench floor lines calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0xccfc; 
    JUMP;
  case 0x894B:
                                                     mon("L894B    LDD   #$8040                  ; 894B: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x894E; JUMP; // sstep
case 0x894E:
                                                     mon("         STD   ,Y++                    ; 894E: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_88F5
    PC = 0x8950; JUMP; // sstep
case 0x8950:
                                                     mon("locret_8950 RTS                           ; 8950: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
  case 0x8951:
                                                     mon("L8951    JSR   L8981                   ; 8951: BD 89 81      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x54); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0x8981; 
    JUMP;
  case 0x8954:
                                                     mon("L8954    INC   <$4D                    ; 8954: 0C 4D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4d); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x4d, res); 
    clockticks = clockticks + 2; 
    // End of function sub_8951
    PC = 0x8956; JUMP; // sstep
case 0x8956:
                                                     mon("         JMP   L89D3                   ; 8956: 7E 89 D3      \n"); // Space wave pitch
    clockticks = clockticks + 4; 
    PC = 0x89d3; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
  case 0x8959:
                                                     mon("L8959    JSR   L8993                   ; 8959: BD 89 93      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0x8993; 
    JUMP;
  case 0x895C:
                                                     mon("L895C    DEC   <$4D                    ; 895C: 0A 4D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4d); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x4d, res); 
    clockticks = clockticks + 2; 
    // End of function sub_8959
    PC = 0x895E; JUMP; // sstep
case 0x895E:
                                                     mon("         JMP   L89D3                   ; 895E: 7E 89 D3      \n"); // Space wave pitch
    clockticks = clockticks + 4; 
    PC = 0x89d3; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
  case 0x8961:
                                                     mon("L8961    JSR   L8993                   ; 8961: BD 89 93      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0x8993; 
    JUMP;
  case 0x8964:
                                                     mon("L8964    DEC   <$4E                    ; 8964: 0A 4E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4e); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x4e, res); 
    clockticks = clockticks + 2; 
    // End of function sub_8961
    PC = 0x8966; JUMP; // sstep
case 0x8966:
                                                     mon("         JMP   L89C8                   ; 8966: 7E 89 C8      \n"); // Space wave roll
    clockticks = clockticks + 4; 
    PC = 0x89c8; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
  case 0x8969:
                                                     mon("L8969    JSR   L8981                   ; 8969: BD 89 81      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0x8981; 
    JUMP;
  case 0x896C:
                                                     mon("L896C    INC   <$4E                    ; 896C: 0C 4E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4e); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x4e, res); 
    clockticks = clockticks + 2; 
    // End of function sub_8969
    PC = 0x896E; JUMP; // sstep
case 0x896E:
                                                     mon("         JMP   L89C8                   ; 896E: 7E 89 C8      \n"); // Space wave roll
    clockticks = clockticks + 4; 
    PC = 0x89c8; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
  case 0x8971:
                                                     mon("L8971    JSR   L8981                   ; 8971: BD 89 81      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0x8981; 
    JUMP;
  case 0x8974:
                                                     mon("L8974    DEC   <$4F                    ; 8974: 0A 4F         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4f); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x4f, res); 
    clockticks = clockticks + 2; 
    // End of function sub_8971
    PC = 0x8976; JUMP; // sstep
case 0x8976:
                                                     mon("         JMP   L89DE                   ; 8976: 7E 89 DE      \n"); // Space wave yaw
    clockticks = clockticks + 4; 
    PC = 0x89de; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
  case 0x8979:
                                                     mon("L8979    JSR   L8993                   ; 8979: BD 89 93      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0x8993; 
    JUMP;
  case 0x897C:
                                                     mon("L897C    INC   <$4F                    ; 897C: 0C 4F         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4f); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x4f, res); 
    clockticks = clockticks + 2; 
    // End of function sub_8979
    PC = 0x897E; JUMP; // sstep
case 0x897E:
                                                     mon("         JMP   L89DE                   ; 897E: 7E 89 DE      \n"); // Space wave yaw
    clockticks = clockticks + 4; 
    PC = 0x89de; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8981:
                                                     mon("L8981    LDA   #$14                    ; 8981: 86 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x14; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8983; JUMP; // sstep
case 0x8983:
                                                     mon("         LDU   #word_89A8              ; 8983: CE 89 A8      \n");
    clockticks = clockticks + 3; 
    U = 0x89a8; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8986; JUMP; // sstep
case 0x8986:
                                                     mon("         LEAU  A,U                     ; 8986: 33 C6         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)A); 
    PC = 0x8988; JUMP; // sstep
case 0x8988:
                                                     mon("         LDD   ,U                      ; 8988: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x898A; JUMP; // sstep
case 0x898A:
                                                     mon("         STD   $5022                   ; 898A: FD 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5022, A); // Care needed with I/O space and word fetches
    wr_mem(0x5023, B); 
    PC = 0x898D; JUMP; // sstep
case 0x898D:
                                                     mon("         LDD   $02,U                   ; 898D: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x898F; JUMP; // sstep
case 0x898F:
                                                     mon("         STD   $5024                   ; 898F: FD 50 24      \n"); // Cosine for rotation
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5024, A); // Care needed with I/O space and word fetches
    wr_mem(0x5025, B); 
    // End of function sub_8981
    PC = 0x8992; JUMP; // sstep
case 0x8992:
                                                     mon("         RTS                           ; 8992: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8993:
                                                     mon("L8993    LDA   #$14                    ; 8993: 86 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x14; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8995; JUMP; // sstep
case 0x8995:
                                                     mon("         LDU   #word_89A8              ; 8995: CE 89 A8      \n");
    clockticks = clockticks + 3; 
    U = 0x89a8; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8998; JUMP; // sstep
case 0x8998:
                                                     mon("         LEAU  A,U                     ; 8998: 33 C6         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)A); 
    PC = 0x899A; JUMP; // sstep
case 0x899A:
                                                     mon("         LDD   #$00                    ; 899A: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x899D; JUMP; // sstep
case 0x899D:
                                                     mon("         SUBD  ,U                      ; 899D: A3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x899F; JUMP; // sstep
case 0x899F:
                                                     mon("         STD   $5022                   ; 899F: FD 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5022, A); // Care needed with I/O space and word fetches
    wr_mem(0x5023, B); 
    PC = 0x89A2; JUMP; // sstep
case 0x89A2:
                                                     mon("         LDD   $02,U                   ; 89A2: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x89A4; JUMP; // sstep
case 0x89A4:
                                                     mon("         STD   $5024                   ; 89A4: FD 50 24      \n"); // Cosine for rotation
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5024, A); // Care needed with I/O space and word fetches
    wr_mem(0x5025, B); 
    // End of function sub_8993
    // ---------------------------------------------------------------------------
    PC = 0x89A7; JUMP; // sstep
case 0x89A7:
                                                     mon("         RTS                           ; 89A7: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Space wave roll
    // Attributes: noreturn
  case 0x89C8:
                                                     mon("L89C8    CLRA                          ; 89C8: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x89C9; JUMP; // sstep
case 0x89C9:
                                                     mon("         LDB   $02,X                   ; 89C9: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x89CB; JUMP; // sstep
case 0x89CB:
                                                     mon("         STD   $4701                   ; 89CB: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x89CE; JUMP; // sstep
case 0x89CE:
                                                     mon("         LDA   #$00                    ; 89CE: 86 00         \n"); // Roll
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_89C8
    PC = 0x89D0; JUMP; // sstep
case 0x89D0:
                                                     mon("         JMP   LCDBA                   ; 89D0: 7E CD BA      \n"); // Do math program run
    clockticks = clockticks + 4; 
    PC = 0xcdba; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Space wave pitch
  case 0x89D3:
                                                     mon("L89D3    CLRA                          ; 89D3: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x89D4; JUMP; // sstep
case 0x89D4:
                                                     mon("         LDB   $02,X                   ; 89D4: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x89D6; JUMP; // sstep
case 0x89D6:
                                                     mon("         STD   $4701                   ; 89D6: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x89D9; JUMP; // sstep
case 0x89D9:
                                                     mon("         LDA   #$0E                    ; 89D9: 86 0E         \n"); // Pitch
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_89D3
    PC = 0x89DB; JUMP; // sstep
case 0x89DB:
                                                     mon("         JMP   LCDBA                   ; 89DB: 7E CD BA      \n"); // Do math program run
    clockticks = clockticks + 4; 
    PC = 0xcdba; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Space wave yaw
  case 0x89DE:
                                                     mon("L89DE    CLRA                          ; 89DE: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x89DF; JUMP; // sstep
case 0x89DF:
                                                     mon("         LDB   $02,X                   ; 89DF: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x89E1; JUMP; // sstep
case 0x89E1:
                                                     mon("         STD   $4701                   ; 89E1: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x89E4; JUMP; // sstep
case 0x89E4:
                                                     mon("         LDA   #$1C                    ; 89E4: 86 1C         \n"); // Yaw
    clockticks = clockticks + 2; 
    val = (UINT8)0x1c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_89DE
    PC = 0x89E6; JUMP; // sstep
case 0x89E6:
                                                     mon("         JMP   LCDBA                   ; 89E6: 7E CD BA      \n"); // Do math program run
    clockticks = clockticks + 4; 
    PC = 0xcdba; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x89E9:
                                                     mon("L89E9    LDD   -16,U                   ; 89E9: EC 50         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff0); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x89EB; JUMP; // sstep
case 0x89EB:
                                                     mon("         JSR   Shift_D_R_5             ; 89EB: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xee); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x89EE:
                                                     mon("L89EE    ADDD  -10,U                   ; 89EE: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x89F0; JUMP; // sstep
case 0x89F0:
                                                     mon("         STD   -10,U                   ; 89F0: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x89F2; JUMP; // sstep
case 0x89F2:
                                                     mon("         LDD   -8,U                    ; 89F2: EC 58         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff8); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x89F4; JUMP; // sstep
case 0x89F4:
                                                     mon("         JSR   Shift_D_R_5             ; 89F4: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x89F7:
                                                     mon("L89F7    ADDD  -2,U                    ; 89F7: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x89F9; JUMP; // sstep
case 0x89F9:
                                                     mon("         STD   -2,U                    ; 89F9: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x89FB; JUMP; // sstep
case 0x89FB:
                                                     mon("         LDD   ,U                      ; 89FB: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x89FD; JUMP; // sstep
case 0x89FD:
                                                     mon("         JSR   Shift_D_R_5             ; 89FD: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x00); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A00:
                                                     mon("L8A00    ADDD  $06,U                   ; 8A00: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A02; JUMP; // sstep
case 0x8A02:
                                                     mon("         STD   $06,U                   ; 8A02: ED 46         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_89E9
    PC = 0x8A04; JUMP; // sstep
case 0x8A04:
                                                     mon("         RTS                           ; 8A04: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8A05:
                                                     mon("L8A05    LDD   -16,U                   ; 8A05: EC 50         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff0); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A07; JUMP; // sstep
case 0x8A07:
                                                     mon("         JSR   Shift_D_R_6             ; 8A07: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A0A:
                                                     mon("L8A0A    ADDD  -10,U                   ; 8A0A: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A0C; JUMP; // sstep
case 0x8A0C:
                                                     mon("         STD   -10,U                   ; 8A0C: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A0E; JUMP; // sstep
case 0x8A0E:
                                                     mon("         LDD   -8,U                    ; 8A0E: EC 58         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff8); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A10; JUMP; // sstep
case 0x8A10:
                                                     mon("         JSR   Shift_D_R_6             ; 8A10: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x13); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A13:
                                                     mon("L8A13    ADDD  -2,U                    ; 8A13: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A15; JUMP; // sstep
case 0x8A15:
                                                     mon("         STD   -2,U                    ; 8A15: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A17; JUMP; // sstep
case 0x8A17:
                                                     mon("         LDD   ,U                      ; 8A17: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A19; JUMP; // sstep
case 0x8A19:
                                                     mon("         JSR   Shift_D_R_6             ; 8A19: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A1C:
                                                     mon("L8A1C    ADDD  $06,U                   ; 8A1C: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A1E; JUMP; // sstep
case 0x8A1E:
                                                     mon("         STD   $06,U                   ; 8A1E: ED 46         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8A05
    PC = 0x8A20; JUMP; // sstep
case 0x8A20:
                                                     mon("         RTS                           ; 8A20: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8A21:
                                                     mon("L8A21    LDD   -12,U                   ; 8A21: EC 54         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff4); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A23; JUMP; // sstep
case 0x8A23:
                                                     mon("         JSR   Shift_D_R_6             ; 8A23: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x26); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A26:
                                                     mon("L8A26    ADDD  -10,U                   ; 8A26: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A28; JUMP; // sstep
case 0x8A28:
                                                     mon("         STD   -10,U                   ; 8A28: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A2A; JUMP; // sstep
case 0x8A2A:
                                                     mon("         LDD   -4,U                    ; 8A2A: EC 5C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfffc); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A2C; JUMP; // sstep
case 0x8A2C:
                                                     mon("         JSR   Shift_D_R_6             ; 8A2C: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A2F:
                                                     mon("L8A2F    ADDD  -2,U                    ; 8A2F: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A31; JUMP; // sstep
case 0x8A31:
                                                     mon("         STD   -2,U                    ; 8A31: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A33; JUMP; // sstep
case 0x8A33:
                                                     mon("         LDD   $04,U                   ; 8A33: EC 44         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A35; JUMP; // sstep
case 0x8A35:
                                                     mon("         JSR   Shift_D_R_6             ; 8A35: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A38:
                                                     mon("L8A38    ADDD  $06,U                   ; 8A38: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A3A; JUMP; // sstep
case 0x8A3A:
                                                     mon("         STD   $06,U                   ; 8A3A: ED 46         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8A21
    PC = 0x8A3C; JUMP; // sstep
case 0x8A3C:
                                                     mon("         RTS                           ; 8A3C: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8A3D:
                                                     mon("L8A3D    LDD   -12,U                   ; 8A3D: EC 54         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff4); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A3F; JUMP; // sstep
case 0x8A3F:
                                                     mon("         JSR   Shift_D_R_5             ; 8A3F: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x42); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A42:
                                                     mon("L8A42    ADDD  -10,U                   ; 8A42: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A44; JUMP; // sstep
case 0x8A44:
                                                     mon("         STD   -10,U                   ; 8A44: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A46; JUMP; // sstep
case 0x8A46:
                                                     mon("         LDD   -4,U                    ; 8A46: EC 5C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfffc); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A48; JUMP; // sstep
case 0x8A48:
                                                     mon("         JSR   Shift_D_R_5             ; 8A48: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A4B:
                                                     mon("L8A4B    ADDD  -2,U                    ; 8A4B: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A4D; JUMP; // sstep
case 0x8A4D:
                                                     mon("         STD   -2,U                    ; 8A4D: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A4F; JUMP; // sstep
case 0x8A4F:
                                                     mon("         LDD   $04,U                   ; 8A4F: EC 44         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8A51; JUMP; // sstep
case 0x8A51:
                                                     mon("         JSR   Shift_D_R_5             ; 8A51: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x54); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A54:
                                                     mon("L8A54    ADDD  $06,U                   ; 8A54: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A56; JUMP; // sstep
case 0x8A56:
                                                     mon("         STD   $06,U                   ; 8A56: ED 46         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8A3D
    PC = 0x8A58; JUMP; // sstep
case 0x8A58:
                                                     mon("         RTS                           ; 8A58: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8A59:
                                                     mon("L8A59    LDD   #$00                    ; 8A59: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8A5C; JUMP; // sstep
case 0x8A5C:
                                                     mon("         SUBD  -12,U                   ; 8A5C: A3 54         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff4))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff4))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8A5E; JUMP; // sstep
case 0x8A5E:
                                                     mon("         JSR   Shift_D_R_6             ; 8A5E: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A61:
                                                     mon("L8A61    ADDD  -10,U                   ; 8A61: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A63; JUMP; // sstep
case 0x8A63:
                                                     mon("         STD   -10,U                   ; 8A63: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A65; JUMP; // sstep
case 0x8A65:
                                                     mon("         LDD   #$00                    ; 8A65: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8A68; JUMP; // sstep
case 0x8A68:
                                                     mon("         SUBD  -4,U                    ; 8A68: A3 5C         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffc))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffc))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8A6A; JUMP; // sstep
case 0x8A6A:
                                                     mon("         JSR   Shift_D_R_6             ; 8A6A: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A6D:
                                                     mon("L8A6D    ADDD  -2,U                    ; 8A6D: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A6F; JUMP; // sstep
case 0x8A6F:
                                                     mon("         STD   -2,U                    ; 8A6F: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A71; JUMP; // sstep
case 0x8A71:
                                                     mon("         LDD   #$00                    ; 8A71: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8A74; JUMP; // sstep
case 0x8A74:
                                                     mon("         SUBD  $04,U                   ; 8A74: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8A76; JUMP; // sstep
case 0x8A76:
                                                     mon("         JSR   Shift_D_R_6             ; 8A76: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0x8A79:
                                                     mon("L8A79    ADDD  $06,U                   ; 8A79: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A7B; JUMP; // sstep
case 0x8A7B:
                                                     mon("         STD   $06,U                   ; 8A7B: ED 46         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8A59
    PC = 0x8A7D; JUMP; // sstep
case 0x8A7D:
                                                     mon("         RTS                           ; 8A7D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8A7E:
                                                     mon("L8A7E    LDD   #$00                    ; 8A7E: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8A81; JUMP; // sstep
case 0x8A81:
                                                     mon("         SUBD  -12,U                   ; 8A81: A3 54         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff4))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff4))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8A83; JUMP; // sstep
case 0x8A83:
                                                     mon("         JSR   Shift_D_R_5             ; 8A83: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A86:
                                                     mon("L8A86    ADDD  -10,U                   ; 8A86: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A88; JUMP; // sstep
case 0x8A88:
                                                     mon("         STD   -10,U                   ; 8A88: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A8A; JUMP; // sstep
case 0x8A8A:
                                                     mon("         LDD   #$00                    ; 8A8A: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8A8D; JUMP; // sstep
case 0x8A8D:
                                                     mon("         SUBD  -4,U                    ; 8A8D: A3 5C         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffc))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffc))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8A8F; JUMP; // sstep
case 0x8A8F:
                                                     mon("         JSR   Shift_D_R_5             ; 8A8F: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x92); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A92:
                                                     mon("L8A92    ADDD  -2,U                    ; 8A92: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8A94; JUMP; // sstep
case 0x8A94:
                                                     mon("         STD   -2,U                    ; 8A94: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8A96; JUMP; // sstep
case 0x8A96:
                                                     mon("         LDD   #$00                    ; 8A96: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8A99; JUMP; // sstep
case 0x8A99:
                                                     mon("         SUBD  $04,U                   ; 8A99: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8A9B; JUMP; // sstep
case 0x8A9B:
                                                     mon("         JSR   Shift_D_R_5             ; 8A9B: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0x8A9E:
                                                     mon("L8A9E    ADDD  $06,U                   ; 8A9E: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8AA0; JUMP; // sstep
case 0x8AA0:
                                                     mon("         STD   $06,U                   ; 8AA0: ED 46         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8A7E
    // ---------------------------------------------------------------------------
    PC = 0x8AA2; JUMP; // sstep
case 0x8AA2:
                                                     mon("         RTS                           ; 8AA2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8AB6:
                                                     mon("L8AB6    LDD   -10,U                   ; 8AB6: EC 56         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff6); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8AB8; JUMP; // sstep
case 0x8AB8:
                                                     mon("         ADDD  $08,U                   ; 8AB8: E3 48         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0008))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0008))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8ABA; JUMP; // sstep
case 0x8ABA:
                                                     mon("         BVS   L8ABE                   ; 8ABA: 29 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x8abe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8ABC; JUMP; // sstep
case 0x8ABC:
                                                     mon("         STD   $08,U                   ; 8ABC: ED 48         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8ABE; JUMP; // sstep
case 0x8ABE:
                                                     mon("L8ABE    LDD   -2,U                    ; 8ABE: EC 5E         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfffe); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8AC0; JUMP; // sstep
case 0x8AC0:
                                                     mon("         ADDD  $0A,U                   ; 8AC0: E3 4A         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x000a))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x000a))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8AC2; JUMP; // sstep
case 0x8AC2:
                                                     mon("         BVS   L8AC6                   ; 8AC2: 29 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x8ac6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8AC4; JUMP; // sstep
case 0x8AC4:
                                                     mon("         STD   $0A,U                   ; 8AC4: ED 4A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8AC6; JUMP; // sstep
case 0x8AC6:
                                                     mon("L8AC6    LDD   $0C,U                   ; 8AC6: EC 4C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x000c); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8AC8; JUMP; // sstep
case 0x8AC8:
                                                     mon("         ADDD  $06,U                   ; 8AC8: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8ACA; JUMP; // sstep
case 0x8ACA:
                                                     mon("         BVS   locret_8ACE             ; 8ACA: 29 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x8ace; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8ACC; JUMP; // sstep
case 0x8ACC:
                                                     mon("         STD   $0C,U                   ; 8ACC: ED 4C         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8AB6
    PC = 0x8ACE; JUMP; // sstep
case 0x8ACE:
                                                     mon("locret_8ACE RTS                           ; 8ACE: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_B32B
  case 0x8ACF:
                                                     mon("L8ACF    LDX   <$C2                    ; 8ACF: 9E C2         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc2)<<8; 
    ea = ea | rd_mem(DP|0xc3); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8AD1; JUMP; // sstep
case 0x8AD1:
                                                     mon("         LDA   $03,X                   ; 8AD1: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8AD3; JUMP; // sstep
case 0x8AD3:
                                                     mon("         CMPA  #$01                    ; 8AD3: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8AD5; JUMP; // sstep
case 0x8AD5:
                                                     mon("         BNE   locret_8ADB             ; 8AD5: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8adb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8AD7; JUMP; // sstep
case 0x8AD7:
                                                     mon("         LDA   $06,X                   ; 8AD7: A6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8AD9; JUMP; // sstep
case 0x8AD9:
                                                     mon("         BEQ   L8ADC                   ; 8AD9: 27 01         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8adc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8ADB; JUMP; // sstep
case 0x8ADB:
                                                     mon("locret_8ADB RTS                           ; 8ADB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8ADC:
                                                     mon("L8ADC    JSR   Gen_Random              ; 8ADC: BD CE 45      \n"); // Update random numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0xce45; 
    JUMP;
  case 0x8ADF:
                                                     mon("L8ADF    LDA   $03,X                   ; 8ADF: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8AE1; JUMP; // sstep
case 0x8AE1:
                                                     mon("         CMPA  #$01                    ; 8AE1: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8AE3; JUMP; // sstep
case 0x8AE3:
                                                     mon("         BNE   L8AED                   ; 8AE3: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8aed; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8AE5; JUMP; // sstep
case 0x8AE5:
                                                     mon("         LDD   $15,X                   ; 8AE5: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8AE8; JUMP; // sstep
case 0x8AE8:
                                                     mon("         ORB   #$01                    ; 8AE8: CA 01         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x01; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8AEA; JUMP; // sstep
case 0x8AEA:
                                                     mon("         STD   $15,X                   ; 8AEA: ED 88 15      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8AED; JUMP; // sstep
case 0x8AED:
                                                     mon("L8AED    LDX   <$C2                    ; 8AED: 9E C2         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc2)<<8; 
    ea = ea | rd_mem(DP|0xc3); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8AEF; JUMP; // sstep
case 0x8AEF:
                                                     mon("         INC   $08,X                   ; 8AEF: 6C 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0008)); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem((UINT16)(X + 0x0008), res); 
    clockticks = clockticks + 2; 
    PC = 0x8AF1; JUMP; // sstep
case 0x8AF1:
                                                     mon("         DEC   $07,X                   ; 8AF1: 6A 07         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0007)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + 0x0007), res); 
    clockticks = clockticks + 2; 
    PC = 0x8AF3; JUMP; // sstep
case 0x8AF3:
                                                     mon("         LBLE  L8B57                   ; 8AF3: 10 2F 00 60   \n");
    clockticks = clockticks + 5; 
    if (((SINT8)(N^V) <  0) || (!Z)) {
    clockticks = clockticks + 1; 
    PC = 0x8b57; 
    JUMP;
    }
    PC = 0x8AF7; JUMP; // sstep
case 0x8AF7:
                                                     mon("         LDA   #$05                    ; 8AF7: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8AF9; JUMP; // sstep
case 0x8AF9:
                                                     mon("         STA   $07,X                   ; 8AF9: A7 07         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0007); 
    wr_mem(ea, val); 
    PC = 0x8AFB; JUMP; // sstep
case 0x8AFB:
                                                     mon("         JSR   L97ED                   ; 8AFB: BD 97 ED      \n"); // Vaders tie score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    PC = 0x97ed; 
    JUMP;
  case 0x8AFE:
                                                     mon("L8AFE    LDA   #$1F                    ; 8AFE: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B00; JUMP; // sstep
case 0x8B00:
                                                     mon("         STA   $09,X                   ; 8B00: A7 09         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0009); 
    wr_mem(ea, val); 
    PC = 0x8B02; JUMP; // sstep
case 0x8B02:
                                                     mon("         STA   $06,X                   ; 8B02: A7 06         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, val); 
    PC = 0x8B04; JUMP; // sstep
case 0x8B04:
                                                     mon("         LDX   #$5090                  ; 8B04: 8E 50 90      \n");
    clockticks = clockticks + 3; 
    X = 0x5090; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8B07; JUMP; // sstep
case 0x8B07:
                                                     mon("         LDU   <$C2                    ; 8B07: DE C2         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc2)<<8; 
    ea = ea | rd_mem(DP|0xc3); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8B09; JUMP; // sstep
case 0x8B09:
                                                     mon("         LDU   ,U                      ; 8B09: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8B0B; JUMP; // sstep
case 0x8B0B:
                                                     mon("         LDD   #$00                    ; 8B0B: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8B0E; JUMP; // sstep
case 0x8B0E:
                                                     mon("         STD   -10,U                   ; 8B0E: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8B10; JUMP; // sstep
case 0x8B10:
                                                     mon("         STD   -2,U                    ; 8B10: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8B12; JUMP; // sstep
case 0x8B12:
                                                     mon("         STD   $06,U                   ; 8B12: ED 46         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8B14; JUMP; // sstep
case 0x8B14:
                                                     mon("         LDA   #$02                    ; 8B14: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B16; JUMP; // sstep
case 0x8B16:
                                                     mon("         STA   <$01                    ; 8B16: 97 01         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, val); 
    PC = 0x8B18; JUMP; // sstep
case 0x8B18:
                                                     mon("L8B18    LDD   #$4000                  ; 8B18: CC 40 00      \n");
    clockticks = clockticks + 3; 
    A = 0x40; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8B1B; JUMP; // sstep
case 0x8B1B:
                                                     mon("         SUBD  <$C4                    ; 8B1B: 93 C4         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc4)<<8; 
    ea = ea | rd_mem(DP|0xc5); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8B1D; JUMP; // sstep
case 0x8B1D:
                                                     mon("         LDB   -16,X                   ; 8B1D: E6 10         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0xfff0)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B1F; JUMP; // sstep
case 0x8B1F:
                                                     mon("         MUL                           ; 8B1F: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x8B20; JUMP; // sstep
case 0x8B20:
                                                     mon("         TFR   A,B                     ; 8B20: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0x8B22; JUMP; // sstep
case 0x8B22:
                                                     mon("         ASLB                          ; 8B22: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8B23; JUMP; // sstep
case 0x8B23:
                                                     mon("         ROLA                          ; 8B23: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0x8B24; JUMP; // sstep
case 0x8B24:
                                                     mon("         SEX                           ; 8B24: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x8B25; JUMP; // sstep
case 0x8B25:
                                                     mon("         ADDD  -10,U                   ; 8B25: E3 56         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff6))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff6))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8B27; JUMP; // sstep
case 0x8B27:
                                                     mon("         STD   -10,U                   ; 8B27: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8B29; JUMP; // sstep
case 0x8B29:
                                                     mon("         LDA   <$53                    ; 8B29: 96 53         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x53); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B2B; JUMP; // sstep
case 0x8B2B:
                                                     mon("         ORA   #$80                    ; 8B2B: 8A 80         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x80; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8B2D; JUMP; // sstep
case 0x8B2D:
                                                     mon("         LDB   -8,X                    ; 8B2D: E6 18         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0xfff8)); 
    B = val; 
    N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x8B2F; JUMP; // sstep
case 0x8B2F:
                                                     mon("         MUL                           ; 8B2F: 3D            \n");
    res = (UINT16)(A * B); 
    Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x8B30; JUMP; // sstep
case 0x8B30:
                                                     mon("         BCS   L8B33                   ; 8B30: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8b33; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B32; JUMP; // sstep
case 0x8B32:
                                                     mon("         NEGA                          ; 8B32: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x8B33; JUMP; // sstep
case 0x8B33:
                                                     mon("L8B33    TFR   A,B                     ; 8B33: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0x8B35; JUMP; // sstep
case 0x8B35:
                                                     mon("         NOP                           ; 8B35: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0x8B36; JUMP; // sstep
case 0x8B36:
                                                     mon("         SEX                           ; 8B36: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x8B37; JUMP; // sstep
case 0x8B37:
                                                     mon("         ADDD  -2,U                    ; 8B37: E3 5E         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8B39; JUMP; // sstep
case 0x8B39:
                                                     mon("         STD   -2,U                    ; 8B39: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8B3B; JUMP; // sstep
case 0x8B3B:
                                                     mon("         LDA   <$54                    ; 8B3B: 96 54         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x54); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B3D; JUMP; // sstep
case 0x8B3D:
                                                     mon("         ORA   #$80                    ; 8B3D: 8A 80         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x80; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8B3F; JUMP; // sstep
case 0x8B3F:
                                                     mon("         LDB   ,X                      ; 8B3F: E6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    B = val; 
    N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x8B41; JUMP; // sstep
case 0x8B41:
                                                     mon("         MUL                           ; 8B41: 3D            \n");
    res = (UINT16)(A * B); 
    Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x8B42; JUMP; // sstep
case 0x8B42:
                                                     mon("         BCS   L8B45                   ; 8B42: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8b45; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B44; JUMP; // sstep
case 0x8B44:
                                                     mon("         NEGA                          ; 8B44: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x8B45; JUMP; // sstep
case 0x8B45:
                                                     mon("L8B45    TFR   A,B                     ; 8B45: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0x8B47; JUMP; // sstep
case 0x8B47:
                                                     mon("L8B47    NOP                           ; 8B47: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0x8B48; JUMP; // sstep
case 0x8B48:
                                                     mon("         SEX                           ; 8B48: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x8B49; JUMP; // sstep
case 0x8B49:
                                                     mon("         ADDD  $06,U                   ; 8B49: E3 46         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8B4B; JUMP; // sstep
case 0x8B4B:
                                                     mon("         STD   $06,U                   ; 8B4B: ED 46         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8B4D; JUMP; // sstep
case 0x8B4D:
                                                     mon("         LEAX  $02,X                   ; 8B4D: 30 02         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0002); 
/**/Z = X; 
    PC = 0x8B4F; JUMP; // sstep
case 0x8B4F:
                                                     mon("         DEC   <$01                    ; 8B4F: 0A 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x01, res); 
    clockticks = clockticks + 2; 
    PC = 0x8B51; JUMP; // sstep
case 0x8B51:
                                                     mon("         BPL   L8B18                   ; 8B51: 2A C5         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x8b18; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B53; JUMP; // sstep
case 0x8B53:
                                                     mon("         JSR   Sound_35                ; 8B53: BD BD FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x56); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0xbdfd; 
    JUMP;
  case 0x8B56:
                                                     mon("L8B56    RTS                           ; 8B56: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8B57:
                                                     mon("L8B57    LDX   <$C2                    ; 8B57: 9E C2         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc2)<<8; 
    ea = ea | rd_mem(DP|0xc3); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x8B59; JUMP; // sstep
case 0x8B59:
                                                     mon("         JSR   Sound_35                ; 8B59: BD BD FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0xbdfd; 
    JUMP;
  case 0x8B5C:
                                                     mon("L8B5C    LDA   $02,X                   ; 8B5C: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B5E; JUMP; // sstep
case 0x8B5E:
                                                     mon("         CMPA  $4B38                   ; 8B5E: B1 4B 38      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b38); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8B61; JUMP; // sstep
case 0x8B61:
                                                     mon("         BNE   L8B66                   ; 8B61: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8b66; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B63; JUMP; // sstep
case 0x8B63:
                                                     mon("         JSR   Sound_2B                ; 8B63: BD BD CB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0xbdcb; 
    JUMP;
  case 0x8B66:
                                                     mon("L8B66    JSR   LB739                   ; 8B66: BD B7 39      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0xb739; 
    JUMP;
  case 0x8B69:
                                                     mon("L8B69    JSR   L97E8                   ; 8B69: BD 97 E8      \n"); // Tie fighter score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0x97e8; 
    JUMP;
    // END OF FUNCTION CHUNK FOR sub_B32B
  case 0x8B6C:
                                                     mon("L8B6C    RTS                           ; 8B6C: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8B6D:
                                                     mon("L8B6D    LDX   #$4900                  ; 8B6D: 8E 49 00      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 3; 
    X = 0x4900; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8B70; JUMP; // sstep
case 0x8B70:
                                                     mon("L8B70    STX   <$5A                    ; 8B70: 9F 5A         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x5a; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8B72; JUMP; // sstep
case 0x8B72:
                                                     mon("         LDU   ,X                      ; 8B72: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8B74; JUMP; // sstep
case 0x8B74:
                                                     mon("         LDA   $03,X                   ; 8B74: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8B76; JUMP; // sstep
case 0x8B76:
                                                     mon("         BEQ   L8B7B                   ; 8B76: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8b7b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B78; JUMP; // sstep
case 0x8B78:
                                                     mon("         JSR   L8BE1                   ; 8B78: BD 8B E1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0x8be1; 
    JUMP;
  case 0x8B7B:
                                                     mon("L8B7B    LDX   <$5A                    ; 8B7B: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8B7D; JUMP; // sstep
case 0x8B7D:
                                                     mon("         LEAX  $19,X                   ; 8B7D: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x8B80; JUMP; // sstep
case 0x8B80:
                                                     mon("         CMPX  #$494B                  ; 8B80: 8C 49 4B      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x494b; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8B83; JUMP; // sstep
case 0x8B83:
                                                     mon("         BCS   L8B70                   ; 8B83: 25 EB         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8b70; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_8B6D
    PC = 0x8B85; JUMP; // sstep
case 0x8B85:
                                                     mon("         RTS                           ; 8B85: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8B86:
                                                     mon("L8B86    LDX   #$4900                  ; 8B86: 8E 49 00      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 3; 
    X = 0x4900; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8B89; JUMP; // sstep
case 0x8B89:
                                                     mon("L8B89    STX   <$5A                    ; 8B89: 9F 5A         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x5a; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8B8B; JUMP; // sstep
case 0x8B8B:
                                                     mon("         LDU   ,X                      ; 8B8B: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8B8D; JUMP; // sstep
case 0x8B8D:
                                                     mon("         LDA   $03,X                   ; 8B8D: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B8F; JUMP; // sstep
case 0x8B8F:
                                                     mon("         CMPA  #$01                    ; 8B8F: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8B91; JUMP; // sstep
case 0x8B91:
                                                     mon("         BNE   L8BD6                   ; 8B91: 26 43         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8bd6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B93; JUMP; // sstep
case 0x8B93:
                                                     mon("         LDA   $0A,U                   ; 8B93: A6 4A         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x000a)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8B95; JUMP; // sstep
case 0x8B95:
                                                     mon("         CMPA  #$09                    ; 8B95: 81 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x09; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8B97; JUMP; // sstep
case 0x8B97:
                                                     mon("         BLT   L8B9B                   ; 8B97: 2D 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8b9b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B99; JUMP; // sstep
case 0x8B99:
                                                     mon("         SUBA  #$02                    ; 8B99: 80 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0x8B9B; JUMP; // sstep
case 0x8B9B:
                                                     mon("L8B9B    CMPA  #$F7                    ; 8B9B: 81 F7         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xf7; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8B9D; JUMP; // sstep
case 0x8B9D:
                                                     mon("         BGT   L8BA1                   ; 8B9D: 2E 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8ba1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8B9F; JUMP; // sstep
case 0x8B9F:
                                                     mon("         ADDA  #$02                    ; 8B9F: 8B 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x8BA1; JUMP; // sstep
case 0x8BA1:
                                                     mon("L8BA1    STA   $0A,U                   ; 8BA1: A7 4A         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000a); 
    wr_mem(ea, val); 
    PC = 0x8BA3; JUMP; // sstep
case 0x8BA3:
                                                     mon("         LDA   $0C,U                   ; 8BA3: A6 4C         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x000c)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BA5; JUMP; // sstep
case 0x8BA5:
                                                     mon("         CMPA  #$09                    ; 8BA5: 81 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x09; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8BA7; JUMP; // sstep
case 0x8BA7:
                                                     mon("         BLT   L8BAB                   ; 8BA7: 2D 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8bab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BA9; JUMP; // sstep
case 0x8BA9:
                                                     mon("         SUBA  #$03                    ; 8BA9: 80 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0x8BAB; JUMP; // sstep
case 0x8BAB:
                                                     mon("L8BAB    CMPA  #$F7                    ; 8BAB: 81 F7         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xf7; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8BAD; JUMP; // sstep
case 0x8BAD:
                                                     mon("         BGT   L8BB1                   ; 8BAD: 2E 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8bb1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BAF; JUMP; // sstep
case 0x8BAF:
                                                     mon("         ADDA  #$03                    ; 8BAF: 8B 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x8BB1; JUMP; // sstep
case 0x8BB1:
                                                     mon("L8BB1    STA   $0C,U                   ; 8BB1: A7 4C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000c); 
    wr_mem(ea, val); 
    PC = 0x8BB3; JUMP; // sstep
case 0x8BB3:
                                                     mon("         LDD   $08,U                   ; 8BB3: EC 48         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8BB5; JUMP; // sstep
case 0x8BB5:
                                                     mon("         ADDD  #$0400                  ; 8BB5: C3 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8BB8; JUMP; // sstep
case 0x8BB8:
                                                     mon("         BVS   L8BBE                   ; 8BB8: 29 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x8bbe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BBA; JUMP; // sstep
case 0x8BBA:
                                                     mon("         STD   $08,U                   ; 8BBA: ED 48         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8BBC; JUMP; // sstep
case 0x8BBC:
                                                     mon("         BRA   L8BD6                   ; 8BBC: 20 18         \n");
    PC = 0x8bd6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8BBE:
                                                     mon("L8BBE    LDA   $0A,U                   ; 8BBE: A6 4A         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x000a)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BC0; JUMP; // sstep
case 0x8BC0:
                                                     mon("         TSTA                          ; 8BC0: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8BC1; JUMP; // sstep
case 0x8BC1:
                                                     mon("         BPL   L8BC4                   ; 8BC1: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x8bc4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BC3; JUMP; // sstep
case 0x8BC3:
                                                     mon("         NEGA                          ; 8BC3: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x8BC4; JUMP; // sstep
case 0x8BC4:
                                                     mon("L8BC4    CMPA  #$08                    ; 8BC4: 81 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8BC6; JUMP; // sstep
case 0x8BC6:
                                                     mon("         BGT   L8BD6                   ; 8BC6: 2E 0E         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8bd6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BC8; JUMP; // sstep
case 0x8BC8:
                                                     mon("         LDA   $0C,U                   ; 8BC8: A6 4C         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x000c)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BCA; JUMP; // sstep
case 0x8BCA:
                                                     mon("         TSTA                          ; 8BCA: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8BCB; JUMP; // sstep
case 0x8BCB:
                                                     mon("         BPL   L8BCE                   ; 8BCB: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x8bce; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BCD; JUMP; // sstep
case 0x8BCD:
                                                     mon("         NEGA                          ; 8BCD: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x8BCE; JUMP; // sstep
case 0x8BCE:
                                                     mon("L8BCE    CMPA  #$08                    ; 8BCE: 81 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8BD0; JUMP; // sstep
case 0x8BD0:
                                                     mon("         BGT   L8BD6                   ; 8BD0: 2E 04         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8bd6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8BD2; JUMP; // sstep
case 0x8BD2:
                                                     mon("         LDA   #$00                    ; 8BD2: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BD4; JUMP; // sstep
case 0x8BD4:
                                                     mon("         STA   $03,X                   ; 8BD4: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0x8BD6; JUMP; // sstep
case 0x8BD6:
                                                     mon("L8BD6    LDX   <$5A                    ; 8BD6: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8BD8; JUMP; // sstep
case 0x8BD8:
                                                     mon("         LEAX  $19,X                   ; 8BD8: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x8BDB; JUMP; // sstep
case 0x8BDB:
                                                     mon("         CMPX  #$494B                  ; 8BDB: 8C 49 4B      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x494b; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8BDE; JUMP; // sstep
case 0x8BDE:
                                                     mon("         BCS   L8B89                   ; 8BDE: 25 A9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8b89; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_8B86
    PC = 0x8BE0; JUMP; // sstep
case 0x8BE0:
                                                     mon("         RTS                           ; 8BE0: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8BE1:
                                                     mon("L8BE1    JSR   L8E3A                   ; 8BE1: BD 8E 3A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    PC = 0x8e3a; 
    JUMP;
  case 0x8BE4:
                                                     mon("L8BE4    LDD   #$00                    ; 8BE4: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8BE7; JUMP; // sstep
case 0x8BE7:
                                                     mon("         STA   <$4C                    ; 8BE7: 97 4C         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x4c; 
    wr_mem(ea, val); 
    PC = 0x8BE9; JUMP; // sstep
case 0x8BE9:
                                                     mon("         STA   <$4E                    ; 8BE9: 97 4E         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x4e; 
    wr_mem(ea, val); 
    PC = 0x8BEB; JUMP; // sstep
case 0x8BEB:
                                                     mon("         STA   <$4D                    ; 8BEB: 97 4D         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x4d; 
    wr_mem(ea, val); 
    PC = 0x8BED; JUMP; // sstep
case 0x8BED:
                                                     mon("         STA   <$4F                    ; 8BED: 97 4F         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x4f; 
    wr_mem(ea, val); 
    PC = 0x8BEF; JUMP; // sstep
case 0x8BEF:
                                                     mon("         LDA   $15,X                   ; 8BEF: A6 88 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)0x15)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BF2; JUMP; // sstep
case 0x8BF2:
                                                     mon("         ANDA  #$10                    ; 8BF2: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8BF4; JUMP; // sstep
case 0x8BF4:
                                                     mon("         LDB   $4703                   ; 8BF4: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BF7; JUMP; // sstep
case 0x8BF7:
                                                     mon("         ANDB  #$30                    ; 8BF7: C4 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x30; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8BF9; JUMP; // sstep
case 0x8BF9:
                                                     mon("         STD   $15,X                   ; 8BF9: ED 88 15      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8BFC; JUMP; // sstep
case 0x8BFC:
                                                     mon("         LDA   $09,X                   ; 8BFC: A6 09         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0009)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8BFE; JUMP; // sstep
case 0x8BFE:
                                                     mon("         DECA                          ; 8BFE: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x8BFF; JUMP; // sstep
case 0x8BFF:
                                                     mon("         BMI   L8C15                   ; 8BFF: 2B 14         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8c15; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C01; JUMP; // sstep
case 0x8C01:
                                                     mon("         STA   $09,X                   ; 8C01: A7 09         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0009); 
    wr_mem(ea, val); 
    PC = 0x8C03; JUMP; // sstep
case 0x8C03:
                                                     mon("         LDD   #$1640                  ; 8C03: CC 16 40      \n");
    clockticks = clockticks + 3; 
    A = 0x16; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8C06; JUMP; // sstep
case 0x8C06:
                                                     mon("         STD   $5022                   ; 8C06: FD 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5022, A); // Care needed with I/O space and word fetches
    wr_mem(0x5023, B); 
    PC = 0x8C09; JUMP; // sstep
case 0x8C09:
                                                     mon("         LDD   #$3C02                  ; 8C09: CC 3C 02      \n");
    clockticks = clockticks + 3; 
    A = 0x3c; 
    B = 0x02; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8C0C; JUMP; // sstep
case 0x8C0C:
                                                     mon("         STD   $5024                   ; 8C0C: FD 50 24      \n"); // Cosine for rotation
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5024, A); // Care needed with I/O space and word fetches
    wr_mem(0x5025, B); 
    PC = 0x8C0F; JUMP; // sstep
case 0x8C0F:
                                                     mon("         JSR   L89C8                   ; 8C0F: BD 89 C8      \n"); // Space wave roll
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x89c8; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C12:
                                                     mon("L8C12    JMP   L8C44                   ; 8C12: 7E 8C 44      \n");
    clockticks = clockticks + 4; 
    PC = 0x8c44; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8C15:
                                                     mon("L8C15    LDB   $11,X                   ; 8C15: E6 88 11      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)0x11)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8C18; JUMP; // sstep
case 0x8C18:
                                                     mon("         STB   <$50                    ; 8C18: D7 50         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
    V = 0; 
    ea = DP|0x50; 
    wr_mem(ea, val); 
    PC = 0x8C1A; JUMP; // sstep
case 0x8C1A:
                                                     mon("         LSR   <$50                    ; 8C1A: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8C1C; JUMP; // sstep
case 0x8C1C:
                                                     mon("         BCC   L8C21                   ; 8C1C: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8c21; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C1E; JUMP; // sstep
case 0x8C1E:
                                                     mon("         JSR   L8961                   ; 8C1E: BD 89 61      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8961; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C21:
                                                     mon("L8C21    LSR   <$50                    ; 8C21: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8C23; JUMP; // sstep
case 0x8C23:
                                                     mon("         BCC   L8C28                   ; 8C23: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8c28; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C25; JUMP; // sstep
case 0x8C25:
                                                     mon("         JSR   L8969                   ; 8C25: BD 89 69      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8969; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C28:
                                                     mon("L8C28    LSR   <$50                    ; 8C28: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8C2A; JUMP; // sstep
case 0x8C2A:
                                                     mon("         BCC   L8C2F                   ; 8C2A: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8c2f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C2C; JUMP; // sstep
case 0x8C2C:
                                                     mon("         JSR   L8951                   ; 8C2C: BD 89 51      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8951; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C2F:
                                                     mon("L8C2F    LSR   <$50                    ; 8C2F: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8C31; JUMP; // sstep
case 0x8C31:
                                                     mon("         BCC   L8C36                   ; 8C31: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8c36; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C33; JUMP; // sstep
case 0x8C33:
                                                     mon("         JSR   L8959                   ; 8C33: BD 89 59      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x36); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8959; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C36:
                                                     mon("L8C36    LSR   <$50                    ; 8C36: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8C38; JUMP; // sstep
case 0x8C38:
                                                     mon("         BCC   L8C3D                   ; 8C38: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8c3d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C3A; JUMP; // sstep
case 0x8C3A:
                                                     mon("         JSR   L8979                   ; 8C3A: BD 89 79      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8979; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C3D:
                                                     mon("L8C3D    LSR   <$50                    ; 8C3D: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8C3F; JUMP; // sstep
case 0x8C3F:
                                                     mon("         BCC   L8C44                   ; 8C3F: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8c44; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C41; JUMP; // sstep
case 0x8C41:
                                                     mon("         JSR   L8971                   ; 8C41: BD 89 71      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x44); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8971; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8C44:
                                                     mon("L8C44    JSR   L8D9D                   ; 8C44: BD 8D 9D      \n"); // Some tie fighters process
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x47); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8d9d; 
    JUMP;
  case 0x8C47:
                                                     mon("L8C47    JSR   L8DE3                   ; 8C47: BD 8D E3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0x8de3; 
    JUMP;
  case 0x8C4A:
                                                     mon("L8C4A    LDA   $03,X                   ; 8C4A: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8C4C; JUMP; // sstep
case 0x8C4C:
                                                     mon("         CMPA  #$01                    ; 8C4C: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8C4E; JUMP; // sstep
case 0x8C4E:
                                                     mon("         LBNE  L8D66                   ; 8C4E: 10 26 01 14   \n");
    clockticks = clockticks + 5; 
    if (Z) {
    clockticks = clockticks + 1; 
    PC = 0x8d66; 
    JUMP;
    }
    PC = 0x8C52; JUMP; // sstep
case 0x8C52:
                                                     mon("         LDA   $02,X                   ; 8C52: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8C54; JUMP; // sstep
case 0x8C54:
                                                     mon("         JSR   LCE0C                   ; 8C54: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x57); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x8C57:
                                                     mon("L8C57    LDX   <$5A                    ; 8C57: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8C59; JUMP; // sstep
case 0x8C59:
                                                     mon("         CLR   $0A,X                   ; 8C59: 6F 0A         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x000a), 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8C5B; JUMP; // sstep
case 0x8C5B:
                                                     mon("         CLRA                          ; 8C5B: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8C5C; JUMP; // sstep
case 0x8C5C:
                                                     mon("         LDB   #$13                    ; 8C5C: C6 13         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x13; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8C5E; JUMP; // sstep
case 0x8C5E:
                                                     mon("         STD   $4701                   ; 8C5E: FD 47 01      \n"); // Point BIC to $5098 MReg4C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0x8C61; JUMP; // sstep
case 0x8C61:
                                                     mon("         LDA   $11,X                   ; 8C61: A6 88 11      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)0x11)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8C64; JUMP; // sstep
case 0x8C64:
                                                     mon("         BITA  #$40                    ; 8C64: 85 40         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x40; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8C66; JUMP; // sstep
case 0x8C66:
                                                     mon("         BEQ   L8C81                   ; 8C66: 27 19         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8c81; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C68; JUMP; // sstep
case 0x8C68:
                                                     mon("         LDD   $5098                   ; 8C68: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8C6B; JUMP; // sstep
case 0x8C6B:
                                                     mon("         ADDD  #$1000                  ; 8C6B: C3 10 00      \n");
    clockticks = clockticks + 4; 
    val = 0x1000; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8C6E; JUMP; // sstep
case 0x8C6E:
                                                     mon("         STD   $5098                   ; 8C6E: FD 50 98      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5098, A); // Care needed with I/O space and word fetches
    wr_mem(0x5099, B); 
    PC = 0x8C71; JUMP; // sstep
case 0x8C71:
                                                     mon("         LDA   #$67                    ; 8C71: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8C73; JUMP; // sstep
case 0x8C73:
                                                     mon("         JSR   LCDBA                   ; 8C73: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8C76:
                                                     mon("L8C76    LDD   $5098                   ; 8C76: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8C79; JUMP; // sstep
case 0x8C79:
                                                     mon("         SUBD  #$1000                  ; 8C79: 83 10 00      \n");
    clockticks = clockticks + 4; 
    val = 0x1000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8C7C; JUMP; // sstep
case 0x8C7C:
                                                     mon("         STD   $5098                   ; 8C7C: FD 50 98      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5098, A); // Care needed with I/O space and word fetches
    wr_mem(0x5099, B); 
    PC = 0x8C7F; JUMP; // sstep
case 0x8C7F:
                                                     mon("         BRA   L8C86                   ; 8C7F: 20 05         \n");
    PC = 0x8c86; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8C81:
                                                     mon("L8C81    LDA   #$67                    ; 8C81: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8C83; JUMP; // sstep
case 0x8C83:
                                                     mon("         JSR   LCDBA                   ; 8C83: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x8C86:
                                                     mon("L8C86    LDD   $5000                   ; 8C86: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8C89; JUMP; // sstep
case 0x8C89:
                                                     mon("         BMI   L8CAE                   ; 8C89: 2B 23         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8cae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C8B; JUMP; // sstep
case 0x8C8B:
                                                     mon("         INC   $0A,X                   ; 8C8B: 6C 0A         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000a)); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem((UINT16)(X + 0x000a), res); 
    clockticks = clockticks + 2; 
    PC = 0x8C8D; JUMP; // sstep
case 0x8C8D:
                                                     mon("         SUBD  #$4000                  ; 8C8D: 83 40 00      \n");
    clockticks = clockticks + 4; 
    val = 0x4000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8C90; JUMP; // sstep
case 0x8C90:
                                                     mon("         BGE   L8CAE                   ; 8C90: 2C 1C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x8cae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8C92; JUMP; // sstep
case 0x8C92:
                                                     mon("         LDD   $15,X                   ; 8C92: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8C95; JUMP; // sstep
case 0x8C95:
                                                     mon("         ORB   #$08                    ; 8C95: CA 08         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x08; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8C97; JUMP; // sstep
case 0x8C97:
                                                     mon("         STD   $15,X                   ; 8C97: ED 88 15      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8C9A; JUMP; // sstep
case 0x8C9A:
                                                     mon("         LDD   $5072                   ; 8C9A: FC 50 72      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5072); // Care needed with I/O space and word fetches
    B = rd_mem(0x5073); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8C9D; JUMP; // sstep
case 0x8C9D:
                                                     mon("         ADDD  $5074                   ; 8C9D: F3 50 74      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5074)<<8; 
    ea = ea | rd_mem(0x5075); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x8CA0; JUMP; // sstep
case 0x8CA0:
                                                     mon("         CMPD  #$20                    ; 8CA0: 10 83 00 20   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0020; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8CA4; JUMP; // sstep
case 0x8CA4:
                                                     mon("         BHI   L8CAE                   ; 8CA4: 22 08         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x8cae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CA6; JUMP; // sstep
case 0x8CA6:
                                                     mon("         LDD   $15,X                   ; 8CA6: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8CA9; JUMP; // sstep
case 0x8CA9:
                                                     mon("         ORB   #$04                    ; 8CA9: CA 04         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x04; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8CAB; JUMP; // sstep
case 0x8CAB:
                                                     mon("         STD   $15,X                   ; 8CAB: ED 88 15      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8CAE; JUMP; // sstep
case 0x8CAE:
                                                     mon("L8CAE    LDD   $15,X                   ; 8CAE: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8CB1; JUMP; // sstep
case 0x8CB1:
                                                     mon("         BITA  #$10                    ; 8CB1: 85 10         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x10; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8CB3; JUMP; // sstep
case 0x8CB3:
                                                     mon("         BEQ   L8D05                   ; 8CB3: 27 50         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8d05; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CB5; JUMP; // sstep
case 0x8CB5:
                                                     mon("         LDD   $11,X                   ; 8CB5: EC 88 11      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x11); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8CB8; JUMP; // sstep
case 0x8CB8:
                                                     mon("         BITA  #$40                    ; 8CB8: 85 40         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x40; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8CBA; JUMP; // sstep
case 0x8CBA:
                                                     mon("         BNE   L8D05                   ; 8CBA: 26 49         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d05; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CBC; JUMP; // sstep
case 0x8CBC:
                                                     mon("         LDD   $5000                   ; 8CBC: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8CBF; JUMP; // sstep
case 0x8CBF:
                                                     mon("         SUBD  #$0800                  ; 8CBF: 83 08 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0800; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8CC2; JUMP; // sstep
case 0x8CC2:
                                                     mon("         BLE   L8D05                   ; 8CC2: 2F 41         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x8d05; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CC4; JUMP; // sstep
case 0x8CC4:
                                                     mon("         LDA   $06,X                   ; 8CC4: A6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8CC6; JUMP; // sstep
case 0x8CC6:
                                                     mon("         BNE   L8D05                   ; 8CC6: 26 3D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d05; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CC8; JUMP; // sstep
case 0x8CC8:
                                                     mon("         LDB   $4B19                   ; 8CC8: F6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8CCB; JUMP; // sstep
case 0x8CCB:
                                                     mon("         CMPB  #$0B                    ; 8CCB: C1 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x0b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8CCD; JUMP; // sstep
case 0x8CCD:
                                                     mon("         BCS   L8CD4                   ; 8CCD: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8cd4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CCF; JUMP; // sstep
case 0x8CCF:
                                                     mon("         LDU   #byte_8D99              ; 8CCF: CE 8D 99      \n");
    clockticks = clockticks + 3; 
    U = 0x8d99; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8CD2; JUMP; // sstep
case 0x8CD2:
                                                     mon("         BRA   L8CDB                   ; 8CD2: 20 07         \n");
    PC = 0x8cdb; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8CD4:
                                                     mon("L8CD4    ASLB                          ; 8CD4: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8CD5; JUMP; // sstep
case 0x8CD5:
                                                     mon("         ASLB                          ; 8CD5: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8CD6; JUMP; // sstep
case 0x8CD6:
                                                     mon("         LDU   #byte_8D71              ; 8CD6: CE 8D 71      \n");
    clockticks = clockticks + 3; 
    U = 0x8d71; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8CD9; JUMP; // sstep
case 0x8CD9:
                                                     mon("         LEAU  B,U                     ; 8CD9: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0x8CDB; JUMP; // sstep
case 0x8CDB:
                                                     mon("L8CDB    LDA   <$43                    ; 8CDB: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8CDD; JUMP; // sstep
case 0x8CDD:
                                                     mon("         ANDA  ,U                      ; 8CDD: A4 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(U); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8CDF; JUMP; // sstep
case 0x8CDF:
                                                     mon("         BNE   L8D05                   ; 8CDF: 26 24         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d05; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CE1; JUMP; // sstep
case 0x8CE1:
                                                     mon("         LDA   $4703                   ; 8CE1: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8CE4; JUMP; // sstep
case 0x8CE4:
                                                     mon("         CMPA  $01,U                   ; 8CE4: A1 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(U + 0x0001)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8CE6; JUMP; // sstep
case 0x8CE6:
                                                     mon("         BLS   L8D05                   ; 8CE6: 23 1D         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x8d05; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CE8; JUMP; // sstep
case 0x8CE8:
                                                     mon("         LDU   $02,U                   ; 8CE8: EE 42         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8CEA; JUMP; // sstep
case 0x8CEA:
                                                     mon("L8CEA    LDA   $03,U                   ; 8CEA: A6 43         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8CEC; JUMP; // sstep
case 0x8CEC:
                                                     mon("         BNE   L8CFD                   ; 8CEC: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8cfd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8CEE; JUMP; // sstep
case 0x8CEE:
                                                     mon("         LDX   <$5A                    ; 8CEE: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8CF0; JUMP; // sstep
case 0x8CF0:
                                                     mon("         LDD   $15,X                   ; 8CF0: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8CF3; JUMP; // sstep
case 0x8CF3:
                                                     mon("         ORB   #$40                    ; 8CF3: CA 40         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x40; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8CF5; JUMP; // sstep
case 0x8CF5:
                                                     mon("         STD   $15,X                   ; 8CF5: ED 88 15      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8CF8; JUMP; // sstep
case 0x8CF8:
                                                     mon("         JSR   LA68B                   ; 8CF8: BD A6 8B      \n"); // Emit fireballs from tie fighters
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    PC = 0xa68b; 
    JUMP;
  case 0x8CFB:
                                                     mon("L8CFB    BRA   L8D05                   ; 8CFB: 20 08         \n");
    PC = 0x8d05; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8CFD:
                                                     mon("L8CFD    LEAU  $06,U                   ; 8CFD: 33 46         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0006); 
    PC = 0x8CFF; JUMP; // sstep
case 0x8CFF:
                                                     mon("         CMPU  #$496F                  ; 8CFF: 11 83 49 6F   \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x496f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8D03; JUMP; // sstep
case 0x8D03:
                                                     mon("         BCS   L8CEA                   ; 8D03: 25 E5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8cea; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D05; JUMP; // sstep
case 0x8D05:
                                                     mon("L8D05    LDX   <$5A                    ; 8D05: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8D07; JUMP; // sstep
case 0x8D07:
                                                     mon("         LDA   $11,X                   ; 8D07: A6 88 11      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)0x11)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8D0A; JUMP; // sstep
case 0x8D0A:
                                                     mon("         BITA  #$80                    ; 8D0A: 85 80         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x80; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8D0C; JUMP; // sstep
case 0x8D0C:
                                                     mon("         BEQ   L8D66                   ; 8D0C: 27 58         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8d66; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D0E; JUMP; // sstep
case 0x8D0E:
                                                     mon("         LDA   <$4F                    ; 8D0E: 96 4F         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4f); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8D10; JUMP; // sstep
case 0x8D10:
                                                     mon("         BNE   L8D3A                   ; 8D10: 26 28         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d3a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D12; JUMP; // sstep
case 0x8D12:
                                                     mon("         LDA   $5002                   ; 8D12: B6 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5002); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8D15; JUMP; // sstep
case 0x8D15:
                                                     mon("         BMI   L8D1C                   ; 8D15: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8d1c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D17; JUMP; // sstep
case 0x8D17:
                                                     mon("         JSR   L8979                   ; 8D17: BD 89 79      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8979; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D1A:
                                                     mon("L8D1A    BRA   L8D1F                   ; 8D1A: 20 03         \n");
    PC = 0x8d1f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8D1C:
                                                     mon("L8D1C    JSR   L8971                   ; 8D1C: BD 89 71      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8971; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D1F:
                                                     mon("L8D1F    LDA   <$4E                    ; 8D1F: 96 4E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4e); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8D21; JUMP; // sstep
case 0x8D21:
                                                     mon("         BNE   L8D3A                   ; 8D21: 26 17         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d3a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D23; JUMP; // sstep
case 0x8D23:
                                                     mon("         LDB   $5004                   ; 8D23: F6 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5004); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8D26; JUMP; // sstep
case 0x8D26:
                                                     mon("         SEX                           ; 8D26: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x8D27; JUMP; // sstep
case 0x8D27:
                                                     mon("         ADDB  #$01                    ; 8D27: CB 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0x8D29; JUMP; // sstep
case 0x8D29:
                                                     mon("         CMPB  #$01                    ; 8D29: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8D2B; JUMP; // sstep
case 0x8D2B:
                                                     mon("         BLS   L8D3A                   ; 8D2B: 23 0D         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x8d3a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D2D; JUMP; // sstep
case 0x8D2D:
                                                     mon("         EORA  $5002                   ; 8D2D: B8 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    res = A ^ rd_mem(0x5002); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8D30; JUMP; // sstep
case 0x8D30:
                                                     mon("         BMI   L8D37                   ; 8D30: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8d37; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D32; JUMP; // sstep
case 0x8D32:
                                                     mon("         JSR   L8961                   ; 8D32: BD 89 61      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8961; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D35:
                                                     mon("L8D35    BRA   L8D3A                   ; 8D35: 20 03         \n");
    PC = 0x8d3a; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8D37:
                                                     mon("L8D37    JSR   L8969                   ; 8D37: BD 89 69      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8969; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D3A:
                                                     mon("L8D3A    LDA   <$4D                    ; 8D3A: 96 4D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8D3C; JUMP; // sstep
case 0x8D3C:
                                                     mon("         BNE   L8D66                   ; 8D3C: 26 28         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d66; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D3E; JUMP; // sstep
case 0x8D3E:
                                                     mon("         LDA   $5004                   ; 8D3E: B6 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5004); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8D41; JUMP; // sstep
case 0x8D41:
                                                     mon("         BMI   L8D48                   ; 8D41: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8d48; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D43; JUMP; // sstep
case 0x8D43:
                                                     mon("         JSR   L8951                   ; 8D43: BD 89 51      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x46); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8951; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D46:
                                                     mon("L8D46    BRA   L8D4B                   ; 8D46: 20 03         \n");
    PC = 0x8d4b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8D48:
                                                     mon("L8D48    JSR   L8959                   ; 8D48: BD 89 59      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8959; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D4B:
                                                     mon("L8D4B    LDA   <$4E                    ; 8D4B: 96 4E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x4e); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8D4D; JUMP; // sstep
case 0x8D4D:
                                                     mon("         BNE   L8D66                   ; 8D4D: 26 17         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8d66; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D4F; JUMP; // sstep
case 0x8D4F:
                                                     mon("         LDB   $5002                   ; 8D4F: F6 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5002); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8D52; JUMP; // sstep
case 0x8D52:
                                                     mon("         SEX                           ; 8D52: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x8D53; JUMP; // sstep
case 0x8D53:
                                                     mon("         ADDB  #$01                    ; 8D53: CB 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0x8D55; JUMP; // sstep
case 0x8D55:
                                                     mon("         CMPB  #$01                    ; 8D55: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8D57; JUMP; // sstep
case 0x8D57:
                                                     mon("         BLS   L8D66                   ; 8D57: 23 0D         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x8d66; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D59; JUMP; // sstep
case 0x8D59:
                                                     mon("         EORA  $5004                   ; 8D59: B8 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    res = A ^ rd_mem(0x5004); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8D5C; JUMP; // sstep
case 0x8D5C:
                                                     mon("         BMI   L8D63                   ; 8D5C: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x8d63; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8D5E; JUMP; // sstep
case 0x8D5E:
                                                     mon("         JSR   L8969                   ; 8D5E: BD 89 69      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8969; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D61:
                                                     mon("L8D61    BRA   L8D66                   ; 8D61: 20 03         \n");
    PC = 0x8d66; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8D63:
                                                     mon("L8D63    JSR   L8961                   ; 8D63: BD 89 61      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8961; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x8D66:
                                                     mon("L8D66    LDX   <$5A                    ; 8D66: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8D68; JUMP; // sstep
case 0x8D68:
                                                     mon("         LDD   $15,X                   ; 8D68: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8D6B; JUMP; // sstep
case 0x8D6B:
                                                     mon("         ANDA  #$EF                    ; 8D6B: 84 EF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xef; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8D6D; JUMP; // sstep
case 0x8D6D:
                                                     mon("         STD   $15,X                   ; 8D6D: ED 88 15      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8BE1
    // ---------------------------------------------------------------------------
    PC = 0x8D70; JUMP; // sstep
case 0x8D70:
                                                     mon("         RTS                           ; 8D70: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Some tie fighters process
  case 0x8D9D:
                                                     mon("L8D9D    LDX   <$5A                    ; 8D9D: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8D9F; JUMP; // sstep
case 0x8D9F:
                                                     mon("         LDU   ,X                      ; 8D9F: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8DA1; JUMP; // sstep
case 0x8DA1:
                                                     mon("         LDA   $06,X                   ; 8DA1: A6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8DA3; JUMP; // sstep
case 0x8DA3:
                                                     mon("         BNE   L8DDF                   ; 8DA3: 26 3A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8ddf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DA5; JUMP; // sstep
case 0x8DA5:
                                                     mon("         LDB   $12,X                   ; 8DA5: E6 88 12      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)0x12)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8DA8; JUMP; // sstep
case 0x8DA8:
                                                     mon("         STB   <$50                    ; 8DA8: D7 50         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x50; 
    wr_mem(ea, val); 
    PC = 0x8DAA; JUMP; // sstep
case 0x8DAA:
                                                     mon("         LDU   ,X                      ; 8DAA: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8DAC; JUMP; // sstep
case 0x8DAC:
                                                     mon("         LDD   #$00                    ; 8DAC: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8DAF; JUMP; // sstep
case 0x8DAF:
                                                     mon("         STD   -10,U                   ; 8DAF: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8DB1; JUMP; // sstep
case 0x8DB1:
                                                     mon("         STD   -2,U                    ; 8DB1: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8DB3; JUMP; // sstep
case 0x8DB3:
                                                     mon("         STD   $06,U                   ; 8DB3: ED 46         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8DB5; JUMP; // sstep
case 0x8DB5:
                                                     mon("         LSR   <$50                    ; 8DB5: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8DB7; JUMP; // sstep
case 0x8DB7:
                                                     mon("         BCC   L8DBC                   ; 8DB7: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8dbc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DB9; JUMP; // sstep
case 0x8DB9:
                                                     mon("         JSR   L8A59                   ; 8DB9: BD 8A 59      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8a59; 
    JUMP;
  case 0x8DBC:
                                                     mon("L8DBC    LSR   <$50                    ; 8DBC: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8DBE; JUMP; // sstep
case 0x8DBE:
                                                     mon("         BCC   L8DC3                   ; 8DBE: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8dc3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DC0; JUMP; // sstep
case 0x8DC0:
                                                     mon("         JSR   L8A7E                   ; 8DC0: BD 8A 7E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8a7e; 
    JUMP;
  case 0x8DC3:
                                                     mon("L8DC3    LSR   <$50                    ; 8DC3: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8DC5; JUMP; // sstep
case 0x8DC5:
                                                     mon("         BCC   L8DCA                   ; 8DC5: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8dca; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DC7; JUMP; // sstep
case 0x8DC7:
                                                     mon("         JSR   L8A21                   ; 8DC7: BD 8A 21      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xca); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8a21; 
    JUMP;
  case 0x8DCA:
                                                     mon("L8DCA    LSR   <$50                    ; 8DCA: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8DCC; JUMP; // sstep
case 0x8DCC:
                                                     mon("         BCC   L8DD1                   ; 8DCC: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8dd1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DCE; JUMP; // sstep
case 0x8DCE:
                                                     mon("         JSR   L8A3D                   ; 8DCE: BD 8A 3D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8a3d; 
    JUMP;
  case 0x8DD1:
                                                     mon("L8DD1    LSR   <$50                    ; 8DD1: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8DD3; JUMP; // sstep
case 0x8DD3:
                                                     mon("         BCC   L8DD8                   ; 8DD3: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8dd8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DD5; JUMP; // sstep
case 0x8DD5:
                                                     mon("         JSR   L8A05                   ; 8DD5: BD 8A 05      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8a05; 
    JUMP;
  case 0x8DD8:
                                                     mon("L8DD8    LSR   <$50                    ; 8DD8: 04 50         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x50); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x50, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8DDA; JUMP; // sstep
case 0x8DDA:
                                                     mon("         BCC   L8DDF                   ; 8DDA: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8ddf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DDC; JUMP; // sstep
case 0x8DDC:
                                                     mon("         JSR   L89E9                   ; 8DDC: BD 89 E9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x89e9; 
    JUMP;
  case 0x8DDF:
                                                     mon("L8DDF    JSR   L8AB6                   ; 8DDF: BD 8A B6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    PC = 0x8ab6; 
    JUMP;
    // End of function sub_8D9D
  case 0x8DE2:
                                                     mon("L8DE2    RTS                           ; 8DE2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8DE3:
                                                     mon("L8DE3    LDU   ,X                      ; 8DE3: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8DE5; JUMP; // sstep
case 0x8DE5:
                                                     mon("         LDD   $08,U                   ; 8DE5: EC 48         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8DE7; JUMP; // sstep
case 0x8DE7:
                                                     mon("         CMPA  #$7D                    ; 8DE7: 81 7D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7d; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8DE9; JUMP; // sstep
case 0x8DE9:
                                                     mon("         BLT   L8DEE                   ; 8DE9: 2D 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8dee; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DEB; JUMP; // sstep
case 0x8DEB:
                                                     mon("         LDD   #$7CFF                  ; 8DEB: CC 7C FF      \n");
    clockticks = clockticks + 3; 
    A = 0x7c; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8DEE; JUMP; // sstep
case 0x8DEE:
                                                     mon("L8DEE    CMPA  #$82                    ; 8DEE: 81 82         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x82; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8DF0; JUMP; // sstep
case 0x8DF0:
                                                     mon("         BGT   L8DF5                   ; 8DF0: 2E 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8df5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DF2; JUMP; // sstep
case 0x8DF2:
                                                     mon("         LDD   #$8300                  ; 8DF2: CC 83 00      \n");
    clockticks = clockticks + 3; 
    A = 0x83; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8DF5; JUMP; // sstep
case 0x8DF5:
                                                     mon("L8DF5    STD   $08,U                   ; 8DF5: ED 48         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8DF7; JUMP; // sstep
case 0x8DF7:
                                                     mon("         LDD   $0A,U                   ; 8DF7: EC 4A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x000a); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8DF9; JUMP; // sstep
case 0x8DF9:
                                                     mon("         CMPA  #$7D                    ; 8DF9: 81 7D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7d; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8DFB; JUMP; // sstep
case 0x8DFB:
                                                     mon("         BLT   L8E00                   ; 8DFB: 2D 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8e00; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8DFD; JUMP; // sstep
case 0x8DFD:
                                                     mon("         LDD   #$7CFF                  ; 8DFD: CC 7C FF      \n");
    clockticks = clockticks + 3; 
    A = 0x7c; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E00; JUMP; // sstep
case 0x8E00:
                                                     mon("L8E00    CMPA  #$82                    ; 8E00: 81 82         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x82; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8E02; JUMP; // sstep
case 0x8E02:
                                                     mon("         BGT   L8E07                   ; 8E02: 2E 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8e07; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E04; JUMP; // sstep
case 0x8E04:
                                                     mon("         LDD   #$8300                  ; 8E04: CC 83 00      \n");
    clockticks = clockticks + 3; 
    A = 0x83; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E07; JUMP; // sstep
case 0x8E07:
                                                     mon("L8E07    STD   $0A,U                   ; 8E07: ED 4A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8E09; JUMP; // sstep
case 0x8E09:
                                                     mon("         LDD   $0C,U                   ; 8E09: EC 4C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x000c); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E0B; JUMP; // sstep
case 0x8E0B:
                                                     mon("         CMPA  #$7D                    ; 8E0B: 81 7D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7d; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8E0D; JUMP; // sstep
case 0x8E0D:
                                                     mon("         BLT   L8E12                   ; 8E0D: 2D 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8e12; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E0F; JUMP; // sstep
case 0x8E0F:
                                                     mon("         LDD   #$7CFF                  ; 8E0F: CC 7C FF      \n");
    clockticks = clockticks + 3; 
    A = 0x7c; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E12; JUMP; // sstep
case 0x8E12:
                                                     mon("L8E12    CMPA  #$82                    ; 8E12: 81 82         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x82; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8E14; JUMP; // sstep
case 0x8E14:
                                                     mon("         BGT   L8E19                   ; 8E14: 2E 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8e19; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E16; JUMP; // sstep
case 0x8E16:
                                                     mon("         LDD   #$8300                  ; 8E16: CC 83 00      \n");
    clockticks = clockticks + 3; 
    A = 0x83; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E19; JUMP; // sstep
case 0x8E19:
                                                     mon("L8E19    STD   $0C,U                   ; 8E19: ED 4C         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_8DE3
    PC = 0x8E1B; JUMP; // sstep
case 0x8E1B:
                                                     mon("         RTS                           ; 8E1B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8E1C:
                                                     mon("L8E1C    DEC   <$E6                    ; 8E1C: 0A E6         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xe6); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0xe6, res); 
    clockticks = clockticks + 2; 
    PC = 0x8E1E; JUMP; // sstep
case 0x8E1E:
                                                     mon("         BGT   locret_8E22             ; 8E1E: 2E 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x8e22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E20; JUMP; // sstep
case 0x8E20:
                                                     mon("         CLR   <$E6                    ; 8E20: 0F E6         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xe6, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_8E1C
    PC = 0x8E22; JUMP; // sstep
case 0x8E22:
                                                     mon("locret_8E22 RTS                           ; 8E22: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8E23:
                                                     mon("L8E23    LDD   #$00                    ; 8E23: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E26; JUMP; // sstep
case 0x8E26:
                                                     mon("         STD   $11,X                   ; 8E26: ED 88 11      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x11); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8E29; JUMP; // sstep
case 0x8E29:
                                                     mon("         STA   $10,X                   ; 8E29: A7 88 10      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x10); 
    wr_mem(ea, val); 
    PC = 0x8E2C; JUMP; // sstep
case 0x8E2C:
                                                     mon("         STD   $13,X                   ; 8E2C: ED 88 13      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x13); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8E2F; JUMP; // sstep
case 0x8E2F:
                                                     mon("         STD   $15,X                   ; 8E2F: ED 88 15      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x15); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8E32; JUMP; // sstep
case 0x8E32:
                                                     mon("L8E32    LDU   $0D,X                   ; 8E32: EE 0D         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000d))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000d))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8E34; JUMP; // sstep
case 0x8E34:
                                                     mon("         LDA   ,U                      ; 8E34: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8E36; JUMP; // sstep
case 0x8E36:
                                                     mon("         STA   $0F,X                   ; 8E36: A7 0F         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x000f); 
    wr_mem(ea, val); 
    PC = 0x8E38; JUMP; // sstep
case 0x8E38:
                                                     mon("         BEQ   L8E51                   ; 8E38: 27 17         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8e51; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E3A; JUMP; // sstep
case 0x8E3A:
                                                     mon("L8E3A    LDD   $15,X                   ; 8E3A: EC 88 15      \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)0x15); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E3D; JUMP; // sstep
case 0x8E3D:
                                                     mon("         ANDA  $13,X                   ; 8E3D: A4 88 13      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    res = val & rd_mem((UINT16)(X + (SINT8)0x13)); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8E40; JUMP; // sstep
case 0x8E40:
                                                     mon("         BNE   L8E5C                   ; 8E40: 26 1A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8e5c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E42; JUMP; // sstep
case 0x8E42:
                                                     mon("         ANDB  $14,X                   ; 8E42: E4 88 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    res = val & rd_mem((UINT16)(X + (SINT8)0x14)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8E45; JUMP; // sstep
case 0x8E45:
                                                     mon("         BNE   L8E5C                   ; 8E45: 26 15         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8e5c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E47; JUMP; // sstep
case 0x8E47:
                                                     mon("         LDA   $0F,X                   ; 8E47: A6 0F         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000f)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8E49; JUMP; // sstep
case 0x8E49:
                                                     mon("         ANDA  #$07                    ; 8E49: 84 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x07; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8E4B; JUMP; // sstep
case 0x8E4B:
                                                     mon("         ASLA                          ; 8E4B: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x8E4C; JUMP; // sstep
case 0x8E4C:
                                                     mon("         LDU   #JumpTable8E68          ; 8E4C: CE 8E 68      \n");
    clockticks = clockticks + 3; 
    U = 0x8e68; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8E4F; JUMP; // sstep
case 0x8E4F:
                                                     mon("         JMP   [A,U]                   ; 8E4F: 6E D6         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    ea = rd_mem((UINT16)(U + (SINT8)A))<<8; 
    ea = ea | rd_mem((UINT16)((U + (SINT8)A) + 1)); 
    PC = ea; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8E51:
                                                     mon("L8E51    LDD   $01,U                   ; 8E51: EC 41         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0001); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8E53; JUMP; // sstep
case 0x8E53:
                                                     mon("         STD   $13,X                   ; 8E53: ED 88 13      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x13); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8E56; JUMP; // sstep
case 0x8E56:
                                                     mon("         LEAU  $03,U                   ; 8E56: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8E58; JUMP; // sstep
case 0x8E58:
                                                     mon("         STU   $0D,X                   ; 8E58: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8E5A; JUMP; // sstep
case 0x8E5A:
                                                     mon("         BRA   L8E32                   ; 8E5A: 20 D6         \n");
    PC = 0x8e32; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8E5C:
                                                     mon("L8E5C    LDU   $0D,X                   ; 8E5C: EE 0D         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000d))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000d))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8E5E; JUMP; // sstep
case 0x8E5E:
                                                     mon("L8E5E    LDA   ,U                      ; 8E5E: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8E60; JUMP; // sstep
case 0x8E60:
                                                     mon("         BEQ   L8E32                   ; 8E60: 27 D0         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8e32; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E62; JUMP; // sstep
case 0x8E62:
                                                     mon("         LEAU  $03,U                   ; 8E62: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8E64; JUMP; // sstep
case 0x8E64:
                                                     mon("         STU   $0D,X                   ; 8E64: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_8E23
    // ---------------------------------------------------------------------------
    PC = 0x8E66; JUMP; // sstep
case 0x8E66:
                                                     mon("         BRA   L8E5E                   ; 8E66: 20 F6         \n");
    PC = 0x8e5e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // End of function sub_8E78
  case 0x8E78:
                                                     mon("L8E78    SWI                           ; 8E78: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
    // =============== S U B R O U T I N E =======================================
  case 0x8E79:
                                                     mon("L8E79    LDU   $0D,X                   ; 8E79: EE 0D         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000d))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000d))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8E7B; JUMP; // sstep
case 0x8E7B:
                                                     mon("L8E7B    LDD   $01,U                   ; 8E7B: EC 41         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0001); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8E7D; JUMP; // sstep
case 0x8E7D:
                                                     mon("         BEQ   L8E94                   ; 8E7D: 27 15         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8e94; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E7F; JUMP; // sstep
case 0x8E7F:
                                                     mon("         ANDA  $15,X                   ; 8E7F: A4 88 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    res = val & rd_mem((UINT16)(X + (SINT8)0x15)); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8E82; JUMP; // sstep
case 0x8E82:
                                                     mon("         BNE   L8E94                   ; 8E82: 26 10         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8e94; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E84; JUMP; // sstep
case 0x8E84:
                                                     mon("         ANDB  $16,X                   ; 8E84: E4 88 16      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    res = val & rd_mem((UINT16)(X + (SINT8)0x16)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x8E87; JUMP; // sstep
case 0x8E87:
                                                     mon("         BNE   L8E94                   ; 8E87: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8e94; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E89; JUMP; // sstep
case 0x8E89:
                                                     mon("L8E89    LEAU  $03,U                   ; 8E89: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8E8B; JUMP; // sstep
case 0x8E8B:
                                                     mon("         LDA   ,U                      ; 8E8B: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8E8D; JUMP; // sstep
case 0x8E8D:
                                                     mon("         ASLA                          ; 8E8D: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x8E8E; JUMP; // sstep
case 0x8E8E:
                                                     mon("         BNE   L8E89                   ; 8E8E: 26 F9         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8e89; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E90; JUMP; // sstep
case 0x8E90:
                                                     mon("         BCC   L8E89                   ; 8E90: 24 F7         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x8e89; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8E92; JUMP; // sstep
case 0x8E92:
                                                     mon("         BRA   L8E7B                   ; 8E92: 20 E7         \n");
    PC = 0x8e7b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8E94:
                                                     mon("L8E94    LEAU  $03,U                   ; 8E94: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8E96; JUMP; // sstep
case 0x8E96:
                                                     mon("         STU   $0D,X                   ; 8E96: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_8E79
    PC = 0x8E98; JUMP; // sstep
case 0x8E98:
                                                     mon("         JMP   L8E32                   ; 8E98: 7E 8E 32      \n");
    clockticks = clockticks + 4; 
    PC = 0x8e32; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8E9B:
                                                     mon("L8E9B    LDU   $0D,X                   ; 8E9B: EE 0D         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000d))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000d))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8E9D; JUMP; // sstep
case 0x8E9D:
                                                     mon("         LDU   $01,U                   ; 8E9D: EE 41         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0001))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0001))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8E9F; JUMP; // sstep
case 0x8E9F:
                                                     mon("         STU   $0D,X                   ; 8E9F: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_8E9B
    PC = 0x8EA1; JUMP; // sstep
case 0x8EA1:
                                                     mon("         JMP   L8E32                   ; 8EA1: 7E 8E 32      \n");
    clockticks = clockticks + 4; 
    PC = 0x8e32; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8EA4:
                                                     mon("L8EA4    LDU   $0D,X                   ; 8EA4: EE 0D         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000d))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000d))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8EA6; JUMP; // sstep
case 0x8EA6:
                                                     mon("         LEAU  $03,U                   ; 8EA6: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8EA8; JUMP; // sstep
case 0x8EA8:
                                                     mon("         STU   $17,X                   ; 8EA8: EF 88 17      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = (X + (SINT8)0x17); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8EAB; JUMP; // sstep
case 0x8EAB:
                                                     mon("         LDU   -2,U                    ; 8EAB: EE 5E         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffe))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffe))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8EAD; JUMP; // sstep
case 0x8EAD:
                                                     mon("         STU   $0D,X                   ; 8EAD: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_8EA4
    PC = 0x8EAF; JUMP; // sstep
case 0x8EAF:
                                                     mon("         JMP   L8E32                   ; 8EAF: 7E 8E 32      \n");
    clockticks = clockticks + 4; 
    PC = 0x8e32; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8EB2:
                                                     mon("L8EB2    LDU   $17,X                   ; 8EB2: EE 88 17      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)0x17))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)0x17))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8EB5; JUMP; // sstep
case 0x8EB5:
                                                     mon("         STU   $0D,X                   ; 8EB5: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_8EB2
    PC = 0x8EB7; JUMP; // sstep
case 0x8EB7:
                                                     mon("         JMP   L8E32                   ; 8EB7: 7E 8E 32      \n");
    clockticks = clockticks + 4; 
    PC = 0x8e32; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8EBA:
                                                     mon("L8EBA    LDU   $0D,X                   ; 8EBA: EE 0D         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000d))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000d))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8EBC; JUMP; // sstep
case 0x8EBC:
                                                     mon("         LDB   ,U                      ; 8EBC: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8EBE; JUMP; // sstep
case 0x8EBE:
                                                     mon("         LSRB                          ; 8EBE: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8EBF; JUMP; // sstep
case 0x8EBF:
                                                     mon("         STB   $10,X                   ; 8EBF: E7 88 10      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x10); 
    wr_mem(ea, val); 
    PC = 0x8EC2; JUMP; // sstep
case 0x8EC2:
                                                     mon("         LDD   $01,U                   ; 8EC2: EC 41         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0001); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8EC4; JUMP; // sstep
case 0x8EC4:
                                                     mon("         STD   $11,X                   ; 8EC4: ED 88 11      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)0x11); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8EC7; JUMP; // sstep
case 0x8EC7:
                                                     mon("         LEAU  $03,U                   ; 8EC7: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8EC9; JUMP; // sstep
case 0x8EC9:
                                                     mon("         STU   $0D,X                   ; 8EC9: EF 0D         \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = (X + 0x000d); 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8ECB; JUMP; // sstep
case 0x8ECB:
                                                     mon("         INC   $0F,X                   ; 8ECB: 6C 0F         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000f)); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem((UINT16)(X + 0x000f), res); 
    clockticks = clockticks + 2; 
    // End of function sub_8EBA
    PC = 0x8ECD; JUMP; // sstep
case 0x8ECD:
                                                     mon("         RTS                           ; 8ECD: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8ECE:
                                                     mon("L8ECE    DEC   $10,X                   ; 8ECE: 6A 88 10      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)0x10)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + (SINT8)0x10), res); 
    clockticks = clockticks + 2; 
    PC = 0x8ED1; JUMP; // sstep
case 0x8ED1:
                                                     mon("         LBMI  L8E32                   ; 8ED1: 10 2B FF 5D   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N <  0) {
    clockticks = clockticks + 1; 
    PC = 0x8e32; 
    JUMP;
    }
    // End of function sub_8ECE
    PC = 0x8ED5; JUMP; // sstep
case 0x8ED5:
                                                     mon("         RTS                           ; 8ED5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8ED6:
                                                     mon("L8ED6    JSR   LCCC0                   ; 8ED6: BD CC C0      \n"); // Initialise object?
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    PC = 0xccc0; 
    JUMP;
  case 0x8ED9:
                                                     mon("L8ED9    LDB   $4B14                   ; 8ED9: F6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8EDC; JUMP; // sstep
case 0x8EDC:
                                                     mon("         ASLB                          ; 8EDC: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8EDD; JUMP; // sstep
case 0x8EDD:
                                                     mon("         LDX   #off_9070               ; 8EDD: 8E 90 70      \n");
    clockticks = clockticks + 3; 
    X = 0x9070; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8EE0; JUMP; // sstep
case 0x8EE0:
                                                     mon("         ABX                           ; 8EE0: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0x8EE1; JUMP; // sstep
case 0x8EE1:
                                                     mon("         CMPX  #byte_907C              ; 8EE1: 8C 90 7C      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x907c; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8EE4; JUMP; // sstep
case 0x8EE4:
                                                     mon("         BCS   L8EF4                   ; 8EE4: 25 0E         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8ef4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8EE6; JUMP; // sstep
case 0x8EE6:
                                                     mon("         LDA   $4B14                   ; 8EE6: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x8EE9; JUMP; // sstep
case 0x8EE9:
                                                     mon("         LSRA                          ; 8EE9: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8EEA; JUMP; // sstep
case 0x8EEA:
                                                     mon("         BCS   L8EF1                   ; 8EEA: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8ef1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8EEC; JUMP; // sstep
case 0x8EEC:
                                                     mon("         LDX   #off_9078               ; 8EEC: 8E 90 78      \n");
    clockticks = clockticks + 3; 
    X = 0x9078; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x8EEF; JUMP; // sstep
case 0x8EEF:
                                                     mon("         BRA   L8EF4                   ; 8EEF: 20 03         \n");
    PC = 0x8ef4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8EF1:
                                                     mon("L8EF1    LDX   #off_907A               ; 8EF1: 8E 90 7A      \n");
    clockticks = clockticks + 3; 
    X = 0x907a; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8EF4; JUMP; // sstep
case 0x8EF4:
                                                     mon("L8EF4    LDX   ,X                      ; 8EF4: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8EF6; JUMP; // sstep
case 0x8EF6:
                                                     mon("         LDB   <$DD                    ; 8EF6: D6 DD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xdd); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8EF8; JUMP; // sstep
case 0x8EF8:
                                                     mon("         CMPB  ,X+                     ; 8EF8: E1 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)B; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    X = X + 1; 
    PC = 0x8EFA; JUMP; // sstep
case 0x8EFA:
                                                     mon("         BLS   L8EFE                   ; 8EFA: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x8efe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8EFC; JUMP; // sstep
case 0x8EFC:
                                                     mon("         LDB   -1,X                    ; 8EFC: E6 1F         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0xffff)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8EFE; JUMP; // sstep
case 0x8EFE:
                                                     mon("L8EFE    ASLB                          ; 8EFE: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8EFF; JUMP; // sstep
case 0x8EFF:
                                                     mon("         LDD   B,X                     ; 8EFF: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F01; JUMP; // sstep
case 0x8F01:
                                                     mon("         STD   <$E4                    ; 8F01: DD E4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xe4; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F03; JUMP; // sstep
case 0x8F03:
                                                     mon("         CLR   <$E6                    ; 8F03: 0F E6         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xe6, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8F05; JUMP; // sstep
case 0x8F05:
                                                     mon("         LDX   #$4900                  ; 8F05: 8E 49 00      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 3; 
    X = 0x4900; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8F08; JUMP; // sstep
case 0x8F08:
                                                     mon("L8F08    STX   <$5A                    ; 8F08: 9F 5A         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x5a; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8F0A; JUMP; // sstep
case 0x8F0A:
                                                     mon("         CLR   $03,X                   ; 8F0A: 6F 03         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0003), 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8F0C; JUMP; // sstep
case 0x8F0C:
                                                     mon("         LDU   <$E4                    ; 8F0C: DE E4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe4)<<8; 
    ea = ea | rd_mem(DP|0xe5); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8F0E; JUMP; // sstep
case 0x8F0E:
                                                     mon("         BEQ   L8F29                   ; 8F0E: 27 19         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8f29; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8F10; JUMP; // sstep
case 0x8F10:
                                                     mon("         LDA   ,U                      ; 8F10: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8F12; JUMP; // sstep
case 0x8F12:
                                                     mon("         BEQ   L8F29                   ; 8F12: 27 15         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8f29; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8F14; JUMP; // sstep
case 0x8F14:
                                                     mon("         INC   <$E6                    ; 8F14: 0C E6         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xe6); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0xe6, res); 
    clockticks = clockticks + 2; 
    PC = 0x8F16; JUMP; // sstep
case 0x8F16:
                                                     mon("         LDD   ,U                      ; 8F16: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F18; JUMP; // sstep
case 0x8F18:
                                                     mon("         STD   <$E0                    ; 8F18: DD E0         \n"); // Pointer to 3D object index
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xe0; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F1A; JUMP; // sstep
case 0x8F1A:
                                                     mon("         LDD   $02,U                   ; 8F1A: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F1C; JUMP; // sstep
case 0x8F1C:
                                                     mon("         STD   <$DE                    ; 8F1C: DD DE         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xde; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F1E; JUMP; // sstep
case 0x8F1E:
                                                     mon("         LDD   $04,U                   ; 8F1E: EC 44         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F20; JUMP; // sstep
case 0x8F20:
                                                     mon("         STD   <$E2                    ; 8F20: DD E2         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xe2; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F22; JUMP; // sstep
case 0x8F22:
                                                     mon("         LEAU  $06,U                   ; 8F22: 33 46         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0006); 
    PC = 0x8F24; JUMP; // sstep
case 0x8F24:
                                                     mon("         STU   <$E4                    ; 8F24: DF E4         \n");
    clockticks = clockticks + 4; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = DP|0xe4; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8F26; JUMP; // sstep
case 0x8F26:
                                                     mon("         JSR   L8F34                   ; 8F26: BD 8F 34      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    PC = 0x8f34; 
    JUMP;
  case 0x8F29:
                                                     mon("L8F29    LDX   <$5A                    ; 8F29: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8F2B; JUMP; // sstep
case 0x8F2B:
                                                     mon("         LEAX  $19,X                   ; 8F2B: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x8F2E; JUMP; // sstep
case 0x8F2E:
                                                     mon("         CMPX  #$494B                  ; 8F2E: 8C 49 4B      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x494b; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8F31; JUMP; // sstep
case 0x8F31:
                                                     mon("         BCS   L8F08                   ; 8F31: 25 D5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8f08; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_8ED6
    PC = 0x8F33; JUMP; // sstep
case 0x8F33:
                                                     mon("         RTS                           ; 8F33: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8F34:
                                                     mon("L8F34    LDA   #$01                    ; 8F34: 86 01         \n"); // Called 3 times at start of attract screen 1 and 2
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8F36; JUMP; // sstep
case 0x8F36:
                                                     mon("         STA   $03,X                   ; 8F36: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0x8F38; JUMP; // sstep
case 0x8F38:
                                                     mon("         LDU   ,X                      ; 8F38: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8F3A; JUMP; // sstep
case 0x8F3A:
                                                     mon("         JSR   LCDC3                   ; 8F3A: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x8F3D:
                                                     mon("L8F3D    LDU   ,X                      ; 8F3D: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8F3F; JUMP; // sstep
case 0x8F3F:
                                                     mon("         LDA   #$C0                    ; 8F3F: 86 C0         \n"); // Matrix -1.000 constant
    clockticks = clockticks + 2; 
    val = (UINT8)0xc0; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8F41; JUMP; // sstep
case 0x8F41:
                                                     mon("         STA   -16,U                   ; 8F41: A7 50         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff0); 
    wr_mem(ea, val); 
    PC = 0x8F43; JUMP; // sstep
case 0x8F43:
                                                     mon("         STA   -6,U                    ; 8F43: A7 5A         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffa); 
    wr_mem(ea, val); 
    PC = 0x8F45; JUMP; // sstep
case 0x8F45:
                                                     mon("         CLRA                          ; 8F45: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8F46; JUMP; // sstep
case 0x8F46:
                                                     mon("         STA   $09,X                   ; 8F46: A7 09         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0009); 
    wr_mem(ea, val); 
    PC = 0x8F48; JUMP; // sstep
case 0x8F48:
                                                     mon("         STA   $08,X                   ; 8F48: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    PC = 0x8F4A; JUMP; // sstep
case 0x8F4A:
                                                     mon("         STA   $06,X                   ; 8F4A: A7 06         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, val); 
    PC = 0x8F4C; JUMP; // sstep
case 0x8F4C:
                                                     mon("         STA   $05,X                   ; 8F4C: A7 05         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0x8F4E; JUMP; // sstep
case 0x8F4E:
                                                     mon("         STA   $0B,X                   ; 8F4E: A7 0B         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000b); 
    wr_mem(ea, val); 
    PC = 0x8F50; JUMP; // sstep
case 0x8F50:
                                                     mon("         LDU   <$E0                    ; 8F50: DE E0         \n"); // Pointer to 3D object index
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe0)<<8; 
    ea = ea | rd_mem(DP|0xe1); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8F52; JUMP; // sstep
case 0x8F52:
                                                     mon("         LDA   $01,U                   ; 8F52: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8F54; JUMP; // sstep
case 0x8F54:
                                                     mon("         STA   $07,X                   ; 8F54: A7 07         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0007); 
    wr_mem(ea, val); 
    PC = 0x8F56; JUMP; // sstep
case 0x8F56:
                                                     mon("         LDU   ,X                      ; 8F56: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8F58; JUMP; // sstep
case 0x8F58:
                                                     mon("         LDX   <$E2                    ; 8F58: 9E E2         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe2)<<8; 
    ea = ea | rd_mem(DP|0xe3); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8F5A; JUMP; // sstep
case 0x8F5A:
                                                     mon("         LDD   ,X                      ; 8F5A: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F5C; JUMP; // sstep
case 0x8F5C:
                                                     mon("         STD   $08,U                   ; 8F5C: ED 48         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F5E; JUMP; // sstep
case 0x8F5E:
                                                     mon("         LDD   $02,X                   ; 8F5E: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F60; JUMP; // sstep
case 0x8F60:
                                                     mon("         STD   $0A,U                   ; 8F60: ED 4A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F62; JUMP; // sstep
case 0x8F62:
                                                     mon("         LDD   $04,X                   ; 8F62: EC 04         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F64; JUMP; // sstep
case 0x8F64:
                                                     mon("         STD   $0C,U                   ; 8F64: ED 4C         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F66; JUMP; // sstep
case 0x8F66:
                                                     mon("         LDX   <$5A                    ; 8F66: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8F68; JUMP; // sstep
case 0x8F68:
                                                     mon("         LDD   <$DE                    ; 8F68: DC DE         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xde); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xdf); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8F6A; JUMP; // sstep
case 0x8F6A:
                                                     mon("         STD   $0D,X                   ; 8F6A: ED 0D         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8F6C; JUMP; // sstep
case 0x8F6C:
                                                     mon("         JSR   L8E23                   ; 8F6C: BD 8E 23      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    PC = 0x8e23; 
    JUMP;
  case 0x8F6F:
                                                     mon("L8F6F    LDX   <$5A                    ; 8F6F: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8F71; JUMP; // sstep
case 0x8F71:
                                                     mon("         LDB   [$48E0]                 ; 8F71: E6 9F 48 E0   \n"); // Pointer to 3D object index
    clockticks = clockticks + 6; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x48e0)<<8; 
    ea = ea | rd_mem(0x48e1); 
    val = (UINT8)rd_mem(ea); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8F75; JUMP; // sstep
case 0x8F75:
                                                     mon("         STB   $04,X                   ; 8F75: E7 04         \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0x8F77; JUMP; // sstep
case 0x8F77:
                                                     mon("         JSR   LCCCC                   ; 8F77: BD CC CC      \n"); // Copy XYZ data to math RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    PC = 0xcccc; 
    JUMP;
    // End of function sub_8F34
  case 0x8F7A:
                                                     mon("L8F7A    RTS                           ; 8F7A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8F7B:
                                                     mon("L8F7B    LDU   <$E4                    ; 8F7B: DE E4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe4)<<8; 
    ea = ea | rd_mem(DP|0xe5); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8F7D; JUMP; // sstep
case 0x8F7D:
                                                     mon("         BEQ   L8F83                   ; 8F7D: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8f83; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8F7F; JUMP; // sstep
case 0x8F7F:
                                                     mon("         LDA   ,U                      ; 8F7F: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8F81; JUMP; // sstep
case 0x8F81:
                                                     mon("         BNE   L8FB1                   ; 8F81: 26 2E         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8fb1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8F83; JUMP; // sstep
case 0x8F83:
                                                     mon("L8F83    INC   <$DD                    ; 8F83: 0C DD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xdd); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0xdd, res); 
    clockticks = clockticks + 2; 
    PC = 0x8F85; JUMP; // sstep
case 0x8F85:
                                                     mon("         LDB   $4B14                   ; 8F85: F6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8F88; JUMP; // sstep
case 0x8F88:
                                                     mon("         ASLB                          ; 8F88: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8F89; JUMP; // sstep
case 0x8F89:
                                                     mon("         LDX   #off_9070               ; 8F89: 8E 90 70      \n");
    clockticks = clockticks + 3; 
    X = 0x9070; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8F8C; JUMP; // sstep
case 0x8F8C:
                                                     mon("         ABX                           ; 8F8C: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0x8F8D; JUMP; // sstep
case 0x8F8D:
                                                     mon("         CMPX  #byte_907C              ; 8F8D: 8C 90 7C      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x907c; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8F90; JUMP; // sstep
case 0x8F90:
                                                     mon("         BCS   L8FA0                   ; 8F90: 25 0E         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8fa0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8F92; JUMP; // sstep
case 0x8F92:
                                                     mon("         LDA   $4B14                   ; 8F92: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x8F95; JUMP; // sstep
case 0x8F95:
                                                     mon("         LSRA                          ; 8F95: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8F96; JUMP; // sstep
case 0x8F96:
                                                     mon("         BCS   L8F9D                   ; 8F96: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8f9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8F98; JUMP; // sstep
case 0x8F98:
                                                     mon("         LDX   #off_9078               ; 8F98: 8E 90 78      \n");
    clockticks = clockticks + 3; 
    X = 0x9078; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x8F9B; JUMP; // sstep
case 0x8F9B:
                                                     mon("         BRA   L8FA0                   ; 8F9B: 20 03         \n");
    PC = 0x8fa0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8F9D:
                                                     mon("L8F9D    LDX   #off_907A               ; 8F9D: 8E 90 7A      \n");
    clockticks = clockticks + 3; 
    X = 0x907a; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8FA0; JUMP; // sstep
case 0x8FA0:
                                                     mon("L8FA0    LDX   ,X                      ; 8FA0: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8FA2; JUMP; // sstep
case 0x8FA2:
                                                     mon("         LDB   <$DD                    ; 8FA2: D6 DD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xdd); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8FA4; JUMP; // sstep
case 0x8FA4:
                                                     mon("         CMPB  ,X+                     ; 8FA4: E1 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)B; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    X = X + 1; 
    PC = 0x8FA6; JUMP; // sstep
case 0x8FA6:
                                                     mon("         BLS   L8FAA                   ; 8FA6: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x8faa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8FA8; JUMP; // sstep
case 0x8FA8:
                                                     mon("         LDB   -1,X                    ; 8FA8: E6 1F         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0xffff)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8FAA; JUMP; // sstep
case 0x8FAA:
                                                     mon("L8FAA    STB   <$DD                    ; 8FAA: D7 DD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdd; 
    wr_mem(ea, val); 
    PC = 0x8FAC; JUMP; // sstep
case 0x8FAC:
                                                     mon("         ASLB                          ; 8FAC: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8FAD; JUMP; // sstep
case 0x8FAD:
                                                     mon("         LDD   B,X                     ; 8FAD: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8FAF; JUMP; // sstep
case 0x8FAF:
                                                     mon("         STD   <$E4                    ; 8FAF: DD E4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xe4; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8FB1; JUMP; // sstep
case 0x8FB1:
                                                     mon("L8FB1    LDX   #$4900                  ; 8FB1: 8E 49 00      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 3; 
    X = 0x4900; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8FB4; JUMP; // sstep
case 0x8FB4:
                                                     mon("L8FB4    STX   <$5A                    ; 8FB4: 9F 5A         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x5a; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8FB6; JUMP; // sstep
case 0x8FB6:
                                                     mon("         LDA   $03,X                   ; 8FB6: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8FB8; JUMP; // sstep
case 0x8FB8:
                                                     mon("         BEQ   L8FC6                   ; 8FB8: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x8fc6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8FBA; JUMP; // sstep
case 0x8FBA:
                                                     mon("         LDX   <$5A                    ; 8FBA: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8FBC; JUMP; // sstep
case 0x8FBC:
                                                     mon("         LEAX  $19,X                   ; 8FBC: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x8FBF; JUMP; // sstep
case 0x8FBF:
                                                     mon("         CMPX  #$494B                  ; 8FBF: 8C 49 4B      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x494b; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8FC2; JUMP; // sstep
case 0x8FC2:
                                                     mon("         BCS   L8FB4                   ; 8FC2: 25 F0         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8fb4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8FC4; JUMP; // sstep
case 0x8FC4:
                                                     mon("         BRA   locret_9023             ; 8FC4: 20 5D         \n");
    PC = 0x9023; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8FC6:
                                                     mon("L8FC6    LDU   <$E4                    ; 8FC6: DE E4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe4)<<8; 
    ea = ea | rd_mem(DP|0xe5); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8FC8; JUMP; // sstep
case 0x8FC8:
                                                     mon("         BEQ   locret_9023             ; 8FC8: 27 59         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x9023; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8FCA; JUMP; // sstep
case 0x8FCA:
                                                     mon("         LDA   ,U                      ; 8FCA: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8FCC; JUMP; // sstep
case 0x8FCC:
                                                     mon("         BEQ   locret_9023             ; 8FCC: 27 55         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x9023; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8FCE; JUMP; // sstep
case 0x8FCE:
                                                     mon("         INC   <$E6                    ; 8FCE: 0C E6         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xe6); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0xe6, res); 
    clockticks = clockticks + 2; 
    PC = 0x8FD0; JUMP; // sstep
case 0x8FD0:
                                                     mon("         LDD   ,U                      ; 8FD0: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8FD2; JUMP; // sstep
case 0x8FD2:
                                                     mon("         STD   <$E0                    ; 8FD2: DD E0         \n"); // Pointer to 3D object index
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xe0; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8FD4; JUMP; // sstep
case 0x8FD4:
                                                     mon("         LDD   $02,U                   ; 8FD4: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8FD6; JUMP; // sstep
case 0x8FD6:
                                                     mon("         STD   <$DE                    ; 8FD6: DD DE         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xde; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8FD8; JUMP; // sstep
case 0x8FD8:
                                                     mon("         LDD   $04,U                   ; 8FD8: EC 44         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8FDA; JUMP; // sstep
case 0x8FDA:
                                                     mon("         STD   <$E2                    ; 8FDA: DD E2         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xe2; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8FDC; JUMP; // sstep
case 0x8FDC:
                                                     mon("         LEAU  $06,U                   ; 8FDC: 33 46         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0006); 
    PC = 0x8FDE; JUMP; // sstep
case 0x8FDE:
                                                     mon("         STU   <$E4                    ; 8FDE: DF E4         \n");
    clockticks = clockticks + 4; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xe4; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x8FE0; JUMP; // sstep
case 0x8FE0:
                                                     mon("         LDA   #$01                    ; 8FE0: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8FE2; JUMP; // sstep
case 0x8FE2:
                                                     mon("         STA   $03,X                   ; 8FE2: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0x8FE4; JUMP; // sstep
case 0x8FE4:
                                                     mon("         LDU   ,X                      ; 8FE4: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8FE6; JUMP; // sstep
case 0x8FE6:
                                                     mon("         JSR   LCDC3                   ; 8FE6: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x8FE9:
                                                     mon("L8FE9    LDU   ,X                      ; 8FE9: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8FEB; JUMP; // sstep
case 0x8FEB:
                                                     mon("         LDA   #$C0                    ; 8FEB: 86 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xc0; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8FED; JUMP; // sstep
case 0x8FED:
                                                     mon("         STA   -16,U                   ; 8FED: A7 50         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff0); 
    wr_mem(ea, val); 
    PC = 0x8FEF; JUMP; // sstep
case 0x8FEF:
                                                     mon("         STA   -6,U                    ; 8FEF: A7 5A         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffa); 
    wr_mem(ea, val); 
    PC = 0x8FF1; JUMP; // sstep
case 0x8FF1:
                                                     mon("         CLRA                          ; 8FF1: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x8FF2; JUMP; // sstep
case 0x8FF2:
                                                     mon("         STA   $09,X                   ; 8FF2: A7 09         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0009); 
    wr_mem(ea, val); 
    PC = 0x8FF4; JUMP; // sstep
case 0x8FF4:
                                                     mon("         STA   $08,X                   ; 8FF4: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    PC = 0x8FF6; JUMP; // sstep
case 0x8FF6:
                                                     mon("         STA   $06,X                   ; 8FF6: A7 06         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, val); 
    PC = 0x8FF8; JUMP; // sstep
case 0x8FF8:
                                                     mon("         STA   $05,X                   ; 8FF8: A7 05         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0x8FFA; JUMP; // sstep
case 0x8FFA:
                                                     mon("         STA   $0B,X                   ; 8FFA: A7 0B         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000b); 
    wr_mem(ea, val); 
    PC = 0x8FFC; JUMP; // sstep
case 0x8FFC:
                                                     mon("         LDU   <$E0                    ; 8FFC: DE E0         \n"); // Pointer to 3D object index
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe0)<<8; 
    ea = ea | rd_mem(DP|0xe1); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8FFE; JUMP; // sstep
case 0x8FFE:
                                                     mon("         LDA   $01,U                   ; 8FFE: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9000; JUMP; // sstep
case 0x9000:
                                                     mon("         STA   $07,X                   ; 9000: A7 07         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0007); 
    wr_mem(ea, val); 
    PC = 0x9002; JUMP; // sstep
case 0x9002:
                                                     mon("         LDU   ,X                      ; 9002: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x9004; JUMP; // sstep
case 0x9004:
                                                     mon("         LDX   <$E2                    ; 9004: 9E E2         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xe2)<<8; 
    ea = ea | rd_mem(DP|0xe3); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x9006; JUMP; // sstep
case 0x9006:
                                                     mon("         LDD   ,X                      ; 9006: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x9008; JUMP; // sstep
case 0x9008:
                                                     mon("         STD   $08,U                   ; 9008: ED 48         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x900A; JUMP; // sstep
case 0x900A:
                                                     mon("         LDD   $02,X                   ; 900A: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x900C; JUMP; // sstep
case 0x900C:
                                                     mon("         STD   $0A,U                   ; 900C: ED 4A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x900E; JUMP; // sstep
case 0x900E:
                                                     mon("         LDD   $04,X                   ; 900E: EC 04         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x9010; JUMP; // sstep
case 0x9010:
                                                     mon("         STD   $0C,U                   ; 9010: ED 4C         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x9012; JUMP; // sstep
case 0x9012:
                                                     mon("         LDX   <$5A                    ; 9012: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x9014; JUMP; // sstep
case 0x9014:
                                                     mon("         LDD   <$DE                    ; 9014: DC DE         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xde); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xdf); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x9016; JUMP; // sstep
case 0x9016:
                                                     mon("         STD   $0D,X                   ; 9016: ED 0D         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x9018; JUMP; // sstep
case 0x9018:
                                                     mon("         JSR   L8E23                   ; 9018: BD 8E 23      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x90); 
    clockticks = clockticks + 1; 
    PC = 0x8e23; 
    JUMP;
  case 0x901B:
                                                     mon("L901B    LDX   <$5A                    ; 901B: 9E 5A         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x5a)<<8; 
    ea = ea | rd_mem(DP|0x5b); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x901D; JUMP; // sstep
case 0x901D:
                                                     mon("         LDB   [$48E0]                 ; 901D: E6 9F 48 E0   \n"); // Pointer to 3D object index
    clockticks = clockticks + 6; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x48e0)<<8; 
    ea = ea | rd_mem(0x48e1); 
    val = (UINT8)rd_mem(ea); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9021; JUMP; // sstep
case 0x9021:
                                                     mon("         STB   $04,X                   ; 9021: E7 04         \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    // End of function sub_8F7B
    // ---------------------------------------------------------------------------
    PC = 0x9023; JUMP; // sstep
case 0x9023:
                                                     mon("locret_9023 RTS                           ; 9023: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x953B:
                                                     mon("L953B    LDA   $4592                   ; 953B: B6 45 92      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4592); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x953E; JUMP; // sstep
case 0x953E:
                                                     mon("         ANDA  #$03                    ; 953E: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x9540; JUMP; // sstep
case 0x9540:
                                                     mon("         BEQ   locret_9557             ; 9540: 27 15         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x9557; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9542; JUMP; // sstep
case 0x9542:
                                                     mon("         ADDA  <$60                    ; 9542: 9B 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x60); 
    res = val + (UINT8)arg; 
/**/C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x9544; JUMP; // sstep
case 0x9544:
                                                     mon("         STA   <$60                    ; 9544: 97 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x60; 
    wr_mem(ea, val); 
    PC = 0x9546; JUMP; // sstep
case 0x9546:
                                                     mon("         LDA   $4593                   ; 9546: B6 45 93      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4593); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9549; JUMP; // sstep
case 0x9549:
                                                     mon("         ANDA  #$03                    ; 9549: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x954B; JUMP; // sstep
case 0x954B:
                                                     mon("         ADDA  #$06                    ; 954B: 8B 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x06; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x954D; JUMP; // sstep
case 0x954D:
                                                     mon("         CMPA  <$60                    ; 954D: 91 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x60); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x954F; JUMP; // sstep
case 0x954F:
                                                     mon("         BCC   L9553                   ; 954F: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x9553; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9551; JUMP; // sstep
case 0x9551:
                                                     mon("         STA   <$60                    ; 9551: 97 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x60; 
    wr_mem(ea, val); 
    PC = 0x9553; JUMP; // sstep
case 0x9553:
                                                     mon("L9553    LDA   #$14                    ; 9553: 86 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x14; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9555; JUMP; // sstep
case 0x9555:
                                                     mon("         STA   <$61                    ; 9555: 97 61         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x61; 
    wr_mem(ea, val); 
    // End of function sub_953B
    PC = 0x9557; JUMP; // sstep
case 0x9557:
                                                     mon("locret_9557 RTS                           ; 9557: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Process shields
  case 0x9558:
                                                     mon("L9558    LDA   <$8B                    ; 9558: 96 8B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8b); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x955A; JUMP; // sstep
case 0x955A:
                                                     mon("         BLE   L95A0                   ; 955A: 2F 44         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x95a0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x955C; JUMP; // sstep
case 0x955C:
                                                     mon("         LDA   <$8C                    ; 955C: 96 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8c); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x955E; JUMP; // sstep
case 0x955E:
                                                     mon("         BGT   L95A0                   ; 955E: 2E 40         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x95a0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9560; JUMP; // sstep
case 0x9560:
                                                     mon("         LDA   #$01                    ; 9560: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9562; JUMP; // sstep
case 0x9562:
                                                     mon("         STA   <$8C                    ; 9562: 97 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8c; 
    wr_mem(ea, val); 
    PC = 0x9564; JUMP; // sstep
case 0x9564:
                                                     mon("         LDA   <$60                    ; 9564: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9566; JUMP; // sstep
case 0x9566:
                                                     mon("         STA   <$8E                    ; 9566: 97 8E         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8e; 
    wr_mem(ea, val); 
    PC = 0x9568; JUMP; // sstep
case 0x9568:
                                                     mon("         LDA   #$F6                    ; 9568: 86 F6         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xf6; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x956A; JUMP; // sstep
case 0x956A:
                                                     mon("         ADDA  <$60                    ; 956A: 9B 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x60); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x956C; JUMP; // sstep
case 0x956C:
                                                     mon("         STA   <$8D                    ; 956C: 97 8D         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8d; 
    wr_mem(ea, val); 
    PC = 0x956E; JUMP; // sstep
case 0x956E:
                                                     mon("L956E    DEC   <$60                    ; 956E: 0A 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x60, res); 
    clockticks = clockticks + 2; 
    PC = 0x9570; JUMP; // sstep
case 0x9570:
                                                     mon("         BGE   L9578                   ; 9570: 2C 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x9578; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9572; JUMP; // sstep
case 0x9572:
                                                     mon("         LDA   #$FF                    ; 9572: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9574; JUMP; // sstep
case 0x9574:
                                                     mon("         STA   <$60                    ; 9574: 97 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x60; 
    wr_mem(ea, val); 
    PC = 0x9576; JUMP; // sstep
case 0x9576:
                                                     mon("         CLR   <$8C                    ; 9576: 0F 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    wr_mem(DP|0x8c, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9578; JUMP; // sstep
case 0x9578:
                                                     mon("L9578    LDA   <$60                    ; 9578: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x957A; JUMP; // sstep
case 0x957A:
                                                     mon("         CMPA  #$00                    ; 957A: 81 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x00; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x957C; JUMP; // sstep
case 0x957C:
                                                     mon("         BNE   L9586                   ; 957C: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9586; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x957E; JUMP; // sstep
case 0x957E:
                                                     mon("         JSR   Sound_D                 ; 957E: BD BD 35      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x81); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0xbd35; 
    JUMP;
  case 0x9581:
                                                     mon("L9581    JSR   Sound_28                ; 9581: BD BD BC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0xbdbc; 
    JUMP;
  case 0x9584:
                                                     mon("L9584    BRA   L9599                   ; 9584: 20 13         \n");
    PC = 0x9599; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x9586:
                                                     mon("L9586    CMPA  #$01                    ; 9586: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x9588; JUMP; // sstep
case 0x9588:
                                                     mon("         BNE   L958F                   ; 9588: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x958f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x958A; JUMP; // sstep
case 0x958A:
                                                     mon("         JSR   Sound_2F                ; 958A: BD BD DF      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0xbddf; 
    JUMP;
  case 0x958D:
                                                     mon("L958D    BRA   L9599                   ; 958D: 20 0A         \n");
    PC = 0x9599; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x958F:
                                                     mon("L958F    CMPA  #$02                    ; 958F: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x9591; JUMP; // sstep
case 0x9591:
                                                     mon("         BNE   L9599                   ; 9591: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9599; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9593; JUMP; // sstep
case 0x9593:
                                                     mon("         JSR   Sound_F                 ; 9593: BD BD 3F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0xbd3f; 
    JUMP;
  case 0x9596:
                                                     mon("L9596    JSR   Sound_30                ; 9596: BD BD E4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x99); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0xbde4; 
    JUMP;
  case 0x9599:
                                                     mon("L9599    CLRB                          ; 9599: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x959A; JUMP; // sstep
case 0x959A:
                                                     mon("         STB   <$91                    ; 959A: D7 91         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x91; 
    wr_mem(ea, val); 
    PC = 0x959C; JUMP; // sstep
case 0x959C:
                                                     mon("         STB   <$90                    ; 959C: D7 90         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x90; 
    wr_mem(ea, val); 
    PC = 0x959E; JUMP; // sstep
case 0x959E:
                                                     mon("         STB   <$8F                    ; 959E: D7 8F         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8f; 
    wr_mem(ea, val); 
    PC = 0x95A0; JUMP; // sstep
case 0x95A0:
                                                     mon("L95A0    LDA   <$61                    ; 95A0: 96 61         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x61); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x95A2; JUMP; // sstep
case 0x95A2:
                                                     mon("         BEQ   locret_95A6             ; 95A2: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x95a6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x95A4; JUMP; // sstep
case 0x95A4:
                                                     mon("         DEC   <$61                    ; 95A4: 0A 61         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x61); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x61, res); 
    clockticks = clockticks + 2; 
    // End of function sub_9558
    PC = 0x95A6; JUMP; // sstep
case 0x95A6:
                                                     mon("locret_95A6 RTS                           ; 95A6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert vector instructions for shields
  case 0x95A7:
                                                     mon("L95A7    LDA   <$8C                    ; 95A7: 96 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8c); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x95A9; JUMP; // sstep
case 0x95A9:
                                                     mon("         BNE   L95B2                   ; 95A9: 26 07         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x95b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x95AB; JUMP; // sstep
case 0x95AB:
                                                     mon("         LDA   <$60                    ; 95AB: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x95AD; JUMP; // sstep
case 0x95AD:
                                                     mon("         BGT   L95B2                   ; 95AD: 2E 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x95b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x95AF; JUMP; // sstep
case 0x95AF:
                                                     mon("         JMP   L9604                   ; 95AF: 7E 96 04      \n");
    clockticks = clockticks + 4; 
    PC = 0x9604; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x95B2:
                                                     mon("L95B2    LDB   <$60                    ; 95B2: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x95B4; JUMP; // sstep
case 0x95B4:
                                                     mon("         ASLB                          ; 95B4: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x95B5; JUMP; // sstep
case 0x95B5:
                                                     mon("         LDX   #word_96B6              ; 95B5: 8E 96 B6      \n"); // Shield colour table
    clockticks = clockticks + 3; 
    X = 0x96b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x95B8; JUMP; // sstep
case 0x95B8:
                                                     mon("         LDU   B,X                     ; 95B8: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x95BA; JUMP; // sstep
case 0x95BA:
                                                     mon("         STU   ,Y++                    ; 95BA: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x95BC; JUMP; // sstep
case 0x95BC:
                                                     mon("         LDD   #$BA03                  ; 95BC: CC BA 03      \n");
    clockticks = clockticks + 3; 
    A = 0xba; 
    B = 0x03; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x95BF; JUMP; // sstep
case 0x95BF:
                                                     mon("         STD   ,Y++                    ; 95BF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x95C1; JUMP; // sstep
case 0x95C1:
                                                     mon("         LDD   #$0228                  ; 95C1: CC 02 28      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x28; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x95C4; JUMP; // sstep
case 0x95C4:
                                                     mon("         STD   ,Y++                    ; 95C4: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x95C6; JUMP; // sstep
case 0x95C6:
                                                     mon("         LDD   #$00                    ; 95C6: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x95C9; JUMP; // sstep
case 0x95C9:
                                                     mon("         STD   ,Y++                    ; 95C9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x95CB; JUMP; // sstep
case 0x95CB:
                                                     mon("         LDA   <$8C                    ; 95CB: 96 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8c); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x95CD; JUMP; // sstep
case 0x95CD:
                                                     mon("         BEQ   L95D4                   ; 95CD: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x95d4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x95CF; JUMP; // sstep
case 0x95CF:
                                                     mon("         JSR   L962A                   ; 95CF: BD 96 2A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0x962a; 
    JUMP;
  case 0x95D2:
                                                     mon("L95D2    BRA   L95D7                   ; 95D2: 20 03         \n");
    PC = 0x95d7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x95D4:
                                                     mon("L95D4    JSR   L960F                   ; 95D4: BD 96 0F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0x960f; 
    JUMP;
  case 0x95D7:
                                                     mon("L95D7    LDD   #$1FD0                  ; 95D7: CC 1F D0      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0xd0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x95DA; JUMP; // sstep
case 0x95DA:
                                                     mon("         STD   ,Y++                    ; 95DA: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x95DC; JUMP; // sstep
case 0x95DC:
                                                     mon("         LDD   #$1FF4                  ; 95DC: CC 1F F4      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0xf4; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x95DF; JUMP; // sstep
case 0x95DF:
                                                     mon("         STD   ,Y++                    ; 95DF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x95E1; JUMP; // sstep
case 0x95E1:
                                                     mon("         LDA   <$8C                    ; 95E1: 96 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8c); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x95E3; JUMP; // sstep
case 0x95E3:
                                                     mon("         BLE   L95EA                   ; 95E3: 2F 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x95ea; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x95E5; JUMP; // sstep
case 0x95E5:
                                                     mon("         LDU   #$A018                  ; 95E5: CE A0 18      \n");
    clockticks = clockticks + 3; 
    U = 0xa018; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x95E8; JUMP; // sstep
case 0x95E8:
                                                     mon("         BRA   L95F2                   ; 95E8: 20 08         \n");
    PC = 0x95f2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x95EA:
                                                     mon("L95EA    LDB   <$60                    ; 95EA: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x95EC; JUMP; // sstep
case 0x95EC:
                                                     mon("         ASLB                          ; 95EC: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x95ED; JUMP; // sstep
case 0x95ED:
                                                     mon("         LDX   #word_96B6              ; 95ED: 8E 96 B6      \n"); // Shield colour table
    clockticks = clockticks + 3; 
    X = 0x96b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x95F0; JUMP; // sstep
case 0x95F0:
                                                     mon("         LDU   B,X                     ; 95F0: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x95F2; JUMP; // sstep
case 0x95F2:
                                                     mon("L95F2    STU   ,Y++                    ; 95F2: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x95F4; JUMP; // sstep
case 0x95F4:
                                                     mon("         CLR   <$AD                    ; 95F4: 0F AD         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xad, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x95F6; JUMP; // sstep
case 0x95F6:
                                                     mon("         LDA   <$60                    ; 95F6: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x95F8; JUMP; // sstep
case 0x95F8:
                                                     mon("         BGE   L95FB                   ; 95F8: 2C 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x95fb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x95FA; JUMP; // sstep
case 0x95FA:
                                                     mon("         CLRA                          ; 95FA: 4F            \n");
    A = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x95FB; JUMP; // sstep
case 0x95FB:
                                                     mon("L95FB    JSR   LE7AD                   ; 95FB: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0x95FE:
                                                     mon("L95FE    LDD   #$8040                  ; 95FE: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x9601; JUMP; // sstep
case 0x9601:
                                                     mon("         STD   ,Y++                    ; 9601: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x9603; JUMP; // sstep
case 0x9603:
                                                     mon("         RTS                           ; 9603: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x9604:
                                                     mon("L9604    LDD   #$7100                  ; 9604: CC 71 00      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x9607; JUMP; // sstep
case 0x9607:
                                                     mon("         STD   ,Y++                    ; 9607: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x9609; JUMP; // sstep
case 0x9609:
                                                     mon("         LDB   #$0E                    ; 9609: C6 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x960B; JUMP; // sstep
case 0x960B:
                                                     mon("         JSR   LE7C7                   ; 960B: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // End of function sub_95A7
  case 0x960E:
                                                     mon("L960E    RTS                           ; 960E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x960F:
                                                     mon("L960F    LDB   <$60                    ; 960F: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9611; JUMP; // sstep
case 0x9611:
                                                     mon("         ASLB                          ; 9611: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x9612; JUMP; // sstep
case 0x9612:
                                                     mon("         LDX   #word_96B6              ; 9612: 8E 96 B6      \n"); // Shield colour table
    clockticks = clockticks + 3; 
    X = 0x96b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x9615; JUMP; // sstep
case 0x9615:
                                                     mon("         LDD   B,X                     ; 9615: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x9617; JUMP; // sstep
case 0x9617:
                                                     mon("         TST   <$61                    ; 9617: 0D 61         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x61); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9619; JUMP; // sstep
case 0x9619:
                                                     mon("         BEQ   L961D                   ; 9619: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x961d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x961B; JUMP; // sstep
case 0x961B:
                                                     mon("         ORB   #$FF                    ; 961B: CA FF         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0xff; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x961D; JUMP; // sstep
case 0x961D:
                                                     mon("L961D    STD   ,Y++                    ; 961D: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x961F; JUMP; // sstep
case 0x961F:
                                                     mon("         LDB   <$60                    ; 961F: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9621; JUMP; // sstep
case 0x9621:
                                                     mon("         ASLB                          ; 9621: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x9622; JUMP; // sstep
case 0x9622:
                                                     mon("         LDX   #word_96CA              ; 9622: 8E 96 CA      \n"); // Shield vector table
    clockticks = clockticks + 3; 
    X = 0x96ca; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x9625; JUMP; // sstep
case 0x9625:
                                                     mon("         LDU   B,X                     ; 9625: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x9627; JUMP; // sstep
case 0x9627:
                                                     mon("         STU   ,Y++                    ; 9627: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    // End of function sub_960F
    PC = 0x9629; JUMP; // sstep
case 0x9629:
                                                     mon("         RTS                           ; 9629: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x962A:
                                                     mon("L962A    LDA   <$91                    ; 962A: 96 91         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x91); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x962C; JUMP; // sstep
case 0x962C:
                                                     mon("         BNE   L964B                   ; 962C: 26 1D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x964b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x962E; JUMP; // sstep
case 0x962E:
                                                     mon("         LDU   #$A018                  ; 962E: CE A0 18      \n");
    clockticks = clockticks + 3; 
    U = 0xa018; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x9631; JUMP; // sstep
case 0x9631:
                                                     mon("         STU   ,Y++                    ; 9631: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x9633; JUMP; // sstep
case 0x9633:
                                                     mon("         LDB   <$8E                    ; 9633: D6 8E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8e); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9635; JUMP; // sstep
case 0x9635:
                                                     mon("         ASLB                          ; 9635: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x9636; JUMP; // sstep
case 0x9636:
                                                     mon("         LDX   #word_96CA              ; 9636: 8E 96 CA      \n"); // Shield vector table
    clockticks = clockticks + 3; 
    X = 0x96ca; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x9639; JUMP; // sstep
case 0x9639:
                                                     mon("         LDU   B,X                     ; 9639: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x963B; JUMP; // sstep
case 0x963B:
                                                     mon("         STU   ,Y++                    ; 963B: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x963D; JUMP; // sstep
case 0x963D:
                                                     mon("         LDA   <$43                    ; 963D: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x963F; JUMP; // sstep
case 0x963F:
                                                     mon("         ANDA  #$00                    ; 963F: 84 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x00; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x9641; JUMP; // sstep
case 0x9641:
                                                     mon("         BNE   L9649                   ; 9641: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9649; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9643; JUMP; // sstep
case 0x9643:
                                                     mon("L9643    INC   <$8D                    ; 9643: 0C 8D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8d); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x8d, res); 
    clockticks = clockticks + 2; 
    PC = 0x9645; JUMP; // sstep
case 0x9645:
                                                     mon("         BLT   L9649                   ; 9645: 2D 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x9649; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9647; JUMP; // sstep
case 0x9647:
                                                     mon("         INC   <$91                    ; 9647: 0C 91         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x91); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x91, res); 
    clockticks = clockticks + 2; 
    PC = 0x9649; JUMP; // sstep
case 0x9649:
                                                     mon("L9649    BRA   locret_96A0             ; 9649: 20 55         \n");
    PC = 0x96a0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x964B:
                                                     mon("L964B    JSR   L96A1                   ; 964B: BD 96 A1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    PC = 0x96a1; 
    JUMP;
  case 0x964E:
                                                     mon("L964E    LDU   #$A018                  ; 964E: CE A0 18      \n");
    clockticks = clockticks + 3; 
    U = 0xa018; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x9651; JUMP; // sstep
case 0x9651:
                                                     mon("         STU   ,Y++                    ; 9651: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x9653; JUMP; // sstep
case 0x9653:
                                                     mon("         LDA   <$90                    ; 9653: 96 90         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x90); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9655; JUMP; // sstep
case 0x9655:
                                                     mon("         BNE   L9674                   ; 9655: 26 1D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9674; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9657; JUMP; // sstep
case 0x9657:
                                                     mon("         LDB   <$8E                    ; 9657: D6 8E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8e); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9659; JUMP; // sstep
case 0x9659:
                                                     mon("         ASLB                          ; 9659: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x965A; JUMP; // sstep
case 0x965A:
                                                     mon("         LDX   #word_96DE              ; 965A: 8E 96 DE      \n"); // Another copy of shield vector table??
    clockticks = clockticks + 3; 
    X = 0x96de; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x965D; JUMP; // sstep
case 0x965D:
                                                     mon("         LDU   B,X                     ; 965D: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x965F; JUMP; // sstep
case 0x965F:
                                                     mon("         STU   ,Y++                    ; 965F: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x9661; JUMP; // sstep
case 0x9661:
                                                     mon("         LDA   <$43                    ; 9661: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9663; JUMP; // sstep
case 0x9663:
                                                     mon("         ANDA  #$00                    ; 9663: 84 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x00; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x9665; JUMP; // sstep
case 0x9665:
                                                     mon("         BNE   L9672                   ; 9665: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9672; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9667; JUMP; // sstep
case 0x9667:
                                                     mon("         INC   <$90                    ; 9667: 0C 90         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x90); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x90, res); 
    clockticks = clockticks + 2; 
    PC = 0x9669; JUMP; // sstep
case 0x9669:
                                                     mon("         LDB   <$60                    ; 9669: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x966B; JUMP; // sstep
case 0x966B:
                                                     mon("         LDX   #byte_9718              ; 966B: 8E 97 18      \n");
    clockticks = clockticks + 3; 
    X = 0x9718; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x966E; JUMP; // sstep
case 0x966E:
                                                     mon("         LDA   B,X                     ; 966E: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9670; JUMP; // sstep
case 0x9670:
                                                     mon("         STA   <$8D                    ; 9670: 97 8D         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x8d; 
    wr_mem(ea, val); 
    PC = 0x9672; JUMP; // sstep
case 0x9672:
                                                     mon("L9672    BRA   locret_96A0             ; 9672: 20 2C         \n");
    PC = 0x96a0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x9674:
                                                     mon("L9674    LDA   <$8F                    ; 9674: 96 8F         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8f); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9676; JUMP; // sstep
case 0x9676:
                                                     mon("         BNE   L9690                   ; 9676: 26 18         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9690; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9678; JUMP; // sstep
case 0x9678:
                                                     mon("         LDB   <$8D                    ; 9678: D6 8D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8d); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x967A; JUMP; // sstep
case 0x967A:
                                                     mon("         ASLB                          ; 967A: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x967B; JUMP; // sstep
case 0x967B:
                                                     mon("         LDX   #word_96F2              ; 967B: 8E 96 F2      \n");
    clockticks = clockticks + 3; 
    X = 0x96f2; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x967E; JUMP; // sstep
case 0x967E:
                                                     mon("         LDU   B,X                     ; 967E: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x9680; JUMP; // sstep
case 0x9680:
                                                     mon("         STU   ,Y++                    ; 9680: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0x9682; JUMP; // sstep
case 0x9682:
                                                     mon("         LDA   <$43                    ; 9682: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9684; JUMP; // sstep
case 0x9684:
                                                     mon("         ANDA  #$00                    ; 9684: 84 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x00; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x9686; JUMP; // sstep
case 0x9686:
                                                     mon("         BNE   L968E                   ; 9686: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x968e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9688; JUMP; // sstep
case 0x9688:
                                                     mon("         DEC   <$8D                    ; 9688: 0A 8D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8d); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x8d, res); 
    clockticks = clockticks + 2; 
    PC = 0x968A; JUMP; // sstep
case 0x968A:
                                                     mon("         BGT   L968E                   ; 968A: 2E 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x968e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x968C; JUMP; // sstep
case 0x968C:
                                                     mon("         INC   <$8F                    ; 968C: 0C 8F         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8f); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x8f, res); 
    clockticks = clockticks + 2; 
    PC = 0x968E; JUMP; // sstep
case 0x968E:
                                                     mon("L968E    BRA   locret_96A0             ; 968E: 20 10         \n");
    PC = 0x96a0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x9690:
                                                     mon("L9690    LDA   <$43                    ; 9690: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9692; JUMP; // sstep
case 0x9692:
                                                     mon("         ANDA  #$00                    ; 9692: 84 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x00; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x9694; JUMP; // sstep
case 0x9694:
                                                     mon("         BNE   locret_96A0             ; 9694: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x96a0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9696; JUMP; // sstep
case 0x9696:
                                                     mon("         LDA   #$00                    ; 9696: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9698; JUMP; // sstep
case 0x9698:
                                                     mon("         STA   <$8C                    ; 9698: 97 8C         \n"); // Sheild being depleted
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8c; 
    wr_mem(ea, val); 
    PC = 0x969A; JUMP; // sstep
case 0x969A:
                                                     mon("         STA   <$8B                    ; 969A: 97 8B         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8b; 
    wr_mem(ea, val); 
    PC = 0x969C; JUMP; // sstep
case 0x969C:
                                                     mon("         LDA   <$60                    ; 969C: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x969E; JUMP; // sstep
case 0x969E:
                                                     mon("         STA   <$8E                    ; 969E: 97 8E         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x8e; 
    wr_mem(ea, val); 
    // End of function sub_962A
    PC = 0x96A0; JUMP; // sstep
case 0x96A0:
                                                     mon("locret_96A0 RTS                           ; 96A0: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x96A1:
                                                     mon("L96A1    LDB   <$60                    ; 96A1: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x96A3; JUMP; // sstep
case 0x96A3:
                                                     mon("         ASLB                          ; 96A3: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x96A4; JUMP; // sstep
case 0x96A4:
                                                     mon("         LDX   #word_96B6              ; 96A4: 8E 96 B6      \n"); // Shield colour table
    clockticks = clockticks + 3; 
    X = 0x96b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x96A7; JUMP; // sstep
case 0x96A7:
                                                     mon("         LDD   B,X                     ; 96A7: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x96A9; JUMP; // sstep
case 0x96A9:
                                                     mon("         STD   ,Y++                    ; 96A9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x96AB; JUMP; // sstep
case 0x96AB:
                                                     mon("         LDB   <$60                    ; 96AB: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x96AD; JUMP; // sstep
case 0x96AD:
                                                     mon("         ASLB                          ; 96AD: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x96AE; JUMP; // sstep
case 0x96AE:
                                                     mon("         LDX   #word_96CA              ; 96AE: 8E 96 CA      \n"); // Shield vector table
    clockticks = clockticks + 3; 
    X = 0x96ca; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x96B1; JUMP; // sstep
case 0x96B1:
                                                     mon("         LDU   B,X                     ; 96B1: EE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x96B3; JUMP; // sstep
case 0x96B3:
                                                     mon("         STU   ,Y++                    ; 96B3: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    // End of function sub_96A1
    // ---------------------------------------------------------------------------
    PC = 0x96B5; JUMP; // sstep
case 0x96B5:
                                                     mon("         RTS                           ; 96B5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Death Star starting wave bonus score
  case 0x9722:
                                                     mon("L9722    LDA   $4B2D                   ; 9722: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9725; JUMP; // sstep
case 0x9725:
                                                     mon("         BNE   locret_9739             ; 9725: 26 12         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9739; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9727; JUMP; // sstep
case 0x9727:
                                                     mon("         LDB   $4B15                   ; 9727: F6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x972A; JUMP; // sstep
case 0x972A:
                                                     mon("         BEQ   locret_9739             ; 972A: 27 0D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x9739; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x972C; JUMP; // sstep
case 0x972C:
                                                     mon("         ASLB                          ; 972C: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x972D; JUMP; // sstep
case 0x972D:
                                                     mon("         ADDB  $4B15                   ; 972D: FB 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x4b15); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0x9730; JUMP; // sstep
case 0x9730:
                                                     mon("         LDX   #byte_9865              ; 9730: 8E 98 65      \n"); // Death Star destroyed  incrementing score value, Also has unused starting wave bonus scores of 200,000 and 600,000, for waves 2 and 4
    clockticks = clockticks + 3; 
    X = 0x9865; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x9733; JUMP; // sstep
case 0x9733:
                                                     mon("         ABX                           ; 9733: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0x9734; JUMP; // sstep
case 0x9734:
                                                     mon("         TFR   X,U                     ; 9734: 1F 13         \n");
    U = X; 
    clockticks = clockticks + 6; 
    PC = 0x9736; JUMP; // sstep
case 0x9736:
                                                     mon("         JSR   L9810                   ; 9736: BD 98 10      \n"); // Add to score total
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x39); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0x9810; 
    JUMP;
    // End of function sub_9722
  case 0x9739:
                                                     mon("locret_9739 RTS                           ; 9739: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Towers incrementing score
  case 0x973A:
                                                     mon("L973A    LDU   #$4B2E                  ; 973A: CE 4B 2E      \n"); // Temporary score adder towers 1
    clockticks = clockticks + 3; 
    U = 0x4b2e; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x973D; JUMP; // sstep
case 0x973D:
                                                     mon("         JSR   L9810                   ; 973D: BD 98 10      \n"); // Add to score total
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x40); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0x9810; 
    JUMP;
  case 0x9740:
                                                     mon("L9740    LDX   #word_9856              ; 9740: 8E 98 56      \n");
    clockticks = clockticks + 3; 
    X = 0x9856; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x9743; JUMP; // sstep
case 0x9743:
                                                     mon("         LDA   $4B30                   ; 9743: B6 4B 30      \n"); // Temporary score adder towers 3
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b30); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9746; JUMP; // sstep
case 0x9746:
                                                     mon("         ADDA  $02,X                   ; 9746: AB 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0002)); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x9748; JUMP; // sstep
case 0x9748:
                                                     mon("         DAA                           ; 9748: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9749; JUMP; // sstep
case 0x9749:
                                                     mon("         STA   $4B30                   ; 9749: B7 4B 30      \n"); // Temporary score adder towers 3
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b30, val); 
    PC = 0x974C; JUMP; // sstep
case 0x974C:
                                                     mon("         LDA   $4B2F                   ; 974C: B6 4B 2F      \n"); // Temporary score adder towers 2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2f); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x974F; JUMP; // sstep
case 0x974F:
                                                     mon("         ADCA  $01,X                   ; 974F: A9 01         \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem((UINT16)(X + 0x0001)); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x9751; JUMP; // sstep
case 0x9751:
                                                     mon("         DAA                           ; 9751: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9752; JUMP; // sstep
case 0x9752:
                                                     mon("         STA   $4B2F                   ; 9752: B7 4B 2F      \n"); // Temporary score adder towers 2
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2f, val); 
    PC = 0x9755; JUMP; // sstep
case 0x9755:
                                                     mon("         LDA   $4B2E                   ; 9755: B6 4B 2E      \n"); // Temporary score adder towers 1
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9758; JUMP; // sstep
case 0x9758:
                                                     mon("         ADCA  ,X                      ; 9758: A9 84         \n");
    clockticks = clockticks + 4; 
    arg = A; 
    val = rd_mem(X); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x975A; JUMP; // sstep
case 0x975A:
                                                     mon("         DAA                           ; 975A: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x975B; JUMP; // sstep
case 0x975B:
                                                     mon("         STA   $4B2E                   ; 975B: B7 4B 2E      \n"); // Temporary score adder towers 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2e, val); 
    PC = 0x975E; JUMP; // sstep
case 0x975E:
                                                     mon("         LDA   $4B1A                   ; 975E: B6 4B 1A      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b1a); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9761; JUMP; // sstep
case 0x9761:
                                                     mon("         BEQ   locret_9774             ; 9761: 27 11         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x9774; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9763; JUMP; // sstep
case 0x9763:
                                                     mon("         ADDA  #$99                    ; 9763: 8B 99         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x99; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x9765; JUMP; // sstep
case 0x9765:
                                                     mon("         DAA                           ; 9765: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9766; JUMP; // sstep
case 0x9766:
                                                     mon("         STA   $4B1A                   ; 9766: B7 4B 1A      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b1a, val); 
    PC = 0x9769; JUMP; // sstep
case 0x9769:
                                                     mon("         BNE   locret_9774             ; 9769: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9774; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x976B; JUMP; // sstep
case 0x976B:
                                                     mon("         LDU   #byte_9862              ; 976B: CE 98 62      \n"); // Cleared all towers score value
    clockticks = clockticks + 3; 
    U = 0x9862; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x976E; JUMP; // sstep
case 0x976E:
                                                     mon("         JSR   L9810                   ; 976E: BD 98 10      \n"); // Add to score total
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0x9810; 
    JUMP;
  case 0x9771:
                                                     mon("L9771    INC   $4B35                   ; 9771: 7C 4B 35      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b35); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x4b35, res); 
    clockticks = clockticks + 2; 
    // End of function sub_973A
    PC = 0x9774; JUMP; // sstep
case 0x9774:
                                                     mon("locret_9774 RTS                           ; 9774: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Shield bonus score
  case 0x9775:
                                                     mon("L9775    LDB   <$60                    ; 9775: D6 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9777; JUMP; // sstep
case 0x9777:
                                                     mon("         BEQ   locret_97AB             ; 9777: 27 32         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x97ab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9779; JUMP; // sstep
case 0x9779:
                                                     mon("         LDU   #byte_9865              ; 9779: CE 98 65      \n"); // Death Star destroyed  incrementing score value, Also has unused starting wave bonus scores of 200,000 and 600,000, for waves 2 and 4
    clockticks = clockticks + 3; 
    U = 0x9865; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x977C; JUMP; // sstep
case 0x977C:
                                                     mon("         LDA   #$00                    ; 977C: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x977E; JUMP; // sstep
case 0x977E:
                                                     mon("         STA   $4B29                   ; 977E: B7 4B 29      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b29, val); 
    PC = 0x9781; JUMP; // sstep
case 0x9781:
                                                     mon("         STA   $4B2A                   ; 9781: B7 4B 2A      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2a, val); 
    PC = 0x9784; JUMP; // sstep
case 0x9784:
                                                     mon("         STA   $4B2B                   ; 9784: B7 4B 2B      \n"); // Temporary score adder 2
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2b, val); 
    PC = 0x9787; JUMP; // sstep
case 0x9787:
                                                     mon("L9787    LDA   $02,U                   ; 9787: A6 42         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9789; JUMP; // sstep
case 0x9789:
                                                     mon("         ADDA  $4B2B                   ; 9789: BB 4B 2B      \n"); // Temporary score adder 2
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b2b); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x978C; JUMP; // sstep
case 0x978C:
                                                     mon("         DAA                           ; 978C: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x978D; JUMP; // sstep
case 0x978D:
                                                     mon("         STA   $4B2B                   ; 978D: B7 4B 2B      \n"); // Temporary score adder 2
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2b, val); 
    PC = 0x9790; JUMP; // sstep
case 0x9790:
                                                     mon("         LDA   $01,U                   ; 9790: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9792; JUMP; // sstep
case 0x9792:
                                                     mon("         ADCA  $4B2A                   ; 9792: B9 4B 2A      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4b2a); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x9795; JUMP; // sstep
case 0x9795:
                                                     mon("         DAA                           ; 9795: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9796; JUMP; // sstep
case 0x9796:
                                                     mon("         STA   $4B2A                   ; 9796: B7 4B 2A      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2a, val); 
    PC = 0x9799; JUMP; // sstep
case 0x9799:
                                                     mon("         LDA   ,U                      ; 9799: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x979B; JUMP; // sstep
case 0x979B:
                                                     mon("         ADCA  $4B29                   ; 979B: B9 4B 29      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4b29); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x979E; JUMP; // sstep
case 0x979E:
                                                     mon("         DAA                           ; 979E: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x979F; JUMP; // sstep
case 0x979F:
                                                     mon("         STA   $4B29                   ; 979F: B7 4B 29      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b29, val); 
    PC = 0x97A2; JUMP; // sstep
case 0x97A2:
                                                     mon("         DECB                          ; 97A2: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x97A3; JUMP; // sstep
case 0x97A3:
                                                     mon("         BNE   L9787                   ; 97A3: 26 E2         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x9787; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x97A5; JUMP; // sstep
case 0x97A5:
                                                     mon("         LDU   #$4B29                  ; 97A5: CE 4B 29      \n"); // Temporary score adder 1
    clockticks = clockticks + 3; 
    U = 0x4b29; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x97A8; JUMP; // sstep
case 0x97A8:
                                                     mon("         JSR   L9810                   ; 97A8: BD 98 10      \n"); // Add to score total
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0x9810; 
    JUMP;
    // End of function sub_9775
  case 0x97AB:
                                                     mon("locret_97AB RTS                           ; 97AB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Used the force score
  case 0x97AC:
                                                     mon("L97AC    LDB   $4B15                   ; 97AC: F6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x97AF; JUMP; // sstep
case 0x97AF:
                                                     mon("         CMPB  #$05                    ; 97AF: C1 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x97B1; JUMP; // sstep
case 0x97B1:
                                                     mon("         BCS   L97B8                   ; 97B1: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x97b8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x97B3; JUMP; // sstep
case 0x97B3:
                                                     mon("         LDU   #byte_9847              ; 97B3: CE 98 47      \n"); // Using Force score value
    clockticks = clockticks + 3; 
    U = 0x9847; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x97B6; JUMP; // sstep
case 0x97B6:
                                                     mon("         BRA   locret_97C1             ; 97B6: 20 09         \n");
    PC = 0x97c1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x97B8:
                                                     mon("L97B8    ASLB                          ; 97B8: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x97B9; JUMP; // sstep
case 0x97B9:
                                                     mon("         ADDB  $4B15                   ; 97B9: FB 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x4b15); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0x97BC; JUMP; // sstep
case 0x97BC:
                                                     mon("         LDU   #byte_983B              ; 97BC: CE 98 3B      \n");
    clockticks = clockticks + 3; 
    U = 0x983b; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x97BF; JUMP; // sstep
case 0x97BF:
                                                     mon("         LEAU  B,U                     ; 97BF: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    // End of function sub_97AC
    PC = 0x97C1; JUMP; // sstep
case 0x97C1:
                                                     mon("locret_97C1 RTS                           ; 97C1: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x97C2:
                                                     mon("L97C2    LDD   #$A01A                  ; 97C2: CC A0 1A      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x1a; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x97C5; JUMP; // sstep
case 0x97C5:
                                                     mon("         STD   ,Y++                    ; 97C5: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x97C7; JUMP; // sstep
case 0x97C7:
                                                     mon("         LDD   #$0180                  ; 97C7: CC 01 80      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x97CA; JUMP; // sstep
case 0x97CA:
                                                     mon("         STD   ,Y++                    ; 97CA: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x97CC; JUMP; // sstep
case 0x97CC:
                                                     mon("         LDD   #$1EC0                  ; 97CC: CC 1E C0      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x97CF; JUMP; // sstep
case 0x97CF:
                                                     mon("         STD   ,Y++                    ; 97CF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x97D1; JUMP; // sstep
case 0x97D1:
                                                     mon("         LDA   #$04                    ; 97D1: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x97D3; JUMP; // sstep
case 0x97D3:
                                                     mon("         STA   <$AD                    ; 97D3: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x97D5; JUMP; // sstep
case 0x97D5:
                                                     mon("         JSR   L97AC                   ; 97D5: BD 97 AC      \n"); // Used the force score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0x97ac; 
    JUMP;
  case 0x97D8:
                                                     mon("L97D8    LEAX  -1,U                    ; 97D8: 30 5F         \n");
    clockticks = clockticks + 5; 
    X = (U + 0xffff); 
    Z = X; 
    PC = 0x97DA; JUMP; // sstep
case 0x97DA:
                                                     mon("         JSR   LE772                   ; 97DA: BD E7 72      \n"); // Display BCD number text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0xe772; 
    JUMP;
  case 0x97DD:
                                                     mon("L97DD    LDB   #$50                    ; 97DD: C6 50         \n"); // 'For using the Force' text
    clockticks = clockticks + 2; 
    val = (UINT8)0x50; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x97DF; JUMP; // sstep
case 0x97DF:
                                                     mon("         JSR   LE7C7                   ; 97DF: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // End of function sub_97C2
  case 0x97E2:
                                                     mon("L97E2    RTS                           ; 97E2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x97E3:
                                                     mon("L97E3    JSR   L97AC                   ; 97E3: BD 97 AC      \n"); // Used the force score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    PC = 0x97ac; 
    JUMP;
    // End of function sub_97E3
  case 0x97E6:
                                                     mon("L97E6    BRA   L9810                   ; 97E6: 20 28         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Tie fighter score
  case 0x97E8:
                                                     mon("L97E8    LDU   #byte_984A              ; 97E8: CE 98 4A      \n"); // Tie fighter score value
    clockticks = clockticks + 3; 
    U = 0x984a; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // End of function sub_97E8
    PC = 0x97EB; JUMP; // sstep
case 0x97EB:
                                                     mon("         BRA   L9810                   ; 97EB: 20 23         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Vaders tie score
  case 0x97ED:
                                                     mon("L97ED    LDU   #byte_984D              ; 97ED: CE 98 4D      \n"); // Vaders tie score value
    clockticks = clockticks + 3; 
    U = 0x984d; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // End of function sub_97ED
    PC = 0x97F0; JUMP; // sstep
case 0x97F0:
                                                     mon("         BRA   L9810                   ; 97F0: 20 1E         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Trench green squares score
  case 0x97F2:
                                                     mon("L97F2    LDU   #byte_9850              ; 97F2: CE 98 50      \n"); // Trench green squares score value
    clockticks = clockticks + 3; 
    U = 0x9850; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // End of function sub_97F2
    PC = 0x97F5; JUMP; // sstep
case 0x97F5:
                                                     mon("         BRA   L9810                   ; 97F5: 20 19         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Laser tower score
  case 0x97F7:
                                                     mon("L97F7    LDU   #byte_9859              ; 97F7: CE 98 59      \n"); // Laser tower score value
    clockticks = clockticks + 3; 
    U = 0x9859; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // End of function sub_97F7
    PC = 0x97FA; JUMP; // sstep
case 0x97FA:
                                                     mon("         BRA   L9810                   ; 97FA: 20 14         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Trench turrets score
  case 0x97FC:
                                                     mon("L97FC    LDU   #byte_9853              ; 97FC: CE 98 53      \n"); // Trench turrets score value
    clockticks = clockticks + 3; 
    U = 0x9853; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // End of function sub_97FC
    PC = 0x97FF; JUMP; // sstep
case 0x97FF:
                                                     mon("         BRA   L9810                   ; 97FF: 20 0F         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Fireball score
  case 0x9801:
                                                     mon("L9801    LDU   #byte_985C              ; 9801: CE 98 5C      \n"); // Fireball score value
    clockticks = clockticks + 3; 
    U = 0x985c; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x9804; JUMP; // sstep
case 0x9804:
                                                     mon("         BRA   L9810                   ; 9804: 20 0A         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x9806:
                                                     mon("L9806    LDU   #byte_985F              ; 9806: CE 98 5F      \n"); // Exhaust port score
    clockticks = clockticks + 3; 
    U = 0x985f; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x9809; JUMP; // sstep
case 0x9809:
                                                     mon("         BRA   L9810                   ; 9809: 20 05         \n"); // Add to score total
    PC = 0x9810; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
                   // FCB   $CE                     ; 980B:  ' ' CE 98 62       LDU   #$9862 ; Cleared all towers score value
                   // FCB   $98                     ; 980C:  ' ' 98 62          EORA  <$62 ; 
                   // FCB   $62                     ; 980D:  'b' 62             Invalid ; 
                   // FCB   $20                     ; 980E:  ' ' 20 00          BRA   $9810 ; 
                   // FCB   $00                     ; 980F:  ' ' 00 A6          NEG   <$A6 ; 
  case 0x9810:
                                                     mon("L9810    LDA   $02,U                   ; 9810: A6 42         \n"); // Add to score total
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9812; JUMP; // sstep
case 0x9812:
                                                     mon("         STA   $4B2B                   ; 9812: B7 4B 2B      \n"); // Temporary score adder 2
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2b, val); 
    PC = 0x9815; JUMP; // sstep
case 0x9815:
                                                     mon("         ADDA  <$5F                    ; 9815: 9B 5F         \n"); // Score
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x5f); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x9817; JUMP; // sstep
case 0x9817:
                                                     mon("         DAA                           ; 9817: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9818; JUMP; // sstep
case 0x9818:
                                                     mon("         STA   <$5F                    ; 9818: 97 5F         \n"); // Score
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5f; 
    wr_mem(ea, val); 
    PC = 0x981A; JUMP; // sstep
case 0x981A:
                                                     mon("         LDA   $01,U                   ; 981A: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x981C; JUMP; // sstep
case 0x981C:
                                                     mon("         STA   $4B2A                   ; 981C: B7 4B 2A      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2a, val); 
    PC = 0x981F; JUMP; // sstep
case 0x981F:
                                                     mon("         ADCA  <$5E                    ; 981F: 99 5E         \n"); // Score thousands
    clockticks = clockticks + 4; 
    arg = A; 
    val = rd_mem(DP|0x5e); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x9821; JUMP; // sstep
case 0x9821:
                                                     mon("         DAA                           ; 9821: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9822; JUMP; // sstep
case 0x9822:
                                                     mon("         STA   <$5E                    ; 9822: 97 5E         \n"); // Score thousands
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5e; 
    wr_mem(ea, val); 
    PC = 0x9824; JUMP; // sstep
case 0x9824:
                                                     mon("         LDA   ,U                      ; 9824: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9826; JUMP; // sstep
case 0x9826:
                                                     mon("         STA   $4B29                   ; 9826: B7 4B 29      \n"); // Temporary score adder 1
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b29, val); 
    PC = 0x9829; JUMP; // sstep
case 0x9829:
                                                     mon("         ADCA  <$5D                    ; 9829: 99 5D         \n"); // Score hundred thousands
    clockticks = clockticks + 4; 
    arg = A; 
    val = rd_mem(DP|0x5d); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x982B; JUMP; // sstep
case 0x982B:
                                                     mon("         DAA                           ; 982B: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x982C; JUMP; // sstep
case 0x982C:
                                                     mon("         STA   <$5D                    ; 982C: 97 5D         \n"); // Score hundred thousands
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5d; 
    wr_mem(ea, val); 
    PC = 0x982E; JUMP; // sstep
case 0x982E:
                                                     mon("         LDA   <$5C                    ; 982E: 96 5C         \n"); // Score millions
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x5c); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9830; JUMP; // sstep
case 0x9830:
                                                     mon("         ADCA  #$00                    ; 9830: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0x9832; JUMP; // sstep
case 0x9832:
                                                     mon("         DAA                           ; 9832: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x9833; JUMP; // sstep
case 0x9833:
                                                     mon("         STA   <$5C                    ; 9833: 97 5C         \n"); // Score millions
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5c; 
    wr_mem(ea, val); 
    PC = 0x9835; JUMP; // sstep
case 0x9835:
                                                     mon("         LDA   #$FF                    ; 9835: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9837; JUMP; // sstep
case 0x9837:
                                                     mon("         STA   $4B2C                   ; 9837: B7 4B 2C      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b2c, val); 
    // End of function sub_9801
    // ---------------------------------------------------------------------------
    PC = 0x983A; JUMP; // sstep
case 0x983A:
                                                     mon("         RTS                           ; 983A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x9874:
                                                     mon("L9874    LDA   <$8B                    ; 9874: 96 8B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8b); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9876; JUMP; // sstep
case 0x9876:
                                                     mon("         BNE   locret_987E             ; 9876: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x987e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9878; JUMP; // sstep
case 0x9878:
                                                     mon("         LDA   #$10                    ; 9878: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x987A; JUMP; // sstep
case 0x987A:
                                                     mon("         STA   <$62                    ; 987A: 97 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x62; 
    wr_mem(ea, val); 
    PC = 0x987C; JUMP; // sstep
case 0x987C:
                                                     mon("         INC   <$8B                    ; 987C: 0C 8B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8b); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x8b, res); 
    clockticks = clockticks + 2; 
    // End of function sub_9874
    PC = 0x987E; JUMP; // sstep
case 0x987E:
                                                     mon("locret_987E RTS                           ; 987E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Fireball timer
  case 0x987F:
                                                     mon("L987F    LDA   <$43                    ; 987F: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9881; JUMP; // sstep
case 0x9881:
                                                     mon("         ANDA  #$03                    ; 9881: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x9883; JUMP; // sstep
case 0x9883:
                                                     mon("         STA   <$62                    ; 9883: 97 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x62; 
    wr_mem(ea, val); 
    // End of function sub_987F
    PC = 0x9885; JUMP; // sstep
case 0x9885:
                                                     mon("         RTS                           ; 9885: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Fireball timer 2
  case 0x9886:
                                                     mon("L9886    LDB   <$62                    ; 9886: D6 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x62); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x9888; JUMP; // sstep
case 0x9888:
                                                     mon("         CMPB  #$08                    ; 9888: C1 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x988A; JUMP; // sstep
case 0x988A:
                                                     mon("         BLS   L9890                   ; 988A: 23 04         \n"); // Fireball timer 3
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x9890; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x988C; JUMP; // sstep
case 0x988C:
                                                     mon("         LDB   #$08                    ; 988C: C6 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    // End of function sub_9886
    PC = 0x988E; JUMP; // sstep
case 0x988E:
                                                     mon("         STB   <$62                    ; 988E: D7 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x62; 
    wr_mem(ea, val); 
    // =============== S U B R O U T I N E =======================================
    // Fireball timer 3
    PC = 0x9890; JUMP; // sstep
case 0x9890:
                                                     mon("L9890    LDB   <$62                    ; 9890: D6 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x62); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x9892; JUMP; // sstep
case 0x9892:
                                                     mon("         BEQ   locret_9897             ; 9892: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x9897; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x9894; JUMP; // sstep
case 0x9894:
                                                     mon("         DECB                          ; 9894: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x9895; JUMP; // sstep
case 0x9895:
                                                     mon("         STB   <$62                    ; 9895: D7 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x62; 
    wr_mem(ea, val); 
    // End of function sub_9890
    PC = 0x9897; JUMP; // sstep
case 0x9897:
                                                     mon("locret_9897 RTS                           ; 9897: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x9898:
                                                     mon("L9898    LDA   <$43                    ; 9898: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x989A; JUMP; // sstep
case 0x989A:
                                                     mon("         ANDA  #$00                    ; 989A: 84 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x00; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x989C; JUMP; // sstep
case 0x989C:
                                                     mon("         BNE   locret_98AF             ; 989C: 26 11         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x98af; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x989E; JUMP; // sstep
case 0x989E:
                                                     mon("         LDX   #$4900                  ; 989E: 8E 49 00      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 3; 
    X = 0x4900; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x98A1; JUMP; // sstep
case 0x98A1:
                                                     mon("L98A1    DEC   $06,X                   ; 98A1: 6A 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + 0x0006), res); 
    clockticks = clockticks + 2; 
    PC = 0x98A3; JUMP; // sstep
case 0x98A3:
                                                     mon("         BPL   L98A7                   ; 98A3: 2A 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x98a7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x98A5; JUMP; // sstep
case 0x98A5:
                                                     mon("         CLR   $06,X                   ; 98A5: 6F 06         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0006), 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x98A7; JUMP; // sstep
case 0x98A7:
                                                     mon("L98A7    LEAX  $19,X                   ; 98A7: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x98AA; JUMP; // sstep
case 0x98AA:
                                                     mon("         CMPX  #$494B                  ; 98AA: 8C 49 4B      \n"); // 3x Tie fighter data structure ($19 bytes per Tie)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x494b; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x98AD; JUMP; // sstep
case 0x98AD:
                                                     mon("         BCS   L98A1                   ; 98AD: 25 F2         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x98a1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_9898
    PC = 0x98AF; JUMP; // sstep
case 0x98AF:
                                                     mon("locret_98AF RTS                           ; 98AF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert vector laser explosion small circle
  case 0x98B0:
                                                     mon("L98B0    LDB   <$62                    ; 98B0: D6 62         \n"); // Timer for fireball hit?
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x62); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x98B2; JUMP; // sstep
case 0x98B2:
                                                     mon("         ANDB  #$03                    ; 98B2: C4 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x03; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x98B4; JUMP; // sstep
case 0x98B4:
                                                     mon("         BEQ   locret_98CA             ; 98B4: 27 14         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x98ca; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x98B6; JUMP; // sstep
case 0x98B6:
                                                     mon("         LDD   #$7100                  ; 98B6: CC 71 00      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x98B9; JUMP; // sstep
case 0x98B9:
                                                     mon("         STD   ,Y++                    ; 98B9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x98BB; JUMP; // sstep
case 0x98BB:
                                                     mon("         LDD   #$67FF                  ; 98BB: CC 67 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x98BE; JUMP; // sstep
case 0x98BE:
                                                     mon("         STD   ,Y++                    ; 98BE: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x98C0; JUMP; // sstep
case 0x98C0:
                                                     mon("         LDD   #$B9B3                  ; 98C0: CC B9 B3      \n"); // Vector JSRL 19B3 Laser explosion small circle
    clockticks = clockticks + 3; 
    A = 0xb9; 
    B = 0xb3; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x98C3; JUMP; // sstep
case 0x98C3:
                                                     mon("         STD   ,Y++                    ; 98C3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0x98C5; JUMP; // sstep
case 0x98C5:
                                                     mon("         LDD   #$7200                  ; 98C5: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x98C8; JUMP; // sstep
case 0x98C8:
                                                     mon("         STD   ,Y++                    ; 98C8: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_98B0
    // ---------------------------------------------------------------------------
    PC = 0x98CA; JUMP; // sstep
case 0x98CA:
                                                     mon("locret_98CA RTS                           ; 98CA: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA1CE:
                                                     mon("LA1CE    LDU   #$49C2                  ; A1CE: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA1D1; JUMP; // sstep
case 0xA1D1:
                                                     mon("LA1D1    LDA   #$00                    ; A1D1: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA1D3; JUMP; // sstep
case 0xA1D3:
                                                     mon("         STA   ,U                      ; A1D3: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA1D5; JUMP; // sstep
case 0xA1D5:
                                                     mon("         LEAU  $01,U                   ; A1D5: 33 41         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0001); 
    PC = 0xA1D7; JUMP; // sstep
case 0xA1D7:
                                                     mon("         CMPU  #$49E2                  ; A1D7: 11 83 49 E2   \n"); // Tie fighter data 1
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x49e2; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA1DB; JUMP; // sstep
case 0xA1DB:
                                                     mon("         BCS   LA1D1                   ; A1DB: 25 F4         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa1d1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA1DD; JUMP; // sstep
case 0xA1DD:
                                                     mon("         LDA   $4B13                   ; A1DD: B6 4B 13      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b13); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA1E0; JUMP; // sstep
case 0xA1E0:
                                                     mon("         CMPA  #$13                    ; A1E0: 81 13         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x13; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA1E2; JUMP; // sstep
case 0xA1E2:
                                                     mon("         BCS   LA1EF                   ; A1E2: 25 0B         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa1ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA1E4; JUMP; // sstep
case 0xA1E4:
                                                     mon("         LDB   #$06                    ; A1E4: C6 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA1E6; JUMP; // sstep
case 0xA1E6:
                                                     mon("         LDA   $4703                   ; A1E6: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA1E9; JUMP; // sstep
case 0xA1E9:
                                                     mon("         MUL                           ; A1E9: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xA1EA; JUMP; // sstep
case 0xA1EA:
                                                     mon("         ADDA  #$0D                    ; A1EA: 8B 0D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0d; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xA1EC; JUMP; // sstep
case 0xA1EC:
                                                     mon("         STA   $4B13                   ; A1EC: B7 4B 13      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b13, val); 
    PC = 0xA1EF; JUMP; // sstep
case 0xA1EF:
                                                     mon("LA1EF    LDB   $4B13                   ; A1EF: F6 4B 13      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b13); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA1F2; JUMP; // sstep
case 0xA1F2:
                                                     mon("         LDX   #byte_98CB              ; A1F2: 8E 98 CB      \n");
    clockticks = clockticks + 3; 
    X = 0x98cb; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA1F5; JUMP; // sstep
case 0xA1F5:
                                                     mon("         ABX                           ; A1F5: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xA1F6; JUMP; // sstep
case 0xA1F6:
                                                     mon("         CMPX  #byte_98DE              ; A1F6: 8C 98 DE      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x98de; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA1F9; JUMP; // sstep
case 0xA1F9:
                                                     mon("         BCS   LA1FE                   ; A1F9: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa1fe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA1FB; JUMP; // sstep
case 0xA1FB:
                                                     mon("         LDX   #byte_98DD              ; A1FB: 8E 98 DD      \n");
    clockticks = clockticks + 3; 
    X = 0x98dd; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA1FE; JUMP; // sstep
case 0xA1FE:
                                                     mon("LA1FE    LDA   ,X                      ; A1FE: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA200; JUMP; // sstep
case 0xA200:
                                                     mon("         STA   $4B1A                   ; A200: B7 4B 1A      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b1a, val); 
    PC = 0xA203; JUMP; // sstep
case 0xA203:
                                                     mon("         LDD   word_9856               ; A203: FC 98 56      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x9856); // Care needed with I/O space and word fetches
    B = rd_mem(0x9857); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA206; JUMP; // sstep
case 0xA206:
                                                     mon("         STD   $4B2E                   ; A206: FD 4B 2E      \n"); // Temporary score adder towers 1
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b2e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b2f, B); 
    PC = 0xA209; JUMP; // sstep
case 0xA209:
                                                     mon("         LDA   byte_9858               ; A209: B6 98 58      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x9858); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA20C; JUMP; // sstep
case 0xA20C:
                                                     mon("         STA   $4B30                   ; A20C: B7 4B 30      \n"); // Temporary score adder towers 3
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b30, val); 
    PC = 0xA20F; JUMP; // sstep
case 0xA20F:
                                                     mon("         LDA   #$00                    ; A20F: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA211; JUMP; // sstep
case 0xA211:
                                                     mon("         STA   <$A7                    ; A211: 97 A7         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xa7; 
    wr_mem(ea, val); 
    // End of function sub_A1CE
    PC = 0xA213; JUMP; // sstep
case 0xA213:
                                                     mon("         RTS                           ; A213: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA214:
                                                     mon("LA214    LDB   #$07                    ; A214: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA216; JUMP; // sstep
case 0xA216:
                                                     mon("         STB   <$DC                    ; A216: D7 DC         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xA218; JUMP; // sstep
case 0xA218:
                                                     mon("         JSR   LCD38                   ; A218: BD CD 38      \n"); // Trench left side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    PC = 0xcd38; 
    JUMP;
  case 0xA21B:
                                                     mon("LA21B    LDD   #$00                    ; A21B: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA21E; JUMP; // sstep
case 0xA21E:
                                                     mon("         STD   $5040                   ; A21E: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0xA221; JUMP; // sstep
case 0xA221:
                                                     mon("         STD   $5042                   ; A221: FD 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5042, A); // Care needed with I/O space and word fetches
    wr_mem(0x5043, B); 
    PC = 0xA224; JUMP; // sstep
case 0xA224:
                                                     mon("         STD   $5044                   ; A224: FD 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5044, A); // Care needed with I/O space and word fetches
    wr_mem(0x5045, B); 
    PC = 0xA227; JUMP; // sstep
case 0xA227:
                                                     mon("         JSR   LA40A                   ; A227: BD A4 0A      \n"); // Some Towers code
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    PC = 0xa40a; 
    JUMP;
  case 0xA22A:
                                                     mon("LA22A    LDD   $5098                   ; A22A: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA22D; JUMP; // sstep
case 0xA22D:
                                                     mon("         STD   $5040                   ; A22D: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0xA230; JUMP; // sstep
case 0xA230:
                                                     mon("         LDD   $509A                   ; A230: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA233; JUMP; // sstep
case 0xA233:
                                                     mon("         STD   $5042                   ; A233: FD 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5042, A); // Care needed with I/O space and word fetches
    wr_mem(0x5043, B); 
    PC = 0xA236; JUMP; // sstep
case 0xA236:
                                                     mon("         LDD   $509C                   ; A236: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA239; JUMP; // sstep
case 0xA239:
                                                     mon("         STD   $5044                   ; A239: FD 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5044, A); // Care needed with I/O space and word fetches
    wr_mem(0x5045, B); 
    PC = 0xA23C; JUMP; // sstep
case 0xA23C:
                                                     mon("         LDB   $4B13                   ; A23C: F6 4B 13      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b13); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA23F; JUMP; // sstep
case 0xA23F:
                                                     mon("         ASLB                          ; A23F: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA240; JUMP; // sstep
case 0xA240:
                                                     mon("         ASLB                          ; A240: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA241; JUMP; // sstep
case 0xA241:
                                                     mon("         LDX   #off_A182               ; A241: 8E A1 82      \n");
    clockticks = clockticks + 3; 
    X = 0xa182; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA244; JUMP; // sstep
case 0xA244:
                                                     mon("         ABX                           ; A244: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xA245; JUMP; // sstep
case 0xA245:
                                                     mon("         CMPX  #LA1CE                  ; A245: 8C A1 CE      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0xa1ce; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA248; JUMP; // sstep
case 0xA248:
                                                     mon("         BCS   LA24D                   ; A248: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa24d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA24A; JUMP; // sstep
case 0xA24A:
                                                     mon("         LDX   #off_A1CA               ; A24A: 8E A1 CA      \n");
    clockticks = clockticks + 3; 
    X = 0xa1ca; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA24D; JUMP; // sstep
case 0xA24D:
                                                     mon("LA24D    LDX   ,X                      ; A24D: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA24F; JUMP; // sstep
case 0xA24F:
                                                     mon("LA24F    STX   <$64                    ; A24F: 9F 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x64; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA251; JUMP; // sstep
case 0xA251:
                                                     mon("         LDA   <$A7                    ; A251: 96 A7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa7); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA253; JUMP; // sstep
case 0xA253:
                                                     mon("         CMPA  $05,X                   ; A253: A1 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0005)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA255; JUMP; // sstep
case 0xA255:
                                                     mon("         LBLT  LA2DA                   ; A255: 10 2D 00 81   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) <  0) {
    clockticks = clockticks + 1; 
    PC = 0xa2da; 
    JUMP;
    }
    PC = 0xA259; JUMP; // sstep
case 0xA259:
                                                     mon("         LDD   ,X                      ; A259: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA25B; JUMP; // sstep
case 0xA25B:
                                                     mon("         STD   $5E00                   ; A25B: FD 5E 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e00, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e01, B); 
    PC = 0xA25E; JUMP; // sstep
case 0xA25E:
                                                     mon("         LDD   $02,X                   ; A25E: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA260; JUMP; // sstep
case 0xA260:
                                                     mon("         STD   $5E02                   ; A260: FD 5E 02      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e02, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e03, B); 
    PC = 0xA263; JUMP; // sstep
case 0xA263:
                                                     mon("         LDD   #$1E00                  ; A263: CC 1E 00      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA266; JUMP; // sstep
case 0xA266:
                                                     mon("         STD   $5E04                   ; A266: FD 5E 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e04, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e05, B); 
    PC = 0xA269; JUMP; // sstep
case 0xA269:
                                                     mon("         LDD   #$01C0                  ; A269: CC 01 C0      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA26C; JUMP; // sstep
case 0xA26C:
                                                     mon("         STD   $4701                   ; A26C: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xA26F; JUMP; // sstep
case 0xA26F:
                                                     mon("         LDA   #$67                    ; A26F: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA271; JUMP; // sstep
case 0xA271:
                                                     mon("         JSR   LCDBA                   ; A271: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA274:
                                                     mon("LA274    LDD   $5000                   ; A274: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA277; JUMP; // sstep
case 0xA277:
                                                     mon("         BPL   LA27E                   ; A277: 2A 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa27e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA279; JUMP; // sstep
case 0xA279:
                                                     mon("         ANDA  #$3F                    ; A279: 84 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x3f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA27B; JUMP; // sstep
case 0xA27B:
                                                     mon("         STD   $5000                   ; A27B: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xA27E; JUMP; // sstep
case 0xA27E:
                                                     mon("LA27E    STD   $507C                   ; A27E: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xA281; JUMP; // sstep
case 0xA281:
                                                     mon("         CMPD  #$0100                  ; A281: 10 83 01 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0100; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA285; JUMP; // sstep
case 0xA285:
                                                     mon("         BLT   LA2B0                   ; A285: 2D 29         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa2b0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA287; JUMP; // sstep
case 0xA287:
                                                     mon("         CMPD  #$3C00                  ; A287: 10 83 3C 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x3c00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA28B; JUMP; // sstep
case 0xA28B:
                                                     mon("         BCC   LA2B0                   ; A28B: 24 23         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa2b0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA28D; JUMP; // sstep
case 0xA28D:
                                                     mon("         LDD   $5002                   ; A28D: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA290; JUMP; // sstep
case 0xA290:
                                                     mon("         BPL   LA296                   ; A290: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa296; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA292; JUMP; // sstep
case 0xA292:
                                                     mon("         COMA                          ; A292: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xA293; JUMP; // sstep
case 0xA293:
                                                     mon("         NEGB                          ; A293: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA294; JUMP; // sstep
case 0xA294:
                                                     mon("         SBCA  #$FF                    ; A294: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xA296; JUMP; // sstep
case 0xA296:
                                                     mon("LA296    SUBD  $5000                   ; A296: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA299; JUMP; // sstep
case 0xA299:
                                                     mon("         BCC   LA2B0                   ; A299: 24 15         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa2b0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA29B; JUMP; // sstep
case 0xA29B:
                                                     mon("         LDU   #$49C2                  ; A29B: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA29E; JUMP; // sstep
case 0xA29E:
                                                     mon("         LDB   $06,X                   ; A29E: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2A0; JUMP; // sstep
case 0xA2A0:
                                                     mon("         LEAU  B,U                     ; A2A0: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA2A2; JUMP; // sstep
case 0xA2A2:
                                                     mon("         LDA   ,U                      ; A2A2: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2A4; JUMP; // sstep
case 0xA2A4:
                                                     mon("         BITA  #$02                    ; A2A4: 85 02         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x02; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA2A6; JUMP; // sstep
case 0xA2A6:
                                                     mon("         BEQ   LA2AE                   ; A2A6: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa2ae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA2A8; JUMP; // sstep
case 0xA2A8:
                                                     mon("         JSR   LA2F8                   ; A2A8: BD A2 F8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    PC = 0xa2f8; 
    JUMP;
  case 0xA2AB:
                                                     mon("LA2AB    JSR   LA591                   ; A2AB: BD A5 91      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xae); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    PC = 0xa591; 
    JUMP;
  case 0xA2AE:
                                                     mon("LA2AE    BRA   LA2DA                   ; A2AE: 20 2A         \n");
    PC = 0xa2da; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA2B0:
                                                     mon("LA2B0    LDX   <$64                    ; A2B0: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA2B2; JUMP; // sstep
case 0xA2B2:
                                                     mon("         LDU   #$49C2                  ; A2B2: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA2B5; JUMP; // sstep
case 0xA2B5:
                                                     mon("         LDB   $06,X                   ; A2B5: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2B7; JUMP; // sstep
case 0xA2B7:
                                                     mon("         LEAU  B,U                     ; A2B7: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA2B9; JUMP; // sstep
case 0xA2B9:
                                                     mon("         LDA   $4B3D                   ; A2B9: B6 4B 3D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA2BC; JUMP; // sstep
case 0xA2BC:
                                                     mon("         BEQ   LA2C2                   ; A2BC: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa2c2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA2BE; JUMP; // sstep
case 0xA2BE:
                                                     mon("         CLR   ,U                      ; A2BE: 6F C4         \n");
    clockticks = clockticks + 4; 
    wr_mem(U, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA2C0; JUMP; // sstep
case 0xA2C0:
                                                     mon("         BRA   LA2DA                   ; A2C0: 20 18         \n");
    PC = 0xa2da; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA2C2:
                                                     mon("LA2C2    LDA   #$0B                    ; A2C2: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2C4; JUMP; // sstep
case 0xA2C4:
                                                     mon("         LDB   ,U                      ; A2C4: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2C6; JUMP; // sstep
case 0xA2C6:
                                                     mon("         BITB  #$04                    ; A2C6: C5 04         \n");
    clockticks = clockticks + 2; 
    res = B & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA2C8; JUMP; // sstep
case 0xA2C8:
                                                     mon("         BEQ   LA2D6                   ; A2C8: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa2d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA2CA; JUMP; // sstep
case 0xA2CA:
                                                     mon("         ORA   #$04                    ; A2CA: 8A 04         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x04; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA2CC; JUMP; // sstep
case 0xA2CC:
                                                     mon("         LDB   $04,X                   ; A2CC: E6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2CE; JUMP; // sstep
case 0xA2CE:
                                                     mon("         CMPB  #$03                    ; A2CE: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA2D0; JUMP; // sstep
case 0xA2D0:
                                                     mon("         BNE   LA2D4                   ; A2D0: 26 02         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa2d4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA2D2; JUMP; // sstep
case 0xA2D2:
                                                     mon("         ANDA  #$FD                    ; A2D2: 84 FD         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xfd; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA2D4; JUMP; // sstep
case 0xA2D4:
                                                     mon("LA2D4    BRA   LA2D8                   ; A2D4: 20 02         \n");
    PC = 0xa2d8; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA2D6:
                                                     mon("LA2D6    ORA   #$10                    ; A2D6: 8A 10         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x10; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA2D8; JUMP; // sstep
case 0xA2D8:
                                                     mon("LA2D8    STA   ,U                      ; A2D8: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA2DA; JUMP; // sstep
case 0xA2DA:
                                                     mon("LA2DA    LDB   $4B13                   ; A2DA: F6 4B 13      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b13); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2DD; JUMP; // sstep
case 0xA2DD:
                                                     mon("         ASLB                          ; A2DD: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA2DE; JUMP; // sstep
case 0xA2DE:
                                                     mon("         ASLB                          ; A2DE: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA2DF; JUMP; // sstep
case 0xA2DF:
                                                     mon("         LDX   #off_A182               ; A2DF: 8E A1 82      \n");
    clockticks = clockticks + 3; 
    X = 0xa182; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA2E2; JUMP; // sstep
case 0xA2E2:
                                                     mon("         ABX                           ; A2E2: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xA2E3; JUMP; // sstep
case 0xA2E3:
                                                     mon("         CMPX  #LA1CE                  ; A2E3: 8C A1 CE      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0xa1ce; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA2E6; JUMP; // sstep
case 0xA2E6:
                                                     mon("         BCS   LA2EB                   ; A2E6: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa2eb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA2E8; JUMP; // sstep
case 0xA2E8:
                                                     mon("         LDX   #off_A1CA               ; A2E8: 8E A1 CA      \n");
    clockticks = clockticks + 3; 
    X = 0xa1ca; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA2EB; JUMP; // sstep
case 0xA2EB:
                                                     mon("LA2EB    TFR   X,U                     ; A2EB: 1F 13         \n");
    U = X; 
    clockticks = clockticks + 6; 
    PC = 0xA2ED; JUMP; // sstep
case 0xA2ED:
                                                     mon("         LDX   <$64                    ; A2ED: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA2EF; JUMP; // sstep
case 0xA2EF:
                                                     mon("         LEAX  $07,X                   ; A2EF: 30 07         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0007); 
/**/Z = X; 
    PC = 0xA2F1; JUMP; // sstep
case 0xA2F1:
                                                     mon("         CPX   $02,U                   ; A2F1: AC 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA2F3; JUMP; // sstep
case 0xA2F3:
                                                     mon("         LBCS  LA24F                   ; A2F3: 10 25 FF 58   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0xa24f; 
    JUMP;
    }
    // End of function sub_A214
    PC = 0xA2F7; JUMP; // sstep
case 0xA2F7:
                                                     mon("         RTS                           ; A2F7: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA2F8:
                                                     mon("LA2F8    LDX   <$64                    ; A2F8: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA2FA; JUMP; // sstep
case 0xA2FA:
                                                     mon("         LDB   $04,X                   ; A2FA: E6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA2FC; JUMP; // sstep
case 0xA2FC:
                                                     mon("         CMPB  #$03                    ; A2FC: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA2FE; JUMP; // sstep
case 0xA2FE:
                                                     mon("         BNE   LA304                   ; A2FE: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa304; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA300; JUMP; // sstep
case 0xA300:
                                                     mon("         LDB   #$09                    ; A300: C6 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA302; JUMP; // sstep
case 0xA302:
                                                     mon("         BRA   LA306                   ; A302: 20 02         \n");
    PC = 0xa306; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA304:
                                                     mon("LA304    LDB   #$08                    ; A304: C6 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA306; JUMP; // sstep
case 0xA306:
                                                     mon("LA306    STB   <$DC                    ; A306: D7 DC         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xA308; JUMP; // sstep
case 0xA308:
                                                     mon("         LDD   #$6680                  ; A308: CC 66 80      \n");
    clockticks = clockticks + 3; 
    A = 0x66; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA30B; JUMP; // sstep
case 0xA30B:
                                                     mon("         STD   $5E02                   ; A30B: FD 5E 02      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e02, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e03, B); 
    PC = 0xA30E; JUMP; // sstep
case 0xA30E:
                                                     mon("         LDU   #$49C2                  ; A30E: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA311; JUMP; // sstep
case 0xA311:
                                                     mon("         LDB   $06,X                   ; A311: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA313; JUMP; // sstep
case 0xA313:
                                                     mon("         LEAU  B,U                     ; A313: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA315; JUMP; // sstep
case 0xA315:
                                                     mon("         LDA   ,U                      ; A315: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA317; JUMP; // sstep
case 0xA317:
                                                     mon("         LDB   $04,X                   ; A317: E6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA319; JUMP; // sstep
case 0xA319:
                                                     mon("         CMPB  #$03                    ; A319: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA31B; JUMP; // sstep
case 0xA31B:
                                                     mon("         BEQ   LA333                   ; A31B: 27 16         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa333; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA31D; JUMP; // sstep
case 0xA31D:
                                                     mon("         BITA  #$04                    ; A31D: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA31F; JUMP; // sstep
case 0xA31F:
                                                     mon("         BNE   LA325                   ; A31F: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa325; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA321; JUMP; // sstep
case 0xA321:
                                                     mon("         BITA  #$10                    ; A321: 85 10         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x10; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA323; JUMP; // sstep
case 0xA323:
                                                     mon("         BNE   LA32E                   ; A323: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa32e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA325; JUMP; // sstep
case 0xA325:
                                                     mon("LA325    LDB   #$0A                    ; A325: C6 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0a; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA327; JUMP; // sstep
case 0xA327:
                                                     mon("         STB   <$DC                    ; A327: D7 DC         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xA329; JUMP; // sstep
case 0xA329:
                                                     mon("         LDD   #$6080                  ; A329: CC 60 80      \n");
    clockticks = clockticks + 3; 
    A = 0x60; 
    B = 0x80; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA32C; JUMP; // sstep
case 0xA32C:
                                                     mon("         BRA   LA331                   ; A32C: 20 03         \n");
    PC = 0xa331; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA32E:
                                                     mon("LA32E    LDD   #$6780                  ; A32E: CC 67 80      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0x80; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA331; JUMP; // sstep
case 0xA331:
                                                     mon("LA331    BRA   LA33F                   ; A331: 20 0C         \n");
    PC = 0xa33f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA333:
                                                     mon("LA333    BITA  #$04                    ; A333: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA335; JUMP; // sstep
case 0xA335:
                                                     mon("         BNE   LA33C                   ; A335: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa33c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA337; JUMP; // sstep
case 0xA337:
                                                     mon("         LDD   #$6460                  ; A337: CC 64 60      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x60; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA33A; JUMP; // sstep
case 0xA33A:
                                                     mon("         BRA   LA33F                   ; A33A: 20 03         \n");
    PC = 0xa33f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA33C:
                                                     mon("LA33C    LDD   #$6080                  ; A33C: CC 60 80      \n");
    clockticks = clockticks + 3; 
    A = 0x60; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA33F; JUMP; // sstep
case 0xA33F:
                                                     mon("LA33F    STD   $5E00                   ; A33F: FD 5E 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e00, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e01, B); 
    PC = 0xA342; JUMP; // sstep
case 0xA342:
                                                     mon("         LDA   #$72                    ; A342: 86 72         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x72; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA344; JUMP; // sstep
case 0xA344:
                                                     mon("         STA   $5E04                   ; A344: B7 5E 04      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x5e04, val); 
    PC = 0xA347; JUMP; // sstep
case 0xA347:
                                                     mon("         LDA   $5000                   ; A347: B6 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5000); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA34A; JUMP; // sstep
case 0xA34A:
                                                     mon("         ASLA                          ; A34A: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xA34B; JUMP; // sstep
case 0xA34B:
                                                     mon("         ASLA                          ; A34B: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xA34C; JUMP; // sstep
case 0xA34C:
                                                     mon("         STA   $5E05                   ; A34C: B7 5E 05      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x5e05, val); 
    PC = 0xA34F; JUMP; // sstep
case 0xA34F:
                                                     mon("         LDB   #$40                    ; A34F: C6 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA351; JUMP; // sstep
case 0xA351:
                                                     mon("         COMA                          ; A351: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xA352; JUMP; // sstep
case 0xA352:
                                                     mon("         MUL                           ; A352: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xA353; JUMP; // sstep
case 0xA353:
                                                     mon("         ADDA  #$40                    ; A353: 8B 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x40; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xA355; JUMP; // sstep
case 0xA355:
                                                     mon("         STA   $5E03                   ; A355: B7 5E 03      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x5e03, val); 
    PC = 0xA358; JUMP; // sstep
case 0xA358:
                                                     mon("         LDD   $5086                   ; A358: FC 50 86      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5086); // Care needed with I/O space and word fetches
    B = rd_mem(0x5087); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA35B; JUMP; // sstep
case 0xA35B:
                                                     mon("         ASLB                          ; A35B: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA35C; JUMP; // sstep
case 0xA35C:
                                                     mon("         ROLA                          ; A35C: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xA35D; JUMP; // sstep
case 0xA35D:
                                                     mon("         ADDD  #$0400                  ; A35D: C3 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA360; JUMP; // sstep
case 0xA360:
                                                     mon("         SUBD  $5000                   ; A360: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA363; JUMP; // sstep
case 0xA363:
                                                     mon("         LBLT  LA3F4                   ; A363: 10 2D 00 8D   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) <  0) {
    clockticks = clockticks + 1; 
    PC = 0xa3f4; 
    JUMP;
    }
    PC = 0xA367; JUMP; // sstep
case 0xA367:
                                                     mon("         LDA   $04,X                   ; A367: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA369; JUMP; // sstep
case 0xA369:
                                                     mon("         CMPA  #$03                    ; A369: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA36B; JUMP; // sstep
case 0xA36B:
                                                     mon("         BEQ   LA3A7                   ; A36B: 27 3A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa3a7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA36D; JUMP; // sstep
case 0xA36D:
                                                     mon("         LDA   <$60                    ; A36D: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA36F; JUMP; // sstep
case 0xA36F:
                                                     mon("         BLT   LA374                   ; A36F: 2D 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa374; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA371; JUMP; // sstep
case 0xA371:
                                                     mon("         JSR   Sound_2C                ; A371: BD BD D0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0xbdd0; 
    JUMP;
  case 0xA374:
                                                     mon("LA374    LDD   $5000                   ; A374: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA377; JUMP; // sstep
case 0xA377:
                                                     mon("         SUBD  #$0200                  ; A377: 83 02 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0200; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA37A; JUMP; // sstep
case 0xA37A:
                                                     mon("         SUBD  $5086                   ; A37A: B3 50 86      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5086)<<8; 
    ea = ea | rd_mem(0x5087); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA37D; JUMP; // sstep
case 0xA37D:
                                                     mon("         BGT   LA3A5                   ; A37D: 2E 26         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa3a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA37F; JUMP; // sstep
case 0xA37F:
                                                     mon("         LDD   #$A018                  ; A37F: CC A0 18      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x18; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA382; JUMP; // sstep
case 0xA382:
                                                     mon("         STD   $5E02                   ; A382: FD 5E 02      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e02, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e03, B); 
    PC = 0xA385; JUMP; // sstep
case 0xA385:
                                                     mon("         LDD   #$6080                  ; A385: CC 60 80      \n");
    clockticks = clockticks + 3; 
    A = 0x60; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA388; JUMP; // sstep
case 0xA388:
                                                     mon("         STD   $5E00                   ; A388: FD 5E 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e00, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e01, B); 
    PC = 0xA38B; JUMP; // sstep
case 0xA38B:
                                                     mon("         LDA   <$60                    ; A38B: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA38D; JUMP; // sstep
case 0xA38D:
                                                     mon("         BLT   LA395                   ; A38D: 2D 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa395; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA38F; JUMP; // sstep
case 0xA38F:
                                                     mon("         JSR   L9874                   ; A38F: BD 98 74      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x92); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0x9874; 
    JUMP;
  case 0xA392:
                                                     mon("LA392    JSR   Sound_26                ; A392: BD BD B2      \n"); // Explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0xbdb2; 
    JUMP;
  case 0xA395:
                                                     mon("LA395    LDA   <$63                    ; A395: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA397; JUMP; // sstep
case 0xA397:
                                                     mon("         BNE   LA39D                   ; A397: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa39d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA399; JUMP; // sstep
case 0xA399:
                                                     mon("         LDA   $5002                   ; A399: B6 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5002); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA39C; JUMP; // sstep
case 0xA39C:
                                                     mon("         NEGA                          ; A39C: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA39D; JUMP; // sstep
case 0xA39D:
                                                     mon("LA39D    LDB   #$20                    ; A39D: C6 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA39F; JUMP; // sstep
case 0xA39F:
                                                     mon("         TSTA                          ; A39F: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA3A0; JUMP; // sstep
case 0xA3A0:
                                                     mon("         BPL   LA3A3                   ; A3A0: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa3a3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3A2; JUMP; // sstep
case 0xA3A2:
                                                     mon("         NEGB                          ; A3A2: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA3A3; JUMP; // sstep
case 0xA3A3:
                                                     mon("LA3A3    STB   <$63                    ; A3A3: D7 63         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0xA3A5; JUMP; // sstep
case 0xA3A5:
                                                     mon("LA3A5    BRA   LA3F4                   ; A3A5: 20 4D         \n");
    PC = 0xa3f4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA3A7:
                                                     mon("LA3A7    LDD   $5044                   ; A3A7: FC 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5044); // Care needed with I/O space and word fetches
    B = rd_mem(0x5045); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA3AA; JUMP; // sstep
case 0xA3AA:
                                                     mon("         SUBD  #$07A0                  ; A3AA: 83 07 A0      \n");
    clockticks = clockticks + 4; 
    val = 0x07a0; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA3AD; JUMP; // sstep
case 0xA3AD:
                                                     mon("         BGT   LA3F4                   ; A3AD: 2E 45         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa3f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3AF; JUMP; // sstep
case 0xA3AF:
                                                     mon("         JSR   Sound_2C                ; A3AF: BD BD D0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0xbdd0; 
    JUMP;
  case 0xA3B2:
                                                     mon("LA3B2    LDX   <$64                    ; A3B2: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA3B4; JUMP; // sstep
case 0xA3B4:
                                                     mon("         LDU   #$49C2                  ; A3B4: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA3B7; JUMP; // sstep
case 0xA3B7:
                                                     mon("         LDB   $06,X                   ; A3B7: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA3B9; JUMP; // sstep
case 0xA3B9:
                                                     mon("         LEAU  B,U                     ; A3B9: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA3BB; JUMP; // sstep
case 0xA3BB:
                                                     mon("         LDA   ,U                      ; A3BB: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA3BD; JUMP; // sstep
case 0xA3BD:
                                                     mon("         BITA  #$04                    ; A3BD: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA3BF; JUMP; // sstep
case 0xA3BF:
                                                     mon("         BNE   LA3F4                   ; A3BF: 26 33         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa3f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3C1; JUMP; // sstep
case 0xA3C1:
                                                     mon("         LDD   $5044                   ; A3C1: FC 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5044); // Care needed with I/O space and word fetches
    B = rd_mem(0x5045); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA3C4; JUMP; // sstep
case 0xA3C4:
                                                     mon("         SUBD  #$05A0                  ; A3C4: 83 05 A0      \n");
    clockticks = clockticks + 4; 
    val = 0x05a0; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA3C7; JUMP; // sstep
case 0xA3C7:
                                                     mon("         BGE   LA3F4                   ; A3C7: 2C 2B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xa3f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3C9; JUMP; // sstep
case 0xA3C9:
                                                     mon("         LDD   $5000                   ; A3C9: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA3CC; JUMP; // sstep
case 0xA3CC:
                                                     mon("         SUBD  #$0400                  ; A3CC: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA3CF; JUMP; // sstep
case 0xA3CF:
                                                     mon("         SUBD  $5086                   ; A3CF: B3 50 86      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5086)<<8; 
    ea = ea | rd_mem(0x5087); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA3D2; JUMP; // sstep
case 0xA3D2:
                                                     mon("         BGT   LA3F4                   ; A3D2: 2E 20         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa3f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3D4; JUMP; // sstep
case 0xA3D4:
                                                     mon("         LDD   #$A018                  ; A3D4: CC A0 18      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x18; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA3D7; JUMP; // sstep
case 0xA3D7:
                                                     mon("         STD   $5E00                   ; A3D7: FD 5E 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5e00, A); // Care needed with I/O space and word fetches
    wr_mem(0x5e01, B); 
    PC = 0xA3DA; JUMP; // sstep
case 0xA3DA:
                                                     mon("         LDA   <$60                    ; A3DA: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA3DC; JUMP; // sstep
case 0xA3DC:
                                                     mon("         BLT   LA3E4                   ; A3DC: 2D 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa3e4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3DE; JUMP; // sstep
case 0xA3DE:
                                                     mon("         JSR   L9874                   ; A3DE: BD 98 74      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0x9874; 
    JUMP;
  case 0xA3E1:
                                                     mon("LA3E1    JSR   Sound_26                ; A3E1: BD BD B2      \n"); // Explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0xbdb2; 
    JUMP;
  case 0xA3E4:
                                                     mon("LA3E4    LDA   <$63                    ; A3E4: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA3E6; JUMP; // sstep
case 0xA3E6:
                                                     mon("         BNE   LA3F4                   ; A3E6: 26 0C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa3f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3E8; JUMP; // sstep
case 0xA3E8:
                                                     mon("         LDA   #$13                    ; A3E8: 86 13         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x13; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA3EA; JUMP; // sstep
case 0xA3EA:
                                                     mon("         LDB   $5002                   ; A3EA: F6 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5002); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA3ED; JUMP; // sstep
case 0xA3ED:
                                                     mon("         BMI   LA3F0                   ; A3ED: 2B 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa3f0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3EF; JUMP; // sstep
case 0xA3EF:
                                                     mon("         NEGA                          ; A3EF: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA3F0; JUMP; // sstep
case 0xA3F0:
                                                     mon("LA3F0    ADDA  <$63                    ; A3F0: 9B 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x63); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xA3F2; JUMP; // sstep
case 0xA3F2:
                                                     mon("         STA   <$63                    ; A3F2: 97 63         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0xA3F4; JUMP; // sstep
case 0xA3F4:
                                                     mon("LA3F4    LDA   $5000                   ; A3F4: B6 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5000); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA3F7; JUMP; // sstep
case 0xA3F7:
                                                     mon("         SUBA  #$08                    ; A3F7: 80 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xA3F9; JUMP; // sstep
case 0xA3F9:
                                                     mon("         BGT   LA400                   ; A3F9: 2E 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa400; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA3FB; JUMP; // sstep
case 0xA3FB:
                                                     mon("         JSR   LCD68                   ; A3FB: BD CD 68      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    PC = 0xcd68; 
    JUMP;
  case 0xA3FE:
                                                     mon("LA3FE    BRA   LA403                   ; A3FE: 20 03         \n");
    PC = 0xa403; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA400:
                                                     mon("LA400    JSR   LCD50                   ; A400: BD CD 50      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x03); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcd50; 
    JUMP;
  case 0xA403:
                                                     mon("LA403    JSR   LCD74                   ; A403: BD CD 74      \n"); // Function select for an object
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x06); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcd74; 
    JUMP;
  case 0xA406:
                                                     mon("LA406    JSR   LA459                   ; A406: BD A4 59      \n"); // Some Towers code
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xa459; 
    JUMP;
    // End of function sub_A2F8
  case 0xA409:
                                                     mon("LA409    RTS                           ; A409: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Some Towers code
  case 0xA40A:
                                                     mon("LA40A    JSR   LCDE7                   ; A40A: BD CD E7      \n"); // Swap Matrix 2  x, y, z to  x, y, z
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcde7; 
    JUMP;
  case 0xA40D:
                                                     mon("LA40D    LDD   #$00                    ; A40D: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA410; JUMP; // sstep
case 0xA410:
                                                     mon("         STD   $5078                   ; A410: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xA413; JUMP; // sstep
case 0xA413:
                                                     mon("         LDD   <$B3                    ; A413: DC B3         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb3); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb4); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA415; JUMP; // sstep
case 0xA415:
                                                     mon("         STD   $507A                   ; A415: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xA418; JUMP; // sstep
case 0xA418:
                                                     mon("         LDD   <$B5                    ; A418: DC B5         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb5); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA41A; JUMP; // sstep
case 0xA41A:
                                                     mon("         STD   $507C                   ; A41A: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xA41D; JUMP; // sstep
case 0xA41D:
                                                     mon("         LDD   #$0F                    ; A41D: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA420; JUMP; // sstep
case 0xA420:
                                                     mon("         STD   $4701                   ; A420: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xA423; JUMP; // sstep
case 0xA423:
                                                     mon("         LDA   #$2A                    ; A423: 86 2A         \n"); // Reg00 = (([BIC,0] - XT) x Ax2)  +  (([BIC,1] - YT) x Bx2)  +  (([BIC,2] - ZT) x Cx2), Reg01 = (([BIC,0] - XT) x Ay2)  +  (([BIC,1] - YT) x By2)  +  (([BIC,2] - ZT) x Cy2), Reg02 = (([BIC,0] - XT) x Az2)  +  (([BIC,1] - YT) x Bz2)  +  (([BIC,2] - ZT) x Cz2), BIC++
    clockticks = clockticks + 2; 
    val = (UINT8)0x2a; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA425; JUMP; // sstep
case 0xA425:
                                                     mon("         JSR   LCDBA                   ; A425: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA428:
                                                     mon("LA428    LDD   $5002                   ; A428: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA42B; JUMP; // sstep
case 0xA42B:
                                                     mon("         STD   $5078                   ; A42B: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xA42E; JUMP; // sstep
case 0xA42E:
                                                     mon("         LDD   $5004                   ; A42E: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA431; JUMP; // sstep
case 0xA431:
                                                     mon("         STD   $507A                   ; A431: FD 50 7A      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xA434; JUMP; // sstep
case 0xA434:
                                                     mon("         BPL   LA455                   ; A434: 2A 1F         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa455; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA436; JUMP; // sstep
case 0xA436:
                                                     mon("         LDA   <$BC                    ; A436: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA438; JUMP; // sstep
case 0xA438:
                                                     mon("         BEQ   LA455                   ; A438: 27 1B         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa455; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA43A; JUMP; // sstep
case 0xA43A:
                                                     mon("         LDA   #$FF                    ; A43A: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA43C; JUMP; // sstep
case 0xA43C:
                                                     mon("         STA   <$BD                    ; A43C: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xA43E; JUMP; // sstep
case 0xA43E:
                                                     mon("         LDA   #$03                    ; A43E: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA440; JUMP; // sstep
case 0xA440:
                                                     mon("         STA   $4B23                   ; A440: B7 4B 23      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b23, val); 
    PC = 0xA443; JUMP; // sstep
case 0xA443:
                                                     mon("         LDD   #$6280                  ; A443: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA446; JUMP; // sstep
case 0xA446:
                                                     mon("         STD   $4B20                   ; A446: FD 4B 20      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b20, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b21, B); 
    PC = 0xA449; JUMP; // sstep
case 0xA449:
                                                     mon("         LDD   $5004                   ; A449: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA44C; JUMP; // sstep
case 0xA44C:
                                                     mon("         LSRA                          ; A44C: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xA44D; JUMP; // sstep
case 0xA44D:
                                                     mon("         RORB                          ; A44D: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA44E; JUMP; // sstep
case 0xA44E:
                                                     mon("         LSRA                          ; A44E: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xA44F; JUMP; // sstep
case 0xA44F:
                                                     mon("         RORB                          ; A44F: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA450; JUMP; // sstep
case 0xA450:
                                                     mon("         ADDB  #$C0                    ; A450: CB C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xc0; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xA452; JUMP; // sstep
case 0xA452:
                                                     mon("         STB   $4B22                   ; A452: F7 4B 22      \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b22, val); 
    PC = 0xA455; JUMP; // sstep
case 0xA455:
                                                     mon("LA455    JSR   LCDE7                   ; A455: BD CD E7      \n"); // Called during towers phase only
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcde7; 
    JUMP;
    // End of function sub_A40A
  case 0xA458:
                                                     mon("LA458    RTS                           ; A458: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Some Towers code
  case 0xA459:
                                                     mon("LA459    LDX   <$64                    ; A459: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA45B; JUMP; // sstep
case 0xA45B:
                                                     mon("         LDD   $507C                   ; A45B: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA45E; JUMP; // sstep
case 0xA45E:
                                                     mon("         ASLB                          ; A45E: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA45F; JUMP; // sstep
case 0xA45F:
                                                     mon("         ROLA                          ; A45F: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xA460; JUMP; // sstep
case 0xA460:
                                                     mon("         STD   $4704                   ; A460: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xA463; JUMP; // sstep
case 0xA463:
                                                     mon("         LDD   $02,X                   ; A463: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA465; JUMP; // sstep
case 0xA465:
                                                     mon("         SUBD  $5042                   ; A465: B3 50 42      \n"); // YT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5042)<<8; 
    ea = ea | rd_mem(0x5043); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA468; JUMP; // sstep
case 0xA468:
                                                     mon("         STD   $5002                   ; A468: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xA46B; JUMP; // sstep
case 0xA46B:
                                                     mon("         LDD   #$00                    ; A46B: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA46E; JUMP; // sstep
case 0xA46E:
                                                     mon("         SUBD  $5044                   ; A46E: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA471; JUMP; // sstep
case 0xA471:
                                                     mon("         STD   $5004                   ; A471: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xA474; JUMP; // sstep
case 0xA474:
                                                     mon("         LDD   $4700                   ; A474: FC 47 00      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4700); // Care needed with I/O space and word fetches
    B = rd_mem(0x4701); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA477; JUMP; // sstep
case 0xA477:
                                                     mon("         STD   $5000                   ; A477: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xA47A; JUMP; // sstep
case 0xA47A:
                                                     mon("         LDA   #$86                    ; A47A: 86 86         \n"); // MReg02 = MReg02 x MReg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA47C; JUMP; // sstep
case 0xA47C:
                                                     mon("         JSR   LCDBA                   ; A47C: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA47F:
                                                     mon("LA47F    LDD   $5002                   ; A47F: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA482; JUMP; // sstep
case 0xA482:
                                                     mon("         STD   $501A                   ; A482: FD 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x501a, A); // Care needed with I/O space and word fetches
    wr_mem(0x501b, B); 
    PC = 0xA485; JUMP; // sstep
case 0xA485:
                                                     mon("         LDD   $5004                   ; A485: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA488; JUMP; // sstep
case 0xA488:
                                                     mon("         STD   $501C                   ; A488: FD 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x501c, A); // Care needed with I/O space and word fetches
    wr_mem(0x501d, B); 
    PC = 0xA48B; JUMP; // sstep
case 0xA48B:
                                                     mon("         LDA   $04,X                   ; A48B: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA48D; JUMP; // sstep
case 0xA48D:
                                                     mon("         CMPA  #$03                    ; A48D: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA48F; JUMP; // sstep
case 0xA48F:
                                                     mon("         BEQ   LA49F                   ; A48F: 27 0E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa49f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA491; JUMP; // sstep
case 0xA491:
                                                     mon("         LDD   #$03C0                  ; A491: CC 03 C0      \n");
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA494; JUMP; // sstep
case 0xA494:
                                                     mon("         STD   $5002                   ; A494: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xA497; JUMP; // sstep
case 0xA497:
                                                     mon("         LDD   #$5280                  ; A497: CC 52 80      \n");
    clockticks = clockticks + 3; 
    A = 0x52; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA49A; JUMP; // sstep
case 0xA49A:
                                                     mon("         STD   $5004                   ; A49A: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xA49D; JUMP; // sstep
case 0xA49D:
                                                     mon("         BRA   LA4BA                   ; A49D: 20 1B         \n");
    PC = 0xa4ba; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA49F:
                                                     mon("LA49F    LDU   #$49C2                  ; A49F: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA4A2; JUMP; // sstep
case 0xA4A2:
                                                     mon("         LDB   $06,X                   ; A4A2: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA4A4; JUMP; // sstep
case 0xA4A4:
                                                     mon("         LEAU  B,U                     ; A4A4: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA4A6; JUMP; // sstep
case 0xA4A6:
                                                     mon("         LDA   ,U                      ; A4A6: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA4A8; JUMP; // sstep
case 0xA4A8:
                                                     mon("         BITA  #$04                    ; A4A8: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA4AA; JUMP; // sstep
case 0xA4AA:
                                                     mon("         LBNE  locret_A54A             ; A4AA: 10 26 00 9C   \n");
    clockticks = clockticks + 5; 
    if (Z) {
    clockticks = clockticks + 1; 
    PC = 0xa54a; 
    JUMP;
    }
    PC = 0xA4AE; JUMP; // sstep
case 0xA4AE:
                                                     mon("         LDD   #$0690                  ; A4AE: CC 06 90      \n");
    clockticks = clockticks + 3; 
    A = 0x06; 
    B = 0x90; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4B1; JUMP; // sstep
case 0xA4B1:
                                                     mon("         STD   $5002                   ; A4B1: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xA4B4; JUMP; // sstep
case 0xA4B4:
                                                     mon("         LDD   #$05A0                  ; A4B4: CC 05 A0      \n");
    clockticks = clockticks + 3; 
    A = 0x05; 
    B = 0xa0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4B7; JUMP; // sstep
case 0xA4B7:
                                                     mon("         STD   $5004                   ; A4B7: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xA4BA; JUMP; // sstep
case 0xA4BA:
                                                     mon("LA4BA    LDD   $5000                   ; A4BA: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4BD; JUMP; // sstep
case 0xA4BD:
                                                     mon("         SUBD  #$0100                  ; A4BD: 83 01 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0100; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA4C0; JUMP; // sstep
case 0xA4C0:
                                                     mon("         BPL   LA4C5                   ; A4C0: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa4c5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA4C2; JUMP; // sstep
case 0xA4C2:
                                                     mon("         LDD   #$00                    ; A4C2: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4C5; JUMP; // sstep
case 0xA4C5:
                                                     mon("LA4C5    STD   $5000                   ; A4C5: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xA4C8; JUMP; // sstep
case 0xA4C8:
                                                     mon("         LDA   #$86                    ; A4C8: 86 86         \n"); // MReg02 = MReg02 x MReg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA4CA; JUMP; // sstep
case 0xA4CA:
                                                     mon("         JSR   LCDBA                   ; A4CA: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA4CD:
                                                     mon("LA4CD    LDD   $501A                   ; A4CD: FC 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501a); // Care needed with I/O space and word fetches
    B = rd_mem(0x501b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4D0; JUMP; // sstep
case 0xA4D0:
                                                     mon("         ADDD  $5002                   ; A4D0: F3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA4D3; JUMP; // sstep
case 0xA4D3:
                                                     mon("         ADDD  #$0A                    ; A4D3: C3 00 0A      \n");
    clockticks = clockticks + 4; 
    val = 0x000a; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA4D6; JUMP; // sstep
case 0xA4D6:
                                                     mon("         SUBD  $5078                   ; A4D6: B3 50 78      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5078)<<8; 
    ea = ea | rd_mem(0x5079); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA4D9; JUMP; // sstep
case 0xA4D9:
                                                     mon("         LBLT  locret_A54A             ; A4D9: 10 2D 00 6D   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) <  0) {
    clockticks = clockticks + 1; 
    PC = 0xa54a; 
    JUMP;
    }
    PC = 0xA4DD; JUMP; // sstep
case 0xA4DD:
                                                     mon("         ASRA                          ; A4DD: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA4DE; JUMP; // sstep
case 0xA4DE:
                                                     mon("         RORB                          ; A4DE: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA4DF; JUMP; // sstep
case 0xA4DF:
                                                     mon("         SUBD  #$0A                    ; A4DF: 83 00 0A      \n");
    clockticks = clockticks + 4; 
    val = 0x000a; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA4E2; JUMP; // sstep
case 0xA4E2:
                                                     mon("         SUBD  $5002                   ; A4E2: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA4E5; JUMP; // sstep
case 0xA4E5:
                                                     mon("         LBGT  locret_A54A             ; A4E5: 10 2E 00 61   \n");
    clockticks = clockticks + 5; 
    if (((SINT8)(N^V) >= 0) && Z) {
    clockticks = clockticks + 1; 
    PC = 0xa54a; 
    JUMP;
    }
    PC = 0xA4E9; JUMP; // sstep
case 0xA4E9:
                                                     mon("         LDD   $507A                   ; A4E9: FC 50 7A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507a); // Care needed with I/O space and word fetches
    B = rd_mem(0x507b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4EC; JUMP; // sstep
case 0xA4EC:
                                                     mon("         SUBD  $501C                   ; A4EC: B3 50 1C      \n"); // ZT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x501c)<<8; 
    ea = ea | rd_mem(0x501d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA4EF; JUMP; // sstep
case 0xA4EF:
                                                     mon("         BMI   locret_A54A             ; A4EF: 2B 59         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa54a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA4F1; JUMP; // sstep
case 0xA4F1:
                                                     mon("         SUBD  $5004                   ; A4F1: B3 50 04      \n"); // Math result Z
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5004)<<8; 
    ea = ea | rd_mem(0x5005); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA4F4; JUMP; // sstep
case 0xA4F4:
                                                     mon("         BGT   locret_A54A             ; A4F4: 2E 54         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa54a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA4F6; JUMP; // sstep
case 0xA4F6:
                                                     mon("         LDA   $04,X                   ; A4F6: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA4F8; JUMP; // sstep
case 0xA4F8:
                                                     mon("         CMPA  #$03                    ; A4F8: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA4FA; JUMP; // sstep
case 0xA4FA:
                                                     mon("         BNE   LA50A                   ; A4FA: 26 0E         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa50a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA4FC; JUMP; // sstep
case 0xA4FC:
                                                     mon("         LDD   $507C                   ; A4FC: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA4FF; JUMP; // sstep
case 0xA4FF:
                                                     mon("         CMPD  <$C8                    ; A4FF: 10 93 C8      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc8)<<8; 
    ea = ea | rd_mem(DP|0xc9); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xA502; JUMP; // sstep
case 0xA502:
                                                     mon("         BCC   LA508                   ; A502: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa508; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA504; JUMP; // sstep
case 0xA504:
                                                     mon("         STD   <$C8                    ; A504: DD C8         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc8; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA506; JUMP; // sstep
case 0xA506:
                                                     mon("         STX   <$C6                    ; A506: 9F C6         \n");
    clockticks = clockticks + 4; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = DP|0xc6; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA508; JUMP; // sstep
case 0xA508:
                                                     mon("LA508    BRA   locret_A54A             ; A508: 20 40         \n");
    PC = 0xa54a; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA50A:
                                                     mon("LA50A    LDD   #$4CE0                  ; A50A: CC 4C E0      \n");
    clockticks = clockticks + 3; 
    A = 0x4c; 
    B = 0xe0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA50D; JUMP; // sstep
case 0xA50D:
                                                     mon("         STD   $5002                   ; A50D: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xA510; JUMP; // sstep
case 0xA510:
                                                     mon("         LDA   #$86                    ; A510: 86 86         \n"); // MReg02 = MReg02 x MReg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA512; JUMP; // sstep
case 0xA512:
                                                     mon("         JSR   LCDBA                   ; A512: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x15); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA515:
                                                     mon("LA515    LDD   $507A                   ; A515: FC 50 7A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507a); // Care needed with I/O space and word fetches
    B = rd_mem(0x507b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA518; JUMP; // sstep
case 0xA518:
                                                     mon("         ADDD  #$0A                    ; A518: C3 00 0A      \n");
    clockticks = clockticks + 4; 
    val = 0x000a; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA51B; JUMP; // sstep
case 0xA51B:
                                                     mon("         SUBD  $501C                   ; A51B: B3 50 1C      \n"); // ZT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x501c)<<8; 
    ea = ea | rd_mem(0x501d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA51E; JUMP; // sstep
case 0xA51E:
                                                     mon("         SUBD  $5002                   ; A51E: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA521; JUMP; // sstep
case 0xA521:
                                                     mon("         BLT   LA53E                   ; A521: 2D 1B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa53e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA523; JUMP; // sstep
case 0xA523:
                                                     mon("         LDU   #$49C2                  ; A523: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA526; JUMP; // sstep
case 0xA526:
                                                     mon("         LDB   $06,X                   ; A526: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA528; JUMP; // sstep
case 0xA528:
                                                     mon("         LEAU  B,U                     ; A528: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA52A; JUMP; // sstep
case 0xA52A:
                                                     mon("         LDA   ,U                      ; A52A: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA52C; JUMP; // sstep
case 0xA52C:
                                                     mon("         BITA  #$04                    ; A52C: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA52E; JUMP; // sstep
case 0xA52E:
                                                     mon("         BNE   locret_A54A             ; A52E: 26 1A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa54a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA530; JUMP; // sstep
case 0xA530:
                                                     mon("         LDD   $507C                   ; A530: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA533; JUMP; // sstep
case 0xA533:
                                                     mon("         CMPD  <$C8                    ; A533: 10 93 C8      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc8)<<8; 
    ea = ea | rd_mem(DP|0xc9); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xA536; JUMP; // sstep
case 0xA536:
                                                     mon("         BCC   LA53C                   ; A536: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa53c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA538; JUMP; // sstep
case 0xA538:
                                                     mon("         STD   <$C8                    ; A538: DD C8         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc8; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA53A; JUMP; // sstep
case 0xA53A:
                                                     mon("         STX   <$C6                    ; A53A: 9F C6         \n");
    clockticks = clockticks + 4; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = DP|0xc6; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA53C; JUMP; // sstep
case 0xA53C:
                                                     mon("LA53C    BRA   locret_A54A             ; A53C: 20 0C         \n");
    PC = 0xa54a; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA53E:
                                                     mon("LA53E    LDD   $507C                   ; A53E: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA541; JUMP; // sstep
case 0xA541:
                                                     mon("         CMPD  <$D0                    ; A541: 10 93 D0      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xd0)<<8; 
    ea = ea | rd_mem(DP|0xd1); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xA544; JUMP; // sstep
case 0xA544:
                                                     mon("         BCC   locret_A54A             ; A544: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa54a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA546; JUMP; // sstep
case 0xA546:
                                                     mon("         STD   <$D0                    ; A546: DD D0         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xd0; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA548; JUMP; // sstep
case 0xA548:
                                                     mon("         STX   <$CE                    ; A548: 9F CE         \n");
    clockticks = clockticks + 4; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = DP|0xce; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_A459
    PC = 0xA54A; JUMP; // sstep
case 0xA54A:
                                                     mon("locret_A54A RTS                           ; A54A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_B2D2
  case 0xA54B:
                                                     mon("LA54B    LDX   <$C6                    ; A54B: 9E C6         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc6)<<8; 
    ea = ea | rd_mem(DP|0xc7); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA54D; JUMP; // sstep
case 0xA54D:
                                                     mon("         LDD   ,X                      ; A54D: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA54F; JUMP; // sstep
case 0xA54F:
                                                     mon("         SUBD  $5098                   ; A54F: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA552; JUMP; // sstep
case 0xA552:
                                                     mon("         ANDA  #$7F                    ; A552: 84 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x7f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA554; JUMP; // sstep
case 0xA554:
                                                     mon("         ADDD  $5098                   ; A554: F3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA557; JUMP; // sstep
case 0xA557:
                                                     mon("         STD   $5018                   ; A557: FD 50 18      \n"); // XT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5018, A); // Care needed with I/O space and word fetches
    wr_mem(0x5019, B); 
    PC = 0xA55A; JUMP; // sstep
case 0xA55A:
                                                     mon("         LDD   $02,X                   ; A55A: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA55C; JUMP; // sstep
case 0xA55C:
                                                     mon("         STD   $501A                   ; A55C: FD 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x501a, A); // Care needed with I/O space and word fetches
    wr_mem(0x501b, B); 
    PC = 0xA55F; JUMP; // sstep
case 0xA55F:
                                                     mon("         LDU   #$49C2                  ; A55F: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA562; JUMP; // sstep
case 0xA562:
                                                     mon("         LDB   $06,X                   ; A562: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA564; JUMP; // sstep
case 0xA564:
                                                     mon("         LEAU  B,U                     ; A564: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA566; JUMP; // sstep
case 0xA566:
                                                     mon("         LDA   ,U                      ; A566: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA568; JUMP; // sstep
case 0xA568:
                                                     mon("         ORA   #$04                    ; A568: 8A 04         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x04; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA56A; JUMP; // sstep
case 0xA56A:
                                                     mon("         STA   ,U                      ; A56A: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA56C; JUMP; // sstep
case 0xA56C:
                                                     mon("         LDA   $04,X                   ; A56C: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA56E; JUMP; // sstep
case 0xA56E:
                                                     mon("         CMPA  #$03                    ; A56E: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA570; JUMP; // sstep
case 0xA570:
                                                     mon("         BNE   LA580                   ; A570: 26 0E         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa580; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA572; JUMP; // sstep
case 0xA572:
                                                     mon("         LDD   #$02D0                  ; A572: CC 02 D0      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0xd0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA575; JUMP; // sstep
case 0xA575:
                                                     mon("         STD   $501C                   ; A575: FD 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x501c, A); // Care needed with I/O space and word fetches
    wr_mem(0x501d, B); 
    PC = 0xA578; JUMP; // sstep
case 0xA578:
                                                     mon("         JSR   LB852                   ; A578: BD B8 52      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xb852; 
    JUMP;
  case 0xA57B:
                                                     mon("LA57B    JSR   L97F7                   ; A57B: BD 97 F7      \n"); // Laser tower score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0x97f7; 
    JUMP;
  case 0xA57E:
                                                     mon("LA57E    BRA   LA58C                   ; A57E: 20 0C         \n");
    PC = 0xa58c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA580:
                                                     mon("LA580    LDD   #$5460                  ; A580: CC 54 60      \n");
    clockticks = clockticks + 3; 
    A = 0x54; 
    B = 0x60; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA583; JUMP; // sstep
case 0xA583:
                                                     mon("         STD   $501C                   ; A583: FD 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x501c, A); // Care needed with I/O space and word fetches
    wr_mem(0x501d, B); 
    PC = 0xA586; JUMP; // sstep
case 0xA586:
                                                     mon("         JSR   LB85E                   ; A586: BD B8 5E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xb85e; 
    JUMP;
  case 0xA589:
                                                     mon("LA589    JSR   L973A                   ; A589: BD 97 3A      \n"); // Towers incrementing score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0x973a; 
    JUMP;
  case 0xA58C:
                                                     mon("LA58C    JSR   Sound_35                ; A58C: BD BD FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xbdfd; 
    JUMP;
    // END OF FUNCTION CHUNK FOR sub_B2D2
    // ---------------------------------------------------------------------------
  case 0xA58F:
                                                     mon("LA58F    RTS                           ; A58F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // FUNCTION CHUNK AT ROM:A728 SIZE 0000008E BYTES
  case 0xA591:
                                                     mon("LA591    LDA   <$60                    ; A591: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA593; JUMP; // sstep
case 0xA593:
                                                     mon("         BLT   locret_A5B2             ; A593: 2D 1D         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa5b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA595; JUMP; // sstep
case 0xA595:
                                                     mon("         LDX   <$64                    ; A595: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA597; JUMP; // sstep
case 0xA597:
                                                     mon("         LDU   #$49C2                  ; A597: CE 49 C2      \n"); // Tie fighter data 1
    clockticks = clockticks + 3; 
    U = 0x49c2; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA59A; JUMP; // sstep
case 0xA59A:
                                                     mon("         LDB   $06,X                   ; A59A: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA59C; JUMP; // sstep
case 0xA59C:
                                                     mon("         LEAU  B,U                     ; A59C: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xA59E; JUMP; // sstep
case 0xA59E:
                                                     mon("         LDA   ,U                      ; A59E: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA5A0; JUMP; // sstep
case 0xA5A0:
                                                     mon("         BITA  #$04                    ; A5A0: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA5A2; JUMP; // sstep
case 0xA5A2:
                                                     mon("         BNE   locret_A5B2             ; A5A2: 26 0E         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa5b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA5A4; JUMP; // sstep
case 0xA5A4:
                                                     mon("         LDA   $04,X                   ; A5A4: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA5A6; JUMP; // sstep
case 0xA5A6:
                                                     mon("         CMPA  #$02                    ; A5A6: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA5A8; JUMP; // sstep
case 0xA5A8:
                                                     mon("         LBEQ  LA608                   ; A5A8: 10 27 00 5C   \n");
    clockticks = clockticks + 5; 
    if (!Z) {
    clockticks = clockticks + 1; 
    PC = 0xa608; 
    JUMP;
    }
    PC = 0xA5AC; JUMP; // sstep
case 0xA5AC:
                                                     mon("         LBHI  LA655                   ; A5AC: 10 22 00 A5   \n");
    clockticks = clockticks + 5; 
    if (Z && (!C)) {
    clockticks = clockticks + 1; 
    PC = 0xa655; 
    JUMP;
    }
    PC = 0xA5B0; JUMP; // sstep
case 0xA5B0:
                                                     mon("         BRA   LA5B3                   ; A5B0: 20 01         \n");
    PC = 0xa5b3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA5B2:
                                                     mon("locret_A5B2 RTS                           ; A5B2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA5B3:
                                                     mon("LA5B3    LDD   #$4000                  ; A5B3: CC 40 00      \n");
    clockticks = clockticks + 3; 
    A = 0x40; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA5B6; JUMP; // sstep
case 0xA5B6:
                                                     mon("         SUBD  $507C                   ; A5B6: B3 50 7C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x507c)<<8; 
    ea = ea | rd_mem(0x507d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA5B9; JUMP; // sstep
case 0xA5B9:
                                                     mon("         ASLB                          ; A5B9: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA5BA; JUMP; // sstep
case 0xA5BA:
                                                     mon("         ROLA                          ; A5BA: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xA5BB; JUMP; // sstep
case 0xA5BB:
                                                     mon("         STD   $5000                   ; A5BB: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xA5BE; JUMP; // sstep
case 0xA5BE:
                                                     mon("         LDD   #$2940                  ; A5BE: CC 29 40      \n");
    clockticks = clockticks + 3; 
    A = 0x29; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA5C1; JUMP; // sstep
case 0xA5C1:
                                                     mon("         STD   $5004                   ; A5C1: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xA5C4; JUMP; // sstep
case 0xA5C4:
                                                     mon("         LDD   #$02D0                  ; A5C4: CC 02 D0      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0xd0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA5C7; JUMP; // sstep
case 0xA5C7:
                                                     mon("         STD   $5002                   ; A5C7: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xA5CA; JUMP; // sstep
case 0xA5CA:
                                                     mon("         LDA   #$86                    ; A5CA: 86 86         \n"); // MReg02 = MReg02 x MReg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA5CC; JUMP; // sstep
case 0xA5CC:
                                                     mon("         JSR   LCDBA                   ; A5CC: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA5CF:
                                                     mon("LA5CF    LDD   $5004                   ; A5CF: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA5D2; JUMP; // sstep
case 0xA5D2:
                                                     mon("         SUBD  $5044                   ; A5D2: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA5D5; JUMP; // sstep
case 0xA5D5:
                                                     mon("         BGE   LA5DE                   ; A5D5: 2C 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xa5de; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA5D7; JUMP; // sstep
case 0xA5D7:
                                                     mon("         LDA   ,U                      ; A5D7: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA5D9; JUMP; // sstep
case 0xA5D9:
                                                     mon("         ORA   #$08                    ; A5D9: 8A 08         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x08; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA5DB; JUMP; // sstep
case 0xA5DB:
                                                     mon("         STA   ,U                      ; A5DB: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA5DD; JUMP; // sstep
case 0xA5DD:
                                                     mon("         RTS                           ; A5DD: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA5DE:
                                                     mon("LA5DE    SUBD  $5002                   ; A5DE: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA5E1; JUMP; // sstep
case 0xA5E1:
                                                     mon("         BLE   LA5E9                   ; A5E1: 2F 06         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa5e9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA5E3; JUMP; // sstep
case 0xA5E3:
                                                     mon("         LDA   ,U                      ; A5E3: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA5E5; JUMP; // sstep
case 0xA5E5:
                                                     mon("         BITA  #$08                    ; A5E5: 85 08         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x08; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA5E7; JUMP; // sstep
case 0xA5E7:
                                                     mon("         BEQ   locret_A607             ; A5E7: 27 1E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa607; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA5E9; JUMP; // sstep
case 0xA5E9:
                                                     mon("LA5E9    LDA   ,U                      ; A5E9: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA5EB; JUMP; // sstep
case 0xA5EB:
                                                     mon("         ANDA  #$F7                    ; A5EB: 84 F7         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf7; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA5ED; JUMP; // sstep
case 0xA5ED:
                                                     mon("         STA   ,U                      ; A5ED: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA5EF; JUMP; // sstep
case 0xA5EF:
                                                     mon("         LDA   $4703                   ; A5EF: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA5F2; JUMP; // sstep
case 0xA5F2:
                                                     mon("         BPL   LA5F7                   ; A5F2: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa5f7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA5F4; JUMP; // sstep
case 0xA5F4:
                                                     mon("         JSR   LA7B6                   ; A5F4: BD A7 B6      \n"); // Emit fireballs from towers/bunkers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xa7b6; 
    JUMP;
  case 0xA5F7:
                                                     mon("LA5F7    LDA   $4703                   ; A5F7: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA5FA; JUMP; // sstep
case 0xA5FA:
                                                     mon("         BPL   LA5FF                   ; A5FA: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa5ff; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA5FC; JUMP; // sstep
case 0xA5FC:
                                                     mon("         JSR   LA7C8                   ; A5FC: BD A7 C8      \n"); // Emit fireballs from towers/bunkers 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xff); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    PC = 0xa7c8; 
    JUMP;
  case 0xA5FF:
                                                     mon("LA5FF    LDA   $4703                   ; A5FF: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA602; JUMP; // sstep
case 0xA602:
                                                     mon("         BPL   locret_A607             ; A602: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa607; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA604; JUMP; // sstep
case 0xA604:
                                                     mon("         JSR   LA7BF                   ; A604: BD A7 BF      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    PC = 0xa7bf; 
    JUMP;
  case 0xA607:
                                                     mon("locret_A607 RTS                           ; A607: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA608:
                                                     mon("LA608    LDD   #$4000                  ; A608: CC 40 00      \n");
    clockticks = clockticks + 3; 
    A = 0x40; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA60B; JUMP; // sstep
case 0xA60B:
                                                     mon("         SUBD  $507C                   ; A60B: B3 50 7C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x507c)<<8; 
    ea = ea | rd_mem(0x507d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA60E; JUMP; // sstep
case 0xA60E:
                                                     mon("         ASLB                          ; A60E: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA60F; JUMP; // sstep
case 0xA60F:
                                                     mon("         ROLA                          ; A60F: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xA610; JUMP; // sstep
case 0xA610:
                                                     mon("         STD   $5000                   ; A610: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xA613; JUMP; // sstep
case 0xA613:
                                                     mon("         LDD   #$2940                  ; A613: CC 29 40      \n");
    clockticks = clockticks + 3; 
    A = 0x29; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA616; JUMP; // sstep
case 0xA616:
                                                     mon("         STD   $5004                   ; A616: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xA619; JUMP; // sstep
case 0xA619:
                                                     mon("         LDD   #$02D0                  ; A619: CC 02 D0      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0xd0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA61C; JUMP; // sstep
case 0xA61C:
                                                     mon("         STD   $5002                   ; A61C: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xA61F; JUMP; // sstep
case 0xA61F:
                                                     mon("         LDA   #$86                    ; A61F: 86 86         \n"); // MReg02 = MReg02 x MReg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA621; JUMP; // sstep
case 0xA621:
                                                     mon("         JSR   LCDBA                   ; A621: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x24); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xA624:
                                                     mon("LA624    LDD   $5004                   ; A624: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA627; JUMP; // sstep
case 0xA627:
                                                     mon("         SUBD  $5044                   ; A627: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA62A; JUMP; // sstep
case 0xA62A:
                                                     mon("         BGE   LA633                   ; A62A: 2C 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xa633; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA62C; JUMP; // sstep
case 0xA62C:
                                                     mon("         LDA   ,U                      ; A62C: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA62E; JUMP; // sstep
case 0xA62E:
                                                     mon("         ORA   #$08                    ; A62E: 8A 08         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x08; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA630; JUMP; // sstep
case 0xA630:
                                                     mon("         STA   ,U                      ; A630: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA632; JUMP; // sstep
case 0xA632:
                                                     mon("         RTS                           ; A632: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA633:
                                                     mon("LA633    SUBD  $5002                   ; A633: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA636; JUMP; // sstep
case 0xA636:
                                                     mon("         BLE   LA63E                   ; A636: 2F 06         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa63e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA638; JUMP; // sstep
case 0xA638:
                                                     mon("         LDA   ,U                      ; A638: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA63A; JUMP; // sstep
case 0xA63A:
                                                     mon("         BITA  #$08                    ; A63A: 85 08         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x08; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA63C; JUMP; // sstep
case 0xA63C:
                                                     mon("         BEQ   locret_A654             ; A63C: 27 16         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa654; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA63E; JUMP; // sstep
case 0xA63E:
                                                     mon("LA63E    LDA   ,U                      ; A63E: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA640; JUMP; // sstep
case 0xA640:
                                                     mon("         ANDA  #$F7                    ; A640: 84 F7         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf7; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA642; JUMP; // sstep
case 0xA642:
                                                     mon("         STA   ,U                      ; A642: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xA644; JUMP; // sstep
case 0xA644:
                                                     mon("         LDA   $4703                   ; A644: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA647; JUMP; // sstep
case 0xA647:
                                                     mon("         BPL   LA64C                   ; A647: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa64c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA649; JUMP; // sstep
case 0xA649:
                                                     mon("         JSR   LA7C8                   ; A649: BD A7 C8      \n"); // Emit fireballs from towers/bunkers 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    PC = 0xa7c8; 
    JUMP;
  case 0xA64C:
                                                     mon("LA64C    LDA   $4703                   ; A64C: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA64F; JUMP; // sstep
case 0xA64F:
                                                     mon("         BPL   locret_A654             ; A64F: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa654; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA651; JUMP; // sstep
case 0xA651:
                                                     mon("         JSR   LA7BF                   ; A651: BD A7 BF      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x54); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    PC = 0xa7bf; 
    JUMP;
  case 0xA654:
                                                     mon("locret_A654 RTS                           ; A654: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA655:
                                                     mon("LA655    LDA   #$40                    ; A655: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA657; JUMP; // sstep
case 0xA657:
                                                     mon("         SUBA  $507C                   ; A657: B0 50 7C      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x507c); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xA65A; JUMP; // sstep
case 0xA65A:
                                                     mon("         CMPA  $4703                   ; A65A: B1 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4703); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA65D; JUMP; // sstep
case 0xA65D:
                                                     mon("         BCS   locret_A674             ; A65D: 25 15         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa674; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA65F; JUMP; // sstep
case 0xA65F:
                                                     mon("         LDA   $4703                   ; A65F: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA662; JUMP; // sstep
case 0xA662:
                                                     mon("         CMPA  #$50                    ; A662: 81 50         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x50; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA664; JUMP; // sstep
case 0xA664:
                                                     mon("         BCC   LA669                   ; A664: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa669; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA666; JUMP; // sstep
case 0xA666:
                                                     mon("         JMP   LA728                   ; A666: 7E A7 28      \n");
    clockticks = clockticks + 4; 
    PC = 0xa728; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA669:
                                                     mon("LA669    LDA   $4703                   ; A669: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA66C; JUMP; // sstep
case 0xA66C:
                                                     mon("         BPL   LA671                   ; A66C: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa671; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA66E; JUMP; // sstep
case 0xA66E:
                                                     mon("         JMP   LA728                   ; A66E: 7E A7 28      \n");
    clockticks = clockticks + 4; 
    PC = 0xa728; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA671:
                                                     mon("LA671    JMP   LA728                   ; A671: 7E A7 28      \n");
    clockticks = clockticks + 4; 
    PC = 0xa728; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // End of function sub_A591
    // ---------------------------------------------------------------------------
  case 0xA674:
                                                     mon("locret_A674 RTS                           ; A674: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Emit fireballs from tie fighters
  case 0xA68B:
                                                     mon("LA68B    STU   <$A8                    ; A68B: DF A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xa8; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA68D; JUMP; // sstep
case 0xA68D:
                                                     mon("         LDB   #$40                    ; A68D: C6 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA68F; JUMP; // sstep
case 0xA68F:
                                                     mon("         STB   $05,U                   ; A68F: E7 45         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xA691; JUMP; // sstep
case 0xA691:
                                                     mon("         LDB   #$01                    ; A691: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA693; JUMP; // sstep
case 0xA693:
                                                     mon("         STB   $03,U                   ; A693: E7 43         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA695; JUMP; // sstep
case 0xA695:
                                                     mon("         LDB   #$01                    ; A695: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA697; JUMP; // sstep
case 0xA697:
                                                     mon("         STB   $04,U                   ; A697: E7 44         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xA699; JUMP; // sstep
case 0xA699:
                                                     mon("         LDA   $4B3C                   ; A699: B6 4B 3C      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3c); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA69C; JUMP; // sstep
case 0xA69C:
                                                     mon("         BLE   LA6AB                   ; A69C: 2F 0D         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa6ab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA69E; JUMP; // sstep
case 0xA69E:
                                                     mon("         CPX   $4B32                   ; A69E: BC 4B 32      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b32)<<8; 
    ea = ea | rd_mem(0x4b33); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA6A1; JUMP; // sstep
case 0xA6A1:
                                                     mon("         BNE   LA6AB                   ; A6A1: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa6ab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA6A3; JUMP; // sstep
case 0xA6A3:
                                                     mon("         DEC   $4B3C                   ; A6A3: 7A 4B 3C      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3c); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4b3c, res); 
    clockticks = clockticks + 2; 
    PC = 0xA6A6; JUMP; // sstep
case 0xA6A6:
                                                     mon("         BNE   LA6AB                   ; A6A6: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa6ab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA6A8; JUMP; // sstep
case 0xA6A8:
                                                     mon("         JSR   Sound_12                ; A6A8: BD BD 4E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    PC = 0xbd4e; 
    JUMP;
  case 0xA6AB:
                                                     mon("LA6AB    LDU   ,U                      ; A6AB: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA6AD; JUMP; // sstep
case 0xA6AD:
                                                     mon("         LDX   ,X                      ; A6AD: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA6AF; JUMP; // sstep
case 0xA6AF:
                                                     mon("         LDD   $08,X                   ; A6AF: EC 08         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA6B1; JUMP; // sstep
case 0xA6B1:
                                                     mon("         SUBD  $5098                   ; A6B1: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA6B4; JUMP; // sstep
case 0xA6B4:
                                                     mon("         STD   ,U                      ; A6B4: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA6B6; JUMP; // sstep
case 0xA6B6:
                                                     mon("         LDD   $0A,X                   ; A6B6: EC 0A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x000a); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA6B8; JUMP; // sstep
case 0xA6B8:
                                                     mon("         SUBD  $509A                   ; A6B8: B3 50 9A      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA6BB; JUMP; // sstep
case 0xA6BB:
                                                     mon("         STD   $02,U                   ; A6BB: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA6BD; JUMP; // sstep
case 0xA6BD:
                                                     mon("         LDD   $0C,X                   ; A6BD: EC 0C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x000c); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA6BF; JUMP; // sstep
case 0xA6BF:
                                                     mon("         SUBD  $509C                   ; A6BF: B3 50 9C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509c)<<8; 
    ea = ea | rd_mem(0x509d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA6C2; JUMP; // sstep
case 0xA6C2:
                                                     mon("         STD   $04,U                   ; A6C2: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA6C4; JUMP; // sstep
case 0xA6C4:
                                                     mon("         JSR   Sound_36                ; A6C4: BD BE 02      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    PC = 0xbe02; 
    JUMP;
    // End of function sub_A68B
    // ---------------------------------------------------------------------------
  case 0xA6C7:
                                                     mon("LA6C7    RTS                           ; A6C7: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Emit fireballs from towers 4
  case 0xA6E0:
                                                     mon("LA6E0    LDB   $4B19                   ; A6E0: F6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA6E3; JUMP; // sstep
case 0xA6E3:
                                                     mon("         CMPB  #$0C                    ; A6E3: C1 0C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x0c; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA6E5; JUMP; // sstep
case 0xA6E5:
                                                     mon("         BCS   LA6EC                   ; A6E5: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa6ec; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA6E7; JUMP; // sstep
case 0xA6E7:
                                                     mon("         LDX   #off_A6DE               ; A6E7: 8E A6 DE      \n");
    clockticks = clockticks + 3; 
    X = 0xa6de; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xA6EA; JUMP; // sstep
case 0xA6EA:
                                                     mon("         BRA   LA6F2                   ; A6EA: 20 06         \n");
    PC = 0xa6f2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA6EC:
                                                     mon("LA6EC    ASLB                          ; A6EC: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA6ED; JUMP; // sstep
case 0xA6ED:
                                                     mon("         LDX   #off_A6C8               ; A6ED: 8E A6 C8      \n");
    clockticks = clockticks + 3; 
    X = 0xa6c8; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA6F0; JUMP; // sstep
case 0xA6F0:
                                                     mon("         LDX   B,X                     ; A6F0: AE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    // End of function sub_A6E0
    PC = 0xA6F2; JUMP; // sstep
case 0xA6F2:
                                                     mon("LA6F2    BRA   LA708                   ; A6F2: 20 14         \n");
    PC = 0xa708; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xA6F4:
                                                     mon("LA6F4    LDB   $4B19                   ; A6F4: F6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA6F7; JUMP; // sstep
case 0xA6F7:
                                                     mon("         CMPB  #$07                    ; A6F7: C1 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x07; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA6F9; JUMP; // sstep
case 0xA6F9:
                                                     mon("         BLS   LA6FD                   ; A6F9: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xa6fd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA6FB; JUMP; // sstep
case 0xA6FB:
                                                     mon("         LDB   #$07                    ; A6FB: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA6FD; JUMP; // sstep
case 0xA6FD:
                                                     mon("LA6FD    ASLB                          ; A6FD: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA6FE; JUMP; // sstep
case 0xA6FE:
                                                     mon("         LDX   #off_A718               ; A6FE: 8E A7 18      \n");
    clockticks = clockticks + 3; 
    X = 0xa718; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA701; JUMP; // sstep
case 0xA701:
                                                     mon("         LDX   B,X                     ; A701: AE 85         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + (SINT8)B))+1)); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    // End of function sub_A6F4
    PC = 0xA703; JUMP; // sstep
case 0xA703:
                                                     mon("         BRA   LA708                   ; A703: 20 03         \n");
    PC = 0xa708; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Emit fireballs from towers 3
  case 0xA705:
                                                     mon("LA705    LDX   #$494B                  ; A705: 8E 49 4B      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 3; 
    X = 0x494b; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA708; JUMP; // sstep
case 0xA708:
                                                     mon("LA708    STX   <$A8                    ; A708: 9F A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xa8; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA70A; JUMP; // sstep
case 0xA70A:
                                                     mon("         LDA   $03,X                   ; A70A: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA70C; JUMP; // sstep
case 0xA70C:
                                                     mon("         BEQ   locret_A717             ; A70C: 27 09         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa717; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA70E; JUMP; // sstep
case 0xA70E:
                                                     mon("         LEAX  $06,X                   ; A70E: 30 06         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0006); 
/**/Z = X; 
    PC = 0xA710; JUMP; // sstep
case 0xA710:
                                                     mon("         CMPX  #$496F                  ; A710: 8C 49 6F      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x496f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA713; JUMP; // sstep
case 0xA713:
                                                     mon("         BCS   LA708                   ; A713: 25 F3         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa708; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA715; JUMP; // sstep
case 0xA715:
                                                     mon("         LEAS  $02,S                   ; A715: 32 62         \n"); // Do not return to last function call ?
    clockticks = clockticks + 5; 
    S = (S + 0x0002); 
    // End of function sub_A705
    // ---------------------------------------------------------------------------
    PC = 0xA717; JUMP; // sstep
case 0xA717:
                                                     mon("locret_A717 RTS                           ; A717: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_A591
  case 0xA728:
                                                     mon("LA728    JSR   LA6E0                   ; A728: BD A6 E0      \n"); // Emit fireballs from towers 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xa6e0; 
    JUMP;
  case 0xA72B:
                                                     mon("LA72B    LDA   #$70                    ; A72B: 86 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x70; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA72D; JUMP; // sstep
case 0xA72D:
                                                     mon("         STA   $05,X                   ; A72D: A7 05         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xA72F; JUMP; // sstep
case 0xA72F:
                                                     mon("         LDA   #$05                    ; A72F: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA731; JUMP; // sstep
case 0xA731:
                                                     mon("         STA   $03,X                   ; A731: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA733; JUMP; // sstep
case 0xA733:
                                                     mon("         LDU   <$64                    ; A733: DE 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA735; JUMP; // sstep
case 0xA735:
                                                     mon("         STX   <$01                    ; A735: 9F 01         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA737; JUMP; // sstep
case 0xA737:
                                                     mon("         LDD   $02,U                   ; A737: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA739; JUMP; // sstep
case 0xA739:
                                                     mon("         SUBD  $509A                   ; A739: B3 50 9A      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA73C; JUMP; // sstep
case 0xA73C:
                                                     mon("         BMI   LA742                   ; A73C: 2B 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa742; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA73E; JUMP; // sstep
case 0xA73E:
                                                     mon("         LDA   #$08                    ; A73E: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA740; JUMP; // sstep
case 0xA740:
                                                     mon("         BRA   LA744                   ; A740: 20 02         \n");
    PC = 0xa744; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA742:
                                                     mon("LA742    LDA   #$07                    ; A742: 86 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA744; JUMP; // sstep
case 0xA744:
                                                     mon("LA744    STA   $04,X                   ; A744: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xA746; JUMP; // sstep
case 0xA746:
                                                     mon("         LDX   ,X                      ; A746: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA748; JUMP; // sstep
case 0xA748:
                                                     mon("         LDA   ,U                      ; A748: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA74A; JUMP; // sstep
case 0xA74A:
                                                     mon("         SUBA  $5098                   ; A74A: B0 50 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x5098); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xA74D; JUMP; // sstep
case 0xA74D:
                                                     mon("         ANDA  #$80                    ; A74D: 84 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x80; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA74F; JUMP; // sstep
case 0xA74F:
                                                     mon("         EORA  ,U                      ; A74F: A8 C4         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(U); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA751; JUMP; // sstep
case 0xA751:
                                                     mon("         LDB   $01,U                   ; A751: E6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA753; JUMP; // sstep
case 0xA753:
                                                     mon("         STD   ,X                      ; A753: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA755; JUMP; // sstep
case 0xA755:
                                                     mon("         LDD   $02,U                   ; A755: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA757; JUMP; // sstep
case 0xA757:
                                                     mon("         STD   $02,X                   ; A757: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA759; JUMP; // sstep
case 0xA759:
                                                     mon("         LDD   #$0200                  ; A759: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA75C; JUMP; // sstep
case 0xA75C:
                                                     mon("         STD   $04,X                   ; A75C: ED 04         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA75E; JUMP; // sstep
case 0xA75E:
                                                     mon("         LDD   $02,X                   ; A75E: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA760; JUMP; // sstep
case 0xA760:
                                                     mon("         SUBD  $509A                   ; A760: B3 50 9A      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA763; JUMP; // sstep
case 0xA763:
                                                     mon("         STA   $06,X                   ; A763: A7 06         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, val); 
    PC = 0xA765; JUMP; // sstep
case 0xA765:
                                                     mon("         BPL   LA76B                   ; A765: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa76b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA767; JUMP; // sstep
case 0xA767:
                                                     mon("         COMA                          ; A767: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xA768; JUMP; // sstep
case 0xA768:
                                                     mon("         NEGB                          ; A768: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA769; JUMP; // sstep
case 0xA769:
                                                     mon("         SBCA  #$FF                    ; A769: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xA76B; JUMP; // sstep
case 0xA76B:
                                                     mon("LA76B    STD   $4706                   ; A76B: FD 47 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4706, A); // Care needed with I/O space and word fetches
    wr_mem(0x4707, B); 
    PC = 0xA76E; JUMP; // sstep
case 0xA76E:
                                                     mon("         LDD   ,X                      ; A76E: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA770; JUMP; // sstep
case 0xA770:
                                                     mon("         SUBD  $5098                   ; A770: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA773; JUMP; // sstep
case 0xA773:
                                                     mon("         STD   $4704                   ; A773: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xA776; JUMP; // sstep
case 0xA776:
                                                     mon("         LDD   #$0200                  ; A776: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA779; JUMP; // sstep
case 0xA779:
                                                     mon("         STD   $4706                   ; A779: FD 47 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4706, A); // Care needed with I/O space and word fetches
    wr_mem(0x4707, B); 
    PC = 0xA77C; JUMP; // sstep
case 0xA77C:
                                                     mon("         LDA   $4700                   ; A77C: B6 47 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4700); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA77F; JUMP; // sstep
case 0xA77F:
                                                     mon("         ASLA                          ; A77F: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xA780; JUMP; // sstep
case 0xA780:
                                                     mon("         ASLA                          ; A780: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xA781; JUMP; // sstep
case 0xA781:
                                                     mon("         BCC   LA784                   ; A781: 24 01         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa784; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA783; JUMP; // sstep
case 0xA783:
                                                     mon("         CLRA                          ; A783: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA784; JUMP; // sstep
case 0xA784:
                                                     mon("LA784    STA   $07,X                   ; A784: A7 07         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0007); 
    wr_mem(ea, val); 
    PC = 0xA786; JUMP; // sstep
case 0xA786:
                                                     mon("         LDA   <$7D                    ; A786: 96 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA788; JUMP; // sstep
case 0xA788:
                                                     mon("         EORA  $06,X                   ; A788: A8 06         \n");
    clockticks = clockticks + 5; 
    res = A ^ rd_mem((UINT16)(X + 0x0006)); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xA78A; JUMP; // sstep
case 0xA78A:
                                                     mon("         BPL   LA790                   ; A78A: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa790; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA78C; JUMP; // sstep
case 0xA78C:
                                                     mon("         CLR   $06,X                   ; A78C: 6F 06         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0006), 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA78E; JUMP; // sstep
case 0xA78E:
                                                     mon("         BRA   LA7B2                   ; A78E: 20 22         \n");
    PC = 0xa7b2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA790:
                                                     mon("LA790    LDA   <$7D                    ; A790: 96 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA792; JUMP; // sstep
case 0xA792:
                                                     mon("         BPL   LA795                   ; A792: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa795; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA794; JUMP; // sstep
case 0xA794:
                                                     mon("         NEGA                          ; A794: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA795; JUMP; // sstep
case 0xA795:
                                                     mon("LA795    ASLA                          ; A795: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xA796; JUMP; // sstep
case 0xA796:
                                                     mon("         CMPA  $07,X                   ; A796: A1 07         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0007)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA798; JUMP; // sstep
case 0xA798:
                                                     mon("         BHI   LA79E                   ; A798: 22 04         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xa79e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA79A; JUMP; // sstep
case 0xA79A:
                                                     mon("         CLR   $06,X                   ; A79A: 6F 06         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0006), 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA79C; JUMP; // sstep
case 0xA79C:
                                                     mon("         BRA   LA7B2                   ; A79C: 20 14         \n");
    PC = 0xa7b2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA79E:
                                                     mon("LA79E    LDA   #$FF                    ; A79E: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7A0; JUMP; // sstep
case 0xA7A0:
                                                     mon("         STA   $06,X                   ; A7A0: A7 06         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, val); 
    PC = 0xA7A2; JUMP; // sstep
case 0xA7A2:
                                                     mon("         LDX   <$01                    ; A7A2: 9E 01         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x01)<<8; 
    ea = ea | rd_mem(DP|0x02); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA7A4; JUMP; // sstep
case 0xA7A4:
                                                     mon("         LDA   $04,X                   ; A7A4: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7A6; JUMP; // sstep
case 0xA7A6:
                                                     mon("         CMPA  #$08                    ; A7A6: 81 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA7A8; JUMP; // sstep
case 0xA7A8:
                                                     mon("         BNE   LA7AE                   ; A7A8: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa7ae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA7AA; JUMP; // sstep
case 0xA7AA:
                                                     mon("         LDA   #$07                    ; A7AA: 86 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA7AC; JUMP; // sstep
case 0xA7AC:
                                                     mon("         BRA   LA7B0                   ; A7AC: 20 02         \n");
    PC = 0xa7b0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA7AE:
                                                     mon("LA7AE    LDA   #$08                    ; A7AE: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7B0; JUMP; // sstep
case 0xA7B0:
                                                     mon("LA7B0    STA   $04,X                   ; A7B0: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xA7B2; JUMP; // sstep
case 0xA7B2:
                                                     mon("LA7B2    JSR   Sound_39                ; A7B2: BD BE 11      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xbe11; 
    JUMP;
    // END OF FUNCTION CHUNK FOR sub_A591
  case 0xA7B5:
                                                     mon("LA7B5    RTS                           ; A7B5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Emit fireballs from towers/bunkers
    // FUNCTION CHUNK AT ROM:A7D1 SIZE 0000000E BYTES
  case 0xA7B6:
                                                     mon("LA7B6    JSR   LA705                   ; A7B6: BD A7 05      \n"); // Emit fireballs from towers 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xa705; 
    JUMP;
  case 0xA7B9:
                                                     mon("LA7B9    LDA   #$03                    ; A7B9: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7BB; JUMP; // sstep
case 0xA7BB:
                                                     mon("         STA   $04,X                   ; A7BB: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    // End of function sub_A7B6
    PC = 0xA7BD; JUMP; // sstep
case 0xA7BD:
                                                     mon("         BRA   LA7D1                   ; A7BD: 20 12         \n");
    PC = 0xa7d1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xA7BF:
                                                     mon("LA7BF    JSR   LA705                   ; A7BF: BD A7 05      \n"); // Emit fireballs from towers 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xa705; 
    JUMP;
  case 0xA7C2:
                                                     mon("LA7C2    LDA   #$04                    ; A7C2: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7C4; JUMP; // sstep
case 0xA7C4:
                                                     mon("         STA   $04,X                   ; A7C4: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    // End of function sub_A7BF
    PC = 0xA7C6; JUMP; // sstep
case 0xA7C6:
                                                     mon("         BRA   LA7D1                   ; A7C6: 20 09         \n");
    PC = 0xa7d1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Emit fireballs from towers/bunkers 2
  case 0xA7C8:
                                                     mon("LA7C8    JSR   LA705                   ; A7C8: BD A7 05      \n"); // Emit fireballs from towers 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xa705; 
    JUMP;
  case 0xA7CB:
                                                     mon("LA7CB    LDA   #$05                    ; A7CB: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7CD; JUMP; // sstep
case 0xA7CD:
                                                     mon("         STA   $04,X                   ; A7CD: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    // End of function sub_A7C8
    PC = 0xA7CF; JUMP; // sstep
case 0xA7CF:
                                                     mon("         BRA   LA7D1                   ; A7CF: 20 00         \n");
    PC = 0xa7d1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // START OF FUNCTION CHUNK FOR sub_A7B6
  case 0xA7D1:
                                                     mon("LA7D1    LDA   #$70                    ; A7D1: 86 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x70; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7D3; JUMP; // sstep
case 0xA7D3:
                                                     mon("         STA   $05,X                   ; A7D3: A7 05         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xA7D5; JUMP; // sstep
case 0xA7D5:
                                                     mon("         LDA   #$05                    ; A7D5: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7D7; JUMP; // sstep
case 0xA7D7:
                                                     mon("         STA   $03,X                   ; A7D7: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA7D9; JUMP; // sstep
case 0xA7D9:
                                                     mon("         LDU   <$64                    ; A7D9: DE 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA7DB; JUMP; // sstep
case 0xA7DB:
                                                     mon("         LDX   ,X                      ; A7DB: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    // END OF FUNCTION CHUNK FOR sub_A7B6
    PC = 0xA7DD; JUMP; // sstep
case 0xA7DD:
                                                     mon("         LDA   ,U                      ; A7DD: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xA7DF; JUMP; // sstep
case 0xA7DF:
                                                     mon("LA7DF    SUBA  $5098                   ; A7DF: B0 50 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x5098); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xA7E2; JUMP; // sstep
case 0xA7E2:
                                                     mon("         ANDA  #$80                    ; A7E2: 84 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x80; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA7E4; JUMP; // sstep
case 0xA7E4:
                                                     mon("         EORA  ,U                      ; A7E4: A8 C4         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(U); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xA7E6; JUMP; // sstep
case 0xA7E6:
                                                     mon("         LDB   $01,U                   ; A7E6: E6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA7E8; JUMP; // sstep
case 0xA7E8:
                                                     mon("         STD   ,X                      ; A7E8: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA7EA; JUMP; // sstep
case 0xA7EA:
                                                     mon("         LDD   $02,U                   ; A7EA: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA7EC; JUMP; // sstep
case 0xA7EC:
                                                     mon("         STD   $02,X                   ; A7EC: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA7EE; JUMP; // sstep
case 0xA7EE:
                                                     mon("         LDD   $5044                   ; A7EE: FC 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5044); // Care needed with I/O space and word fetches
    B = rd_mem(0x5045); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA7F1; JUMP; // sstep
case 0xA7F1:
                                                     mon("         STD   $04,X                   ; A7F1: ED 04         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA7F3; JUMP; // sstep
case 0xA7F3:
                                                     mon("         JSR   Sound_39                ; A7F3: BD BE 11      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xbe11; 
    JUMP;
    // End of function sub_A7DF
  case 0xA7F6:
                                                     mon("LA7F6    RTS                           ; A7F6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA7F7:
                                                     mon("LA7F7    LDA   <$95                    ; A7F7: 96 95         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x95); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA7F9; JUMP; // sstep
case 0xA7F9:
                                                     mon("         BEQ   LA800                   ; A7F9: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa800; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA7FB; JUMP; // sstep
case 0xA7FB:
                                                     mon("         JSR   LA705                   ; A7FB: BD A7 05      \n"); // Emit fireballs from towers 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    PC = 0xa705; 
    JUMP;
  case 0xA7FE:
                                                     mon("LA7FE    BRA   LA803                   ; A7FE: 20 03         \n");
    PC = 0xa803; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA800:
                                                     mon("LA800    JSR   LA6F4                   ; A800: BD A6 F4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x03); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xa6f4; 
    JUMP;
  case 0xA803:
                                                     mon("LA803    LDA   #$09                    ; A803: 86 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA805; JUMP; // sstep
case 0xA805:
                                                     mon("         STA   $04,X                   ; A805: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xA807; JUMP; // sstep
case 0xA807:
                                                     mon("         LDU   ,X                      ; A807: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // End of function sub_A7F7
    PC = 0xA809; JUMP; // sstep
case 0xA809:
                                                     mon("         BRA   LA81F                   ; A809: 20 14         \n");
    PC = 0xa81f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xA80B:
                                                     mon("LA80B    LDA   <$95                    ; A80B: 96 95         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x95); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA80D; JUMP; // sstep
case 0xA80D:
                                                     mon("         BEQ   LA814                   ; A80D: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa814; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA80F; JUMP; // sstep
case 0xA80F:
                                                     mon("         JSR   LA705                   ; A80F: BD A7 05      \n"); // Emit fireballs from towers 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xa705; 
    JUMP;
  case 0xA812:
                                                     mon("LA812    BRA   LA817                   ; A812: 20 03         \n");
    PC = 0xa817; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA814:
                                                     mon("LA814    JSR   LA6F4                   ; A814: BD A6 F4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xa6f4; 
    JUMP;
  case 0xA817:
                                                     mon("LA817    LDA   #$0A                    ; A817: 86 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0a; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA819; JUMP; // sstep
case 0xA819:
                                                     mon("         STA   $04,X                   ; A819: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xA81B; JUMP; // sstep
case 0xA81B:
                                                     mon("         LDU   ,X                      ; A81B: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xA81D; JUMP; // sstep
case 0xA81D:
                                                     mon("         BRA   LA81F                   ; A81D: 20 00         \n");
    PC = 0xa81f; 
    JUMP;
    clockticks = clockticks + 3; 
    
  case 0xA81F:
                                                     mon("LA81F    LDD   $5078                   ; A81F: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA822; JUMP; // sstep
case 0xA822:
                                                     mon("         STD   ,U                      ; A822: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA824; JUMP; // sstep
case 0xA824:
                                                     mon("         LDD   $507A                   ; A824: FC 50 7A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507a); // Care needed with I/O space and word fetches
    B = rd_mem(0x507b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA827; JUMP; // sstep
case 0xA827:
                                                     mon("         STD   $02,U                   ; A827: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA829; JUMP; // sstep
case 0xA829:
                                                     mon("         LDD   $507C                   ; A829: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA82C; JUMP; // sstep
case 0xA82C:
                                                     mon("         STD   $04,U                   ; A82C: ED 44         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA82E; JUMP; // sstep
case 0xA82E:
                                                     mon("         LDA   #$40                    ; A82E: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA830; JUMP; // sstep
case 0xA830:
                                                     mon("         STA   $05,X                   ; A830: A7 05         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xA832; JUMP; // sstep
case 0xA832:
                                                     mon("         LDA   #$05                    ; A832: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA834; JUMP; // sstep
case 0xA834:
                                                     mon("         STA   $03,X                   ; A834: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA836; JUMP; // sstep
case 0xA836:
                                                     mon("         LDA   $4703                   ; A836: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA839; JUMP; // sstep
case 0xA839:
                                                     mon("         LSRA                          ; A839: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xA83A; JUMP; // sstep
case 0xA83A:
                                                     mon("         LDB   $507C                   ; A83A: F6 50 7C      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x507c); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA83D; JUMP; // sstep
case 0xA83D:
                                                     mon("         CMPB  #$FC                    ; A83D: C1 FC         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xfc; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA83F; JUMP; // sstep
case 0xA83F:
                                                     mon("         BLT   LA843                   ; A83F: 2D 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xa843; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA841; JUMP; // sstep
case 0xA841:
                                                     mon("         LDA   #$00                    ; A841: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA843; JUMP; // sstep
case 0xA843:
                                                     mon("LA843    STA   $06,U                   ; A843: A7 46         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, val); 
    PC = 0xA845; JUMP; // sstep
case 0xA845:
                                                     mon("         JSR   Sound_39                ; A845: BD BE 11      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x48); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xbe11; 
    JUMP;
    // End of function sub_A80B
  case 0xA848:
                                                     mon("LA848    RTS                           ; A848: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Fireball movement
  case 0xA849:
                                                     mon("LA849    LDX   #$494B                  ; A849: 8E 49 4B      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 3; 
    X = 0x494b; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA84C; JUMP; // sstep
case 0xA84C:
                                                     mon("LA84C    STX   <$A8                    ; A84C: 9F A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xa8; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xA84E; JUMP; // sstep
case 0xA84E:
                                                     mon("         LDA   $03,X                   ; A84E: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xA850; JUMP; // sstep
case 0xA850:
                                                     mon("         BEQ   LA861                   ; A850: 27 0F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa861; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA852; JUMP; // sstep
case 0xA852:
                                                     mon("         LDB   $04,X                   ; A852: E6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA854; JUMP; // sstep
case 0xA854:
                                                     mon("         ASLB                          ; A854: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xA855; JUMP; // sstep
case 0xA855:
                                                     mon("         CMPB  #$16                    ; A855: C1 16         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x16; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xA857; JUMP; // sstep
case 0xA857:
                                                     mon("         BCC   LA860                   ; A857: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xa860; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA859; JUMP; // sstep
case 0xA859:
                                                     mon("         LDU   #JumpTableA675          ; A859: CE A6 75      \n");
    clockticks = clockticks + 3; 
    U = 0xa675; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xA85C; JUMP; // sstep
case 0xA85C:
                                                     mon("         JSR   [B,U]                   ; A85C: AD D5         \n"); // Fireball movement processing
    clockticks = clockticks + 3; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    ea = rd_mem((UINT16)(U + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)((U + (SINT8)B) + 1)); 
    S = S - 1; 
    wr_mem(S, 0x5e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = ea; 
    JUMP;
  case 0xA85E:
                                                     mon("LA85E    BRA   LA861                   ; A85E: 20 01         \n");
    PC = 0xa861; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA860:
                                                     mon("LA860    SWI                           ; A860: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xA861:
                                                     mon("LA861    LDX   <$A8                    ; A861: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xA863; JUMP; // sstep
case 0xA863:
                                                     mon("         LEAX  $06,X                   ; A863: 30 06         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0006); 
/**/Z = X; 
    PC = 0xA865; JUMP; // sstep
case 0xA865:
                                                     mon("         CMPX  #$496F                  ; A865: 8C 49 6F      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x496f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA868; JUMP; // sstep
case 0xA868:
                                                     mon("         BCS   LA84C                   ; A868: 25 E2         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xa84c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_A849
    PC = 0xA86A; JUMP; // sstep
case 0xA86A:
                                                     mon("         RTS                           ; A86A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA86B:
                                                     mon("LA86B    DEC   $05,X                   ; A86B: 6A 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0005)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + 0x0005), res); 
    clockticks = clockticks + 2; 
    PC = 0xA86D; JUMP; // sstep
case 0xA86D:
                                                     mon("         BGT   locret_A874             ; A86D: 2E 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa874; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA86F; JUMP; // sstep
case 0xA86F:
                                                     mon("         CLRB                          ; A86F: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA870; JUMP; // sstep
case 0xA870:
                                                     mon("         STB   $03,X                   ; A870: E7 03         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA872; JUMP; // sstep
case 0xA872:
                                                     mon("         STB   $05,X                   ; A872: E7 05         \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    // End of function sub_A86B
    PC = 0xA874; JUMP; // sstep
case 0xA874:
                                                     mon("locret_A874 RTS                           ; A874: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA875:
                                                     mon("LA875    DEC   $05,X                   ; A875: 6A 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0005)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + 0x0005), res); 
    clockticks = clockticks + 2; 
    PC = 0xA877; JUMP; // sstep
case 0xA877:
                                                     mon("         BGT   LA880                   ; A877: 2E 07         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa880; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA879; JUMP; // sstep
case 0xA879:
                                                     mon("         CLRB                          ; A879: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA87A; JUMP; // sstep
case 0xA87A:
                                                     mon("         STB   $03,X                   ; A87A: E7 03         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA87C; JUMP; // sstep
case 0xA87C:
                                                     mon("         STB   $05,X                   ; A87C: E7 05         \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xA87E; JUMP; // sstep
case 0xA87E:
                                                     mon("         BRA   locret_A8A6             ; A87E: 20 26         \n");
    PC = 0xa8a6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA880:
                                                     mon("LA880    LDU   ,X                      ; A880: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA882; JUMP; // sstep
case 0xA882:
                                                     mon("         LDD   #$00                    ; A882: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA885; JUMP; // sstep
case 0xA885:
                                                     mon("         SUBD  ,U                      ; A885: A3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA887; JUMP; // sstep
case 0xA887:
                                                     mon("         JSR   Shift_D_R_3             ; A887: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA88A:
                                                     mon("LA88A    ADDD  ,U                      ; A88A: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA88C; JUMP; // sstep
case 0xA88C:
                                                     mon("         STD   ,U                      ; A88C: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA88E; JUMP; // sstep
case 0xA88E:
                                                     mon("         LDD   #$00                    ; A88E: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA891; JUMP; // sstep
case 0xA891:
                                                     mon("         SUBD  $02,U                   ; A891: A3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA893; JUMP; // sstep
case 0xA893:
                                                     mon("         JSR   Shift_D_R_3             ; A893: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA896:
                                                     mon("LA896    ADDD  $02,U                   ; A896: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA898; JUMP; // sstep
case 0xA898:
                                                     mon("         STD   $02,U                   ; A898: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA89A; JUMP; // sstep
case 0xA89A:
                                                     mon("         LDD   #$00                    ; A89A: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA89D; JUMP; // sstep
case 0xA89D:
                                                     mon("         SUBD  $04,U                   ; A89D: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA89F; JUMP; // sstep
case 0xA89F:
                                                     mon("         JSR   Shift_D_R_3             ; A89F: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA8A2:
                                                     mon("LA8A2    ADDD  $04,U                   ; A8A2: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8A4; JUMP; // sstep
case 0xA8A4:
                                                     mon("         STD   $04,U                   ; A8A4: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_A875
    PC = 0xA8A6; JUMP; // sstep
case 0xA8A6:
                                                     mon("locret_A8A6 RTS                           ; A8A6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xA8A7:
                                                     mon("LA8A7    DEC   $05,X                   ; A8A7: 6A 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0005)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + 0x0005), res); 
    clockticks = clockticks + 2; 
    PC = 0xA8A9; JUMP; // sstep
case 0xA8A9:
                                                     mon("         BGT   LA8B2                   ; A8A9: 2E 07         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xa8b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA8AB; JUMP; // sstep
case 0xA8AB:
                                                     mon("         CLRB                          ; A8AB: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA8AC; JUMP; // sstep
case 0xA8AC:
                                                     mon("         STB   $03,X                   ; A8AC: E7 03         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xA8AE; JUMP; // sstep
case 0xA8AE:
                                                     mon("         STB   $05,X                   ; A8AE: E7 05         \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xA8B0; JUMP; // sstep
case 0xA8B0:
                                                     mon("         BRA   locret_A8D5             ; A8B0: 20 23         \n");
    PC = 0xa8d5; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA8B2:
                                                     mon("LA8B2    LDU   ,X                      ; A8B2: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA8B4; JUMP; // sstep
case 0xA8B4:
                                                     mon("         LDD   ,U                      ; A8B4: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA8B6; JUMP; // sstep
case 0xA8B6:
                                                     mon("         JSR   Shift_D_R_3             ; A8B6: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA8B9:
                                                     mon("LA8B9    ADDD  ,U                      ; A8B9: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8BB; JUMP; // sstep
case 0xA8BB:
                                                     mon("         BVS   LA8D6                   ; A8BB: 29 19         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xa8d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA8BD; JUMP; // sstep
case 0xA8BD:
                                                     mon("         STD   ,U                      ; A8BD: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA8BF; JUMP; // sstep
case 0xA8BF:
                                                     mon("         LDD   $02,U                   ; A8BF: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA8C1; JUMP; // sstep
case 0xA8C1:
                                                     mon("         JSR   Shift_D_R_3             ; A8C1: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA8C4:
                                                     mon("LA8C4    ADDD  $02,U                   ; A8C4: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8C6; JUMP; // sstep
case 0xA8C6:
                                                     mon("         BVS   LA8D6                   ; A8C6: 29 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xa8d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA8C8; JUMP; // sstep
case 0xA8C8:
                                                     mon("         STD   $02,U                   ; A8C8: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA8CA; JUMP; // sstep
case 0xA8CA:
                                                     mon("         LDD   $04,U                   ; A8CA: EC 44         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xA8CC; JUMP; // sstep
case 0xA8CC:
                                                     mon("         JSR   Shift_D_R_3             ; A8CC: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA8CF:
                                                     mon("LA8CF    ADDD  $04,U                   ; A8CF: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8D1; JUMP; // sstep
case 0xA8D1:
                                                     mon("         BVS   LA8D6                   ; A8D1: 29 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xa8d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA8D3; JUMP; // sstep
case 0xA8D3:
                                                     mon("         STD   $04,U                   ; A8D3: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA8D5; JUMP; // sstep
case 0xA8D5:
                                                     mon("locret_A8D5 RTS                           ; A8D5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA8D6:
                                                     mon("LA8D6    CLRB                          ; A8D6: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA8D7; JUMP; // sstep
case 0xA8D7:
                                                     mon("         STB   $03,X                   ; A8D7: E7 03         \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    // End of function sub_A8A7
    PC = 0xA8D9; JUMP; // sstep
case 0xA8D9:
                                                     mon("         RTS                           ; A8D9: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Some towers processing
  case 0xA8DA:
                                                     mon("LA8DA    LDU   ,X                      ; A8DA: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA8DC; JUMP; // sstep
case 0xA8DC:
                                                     mon("         LDD   #$FF00                  ; A8DC: CC FF 00      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA8DF; JUMP; // sstep
case 0xA8DF:
                                                     mon("         ADDD  ,U                      ; A8DF: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8E1; JUMP; // sstep
case 0xA8E1:
                                                     mon("         STD   ,U                      ; A8E1: ED C4         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA8E3; JUMP; // sstep
case 0xA8E3:
                                                     mon("         JMP   LAA7D                   ; A8E3: 7E AA 7D      \n");
    clockticks = clockticks + 4; 
    PC = 0xaa7d; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA8E6:
                                                     mon("LA8E6    LDU   ,X                      ; A8E6: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA8E8; JUMP; // sstep
case 0xA8E8:
                                                     mon("         LDD   #$FF00                  ; A8E8: CC FF 00      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA8EB; JUMP; // sstep
case 0xA8EB:
                                                     mon("         ADDD  ,U                      ; A8EB: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8ED; JUMP; // sstep
case 0xA8ED:
                                                     mon("         STD   ,U                      ; A8ED: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA8EF; JUMP; // sstep
case 0xA8EF:
                                                     mon("         LDD   #$FF00                  ; A8EF: CC FF 00      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA8F2; JUMP; // sstep
case 0xA8F2:
                                                     mon("         ADDD  $02,U                   ; A8F2: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA8F4; JUMP; // sstep
case 0xA8F4:
                                                     mon("         STD   $02,U                   ; A8F4: ED 42         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA8F6; JUMP; // sstep
case 0xA8F6:
                                                     mon("         JMP   LAA7D                   ; A8F6: 7E AA 7D      \n");
    clockticks = clockticks + 4; 
    PC = 0xaa7d; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA8F9:
                                                     mon("LA8F9    LDU   ,X                      ; A8F9: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xA8FB; JUMP; // sstep
case 0xA8FB:
                                                     mon("         LDD   #$FF00                  ; A8FB: CC FF 00      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA8FE; JUMP; // sstep
case 0xA8FE:
                                                     mon("         ADDD  ,U                      ; A8FE: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA900; JUMP; // sstep
case 0xA900:
                                                     mon("         STD   ,U                      ; A900: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA902; JUMP; // sstep
case 0xA902:
                                                     mon("         LDD   #$0100                  ; A902: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA905; JUMP; // sstep
case 0xA905:
                                                     mon("         ADDD  $02,U                   ; A905: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA907; JUMP; // sstep
case 0xA907:
                                                     mon("         STD   $02,U                   ; A907: ED 42         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA909; JUMP; // sstep
case 0xA909:
                                                     mon("         JMP   LAA7D                   ; A909: 7E AA 7D      \n");
    clockticks = clockticks + 4; 
    PC = 0xaa7d; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA90C:
                                                     mon("LA90C    LDB   ,U                      ; A90C: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA90E; JUMP; // sstep
case 0xA90E:
                                                     mon("         SUBB  $5098                   ; A90E: F0 50 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x5098); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xA911; JUMP; // sstep
case 0xA911:
                                                     mon("         BMI   locret_A91F             ; A911: 2B 0C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa91f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA913; JUMP; // sstep
case 0xA913:
                                                     mon("         CLRA                          ; A913: 4F            \n");
    A = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA914; JUMP; // sstep
case 0xA914:
                                                     mon("         JSR   Shift_D_L_2             ; A914: BD CD B5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcdb5; 
    JUMP;
  case 0xA917:
                                                     mon("LA917    COMA                          ; A917: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xA918; JUMP; // sstep
case 0xA918:
                                                     mon("         NEGB                          ; A918: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA919; JUMP; // sstep
case 0xA919:
                                                     mon("         SBCA  #$FF                    ; A919: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xA91B; JUMP; // sstep
case 0xA91B:
                                                     mon("         ADDD  ,U                      ; A91B: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA91D; JUMP; // sstep
case 0xA91D:
                                                     mon("         STD   ,U                      ; A91D: ED C4         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA91F; JUMP; // sstep
case 0xA91F:
                                                     mon("locret_A91F RTS                           ; A91F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA920:
                                                     mon("LA920    LDD   #$00                    ; A920: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA923; JUMP; // sstep
case 0xA923:
                                                     mon("         SUBD  $508E                   ; A923: B3 50 8E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x508e)<<8; 
    ea = ea | rd_mem(0x508f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA926; JUMP; // sstep
case 0xA926:
                                                     mon("         JSR   Shift_D_R_3             ; A926: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA929:
                                                     mon("LA929    ADDD  $508E                   ; A929: F3 50 8E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x508e)<<8; 
    ea = ea | rd_mem(0x508f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA92C; JUMP; // sstep
case 0xA92C:
                                                     mon("         BPL   locret_A932             ; A92C: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xa932; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA92E; JUMP; // sstep
case 0xA92E:
                                                     mon("         ADDD  $02,U                   ; A92E: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA930; JUMP; // sstep
case 0xA930:
                                                     mon("         STD   $02,U                   ; A930: ED 42         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA932; JUMP; // sstep
case 0xA932:
                                                     mon("locret_A932 RTS                           ; A932: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA933:
                                                     mon("LA933    LDD   #$00                    ; A933: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA936; JUMP; // sstep
case 0xA936:
                                                     mon("         SUBD  $508E                   ; A936: B3 50 8E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x508e)<<8; 
    ea = ea | rd_mem(0x508f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA939; JUMP; // sstep
case 0xA939:
                                                     mon("         JSR   Shift_D_R_3             ; A939: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA93C:
                                                     mon("LA93C    ADDD  $508E                   ; A93C: F3 50 8E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x508e)<<8; 
    ea = ea | rd_mem(0x508f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA93F; JUMP; // sstep
case 0xA93F:
                                                     mon("         BMI   locret_A945             ; A93F: 2B 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa945; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA941; JUMP; // sstep
case 0xA941:
                                                     mon("         ADDD  $02,U                   ; A941: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA943; JUMP; // sstep
case 0xA943:
                                                     mon("         STD   $02,U                   ; A943: ED 42         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA945; JUMP; // sstep
case 0xA945:
                                                     mon("locret_A945 RTS                           ; A945: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA946:
                                                     mon("LA946    LDU   ,X                      ; A946: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xA948; JUMP; // sstep
case 0xA948:
                                                     mon("         JSR   LA933                   ; A948: BD A9 33      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xa933; 
    JUMP;
  case 0xA94B:
                                                     mon("LA94B    JSR   LA90C                   ; A94B: BD A9 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xa90c; 
    JUMP;
  case 0xA94E:
                                                     mon("LA94E    LDD   ,U                      ; A94E: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA950; JUMP; // sstep
case 0xA950:
                                                     mon("         SUBD  $5098                   ; A950: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA953; JUMP; // sstep
case 0xA953:
                                                     mon("         LDB   $07,U                   ; A953: E6 47         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0007)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA955; JUMP; // sstep
case 0xA955:
                                                     mon("         MUL                           ; A955: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xA956; JUMP; // sstep
case 0xA956:
                                                     mon("         TST   $06,U                   ; A956: 6D 46         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0006)); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA958; JUMP; // sstep
case 0xA958:
                                                     mon("         BNE   LA95E                   ; A958: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xa95e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA95A; JUMP; // sstep
case 0xA95A:
                                                     mon("         COMA                          ; A95A: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xA95B; JUMP; // sstep
case 0xA95B:
                                                     mon("         NEGB                          ; A95B: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA95C; JUMP; // sstep
case 0xA95C:
                                                     mon("         SBCA  #$FF                    ; A95C: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xA95E; JUMP; // sstep
case 0xA95E:
                                                     mon("LA95E    ADDD  $509A                   ; A95E: F3 50 9A      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA961; JUMP; // sstep
case 0xA961:
                                                     mon("         SUBD  $02,U                   ; A961: A3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA963; JUMP; // sstep
case 0xA963:
                                                     mon("         ADDD  #$0100                  ; A963: C3 01 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0100; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA966; JUMP; // sstep
case 0xA966:
                                                     mon("         BMI   LA978                   ; A966: 2B 10         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa978; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA968; JUMP; // sstep
case 0xA968:
                                                     mon("         JSR   Shift_D_R_3             ; A968: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA96B:
                                                     mon("LA96B    CMPD  #$0180                  ; A96B: 10 83 01 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0180; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA96F; JUMP; // sstep
case 0xA96F:
                                                     mon("         BLE   LA974                   ; A96F: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa974; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA971; JUMP; // sstep
case 0xA971:
                                                     mon("         LDD   #$0180                  ; A971: CC 01 80      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA974; JUMP; // sstep
case 0xA974:
                                                     mon("LA974    ADDD  $02,U                   ; A974: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA976; JUMP; // sstep
case 0xA976:
                                                     mon("         BRA   LA986                   ; A976: 20 0E         \n");
    PC = 0xa986; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA978:
                                                     mon("LA978    JSR   Shift_D_R_5             ; A978: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xA97B:
                                                     mon("LA97B    CMPD  #$FE80                  ; A97B: 10 83 FE 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfe80; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA97F; JUMP; // sstep
case 0xA97F:
                                                     mon("         BGE   LA984                   ; A97F: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xa984; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA981; JUMP; // sstep
case 0xA981:
                                                     mon("         LDD   #$FE80                  ; A981: CC FE 80      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA984; JUMP; // sstep
case 0xA984:
                                                     mon("LA984    ADDD  $02,U                   ; A984: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA986; JUMP; // sstep
case 0xA986:
                                                     mon("LA986    STD   $02,U                   ; A986: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA988; JUMP; // sstep
case 0xA988:
                                                     mon("         LDD   $509C                   ; A988: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA98B; JUMP; // sstep
case 0xA98B:
                                                     mon("         ADDD  #$0100                  ; A98B: C3 01 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0100; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA98E; JUMP; // sstep
case 0xA98E:
                                                     mon("         SUBD  $04,U                   ; A98E: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA990; JUMP; // sstep
case 0xA990:
                                                     mon("         BMI   locret_A9A2             ; A990: 2B 10         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa9a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA992; JUMP; // sstep
case 0xA992:
                                                     mon("         JSR   Shift_D_R_3             ; A992: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA995:
                                                     mon("LA995    CMPD  #$0200                  ; A995: 10 83 02 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0200; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA999; JUMP; // sstep
case 0xA999:
                                                     mon("         BLE   LA99E                   ; A999: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa99e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA99B; JUMP; // sstep
case 0xA99B:
                                                     mon("         LDD   #$0200                  ; A99B: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA99E; JUMP; // sstep
case 0xA99E:
                                                     mon("LA99E    ADDD  $04,U                   ; A99E: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9A0; JUMP; // sstep
case 0xA9A0:
                                                     mon("         STD   $04,U                   ; A9A0: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA9A2; JUMP; // sstep
case 0xA9A2:
                                                     mon("locret_A9A2 RTS                           ; A9A2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xA9A3:
                                                     mon("LA9A3    LDU   ,X                      ; A9A3: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xA9A5; JUMP; // sstep
case 0xA9A5:
                                                     mon("         JSR   LA920                   ; A9A5: BD A9 20      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xa920; 
    JUMP;
  case 0xA9A8:
                                                     mon("LA9A8    JSR   LA90C                   ; A9A8: BD A9 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xa90c; 
    JUMP;
  case 0xA9AB:
                                                     mon("LA9AB    LDD   ,U                      ; A9AB: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA9AD; JUMP; // sstep
case 0xA9AD:
                                                     mon("         SUBD  $5098                   ; A9AD: B3 50 98      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA9B0; JUMP; // sstep
case 0xA9B0:
                                                     mon("         LDB   $07,U                   ; A9B0: E6 47         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0007)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xA9B2; JUMP; // sstep
case 0xA9B2:
                                                     mon("         MUL                           ; A9B2: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xA9B3; JUMP; // sstep
case 0xA9B3:
                                                     mon("         TST   $06,U                   ; A9B3: 6D 46         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0006)); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xA9B5; JUMP; // sstep
case 0xA9B5:
                                                     mon("         BEQ   LA9BB                   ; A9B5: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xa9bb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA9B7; JUMP; // sstep
case 0xA9B7:
                                                     mon("         COMA                          ; A9B7: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xA9B8; JUMP; // sstep
case 0xA9B8:
                                                     mon("         NEGB                          ; A9B8: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xA9B9; JUMP; // sstep
case 0xA9B9:
                                                     mon("         SBCA  #$FF                    ; A9B9: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xA9BB; JUMP; // sstep
case 0xA9BB:
                                                     mon("LA9BB    ADDD  $509A                   ; A9BB: F3 50 9A      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9BE; JUMP; // sstep
case 0xA9BE:
                                                     mon("         ADDD  #$FF00                  ; A9BE: C3 FF 00      \n");
    clockticks = clockticks + 4; 
    val = 0xff00; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9C1; JUMP; // sstep
case 0xA9C1:
                                                     mon("         SUBD  $02,U                   ; A9C1: A3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA9C3; JUMP; // sstep
case 0xA9C3:
                                                     mon("         BMI   LA9D5                   ; A9C3: 2B 10         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa9d5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA9C5; JUMP; // sstep
case 0xA9C5:
                                                     mon("         JSR   Shift_D_R_5             ; A9C5: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xA9C8:
                                                     mon("LA9C8    CMPD  #$0180                  ; A9C8: 10 83 01 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0180; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA9CC; JUMP; // sstep
case 0xA9CC:
                                                     mon("         BLE   LA9D1                   ; A9CC: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa9d1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA9CE; JUMP; // sstep
case 0xA9CE:
                                                     mon("         LDD   #$0180                  ; A9CE: CC 01 80      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA9D1; JUMP; // sstep
case 0xA9D1:
                                                     mon("LA9D1    ADDD  $02,U                   ; A9D1: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9D3; JUMP; // sstep
case 0xA9D3:
                                                     mon("         BRA   LA9E3                   ; A9D3: 20 0E         \n");
    PC = 0xa9e3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xA9D5:
                                                     mon("LA9D5    JSR   Shift_D_R_3             ; A9D5: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA9D8:
                                                     mon("LA9D8    CMPD  #$FE80                  ; A9D8: 10 83 FE 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfe80; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA9DC; JUMP; // sstep
case 0xA9DC:
                                                     mon("         BGE   LA9E1                   ; A9DC: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xa9e1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA9DE; JUMP; // sstep
case 0xA9DE:
                                                     mon("         LDD   #$FE80                  ; A9DE: CC FE 80      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA9E1; JUMP; // sstep
case 0xA9E1:
                                                     mon("LA9E1    ADDD  $02,U                   ; A9E1: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9E3; JUMP; // sstep
case 0xA9E3:
                                                     mon("LA9E3    STD   $02,U                   ; A9E3: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA9E5; JUMP; // sstep
case 0xA9E5:
                                                     mon("         LDD   $509C                   ; A9E5: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA9E8; JUMP; // sstep
case 0xA9E8:
                                                     mon("         ADDD  #$0100                  ; A9E8: C3 01 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0100; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9EB; JUMP; // sstep
case 0xA9EB:
                                                     mon("         SUBD  $04,U                   ; A9EB: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xA9ED; JUMP; // sstep
case 0xA9ED:
                                                     mon("         BMI   locret_A9FF             ; A9ED: 2B 10         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xa9ff; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA9EF; JUMP; // sstep
case 0xA9EF:
                                                     mon("         JSR   Shift_D_R_3             ; A9EF: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xA9F2:
                                                     mon("LA9F2    CMPD  #$0200                  ; A9F2: 10 83 02 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0200; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xA9F6; JUMP; // sstep
case 0xA9F6:
                                                     mon("         BLE   LA9FB                   ; A9F6: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xa9fb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xA9F8; JUMP; // sstep
case 0xA9F8:
                                                     mon("         LDD   #$0200                  ; A9F8: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xA9FB; JUMP; // sstep
case 0xA9FB:
                                                     mon("LA9FB    ADDD  $04,U                   ; A9FB: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xA9FD; JUMP; // sstep
case 0xA9FD:
                                                     mon("         STD   $04,U                   ; A9FD: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xA9FF; JUMP; // sstep
case 0xA9FF:
                                                     mon("locret_A9FF RTS                           ; A9FF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xAA00:
                                                     mon("LAA00    LDU   ,X                      ; AA00: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xAA02; JUMP; // sstep
case 0xAA02:
                                                     mon("         LDD   #$FF00                  ; AA02: CC FF 00      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAA05; JUMP; // sstep
case 0xAA05:
                                                     mon("         ADDD  ,U                      ; AA05: E3 C4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAA07; JUMP; // sstep
case 0xAA07:
                                                     mon("         STD   ,U                      ; AA07: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAA09; JUMP; // sstep
case 0xAA09:
                                                     mon("         LDD   $509C                   ; AA09: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAA0C; JUMP; // sstep
case 0xAA0C:
                                                     mon("         ADDD  #$80                    ; AA0C: C3 00 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0080; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAA0F; JUMP; // sstep
case 0xAA0F:
                                                     mon("         SUBD  $04,U                   ; AA0F: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAA11; JUMP; // sstep
case 0xAA11:
                                                     mon("         BMI   LAA23                   ; AA11: 2B 10         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xaa23; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAA13; JUMP; // sstep
case 0xAA13:
                                                     mon("         JSR   Shift_D_R_3             ; AA13: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xAA16:
                                                     mon("LAA16    CMPD  #$0180                  ; AA16: 10 83 01 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0180; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xAA1A; JUMP; // sstep
case 0xAA1A:
                                                     mon("         BLE   LAA1F                   ; AA1A: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xaa1f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAA1C; JUMP; // sstep
case 0xAA1C:
                                                     mon("         LDD   #$0180                  ; AA1C: CC 01 80      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAA1F; JUMP; // sstep
case 0xAA1F:
                                                     mon("LAA1F    ADDD  $04,U                   ; AA1F: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAA21; JUMP; // sstep
case 0xAA21:
                                                     mon("         STD   $04,U                   ; AA21: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // ---------------------------------------------------------------------------
    PC = 0xAA23; JUMP; // sstep
case 0xAA23:
                                                     mon("LAA23    BRA   LAA7D                   ; AA23: 20 58         \n");
    PC = 0xaa7d; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAA7D:
                                                     mon("LAA7D    LDA   $03,X                   ; AA7D: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAA7F; JUMP; // sstep
case 0xAA7F:
                                                     mon("         BITA  #$02                    ; AA7F: 85 02         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x02; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAA81; JUMP; // sstep
case 0xAA81:
                                                     mon("         BEQ   locret_AA85             ; AA81: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xaa85; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAA83; JUMP; // sstep
case 0xAA83:
                                                     mon("         CLR   $03,X                   ; AA83: 6F 03         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0003), 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_A8DA
    PC = 0xAA85; JUMP; // sstep
case 0xAA85:
                                                     mon("locret_AA85 RTS                           ; AA85: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Exhaust port processing
  case 0xAA86:
                                                     mon("LAA86    LDU   ,X                      ; AA86: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xAA88; JUMP; // sstep
case 0xAA88:
                                                     mon("         JSR   LA90C                   ; AA88: BD A9 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xa90c; 
    JUMP;
  case 0xAA8B:
                                                     mon("LAA8B    LDD   $509C                   ; AA8B: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAA8E; JUMP; // sstep
case 0xAA8E:
                                                     mon("         SUBD  $04,U                   ; AA8E: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAA90; JUMP; // sstep
case 0xAA90:
                                                     mon("         BMI   LAA99                   ; AA90: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xaa99; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAA92; JUMP; // sstep
case 0xAA92:
                                                     mon("         JSR   Shift_D_R_4             ; AA92: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xAA95:
                                                     mon("LAA95    ADDD  $04,U                   ; AA95: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAA97; JUMP; // sstep
case 0xAA97:
                                                     mon("         STD   $04,U                   ; AA97: ED 44         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAA99; JUMP; // sstep
case 0xAA99:
                                                     mon("LAA99    LDA   $4B19                   ; AA99: B6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAA9C; JUMP; // sstep
case 0xAA9C:
                                                     mon("         CMPA  #$01                    ; AA9C: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xAA9E; JUMP; // sstep
case 0xAA9E:
                                                     mon("         BCS   LAAA5                   ; AA9E: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xaaa5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAAA0; JUMP; // sstep
case 0xAAA0:
                                                     mon("         LDD   $509A                   ; AAA0: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xAAA3; JUMP; // sstep
case 0xAAA3:
                                                     mon("         BRA   LAAA8                   ; AAA3: 20 03         \n");
    PC = 0xaaa8; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAAA5:
                                                     mon("LAAA5    LDD   #$FE80                  ; AAA5: CC FE 80      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAAA8; JUMP; // sstep
case 0xAAA8:
                                                     mon("LAAA8    SUBD  $02,U                   ; AAA8: A3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAAAA; JUMP; // sstep
case 0xAAAA:
                                                     mon("         BMI   LAAB3                   ; AAAA: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xaab3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAAAC; JUMP; // sstep
case 0xAAAC:
                                                     mon("         JSR   Shift_D_R_4             ; AAAC: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xAAAF:
                                                     mon("LAAAF    ADDD  $02,U                   ; AAAF: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAAB1; JUMP; // sstep
case 0xAAB1:
                                                     mon("         STD   $02,U                   ; AAB1: ED 42         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_AA86
    PC = 0xAAB3; JUMP; // sstep
case 0xAAB3:
                                                     mon("LAAB3    BRA   LAA7D                   ; AAB3: 20 C8         \n");
    PC = 0xaa7d; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xAAB5:
                                                     mon("LAAB5    LDU   ,X                      ; AAB5: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xAAB7; JUMP; // sstep
case 0xAAB7:
                                                     mon("         JSR   LA90C                   ; AAB7: BD A9 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xa90c; 
    JUMP;
  case 0xAABA:
                                                     mon("LAABA    LDD   $509C                   ; AABA: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAABD; JUMP; // sstep
case 0xAABD:
                                                     mon("         SUBD  $04,U                   ; AABD: A3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAABF; JUMP; // sstep
case 0xAABF:
                                                     mon("         BMI   LAAC8                   ; AABF: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xaac8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAAC1; JUMP; // sstep
case 0xAAC1:
                                                     mon("         JSR   Shift_D_R_4             ; AAC1: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xAAC4:
                                                     mon("LAAC4    ADDD  $04,U                   ; AAC4: E3 44         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAAC6; JUMP; // sstep
case 0xAAC6:
                                                     mon("         STD   $04,U                   ; AAC6: ED 44         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAAC8; JUMP; // sstep
case 0xAAC8:
                                                     mon("LAAC8    LDA   $4B19                   ; AAC8: B6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAACB; JUMP; // sstep
case 0xAACB:
                                                     mon("         CMPA  #$01                    ; AACB: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xAACD; JUMP; // sstep
case 0xAACD:
                                                     mon("         BCS   LAAD4                   ; AACD: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xaad4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAACF; JUMP; // sstep
case 0xAACF:
                                                     mon("         LDD   $509A                   ; AACF: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xAAD2; JUMP; // sstep
case 0xAAD2:
                                                     mon("         BRA   LAAD7                   ; AAD2: 20 03         \n");
    PC = 0xaad7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAAD4:
                                                     mon("LAAD4    LDD   #$0180                  ; AAD4: CC 01 80      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAAD7; JUMP; // sstep
case 0xAAD7:
                                                     mon("LAAD7    SUBD  $02,U                   ; AAD7: A3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAAD9; JUMP; // sstep
case 0xAAD9:
                                                     mon("         BPL   LAAE2                   ; AAD9: 2A 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xaae2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAADB; JUMP; // sstep
case 0xAADB:
                                                     mon("         JSR   Shift_D_R_4             ; AADB: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xde); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xAADE:
                                                     mon("LAADE    ADDD  $02,U                   ; AADE: E3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAAE0; JUMP; // sstep
case 0xAAE0:
                                                     mon("         STD   $02,U                   ; AAE0: ED 42         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_AAB5
    PC = 0xAAE2; JUMP; // sstep
case 0xAAE2:
                                                     mon("LAAE2    BRA   LAA7D                   ; AAE2: 20 99         \n");
    PC = 0xaa7d; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Fireball processing
  case 0xAAE4:
                                                     mon("LAAE4    LDX   #$494B                  ; AAE4: 8E 49 4B      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 3; 
    X = 0x494b; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAAE7; JUMP; // sstep
case 0xAAE7:
                                                     mon("LAAE7    STX   <$A8                    ; AAE7: 9F A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xa8; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xAAE9; JUMP; // sstep
case 0xAAE9:
                                                     mon("         LDA   $03,X                   ; AAE9: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAAEB; JUMP; // sstep
case 0xAAEB:
                                                     mon("         LBEQ  LAC34                   ; AAEB: 10 27 01 45   \n");
    clockticks = clockticks + 5; 
    if (!Z) {
    clockticks = clockticks + 1; 
    PC = 0xac34; 
    JUMP;
    }
    PC = 0xAAEF; JUMP; // sstep
case 0xAAEF:
                                                     mon("         BITA  #$10                    ; AAEF: 85 10         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x10; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAAF1; JUMP; // sstep
case 0xAAF1:
                                                     mon("         BEQ   LAAF9                   ; AAF1: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xaaf9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAAF3; JUMP; // sstep
case 0xAAF3:
                                                     mon("         JSR   LACB1                   ; AAF3: BD AC B1      \n"); // Shield lost by fireball animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    PC = 0xacb1; 
    JUMP;
  case 0xAAF6:
                                                     mon("LAAF6    JMP   LAC34                   ; AAF6: 7E AC 34      \n");
    clockticks = clockticks + 4; 
    PC = 0xac34; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xAAF9:
                                                     mon("LAAF9    BITA  #$04                    ; AAF9: 85 04         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x04; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAAFB; JUMP; // sstep
case 0xAAFB:
                                                     mon("         BEQ   LAB11                   ; AAFB: 27 14         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xab11; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAAFD; JUMP; // sstep
case 0xAAFD:
                                                     mon("         LDD   $5098                   ; AAFD: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB00; JUMP; // sstep
case 0xAB00:
                                                     mon("         STD   $5040                   ; AB00: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0xAB03; JUMP; // sstep
case 0xAB03:
                                                     mon("         LDD   $509A                   ; AB03: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB06; JUMP; // sstep
case 0xAB06:
                                                     mon("         STD   $5042                   ; AB06: FD 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5042, A); // Care needed with I/O space and word fetches
    wr_mem(0x5043, B); 
    PC = 0xAB09; JUMP; // sstep
case 0xAB09:
                                                     mon("         LDD   $509C                   ; AB09: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB0C; JUMP; // sstep
case 0xAB0C:
                                                     mon("         STD   $5044                   ; AB0C: FD 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5044, A); // Care needed with I/O space and word fetches
    wr_mem(0x5045, B); 
    PC = 0xAB0F; JUMP; // sstep
case 0xAB0F:
                                                     mon("         BRA   LAB1D                   ; AB0F: 20 0C         \n");
    PC = 0xab1d; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAB11:
                                                     mon("LAB11    LDD   #$00                    ; AB11: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB14; JUMP; // sstep
case 0xAB14:
                                                     mon("         STD   $5040                   ; AB14: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0xAB17; JUMP; // sstep
case 0xAB17:
                                                     mon("         STD   $5042                   ; AB17: FD 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5042, A); // Care needed with I/O space and word fetches
    wr_mem(0x5043, B); 
    PC = 0xAB1A; JUMP; // sstep
case 0xAB1A:
                                                     mon("         STD   $5044                   ; AB1A: FD 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5044, A); // Care needed with I/O space and word fetches
    wr_mem(0x5045, B); 
    PC = 0xAB1D; JUMP; // sstep
case 0xAB1D:
                                                     mon("LAB1D    CLRA                          ; AB1D: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAB1E; JUMP; // sstep
case 0xAB1E:
                                                     mon("         LDB   $02,X                   ; AB1E: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAB20; JUMP; // sstep
case 0xAB20:
                                                     mon("         STD   $4701                   ; AB20: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xAB23; JUMP; // sstep
case 0xAB23:
                                                     mon("         LDA   #$67                    ; AB23: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAB25; JUMP; // sstep
case 0xAB25:
                                                     mon("         JSR   LCDBA                   ; AB25: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xAB28:
                                                     mon("LAB28    LDD   $5000                   ; AB28: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB2B; JUMP; // sstep
case 0xAB2B:
                                                     mon("         CMPD  #$01                    ; AB2B: 10 83 00 01   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0001; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xAB2F; JUMP; // sstep
case 0xAB2F:
                                                     mon("         LBLE  LAC27                   ; AB2F: 10 2F 00 F4   \n");
    clockticks = clockticks + 5; 
    if (((SINT8)(N^V) <  0) || (!Z)) {
    clockticks = clockticks + 1; 
    PC = 0xac27; 
    JUMP;
    }
    PC = 0xAB33; JUMP; // sstep
case 0xAB33:
                                                     mon("         CMPD  #$7F00                  ; AB33: 10 83 7F 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x7f00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xAB37; JUMP; // sstep
case 0xAB37:
                                                     mon("         LBHI  LAC27                   ; AB37: 10 22 00 EC   \n");
    clockticks = clockticks + 5; 
    if (Z && (!C)) {
    clockticks = clockticks + 1; 
    PC = 0xac27; 
    JUMP;
    }
    PC = 0xAB3B; JUMP; // sstep
case 0xAB3B:
                                                     mon("         STD   $4704                   ; AB3B: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xAB3E; JUMP; // sstep
case 0xAB3E:
                                                     mon("         STD   $5018                   ; AB3E: FD 50 18      \n"); // XT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5018, A); // Care needed with I/O space and word fetches
    wr_mem(0x5019, B); 
    PC = 0xAB41; JUMP; // sstep
case 0xAB41:
                                                     mon("         LDD   $5002                   ; AB41: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB44; JUMP; // sstep
case 0xAB44:
                                                     mon("         STD   $501A                   ; AB44: FD 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x501a, A); // Care needed with I/O space and word fetches
    wr_mem(0x501b, B); 
    PC = 0xAB47; JUMP; // sstep
case 0xAB47:
                                                     mon("         BPL   LAB4D                   ; AB47: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xab4d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAB49; JUMP; // sstep
case 0xAB49:
                                                     mon("         COMA                          ; AB49: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAB4A; JUMP; // sstep
case 0xAB4A:
                                                     mon("         NEGB                          ; AB4A: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAB4B; JUMP; // sstep
case 0xAB4B:
                                                     mon("         SBCA  #$FF                    ; AB4B: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAB4D; JUMP; // sstep
case 0xAB4D:
                                                     mon("LAB4D    SUBD  $5000                   ; AB4D: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAB50; JUMP; // sstep
case 0xAB50:
                                                     mon("         LBCC  LAC27                   ; AB50: 10 24 00 D3   \n");
    clockticks = clockticks + 5; 
    if (!C) {
    clockticks = clockticks + 1; 
    PC = 0xac27; 
    JUMP;
    }
    PC = 0xAB54; JUMP; // sstep
case 0xAB54:
                                                     mon("         LDD   $5004                   ; AB54: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB57; JUMP; // sstep
case 0xAB57:
                                                     mon("         STD   $501C                   ; AB57: FD 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x501c, A); // Care needed with I/O space and word fetches
    wr_mem(0x501d, B); 
    PC = 0xAB5A; JUMP; // sstep
case 0xAB5A:
                                                     mon("         BPL   LAB60                   ; AB5A: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xab60; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAB5C; JUMP; // sstep
case 0xAB5C:
                                                     mon("         COMA                          ; AB5C: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAB5D; JUMP; // sstep
case 0xAB5D:
                                                     mon("         NEGB                          ; AB5D: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAB5E; JUMP; // sstep
case 0xAB5E:
                                                     mon("         SBCA  #$FF                    ; AB5E: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAB60; JUMP; // sstep
case 0xAB60:
                                                     mon("LAB60    SUBD  $5000                   ; AB60: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAB63; JUMP; // sstep
case 0xAB63:
                                                     mon("         LBCC  LAC27                   ; AB63: 10 24 00 C0   \n");
    clockticks = clockticks + 5; 
    if (!C) {
    clockticks = clockticks + 1; 
    PC = 0xac27; 
    JUMP;
    }
    PC = 0xAB67; JUMP; // sstep
case 0xAB67:
                                                     mon("         JSR   LCCF0                   ; AB67: BD CC F0      \n"); // Get divider result and multiply by Math result Z, insert VCTR instruction
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    PC = 0xccf0; 
    JUMP;
  case 0xAB6A:
                                                     mon("LAB6A    LDX   <$A8                    ; AB6A: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAB6C; JUMP; // sstep
case 0xAB6C:
                                                     mon("         LDA   $03,X                   ; AB6C: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAB6E; JUMP; // sstep
case 0xAB6E:
                                                     mon("         BITA  #$03                    ; AB6E: 85 03         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x03; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAB70; JUMP; // sstep
case 0xAB70:
                                                     mon("         BEQ   LABC0                   ; AB70: 27 4E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xabc0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAB72; JUMP; // sstep
case 0xAB72:
                                                     mon("         LDD   #$80                    ; AB72: CC 00 80      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB75; JUMP; // sstep
case 0xAB75:
                                                     mon("         STD   $5002                   ; AB75: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xAB78; JUMP; // sstep
case 0xAB78:
                                                     mon("         LDA   #$86                    ; AB78: 86 86         \n"); // Reg02 = Reg02 x Reg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAB7A; JUMP; // sstep
case 0xAB7A:
                                                     mon("         JSR   LCDBA                   ; AB7A: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xab); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xAB7D:
                                                     mon("LAB7D    LDD   $5002                   ; AB7D: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB80; JUMP; // sstep
case 0xAB80:
                                                     mon("         ADDD  #$0A                    ; AB80: C3 00 0A      \n");
    clockticks = clockticks + 4; 
    val = 0x000a; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAB83; JUMP; // sstep
case 0xAB83:
                                                     mon("         STD   <$03                    ; AB83: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAB85; JUMP; // sstep
case 0xAB85:
                                                     mon("         LDD   <$D6                    ; AB85: DC D6         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xd6); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xd7); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB87; JUMP; // sstep
case 0xAB87:
                                                     mon("         SUBD  <$B3                    ; AB87: 93 B3         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xb3)<<8; 
    ea = ea | rd_mem(DP|0xb4); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAB89; JUMP; // sstep
case 0xAB89:
                                                     mon("         BPL   LAB8F                   ; AB89: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xab8f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAB8B; JUMP; // sstep
case 0xAB8B:
                                                     mon("         COMA                          ; AB8B: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAB8C; JUMP; // sstep
case 0xAB8C:
                                                     mon("         NEGB                          ; AB8C: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAB8D; JUMP; // sstep
case 0xAB8D:
                                                     mon("         SBCA  #$FF                    ; AB8D: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAB8F; JUMP; // sstep
case 0xAB8F:
                                                     mon("LAB8F    STD   <$01                    ; AB8F: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAB91; JUMP; // sstep
case 0xAB91:
                                                     mon("         SUBD  <$03                    ; AB91: 93 03         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x03)<<8; 
    ea = ea | rd_mem(DP|0x04); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAB93; JUMP; // sstep
case 0xAB93:
                                                     mon("         BGT   LABC0                   ; AB93: 2E 2B         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xabc0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAB95; JUMP; // sstep
case 0xAB95:
                                                     mon("         LDD   <$D8                    ; AB95: DC D8         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xd8); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xd9); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAB97; JUMP; // sstep
case 0xAB97:
                                                     mon("         SUBD  <$B5                    ; AB97: 93 B5         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xb5)<<8; 
    ea = ea | rd_mem(DP|0xb6); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAB99; JUMP; // sstep
case 0xAB99:
                                                     mon("         BPL   LAB9F                   ; AB99: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xab9f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAB9B; JUMP; // sstep
case 0xAB9B:
                                                     mon("         COMA                          ; AB9B: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAB9C; JUMP; // sstep
case 0xAB9C:
                                                     mon("         NEGB                          ; AB9C: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAB9D; JUMP; // sstep
case 0xAB9D:
                                                     mon("         SBCA  #$FF                    ; AB9D: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAB9F; JUMP; // sstep
case 0xAB9F:
                                                     mon("LAB9F    CMPD  <$03                    ; AB9F: 10 93 03      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x03)<<8; 
    ea = ea | rd_mem(DP|0x04); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xABA2; JUMP; // sstep
case 0xABA2:
                                                     mon("         BGT   LABC0                   ; ABA2: 2E 1C         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xabc0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABA4; JUMP; // sstep
case 0xABA4:
                                                     mon("         ADDD  <$01                    ; ABA4: D3 01         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x01)<<8; 
    ea = ea | rd_mem(DP|0x02); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xABA6; JUMP; // sstep
case 0xABA6:
                                                     mon("         STD   <$01                    ; ABA6: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xABA8; JUMP; // sstep
case 0xABA8:
                                                     mon("         LDD   <$03                    ; ABA8: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xABAA; JUMP; // sstep
case 0xABAA:
                                                     mon("         LSRA                          ; ABAA: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xABAB; JUMP; // sstep
case 0xABAB:
                                                     mon("         RORB                          ; ABAB: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xABAC; JUMP; // sstep
case 0xABAC:
                                                     mon("         ADDD  <$03                    ; ABAC: D3 03         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x03)<<8; 
    ea = ea | rd_mem(DP|0x04); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xABAE; JUMP; // sstep
case 0xABAE:
                                                     mon("         SUBD  <$01                    ; ABAE: 93 01         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x01)<<8; 
    ea = ea | rd_mem(DP|0x02); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABB0; JUMP; // sstep
case 0xABB0:
                                                     mon("         BLT   LABC0                   ; ABB0: 2D 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xabc0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABB2; JUMP; // sstep
case 0xABB2:
                                                     mon("         LDD   $5018                   ; ABB2: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xABB5; JUMP; // sstep
case 0xABB5:
                                                     mon("         CMPD  <$CC                    ; ABB5: 10 93 CC      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xcc)<<8; 
    ea = ea | rd_mem(DP|0xcd); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xABB8; JUMP; // sstep
case 0xABB8:
                                                     mon("         BCC   LABC0                   ; ABB8: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xabc0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABBA; JUMP; // sstep
case 0xABBA:
                                                     mon("         STD   <$CC                    ; ABBA: DD CC         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xcc; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xABBC; JUMP; // sstep
case 0xABBC:
                                                     mon("         LDX   <$A8                    ; ABBC: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xABBE; JUMP; // sstep
case 0xABBE:
                                                     mon("         STX   <$CA                    ; ABBE: 9F CA         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xca; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xABC0; JUMP; // sstep
case 0xABC0:
                                                     mon("LABC0    LDA   $03,X                   ; ABC0: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xABC2; JUMP; // sstep
case 0xABC2:
                                                     mon("         BITA  #$01                    ; ABC2: 85 01         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x01; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xABC4; JUMP; // sstep
case 0xABC4:
                                                     mon("         BEQ   LAC22                   ; ABC4: 27 5C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABC6; JUMP; // sstep
case 0xABC6:
                                                     mon("         LDD   $5018                   ; ABC6: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xABC9; JUMP; // sstep
case 0xABC9:
                                                     mon("         ASLB                          ; ABC9: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xABCA; JUMP; // sstep
case 0xABCA:
                                                     mon("         ROLA                          ; ABCA: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xABCB; JUMP; // sstep
case 0xABCB:
                                                     mon("         BMI   LAC22                   ; ABCB: 2B 55         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABCD; JUMP; // sstep
case 0xABCD:
                                                     mon("         LDU   $5086                   ; ABCD: FE 50 86      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5086)<<8; 
    ea = ea | rd_mem(0x5087); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xABD0; JUMP; // sstep
case 0xABD0:
                                                     mon("         CMPU  #$0200                  ; ABD0: 11 83 02 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x0200; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xABD4; JUMP; // sstep
case 0xABD4:
                                                     mon("         BLT   LABDB                   ; ABD4: 2D 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xabdb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABD6; JUMP; // sstep
case 0xABD6:
                                                     mon("         SUBD  $5086                   ; ABD6: B3 50 86      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5086)<<8; 
    ea = ea | rd_mem(0x5087); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABD9; JUMP; // sstep
case 0xABD9:
                                                     mon("         BRA   LABDE                   ; ABD9: 20 03         \n");
    PC = 0xabde; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xABDB:
                                                     mon("LABDB    SUBD  #$0200                  ; ABDB: 83 02 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0200; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABDE; JUMP; // sstep
case 0xABDE:
                                                     mon("LABDE    BLE   LABE5                   ; ABDE: 2F 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xabe5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABE0; JUMP; // sstep
case 0xABE0:
                                                     mon("         SUBD  #$0110                  ; ABE0: 83 01 10      \n");
    clockticks = clockticks + 4; 
    val = 0x0110; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABE3; JUMP; // sstep
case 0xABE3:
                                                     mon("         BGT   LAC22                   ; ABE3: 2E 3D         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABE5; JUMP; // sstep
case 0xABE5:
                                                     mon("LABE5    LDD   <$D6                    ; ABE5: DC D6         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xd6); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xd7); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xABE7; JUMP; // sstep
case 0xABE7:
                                                     mon("         BMI   LABF0                   ; ABE7: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xabf0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABE9; JUMP; // sstep
case 0xABE9:
                                                     mon("         SUBD  #$01C0                  ; ABE9: 83 01 C0      \n");
    clockticks = clockticks + 4; 
    val = 0x01c0; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABEC; JUMP; // sstep
case 0xABEC:
                                                     mon("         BGE   LAC22                   ; ABEC: 2C 34         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABEE; JUMP; // sstep
case 0xABEE:
                                                     mon("         BRA   LABF5                   ; ABEE: 20 05         \n");
    PC = 0xabf5; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xABF0:
                                                     mon("LABF0    SUBD  #$FE40                  ; ABF0: 83 FE 40      \n");
    clockticks = clockticks + 4; 
    val = 0xfe40; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABF3; JUMP; // sstep
case 0xABF3:
                                                     mon("         BLE   LAC22                   ; ABF3: 2F 2D         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABF5; JUMP; // sstep
case 0xABF5:
                                                     mon("LABF5    LDD   <$D8                    ; ABF5: DC D8         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xd8); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xd9); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xABF7; JUMP; // sstep
case 0xABF7:
                                                     mon("         BMI   LAC00                   ; ABF7: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xac00; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABF9; JUMP; // sstep
case 0xABF9:
                                                     mon("         SUBD  #$01E0                  ; ABF9: 83 01 E0      \n");
    clockticks = clockticks + 4; 
    val = 0x01e0; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xABFC; JUMP; // sstep
case 0xABFC:
                                                     mon("         BGE   LAC22                   ; ABFC: 2C 24         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xABFE; JUMP; // sstep
case 0xABFE:
                                                     mon("         BRA   LAC05                   ; ABFE: 20 05         \n");
    PC = 0xac05; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAC00:
                                                     mon("LAC00    SUBD  #LFE60                  ; AC00: 83 FE 60      \n");
    clockticks = clockticks + 4; 
    val = 0xfe60; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAC03; JUMP; // sstep
case 0xAC03:
                                                     mon("         BLE   LAC22                   ; AC03: 2F 1D         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xac22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC05; JUMP; // sstep
case 0xAC05:
                                                     mon("LAC05    CPX   <$CA                    ; AC05: 9C CA         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xca)<<8; 
    ea = ea | rd_mem(DP|0xcb); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xAC07; JUMP; // sstep
case 0xAC07:
                                                     mon("         BNE   LAC14                   ; AC07: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xac14; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC09; JUMP; // sstep
case 0xAC09:
                                                     mon("         LDA   <$BC                    ; AC09: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAC0B; JUMP; // sstep
case 0xAC0B:
                                                     mon("         BEQ   LAC14                   ; AC0B: 27 07         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xac14; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC0D; JUMP; // sstep
case 0xAC0D:
                                                     mon("         JSR   LAD20                   ; AC0D: BD AD 20      \n"); // Fireball destroyed
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x10); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    PC = 0xad20; 
    JUMP;
  case 0xAC10:
                                                     mon("LAC10    LDX   <$A8                    ; AC10: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xAC12; JUMP; // sstep
case 0xAC12:
                                                     mon("         BRA   LAC22                   ; AC12: 20 0E         \n");
    PC = 0xac22; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAC14:
                                                     mon("LAC14    JSR   LACE0                   ; AC14: BD AC E0      \n"); // Shield lost by fireball hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    PC = 0xace0; 
    JUMP;
  case 0xAC17:
                                                     mon("LAC17    LDD   #$8040                  ; AC17: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAC1A; JUMP; // sstep
case 0xAC1A:
                                                     mon("         STD   ,Y++                    ; AC1A: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAC1C; JUMP; // sstep
case 0xAC1C:
                                                     mon("         JSR   LACB1                   ; AC1C: BD AC B1      \n"); // Shield lost by fireball animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    PC = 0xacb1; 
    JUMP;
  case 0xAC1F:
                                                     mon("LAC1F    JMP   LAC34                   ; AC1F: 7E AC 34      \n");
    clockticks = clockticks + 4; 
    PC = 0xac34; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xAC22:
                                                     mon("LAC22    JSR   LAC52                   ; AC22: BD AC 52      \n"); // Fireball animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x25); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    PC = 0xac52; 
    JUMP;
  case 0xAC25:
                                                     mon("LAC25    BRA   LAC34                   ; AC25: 20 0D         \n");
    PC = 0xac34; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAC27:
                                                     mon("LAC27    LDA   $03,X                   ; AC27: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC29; JUMP; // sstep
case 0xAC29:
                                                     mon("         BITA  #$01                    ; AC29: 85 01         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x01; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAC2B; JUMP; // sstep
case 0xAC2B:
                                                     mon("         BEQ   LAC31                   ; AC2B: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xac31; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC2D; JUMP; // sstep
case 0xAC2D:
                                                     mon("         LDA   #$00                    ; AC2D: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAC2F; JUMP; // sstep
case 0xAC2F:
                                                     mon("         BRA   LAC32                   ; AC2F: 20 01         \n");
    PC = 0xac32; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAC31:
                                                     mon("LAC31    CLRA                          ; AC31: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAC32; JUMP; // sstep
case 0xAC32:
                                                     mon("LAC32    STA   $03,X                   ; AC32: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xAC34; JUMP; // sstep
case 0xAC34:
                                                     mon("LAC34    LDX   <$A8                    ; AC34: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAC36; JUMP; // sstep
case 0xAC36:
                                                     mon("         LEAX  $06,X                   ; AC36: 30 06         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0006); 
/**/Z = X; 
    PC = 0xAC38; JUMP; // sstep
case 0xAC38:
                                                     mon("         CMPX  #$496F                  ; AC38: 8C 49 6F      \n"); // Check for all 6 fireball slots
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x496f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xAC3B; JUMP; // sstep
case 0xAC3B:
                                                     mon("         LBCS  LAAE7                   ; AC3B: 10 25 FE A8   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0xaae7; 
    JUMP;
    }
    PC = 0xAC3F; JUMP; // sstep
case 0xAC3F:
                                                     mon("         LDD   $5098                   ; AC3F: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAC42; JUMP; // sstep
case 0xAC42:
                                                     mon("         STD   $5040                   ; AC42: FD 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5040, A); // Care needed with I/O space and word fetches
    wr_mem(0x5041, B); 
    PC = 0xAC45; JUMP; // sstep
case 0xAC45:
                                                     mon("         LDD   $509A                   ; AC45: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAC48; JUMP; // sstep
case 0xAC48:
                                                     mon("         STD   $5042                   ; AC48: FD 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5042, A); // Care needed with I/O space and word fetches
    wr_mem(0x5043, B); 
    PC = 0xAC4B; JUMP; // sstep
case 0xAC4B:
                                                     mon("         LDD   $509C                   ; AC4B: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAC4E; JUMP; // sstep
case 0xAC4E:
                                                     mon("         STD   $5044                   ; AC4E: FD 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x5044, A); // Care needed with I/O space and word fetches
    wr_mem(0x5045, B); 
    // End of function sub_AAE4
    PC = 0xAC51; JUMP; // sstep
case 0xAC51:
                                                     mon("         RTS                           ; AC51: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Fireball animation
  case 0xAC52:
                                                     mon("LAC52    LDX   <$A8                    ; AC52: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAC54; JUMP; // sstep
case 0xAC54:
                                                     mon("         LDA   #$08                    ; AC54: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC56; JUMP; // sstep
case 0xAC56:
                                                     mon("         STA   <$01                    ; AC56: 97 01         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, val); 
    PC = 0xAC58; JUMP; // sstep
case 0xAC58:
                                                     mon("         LDD   $5018                   ; AC58: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAC5B; JUMP; // sstep
case 0xAC5B:
                                                     mon("LAC5B    DEC   <$01                    ; AC5B: 0A 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x01, res); 
    clockticks = clockticks + 2; 
    PC = 0xAC5D; JUMP; // sstep
case 0xAC5D:
                                                     mon("         BEQ   LAC65                   ; AC5D: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xac65; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC5F; JUMP; // sstep
case 0xAC5F:
                                                     mon("         ASLB                          ; AC5F: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAC60; JUMP; // sstep
case 0xAC60:
                                                     mon("         ROLA                          ; AC60: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xAC61; JUMP; // sstep
case 0xAC61:
                                                     mon("         BPL   LAC5B                   ; AC61: 2A F8         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xac5b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC63; JUMP; // sstep
case 0xAC63:
                                                     mon("         ANDA  #$7F                    ; AC63: 84 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x7f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAC65; JUMP; // sstep
case 0xAC65:
                                                     mon("LAC65    STA   <$02                    ; AC65: 97 02         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x02; 
    wr_mem(ea, val); 
    PC = 0xAC67; JUMP; // sstep
case 0xAC67:
                                                     mon("         LDA   $03,X                   ; AC67: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC69; JUMP; // sstep
case 0xAC69:
                                                     mon("         ANDA  #$20                    ; AC69: 84 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x20; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAC6B; JUMP; // sstep
case 0xAC6B:
                                                     mon("         BNE   LAC7C                   ; AC6B: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xac7c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC6D; JUMP; // sstep
case 0xAC6D:
                                                     mon("         LDA   <$01                    ; AC6D: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC6F; JUMP; // sstep
case 0xAC6F:
                                                     mon("         ORA   #$70                    ; AC6F: 8A 70         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x70; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAC71; JUMP; // sstep
case 0xAC71:
                                                     mon("         LDB   <$02                    ; AC71: D6 02         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x02); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC73; JUMP; // sstep
case 0xAC73:
                                                     mon("         STD   ,Y++                    ; AC73: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAC75; JUMP; // sstep
case 0xAC75:
                                                     mon("         LDD   #$A015                  ; AC75: CC A0 15      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x15; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAC78; JUMP; // sstep
case 0xAC78:
                                                     mon("         STD   ,Y++                    ; AC78: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAC7A; JUMP; // sstep
case 0xAC7A:
                                                     mon("         BRA   LACA6                   ; AC7A: 20 2A         \n");
    PC = 0xaca6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAC7C:
                                                     mon("LAC7C    LDB   <$02                    ; AC7C: D6 02         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x02); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC7E; JUMP; // sstep
case 0xAC7E:
                                                     mon("         LDA   <$01                    ; AC7E: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC80; JUMP; // sstep
case 0xAC80:
                                                     mon("         INCA                          ; AC80: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xAC81; JUMP; // sstep
case 0xAC81:
                                                     mon("         CMPA  #$03                    ; AC81: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xAC83; JUMP; // sstep
case 0xAC83:
                                                     mon("         BCC   LAC8A                   ; AC83: 24 05         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xac8a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC85; JUMP; // sstep
case 0xAC85:
                                                     mon("         LDA   #$03                    ; AC85: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC87; JUMP; // sstep
case 0xAC87:
                                                     mon("         CLRB                          ; AC87: 5F            \n");
    B = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAC88; JUMP; // sstep
case 0xAC88:
                                                     mon("         BRA   LAC91                   ; AC88: 20 07         \n");
    PC = 0xac91; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAC8A:
                                                     mon("LAC8A    CMPA  #$06                    ; AC8A: 81 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x06; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xAC8C; JUMP; // sstep
case 0xAC8C:
                                                     mon("         BCS   LAC91                   ; AC8C: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xac91; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAC8E; JUMP; // sstep
case 0xAC8E:
                                                     mon("         LDA   #$06                    ; AC8E: 86 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC90; JUMP; // sstep
case 0xAC90:
                                                     mon("         CLRB                          ; AC90: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAC91; JUMP; // sstep
case 0xAC91:
                                                     mon("LAC91    ORA   #$70                    ; AC91: 8A 70         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x70; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAC93; JUMP; // sstep
case 0xAC93:
                                                     mon("         STD   ,Y++                    ; AC93: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAC95; JUMP; // sstep
case 0xAC95:
                                                     mon("         LDB   $05,X                   ; AC95: E6 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0005)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC97; JUMP; // sstep
case 0xAC97:
                                                     mon("         ASLB                          ; AC97: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAC98; JUMP; // sstep
case 0xAC98:
                                                     mon("         ASLB                          ; AC98: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAC99; JUMP; // sstep
case 0xAC99:
                                                     mon("         ASLB                          ; AC99: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAC9A; JUMP; // sstep
case 0xAC9A:
                                                     mon("         ASLB                          ; AC9A: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAC9B; JUMP; // sstep
case 0xAC9B:
                                                     mon("         ORB   #$0F                    ; AC9B: CA 0F         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAC9D; JUMP; // sstep
case 0xAC9D:
                                                     mon("         LDA   #$65                    ; AC9D: 86 65         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x65; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAC9F; JUMP; // sstep
case 0xAC9F:
                                                     mon("         STD   ,Y++                    ; AC9F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACA1; JUMP; // sstep
case 0xACA1:
                                                     mon("         LDD   #$A017                  ; ACA1: CC A0 17      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x17; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACA4; JUMP; // sstep
case 0xACA4:
                                                     mon("         STD   ,Y++                    ; ACA4: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACA6; JUMP; // sstep
case 0xACA6:
                                                     mon("LACA6    LDD   #$7200                  ; ACA6: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACA9; JUMP; // sstep
case 0xACA9:
                                                     mon("         STD   ,Y++                    ; ACA9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACAB; JUMP; // sstep
case 0xACAB:
                                                     mon("         LDD   #$8040                  ; ACAB: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACAE; JUMP; // sstep
case 0xACAE:
                                                     mon("         STD   ,Y++                    ; ACAE: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_AC52
    PC = 0xACB0; JUMP; // sstep
case 0xACB0:
                                                     mon("         RTS                           ; ACB0: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Shield lost by fireball animation
  case 0xACB1:
                                                     mon("LACB1    LDX   <$A8                    ; ACB1: 9E A8         \n"); // Fireball data pointer
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa8)<<8; 
    ea = ea | rd_mem(DP|0xa9); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xACB3; JUMP; // sstep
case 0xACB3:
                                                     mon("         LDU   ,X                      ; ACB3: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xACB5; JUMP; // sstep
case 0xACB5:
                                                     mon("         LDD   ,U                      ; ACB5: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACB7; JUMP; // sstep
case 0xACB7:
                                                     mon("         STD   ,Y++                    ; ACB7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACB9; JUMP; // sstep
case 0xACB9:
                                                     mon("         LDD   $02,U                   ; ACB9: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACBB; JUMP; // sstep
case 0xACBB:
                                                     mon("         STD   ,Y++                    ; ACBB: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACBD; JUMP; // sstep
case 0xACBD:
                                                     mon("         LDA   $05,X                   ; ACBD: A6 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0005)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACBF; JUMP; // sstep
case 0xACBF:
                                                     mon("         LDB   #$10                    ; ACBF: C6 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACC1; JUMP; // sstep
case 0xACC1:
                                                     mon("         MUL                           ; ACC1: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xACC2; JUMP; // sstep
case 0xACC2:
                                                     mon("         LDA   #$70                    ; ACC2: 86 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x70; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACC4; JUMP; // sstep
case 0xACC4:
                                                     mon("         STD   ,Y++                    ; ACC4: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACC6; JUMP; // sstep
case 0xACC6:
                                                     mon("         LDB   $05,X                   ; ACC6: E6 05         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0005)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACC8; JUMP; // sstep
case 0xACC8:
                                                     mon("         ASLB                          ; ACC8: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xACC9; JUMP; // sstep
case 0xACC9:
                                                     mon("         ASLB                          ; ACC9: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xACCA; JUMP; // sstep
case 0xACCA:
                                                     mon("         ASLB                          ; ACCA: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xACCB; JUMP; // sstep
case 0xACCB:
                                                     mon("         ASLB                          ; ACCB: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xACCC; JUMP; // sstep
case 0xACCC:
                                                     mon("         LDA   #$67                    ; ACCC: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACCE; JUMP; // sstep
case 0xACCE:
                                                     mon("         STD   ,Y++                    ; ACCE: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACD0; JUMP; // sstep
case 0xACD0:
                                                     mon("         LDD   #$A017                  ; ACD0: CC A0 17      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x17; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACD3; JUMP; // sstep
case 0xACD3:
                                                     mon("         STD   ,Y++                    ; ACD3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACD5; JUMP; // sstep
case 0xACD5:
                                                     mon("         LDD   #$7200                  ; ACD5: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACD8; JUMP; // sstep
case 0xACD8:
                                                     mon("         STD   ,Y++                    ; ACD8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xACDA; JUMP; // sstep
case 0xACDA:
                                                     mon("         LDD   #$8040                  ; ACDA: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACDD; JUMP; // sstep
case 0xACDD:
                                                     mon("         STD   ,Y++                    ; ACDD: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_ACB1
    PC = 0xACDF; JUMP; // sstep
case 0xACDF:
                                                     mon("         RTS                           ; ACDF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Shield lost by fireball hit
  case 0xACE0:
                                                     mon("LACE0    LDU   ,X                      ; ACE0: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xACE2; JUMP; // sstep
case 0xACE2:
                                                     mon("         LDD   -4,Y                    ; ACE2: EC 3C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(Y + 0xfffc); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACE4; JUMP; // sstep
case 0xACE4:
                                                     mon("         STD   ,U                      ; ACE4: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xACE6; JUMP; // sstep
case 0xACE6:
                                                     mon("         LDD   -2,Y                    ; ACE6: EC 3E         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(Y + 0xfffe); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xACE8; JUMP; // sstep
case 0xACE8:
                                                     mon("         STD   $02,U                   ; ACE8: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xACEA; JUMP; // sstep
case 0xACEA:
                                                     mon("         LDA   #$10                    ; ACEA: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACEC; JUMP; // sstep
case 0xACEC:
                                                     mon("         STA   $03,X                   ; ACEC: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xACEE; JUMP; // sstep
case 0xACEE:
                                                     mon("         LDA   #$0F                    ; ACEE: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACF0; JUMP; // sstep
case 0xACF0:
                                                     mon("         STA   $05,X                   ; ACF0: A7 05         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xACF2; JUMP; // sstep
case 0xACF2:
                                                     mon("         LDA   #$00                    ; ACF2: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xACF4; JUMP; // sstep
case 0xACF4:
                                                     mon("         STA   $04,X                   ; ACF4: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xACF6; JUMP; // sstep
case 0xACF6:
                                                     mon("         JSR   L9874                   ; ACF6: BD 98 74      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    PC = 0x9874; 
    JUMP;
  case 0xACF9:
                                                     mon("LACF9    LDA   <$63                    ; ACF9: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xACFB; JUMP; // sstep
case 0xACFB:
                                                     mon("         BNE   LAD00                   ; ACFB: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xad00; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xACFD; JUMP; // sstep
case 0xACFD:
                                                     mon("         LDA   $4703                   ; ACFD: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAD00; JUMP; // sstep
case 0xAD00:
                                                     mon("LAD00    LDB   #$20                    ; AD00: C6 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAD02; JUMP; // sstep
case 0xAD02:
                                                     mon("         TSTA                          ; AD02: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAD03; JUMP; // sstep
case 0xAD03:
                                                     mon("         BPL   LAD06                   ; AD03: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xad06; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD05; JUMP; // sstep
case 0xAD05:
                                                     mon("         NEGB                          ; AD05: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAD06; JUMP; // sstep
case 0xAD06:
                                                     mon("LAD06    STB   <$63                    ; AD06: D7 63         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0xAD08; JUMP; // sstep
case 0xAD08:
                                                     mon("         JSR   Sound_33                ; AD08: BD BD F3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbdf3; 
    JUMP;
  case 0xAD0B:
                                                     mon("LAD0B    LDA   $4B37                   ; AD0B: B6 4B 37      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b37); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAD0E; JUMP; // sstep
case 0xAD0E:
                                                     mon("         BNE   locret_AD1F             ; AD0E: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xad1f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD10; JUMP; // sstep
case 0xAD10:
                                                     mon("         INC   $4B37                   ; AD10: 7C 4B 37      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b37); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4b37, res); 
    clockticks = clockticks + 2; 
    PC = 0xAD13; JUMP; // sstep
case 0xAD13:
                                                     mon("         LDA   <$60                    ; AD13: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAD15; JUMP; // sstep
case 0xAD15:
                                                     mon("         CMPA  #$03                    ; AD15: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xAD17; JUMP; // sstep
case 0xAD17:
                                                     mon("         BLS   locret_AD1F             ; AD17: 23 06         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xad1f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD19; JUMP; // sstep
case 0xAD19:
                                                     mon("         JSR   Sound_9                 ; AD19: BD BD 21      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbd21; 
    JUMP;
  case 0xAD1C:
                                                     mon("LAD1C    JSR   Sound_31                ; AD1C: BD BD E9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbde9; 
    JUMP;
    // End of function sub_ACE0
  case 0xAD1F:
                                                     mon("locret_AD1F RTS                           ; AD1F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Fireball destroyed
  case 0xAD20:
                                                     mon("LAD20    LDU   <$CA                    ; AD20: DE CA         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xca)<<8; 
    ea = ea | rd_mem(DP|0xcb); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xAD22; JUMP; // sstep
case 0xAD22:
                                                     mon("         LDA   $03,U                   ; AD22: A6 43         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAD24; JUMP; // sstep
case 0xAD24:
                                                     mon("         BEQ   locret_AD3D             ; AD24: 27 17         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xad3d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD26; JUMP; // sstep
case 0xAD26:
                                                     mon("         ANDA  #$04                    ; AD26: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAD28; JUMP; // sstep
case 0xAD28:
                                                     mon("         ORA   #$20                    ; AD28: 8A 20         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x20; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAD2A; JUMP; // sstep
case 0xAD2A:
                                                     mon("         STA   $03,U                   ; AD2A: A7 43         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xAD2C; JUMP; // sstep
case 0xAD2C:
                                                     mon("         LDA   #$0F                    ; AD2C: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAD2E; JUMP; // sstep
case 0xAD2E:
                                                     mon("         STA   $05,U                   ; AD2E: A7 45         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0005); 
    wr_mem(ea, val); 
    PC = 0xAD30; JUMP; // sstep
case 0xAD30:
                                                     mon("         LDA   #$00                    ; AD30: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAD32; JUMP; // sstep
case 0xAD32:
                                                     mon("         STA   $04,U                   ; AD32: A7 44         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xAD34; JUMP; // sstep
case 0xAD34:
                                                     mon("         JSR   Sound_37                ; AD34: BD BE 07      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x37); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbe07; 
    JUMP;
  case 0xAD37:
                                                     mon("LAD37    JSR   L9801                   ; AD37: BD 98 01      \n"); // Fireball score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0x9801; 
    JUMP;
  case 0xAD3A:
                                                     mon("LAD3A    JSR   LBDF8                   ; AD3A: BD BD F8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbdf8; 
    JUMP;
    // End of function sub_AD20
  case 0xAD3D:
                                                     mon("locret_AD3D RTS                           ; AD3D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xAD3E:
                                                     mon("LAD3E    LDA   #$01                    ; AD3E: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAD40; JUMP; // sstep
case 0xAD40:
                                                     mon("         STA   <$45                    ; AD40: 97 45         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x45; 
    wr_mem(ea, val); 
    PC = 0xAD42; JUMP; // sstep
case 0xAD42:
                                                     mon("         LDD   $5098                   ; AD42: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD45; JUMP; // sstep
case 0xAD45:
                                                     mon("         ADDD  #$0100                  ; AD45: C3 01 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0100; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAD48; JUMP; // sstep
case 0xAD48:
                                                     mon("         STD   <$46                    ; AD48: DD 46         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x46; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAD4A; JUMP; // sstep
case 0xAD4A:
                                                     mon("         LDD   $509A                   ; AD4A: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD4D; JUMP; // sstep
case 0xAD4D:
                                                     mon("         STD   <$48                    ; AD4D: DD 48         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x48; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAD4F; JUMP; // sstep
case 0xAD4F:
                                                     mon("         LDD   $509C                   ; AD4F: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD52; JUMP; // sstep
case 0xAD52:
                                                     mon("         STD   <$4A                    ; AD52: DD 4A         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x4a; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAD54; JUMP; // sstep
case 0xAD54:
                                                     mon("         LDX   #$494B                  ; AD54: 8E 49 4B      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 3; 
    X = 0x494b; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAD57; JUMP; // sstep
case 0xAD57:
                                                     mon("LAD57    STX   <$CA                    ; AD57: 9F CA         \n");
    clockticks = clockticks + 4; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = DP|0xca; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xAD59; JUMP; // sstep
case 0xAD59:
                                                     mon("         JSR   LAD20                   ; AD59: BD AD 20      \n"); // Fireball destroyed
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xad20; 
    JUMP;
  case 0xAD5C:
                                                     mon("LAD5C    LDX   <$CA                    ; AD5C: 9E CA         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xca)<<8; 
    ea = ea | rd_mem(DP|0xcb); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAD5E; JUMP; // sstep
case 0xAD5E:
                                                     mon("         LEAX  $06,X                   ; AD5E: 30 06         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0006); 
/**/Z = X; 
    PC = 0xAD60; JUMP; // sstep
case 0xAD60:
                                                     mon("         CMPX  #$496F                  ; AD60: 8C 49 6F      \n"); // 6x Fireball data structure 2 ($6 bytes per fireball)
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x496f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xAD63; JUMP; // sstep
case 0xAD63:
                                                     mon("         BCS   LAD57                   ; AD63: 25 F2         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xad57; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD65; JUMP; // sstep
case 0xAD65:
                                                     mon("         JSR   Sound_23                ; AD65: BD BD A3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbda3; 
    JUMP;
  case 0xAD68:
                                                     mon("LAD68    JSR   LBDD5                   ; AD68: BD BD D5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xbdd5; 
    JUMP;
    // End of function sub_AD3E
  case 0xAD6B:
                                                     mon("LAD6B    RTS                           ; AD6B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xAD6C:
                                                     mon("LAD6C    LDA   <$45                    ; AD6C: 96 45         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x45); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAD6E; JUMP; // sstep
case 0xAD6E:
                                                     mon("         BEQ   locret_ADAE             ; AD6E: 27 3E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xadae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD70; JUMP; // sstep
case 0xAD70:
                                                     mon("         LDD   <$46                    ; AD70: DC 46         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x46); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x47); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD72; JUMP; // sstep
case 0xAD72:
                                                     mon("         ADDD  #$0300                  ; AD72: C3 03 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0300; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAD75; JUMP; // sstep
case 0xAD75:
                                                     mon("         ADDD  $5086                   ; AD75: F3 50 86      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5086)<<8; 
    ea = ea | rd_mem(0x5087); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAD78; JUMP; // sstep
case 0xAD78:
                                                     mon("         CMPD  <$96                    ; AD78: 10 93 96      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x96)<<8; 
    ea = ea | rd_mem(DP|0x97); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xAD7B; JUMP; // sstep
case 0xAD7B:
                                                     mon("         BMI   LAD7F                   ; AD7B: 2B 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xad7f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD7D; JUMP; // sstep
case 0xAD7D:
                                                     mon("         LDD   <$96                    ; AD7D: DC 96         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x96); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x97); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD7F; JUMP; // sstep
case 0xAD7F:
                                                     mon("LAD7F    STD   <$46                    ; AD7F: DD 46         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x46; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAD81; JUMP; // sstep
case 0xAD81:
                                                     mon("         LDD   <$96                    ; AD81: DC 96         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x96); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x97); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD83; JUMP; // sstep
case 0xAD83:
                                                     mon("         SUBD  <$46                    ; AD83: 93 46         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x46)<<8; 
    ea = ea | rd_mem(DP|0x47); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAD85; JUMP; // sstep
case 0xAD85:
                                                     mon("         SUBD  #$1000                  ; AD85: 83 10 00      \n");
    clockticks = clockticks + 4; 
    val = 0x1000; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAD88; JUMP; // sstep
case 0xAD88:
                                                     mon("         CMPD  <$4A                    ; AD88: 10 93 4A      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x4a)<<8; 
    ea = ea | rd_mem(DP|0x4b); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xAD8B; JUMP; // sstep
case 0xAD8B:
                                                     mon("         BGE   LAD8F                   ; AD8B: 2C 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xad8f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD8D; JUMP; // sstep
case 0xAD8D:
                                                     mon("         STD   <$4A                    ; AD8D: DD 4A         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x4a; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAD8F; JUMP; // sstep
case 0xAD8F:
                                                     mon("LAD8F    LDD   <$96                    ; AD8F: DC 96         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x96); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x97); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAD91; JUMP; // sstep
case 0xAD91:
                                                     mon("         SUBD  <$46                    ; AD91: 93 46         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x46)<<8; 
    ea = ea | rd_mem(DP|0x47); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAD93; JUMP; // sstep
case 0xAD93:
                                                     mon("         JSR   Shift_D_R_4             ; AD93: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xAD96:
                                                     mon("LAD96    TST   <$48                    ; AD96: 0D 48         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x48); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAD98; JUMP; // sstep
case 0xAD98:
                                                     mon("         BMI   LADA3                   ; AD98: 2B 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xada3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD9A; JUMP; // sstep
case 0xAD9A:
                                                     mon("         CMPD  <$48                    ; AD9A: 10 93 48      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x48)<<8; 
    ea = ea | rd_mem(DP|0x49); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xAD9D; JUMP; // sstep
case 0xAD9D:
                                                     mon("         BGE   LADA1                   ; AD9D: 2C 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xada1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAD9F; JUMP; // sstep
case 0xAD9F:
                                                     mon("         STD   <$48                    ; AD9F: DD 48         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x48; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xADA1; JUMP; // sstep
case 0xADA1:
                                                     mon("LADA1    BRA   locret_ADAE             ; ADA1: 20 0B         \n");
    PC = 0xadae; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xADA3:
                                                     mon("LADA3    COMA                          ; ADA3: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xADA4; JUMP; // sstep
case 0xADA4:
                                                     mon("         NEGB                          ; ADA4: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xADA5; JUMP; // sstep
case 0xADA5:
                                                     mon("         SBCA  #$FF                    ; ADA5: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xADA7; JUMP; // sstep
case 0xADA7:
                                                     mon("         CMPD  <$48                    ; ADA7: 10 93 48      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x48)<<8; 
    ea = ea | rd_mem(DP|0x49); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xADAA; JUMP; // sstep
case 0xADAA:
                                                     mon("         BLE   locret_ADAE             ; ADAA: 2F 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xadae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xADAC; JUMP; // sstep
case 0xADAC:
                                                     mon("         STD   <$48                    ; ADAC: DD 48         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x48; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_AD6C
    PC = 0xADAE; JUMP; // sstep
case 0xADAE:
                                                     mon("locret_ADAE RTS                           ; ADAE: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xADAF:
                                                     mon("LADAF    LDA   <$45                    ; ADAF: 96 45         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x45); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xADB1; JUMP; // sstep
case 0xADB1:
                                                     mon("         BEQ   locret_ADD3             ; ADB1: 27 20         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xadd3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xADB3; JUMP; // sstep
case 0xADB3:
                                                     mon("         LDD   <$46                    ; ADB3: DC 46         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x46); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x47); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xADB5; JUMP; // sstep
case 0xADB5:
                                                     mon("         STD   $5078                   ; ADB5: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xADB8; JUMP; // sstep
case 0xADB8:
                                                     mon("         LDD   <$48                    ; ADB8: DC 48         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x48); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x49); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    // End of function sub_ADAF
    PC = 0xADBA; JUMP; // sstep
case 0xADBA:
                                                     mon("         ADDD  #$80                    ; ADBA: C3 00 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0080; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xADBD; JUMP; // sstep
case 0xADBD:
                                                     mon("LADBD    STD   $507A                   ; ADBD: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xADC0; JUMP; // sstep
case 0xADC0:
                                                     mon("         LDD   <$4A                    ; ADC0: DC 4A         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x4a); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x4b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xADC2; JUMP; // sstep
case 0xADC2:
                                                     mon("         STD   $507C                   ; ADC2: FD 50 7C      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xADC5; JUMP; // sstep
case 0xADC5:
                                                     mon("         JSR   LADD4                   ; ADC5: BD AD D4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xadd4; 
    JUMP;
  case 0xADC8:
                                                     mon("LADC8    LDD   <$48                    ; ADC8: DC 48         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x48); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x49); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xADCA; JUMP; // sstep
case 0xADCA:
                                                     mon("         SUBD  #$80                    ; ADCA: 83 00 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0080; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xADCD; JUMP; // sstep
case 0xADCD:
                                                     mon("         STD   $507A                   ; ADCD: FD 50 7A      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xADD0; JUMP; // sstep
case 0xADD0:
                                                     mon("         JSR   LADD4                   ; ADD0: BD AD D4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xadd4; 
    JUMP;
    // End of function sub_ADBD
  case 0xADD3:
                                                     mon("locret_ADD3 RTS                           ; ADD3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xADD4:
                                                     mon("LADD4    LDD   #$0F                    ; ADD4: CC 00 0F      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xADD7; JUMP; // sstep
case 0xADD7:
                                                     mon("         STD   $4701                   ; ADD7: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xADDA; JUMP; // sstep
case 0xADDA:
                                                     mon("         LDA   #$67                    ; ADDA: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xADDC; JUMP; // sstep
case 0xADDC:
                                                     mon("         JSR   LCDBA                   ; ADDC: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xADDF:
                                                     mon("LADDF    LDD   $5000                   ; ADDF: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xADE2; JUMP; // sstep
case 0xADE2:
                                                     mon("         SUBD  #LE000                  ; ADE2: 83 E0 00      \n");
    clockticks = clockticks + 4; 
    val = 0xe000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xADE5; JUMP; // sstep
case 0xADE5:
                                                     mon("         BGT   LADEB                   ; ADE5: 2E 04         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xadeb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xADE7; JUMP; // sstep
case 0xADE7:
                                                     mon("         LDA   #$00                    ; ADE7: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xADE9; JUMP; // sstep
case 0xADE9:
                                                     mon("         STA   <$45                    ; ADE9: 97 45         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x45; 
    wr_mem(ea, val); 
    PC = 0xADEB; JUMP; // sstep
case 0xADEB:
                                                     mon("LADEB    LDD   $5000                   ; ADEB: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xADEE; JUMP; // sstep
case 0xADEE:
                                                     mon("         CMPD  #$01                    ; ADEE: 10 83 00 01   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0001; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xADF2; JUMP; // sstep
case 0xADF2:
                                                     mon("         BLT   locret_AE5F             ; ADF2: 2D 6B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xae5f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xADF4; JUMP; // sstep
case 0xADF4:
                                                     mon("         STD   $4704                   ; ADF4: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xADF7; JUMP; // sstep
case 0xADF7:
                                                     mon("         STD   $5018                   ; ADF7: FD 50 18      \n"); // XT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5018, A); // Care needed with I/O space and word fetches
    wr_mem(0x5019, B); 
    PC = 0xADFA; JUMP; // sstep
case 0xADFA:
                                                     mon("         LDD   $5002                   ; ADFA: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xADFD; JUMP; // sstep
case 0xADFD:
                                                     mon("         BPL   LAE03                   ; ADFD: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xae03; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xADFF; JUMP; // sstep
case 0xADFF:
                                                     mon("         COMA                          ; ADFF: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAE00; JUMP; // sstep
case 0xAE00:
                                                     mon("         NEGB                          ; AE00: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAE01; JUMP; // sstep
case 0xAE01:
                                                     mon("         SBCA  #$FF                    ; AE01: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAE03; JUMP; // sstep
case 0xAE03:
                                                     mon("LAE03    SUBD  $5000                   ; AE03: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAE06; JUMP; // sstep
case 0xAE06:
                                                     mon("         BGE   locret_AE5F             ; AE06: 2C 57         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xae5f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE08; JUMP; // sstep
case 0xAE08:
                                                     mon("         LDD   $5004                   ; AE08: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xAE0B; JUMP; // sstep
case 0xAE0B:
                                                     mon("         BPL   LAE11                   ; AE0B: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xae11; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE0D; JUMP; // sstep
case 0xAE0D:
                                                     mon("         COMA                          ; AE0D: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAE0E; JUMP; // sstep
case 0xAE0E:
                                                     mon("         NEGB                          ; AE0E: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAE0F; JUMP; // sstep
case 0xAE0F:
                                                     mon("         SBCA  #$FF                    ; AE0F: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAE11; JUMP; // sstep
case 0xAE11:
                                                     mon("LAE11    SUBD  $5000                   ; AE11: B3 50 00      \n"); // Math result X
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5000)<<8; 
    ea = ea | rd_mem(0x5001); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAE14; JUMP; // sstep
case 0xAE14:
                                                     mon("         BGE   locret_AE5F             ; AE14: 2C 49         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xae5f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE16; JUMP; // sstep
case 0xAE16:
                                                     mon("         LDD   $4700                   ; AE16: FC 47 00      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4700); // Care needed with I/O space and word fetches
    B = rd_mem(0x4701); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE19; JUMP; // sstep
case 0xAE19:
                                                     mon("         STD   $5000                   ; AE19: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xAE1C; JUMP; // sstep
case 0xAE1C:
                                                     mon("         LDA   #$86                    ; AE1C: 86 86         \n"); // Reg02 = Reg02 x Reg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAE1E; JUMP; // sstep
case 0xAE1E:
                                                     mon("         JSR   LCDBA                   ; AE1E: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xae); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xAE21:
                                                     mon("LAE21    LDD   $5004                   ; AE21: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE24; JUMP; // sstep
case 0xAE24:
                                                     mon("         ADDD  #$FF98                  ; AE24: C3 FF 98      \n");
    clockticks = clockticks + 4; 
    val = 0xff98; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAE27; JUMP; // sstep
case 0xAE27:
                                                     mon("         ANDA  #$1F                    ; AE27: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAE29; JUMP; // sstep
case 0xAE29:
                                                     mon("         STD   ,Y++                    ; AE29: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAE2B; JUMP; // sstep
case 0xAE2B:
                                                     mon("         LDD   $5002                   ; AE2B: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE2E; JUMP; // sstep
case 0xAE2E:
                                                     mon("         ANDA  #$1F                    ; AE2E: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAE30; JUMP; // sstep
case 0xAE30:
                                                     mon("         STD   ,Y++                    ; AE30: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAE32; JUMP; // sstep
case 0xAE32:
                                                     mon("         LDD   #$63FF                  ; AE32: CC 63 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x63; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE35; JUMP; // sstep
case 0xAE35:
                                                     mon("         STD   ,Y++                    ; AE35: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAE37; JUMP; // sstep
case 0xAE37:
                                                     mon("         LDA   #$06                    ; AE37: 86 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAE39; JUMP; // sstep
case 0xAE39:
                                                     mon("         STA   <$01                    ; AE39: 97 01         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, val); 
    PC = 0xAE3B; JUMP; // sstep
case 0xAE3B:
                                                     mon("         LDD   $5018                   ; AE3B: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE3E; JUMP; // sstep
case 0xAE3E:
                                                     mon("LAE3E    DEC   <$01                    ; AE3E: 0A 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x01, res); 
    clockticks = clockticks + 2; 
    PC = 0xAE40; JUMP; // sstep
case 0xAE40:
                                                     mon("         BEQ   LAE48                   ; AE40: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xae48; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE42; JUMP; // sstep
case 0xAE42:
                                                     mon("         ASLB                          ; AE42: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAE43; JUMP; // sstep
case 0xAE43:
                                                     mon("         ROLA                          ; AE43: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xAE44; JUMP; // sstep
case 0xAE44:
                                                     mon("         BPL   LAE3E                   ; AE44: 2A F8         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xae3e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE46; JUMP; // sstep
case 0xAE46:
                                                     mon("         ANDA  #$7F                    ; AE46: 84 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x7f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAE48; JUMP; // sstep
case 0xAE48:
                                                     mon("LAE48    LDB   <$01                    ; AE48: D6 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAE4A; JUMP; // sstep
case 0xAE4A:
                                                     mon("         ORB   #$70                    ; AE4A: CA 70         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x70; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAE4C; JUMP; // sstep
case 0xAE4C:
                                                     mon("         STB   ,Y+                     ; AE4C: E7 A0         \n");
    clockticks = clockticks + 6; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, val); 
    Y = Y + 1; 
    PC = 0xAE4E; JUMP; // sstep
case 0xAE4E:
                                                     mon("         STA   ,Y+                     ; AE4E: A7 A0         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, val); 
    Y = Y + 1; 
    PC = 0xAE50; JUMP; // sstep
case 0xAE50:
                                                     mon("         LDD   #$A016                  ; AE50: CC A0 16      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x16; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE53; JUMP; // sstep
case 0xAE53:
                                                     mon("         STD   ,Y++                    ; AE53: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAE55; JUMP; // sstep
case 0xAE55:
                                                     mon("         LDD   #$7200                  ; AE55: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE58; JUMP; // sstep
case 0xAE58:
                                                     mon("         STD   ,Y++                    ; AE58: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAE5A; JUMP; // sstep
case 0xAE5A:
                                                     mon("         LDD   #$8040                  ; AE5A: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE5D; JUMP; // sstep
case 0xAE5D:
                                                     mon("         STD   ,Y++                    ; AE5D: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_ADD4
    PC = 0xAE5F; JUMP; // sstep
case 0xAE5F:
                                                     mon("locret_AE5F RTS                           ; AE5F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xAE60:
                                                     mon("LAE60    LDA   <$BD                    ; AE60: 96 BD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAE62; JUMP; // sstep
case 0xAE62:
                                                     mon("         BLE   LAE6E                   ; AE62: 2F 0A         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xae6e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE64; JUMP; // sstep
case 0xAE64:
                                                     mon("         DEC   <$BD                    ; AE64: 0A BD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbd); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0xbd, res); 
    clockticks = clockticks + 2; 
    PC = 0xAE66; JUMP; // sstep
case 0xAE66:
                                                     mon("         LDA   #$00                    ; AE66: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAE68; JUMP; // sstep
case 0xAE68:
                                                     mon("         STA   <$B7                    ; AE68: 97 B7         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xb7; 
    wr_mem(ea, val); 
    PC = 0xAE6A; JUMP; // sstep
case 0xAE6A:
                                                     mon("         STA   <$BC                    ; AE6A: 97 BC         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbc; 
    wr_mem(ea, val); 
    PC = 0xAE6C; JUMP; // sstep
case 0xAE6C:
                                                     mon("         BRA   LAE72                   ; AE6C: 20 04         \n");
    PC = 0xae72; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xAE6E:
                                                     mon("LAE6E    LDA   #$00                    ; AE6E: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAE70; JUMP; // sstep
case 0xAE70:
                                                     mon("         STA   <$BD                    ; AE70: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xAE72; JUMP; // sstep
case 0xAE72:
                                                     mon("LAE72    LDA   #$00                    ; AE72: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAE74; JUMP; // sstep
case 0xAE74:
                                                     mon("         STA   <$BC                    ; AE74: 97 BC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbc; 
    wr_mem(ea, val); 
    PC = 0xAE76; JUMP; // sstep
case 0xAE76:
                                                     mon("         ORCC  #$10                    ; AE76: 1A 10         \n");
    I = 1; 
    clockticks = clockticks + 3; 
    PC = 0xAE78; JUMP; // sstep
case 0xAE78:
                                                     mon("         LDA   <$31                    ; AE78: 96 31         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x31); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAE7A; JUMP; // sstep
case 0xAE7A:
                                                     mon("         BEQ   LAE87                   ; AE7A: 27 0B         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xae87; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE7C; JUMP; // sstep
case 0xAE7C:
                                                     mon("         INC   $4B1B                   ; AE7C: 7C 4B 1B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b1b); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4b1b, res); 
    clockticks = clockticks + 2; 
    PC = 0xAE7F; JUMP; // sstep
case 0xAE7F:
                                                     mon("         CLR   <$BD                    ; AE7F: 0F BD         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xbd, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAE81; JUMP; // sstep
case 0xAE81:
                                                     mon("         LDB   #$08                    ; AE81: C6 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAE83; JUMP; // sstep
case 0xAE83:
                                                     mon("         STB   <$B7                    ; AE83: D7 B7         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xb7; 
    wr_mem(ea, val); 
    PC = 0xAE85; JUMP; // sstep
case 0xAE85:
                                                     mon("         CLR   <$31                    ; AE85: 0F 31         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0x31, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xAE87; JUMP; // sstep
case 0xAE87:
                                                     mon("LAE87    LDA   <$B7                    ; AE87: 96 B7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xb7); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAE89; JUMP; // sstep
case 0xAE89:
                                                     mon("         BLE   LAE9F                   ; AE89: 2F 14         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xae9f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAE8B; JUMP; // sstep
case 0xAE8B:
                                                     mon("         DEC   <$B7                    ; AE8B: 0A B7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xb7); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0xb7, res); 
    clockticks = clockticks + 2; 
    PC = 0xAE8D; JUMP; // sstep
case 0xAE8D:
                                                     mon("         STA   <$BC                    ; AE8D: 97 BC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbc; 
    wr_mem(ea, val); 
    PC = 0xAE8F; JUMP; // sstep
case 0xAE8F:
                                                     mon("         LDD   <$74                    ; AE8F: DC 74         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x74); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x75); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE91; JUMP; // sstep
case 0xAE91:
                                                     mon("         STD   <$B8                    ; AE91: DD B8         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xb8; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAE93; JUMP; // sstep
case 0xAE93:
                                                     mon("         LDD   <$6B                    ; AE93: DC 6B         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x6b); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x6c); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE95; JUMP; // sstep
case 0xAE95:
                                                     mon("         STD   <$BA                    ; AE95: DD BA         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xba; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAE97; JUMP; // sstep
case 0xAE97:
                                                     mon("         LDD   <$2D                    ; AE97: DC 2D         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x2d); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x2e); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE99; JUMP; // sstep
case 0xAE99:
                                                     mon("         STD   <$B3                    ; AE99: DD B3         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xb3; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAE9B; JUMP; // sstep
case 0xAE9B:
                                                     mon("         LDD   <$2F                    ; AE9B: DC 2F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x2f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x30); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAE9D; JUMP; // sstep
case 0xAE9D:
                                                     mon("         STD   <$B5                    ; AE9D: DD B5         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xb5; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAE9F; JUMP; // sstep
case 0xAE9F:
                                                     mon("LAE9F    ANDCC #$EF                    ; AE9F: 1C EF         \n");
    I = 0; 
    clockticks = clockticks + 3; 
    PC = 0xAEA1; JUMP; // sstep
case 0xAEA1:
                                                     mon("         LDA   <$B7                    ; AEA1: 96 B7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xb7); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAEA3; JUMP; // sstep
case 0xAEA3:
                                                     mon("         CMPA  #$07                    ; AEA3: 81 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x07; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xAEA5; JUMP; // sstep
case 0xAEA5:
                                                     mon("         BNE   LAEB2                   ; AEA5: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xaeb2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAEA7; JUMP; // sstep
case 0xAEA7:
                                                     mon("         LDA   $4B36                   ; AEA7: B6 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAEAA; JUMP; // sstep
case 0xAEAA:
                                                     mon("         BNE   LAEAF                   ; AEAA: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xaeaf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAEAC; JUMP; // sstep
case 0xAEAC:
                                                     mon("         DEC   $4B36                   ; AEAC: 7A 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4b36, res); 
    clockticks = clockticks + 2; 
    PC = 0xAEAF; JUMP; // sstep
case 0xAEAF:
                                                     mon("LAEAF    JSR   LBE16                   ; AEAF: BD BE 16      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xae); 
    clockticks = clockticks + 1; 
    PC = 0xbe16; 
    JUMP;
  case 0xAEB2:
                                                     mon("LAEB2    LDA   #$FF                    ; AEB2: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAEB4; JUMP; // sstep
case 0xAEB4:
                                                     mon("         STA   <$C4                    ; AEB4: 97 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc4; 
    wr_mem(ea, val); 
    PC = 0xAEB6; JUMP; // sstep
case 0xAEB6:
                                                     mon("         STA   <$C8                    ; AEB6: 97 C8         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc8; 
    wr_mem(ea, val); 
    PC = 0xAEB8; JUMP; // sstep
case 0xAEB8:
                                                     mon("         STA   <$CC                    ; AEB8: 97 CC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xcc; 
    wr_mem(ea, val); 
    PC = 0xAEBA; JUMP; // sstep
case 0xAEBA:
                                                     mon("         STA   <$D0                    ; AEBA: 97 D0         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xd0; 
    wr_mem(ea, val); 
    // End of function sub_AE60
    PC = 0xAEBC; JUMP; // sstep
case 0xAEBC:
                                                     mon("         RTS                           ; AEBC: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xAEBD:
                                                     mon("LAEBD    LDA   <$BC                    ; AEBD: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAEBF; JUMP; // sstep
case 0xAEBF:
                                                     mon("         ORA   <$BD                    ; AEBF: 9A BD         \n");
    clockticks = clockticks + 4; 
    res = A | (UINT8)rd_mem(DP|0xbd); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAEC1; JUMP; // sstep
case 0xAEC1:
                                                     mon("         BNE   LAEC4                   ; AEC1: 26 01         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xaec4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAEC3; JUMP; // sstep
case 0xAEC3:
                                                     mon("         RTS                           ; AEC3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xAEC4:
                                                     mon("LAEC4    LDA   $4B1B                   ; AEC4: B6 4B 1B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b1b); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAEC7; JUMP; // sstep
case 0xAEC7:
                                                     mon("         ANDA  #$01                    ; AEC7: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAEC9; JUMP; // sstep
case 0xAEC9:
                                                     mon("         BEQ   LAF25                   ; AEC9: 27 5A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xaf25; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAECB; JUMP; // sstep
case 0xAECB:
                                                     mon("         LDD   #$FF98                  ; AECB: CC FF 98      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAECE; JUMP; // sstep
case 0xAECE:
                                                     mon("         ADDD  $4B1E                   ; AECE: F3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAED1; JUMP; // sstep
case 0xAED1:
                                                     mon("         ANDA  #$1F                    ; AED1: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAED3; JUMP; // sstep
case 0xAED3:
                                                     mon("         STD   ,Y++                    ; AED3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAED5; JUMP; // sstep
case 0xAED5:
                                                     mon("         LDD   <$B5                    ; AED5: DC B5         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb5); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAED7; JUMP; // sstep
case 0xAED7:
                                                     mon("         SUBD  #$00                    ; AED7: 83 00 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0000; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAEDA; JUMP; // sstep
case 0xAEDA:
                                                     mon("         SUBD  $4B1E                   ; AEDA: B3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAEDD; JUMP; // sstep
case 0xAEDD:
                                                     mon("         STD   <$03                    ; AEDD: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAEDF; JUMP; // sstep
case 0xAEDF:
                                                     mon("         LDD   #$FE7A                  ; AEDF: CC FE 7A      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x7a; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAEE2; JUMP; // sstep
case 0xAEE2:
                                                     mon("         ADDD  $4B1C                   ; AEE2: F3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAEE5; JUMP; // sstep
case 0xAEE5:
                                                     mon("         ANDA  #$1F                    ; AEE5: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAEE7; JUMP; // sstep
case 0xAEE7:
                                                     mon("         STD   ,Y++                    ; AEE7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAEE9; JUMP; // sstep
case 0xAEE9:
                                                     mon("         LDD   <$B3                    ; AEE9: DC B3         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb3); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb4); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAEEB; JUMP; // sstep
case 0xAEEB:
                                                     mon("         SUBD  #$FE7A                  ; AEEB: 83 FE 7A      \n");
    clockticks = clockticks + 4; 
    val = 0xfe7a; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAEEE; JUMP; // sstep
case 0xAEEE:
                                                     mon("         SUBD  $4B1C                   ; AEEE: B3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAEF1; JUMP; // sstep
case 0xAEF1:
                                                     mon("         STD   <$01                    ; AEF1: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAEF3; JUMP; // sstep
case 0xAEF3:
                                                     mon("         LDB   #$00                    ; AEF3: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAEF5; JUMP; // sstep
case 0xAEF5:
                                                     mon("         JSR   LAF87                   ; AEF5: BD AF 87      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xae); 
    clockticks = clockticks + 1; 
    PC = 0xaf87; 
    JUMP;
  case 0xAEF8:
                                                     mon("LAEF8    LDD   #$FDFB                  ; AEF8: CC FD FB      \n");
    clockticks = clockticks + 3; 
    A = 0xfd; 
    B = 0xfb; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAEFB; JUMP; // sstep
case 0xAEFB:
                                                     mon("         ADDD  $4B1E                   ; AEFB: F3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAEFE; JUMP; // sstep
case 0xAEFE:
                                                     mon("         ANDA  #$1F                    ; AEFE: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAF00; JUMP; // sstep
case 0xAF00:
                                                     mon("         STD   ,Y++                    ; AF00: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF02; JUMP; // sstep
case 0xAF02:
                                                     mon("         LDD   <$B5                    ; AF02: DC B5         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb5); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF04; JUMP; // sstep
case 0xAF04:
                                                     mon("         SUBD  #$FE63                  ; AF04: 83 FE 63      \n");
    clockticks = clockticks + 4; 
    val = 0xfe63; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF07; JUMP; // sstep
case 0xAF07:
                                                     mon("         SUBD  $4B1E                   ; AF07: B3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF0A; JUMP; // sstep
case 0xAF0A:
                                                     mon("         STD   <$03                    ; AF0A: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAF0C; JUMP; // sstep
case 0xAF0C:
                                                     mon("         LDD   #LFE75                  ; AF0C: CC FE 75      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x75; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF0F; JUMP; // sstep
case 0xAF0F:
                                                     mon("         ADDD  $4B1C                   ; AF0F: F3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAF12; JUMP; // sstep
case 0xAF12:
                                                     mon("         ANDA  #$1F                    ; AF12: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAF14; JUMP; // sstep
case 0xAF14:
                                                     mon("         STD   ,Y++                    ; AF14: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF16; JUMP; // sstep
case 0xAF16:
                                                     mon("         LDD   <$B3                    ; AF16: DC B3         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb3); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb4); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF18; JUMP; // sstep
case 0xAF18:
                                                     mon("         SUBD  #LFE75                  ; AF18: 83 FE 75      \n");
    clockticks = clockticks + 4; 
    val = 0xfe75; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF1B; JUMP; // sstep
case 0xAF1B:
                                                     mon("         SUBD  $4B1C                   ; AF1B: B3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF1E; JUMP; // sstep
case 0xAF1E:
                                                     mon("         STD   <$01                    ; AF1E: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAF20; JUMP; // sstep
case 0xAF20:
                                                     mon("         LDB   #$08                    ; AF20: C6 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAF22; JUMP; // sstep
case 0xAF22:
                                                     mon("         JSR   LAF87                   ; AF22: BD AF 87      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x25); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    PC = 0xaf87; 
    JUMP;
  case 0xAF25:
                                                     mon("LAF25    LDA   $4B1B                   ; AF25: B6 4B 1B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b1b); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAF28; JUMP; // sstep
case 0xAF28:
                                                     mon("         ANDA  #$01                    ; AF28: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xAF2A; JUMP; // sstep
case 0xAF2A:
                                                     mon("         BNE   locret_AF86             ; AF2A: 26 5A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xaf86; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAF2C; JUMP; // sstep
case 0xAF2C:
                                                     mon("         LDD   #$FDFB                  ; AF2C: CC FD FB      \n");
    clockticks = clockticks + 3; 
    A = 0xfd; 
    B = 0xfb; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF2F; JUMP; // sstep
case 0xAF2F:
                                                     mon("         ADDD  $4B1E                   ; AF2F: F3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAF32; JUMP; // sstep
case 0xAF32:
                                                     mon("         ANDA  #$1F                    ; AF32: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAF34; JUMP; // sstep
case 0xAF34:
                                                     mon("         STD   ,Y++                    ; AF34: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF36; JUMP; // sstep
case 0xAF36:
                                                     mon("         LDD   <$B5                    ; AF36: DC B5         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb5); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF38; JUMP; // sstep
case 0xAF38:
                                                     mon("         SUBD  #$FE63                  ; AF38: 83 FE 63      \n");
    clockticks = clockticks + 4; 
    val = 0xfe63; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF3B; JUMP; // sstep
case 0xAF3B:
                                                     mon("         SUBD  $4B1E                   ; AF3B: B3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF3E; JUMP; // sstep
case 0xAF3E:
                                                     mon("         STD   <$03                    ; AF3E: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAF40; JUMP; // sstep
case 0xAF40:
                                                     mon("         LDD   #$018B                  ; AF40: CC 01 8B      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x8b; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF43; JUMP; // sstep
case 0xAF43:
                                                     mon("         ADDD  $4B1C                   ; AF43: F3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAF46; JUMP; // sstep
case 0xAF46:
                                                     mon("         ANDA  #$1F                    ; AF46: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAF48; JUMP; // sstep
case 0xAF48:
                                                     mon("         STD   ,Y++                    ; AF48: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF4A; JUMP; // sstep
case 0xAF4A:
                                                     mon("         LDD   <$B3                    ; AF4A: DC B3         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb3); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb4); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF4C; JUMP; // sstep
case 0xAF4C:
                                                     mon("         SUBD  #$018B                  ; AF4C: 83 01 8B      \n");
    clockticks = clockticks + 4; 
    val = 0x018b; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF4F; JUMP; // sstep
case 0xAF4F:
                                                     mon("         SUBD  $4B1C                   ; AF4F: B3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF52; JUMP; // sstep
case 0xAF52:
                                                     mon("         STD   <$01                    ; AF52: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAF54; JUMP; // sstep
case 0xAF54:
                                                     mon("         LDB   #$00                    ; AF54: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAF56; JUMP; // sstep
case 0xAF56:
                                                     mon("         JSR   LAF87                   ; AF56: BD AF 87      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x59); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    PC = 0xaf87; 
    JUMP;
  case 0xAF59:
                                                     mon("LAF59    LDD   #$FF98                  ; AF59: CC FF 98      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF5C; JUMP; // sstep
case 0xAF5C:
                                                     mon("         ADDD  $4B1E                   ; AF5C: F3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAF5F; JUMP; // sstep
case 0xAF5F:
                                                     mon("         ANDA  #$1F                    ; AF5F: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAF61; JUMP; // sstep
case 0xAF61:
                                                     mon("         STD   ,Y++                    ; AF61: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF63; JUMP; // sstep
case 0xAF63:
                                                     mon("         LDD   <$B5                    ; AF63: DC B5         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb5); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF65; JUMP; // sstep
case 0xAF65:
                                                     mon("         SUBD  #$00                    ; AF65: 83 00 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0000; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF68; JUMP; // sstep
case 0xAF68:
                                                     mon("         SUBD  $4B1E                   ; AF68: B3 4B 1E      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1e)<<8; 
    ea = ea | rd_mem(0x4b1f); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF6B; JUMP; // sstep
case 0xAF6B:
                                                     mon("         STD   <$03                    ; AF6B: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAF6D; JUMP; // sstep
case 0xAF6D:
                                                     mon("         LDD   #$0186                  ; AF6D: CC 01 86      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x86; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF70; JUMP; // sstep
case 0xAF70:
                                                     mon("         ADDD  $4B1C                   ; AF70: F3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAF73; JUMP; // sstep
case 0xAF73:
                                                     mon("         ANDA  #$1F                    ; AF73: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAF75; JUMP; // sstep
case 0xAF75:
                                                     mon("         STD   ,Y++                    ; AF75: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF77; JUMP; // sstep
case 0xAF77:
                                                     mon("         LDD   <$B3                    ; AF77: DC B3         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xb3); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xb4); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF79; JUMP; // sstep
case 0xAF79:
                                                     mon("         SUBD  #$0186                  ; AF79: 83 01 86      \n");
    clockticks = clockticks + 4; 
    val = 0x0186; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF7C; JUMP; // sstep
case 0xAF7C:
                                                     mon("         SUBD  $4B1C                   ; AF7C: B3 4B 1C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b1c)<<8; 
    ea = ea | rd_mem(0x4b1d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAF7F; JUMP; // sstep
case 0xAF7F:
                                                     mon("         STD   <$01                    ; AF7F: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAF81; JUMP; // sstep
case 0xAF81:
                                                     mon("         LDB   #$08                    ; AF81: C6 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAF83; JUMP; // sstep
case 0xAF83:
                                                     mon("         JSR   LAF87                   ; AF83: BD AF 87      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    PC = 0xaf87; 
    JUMP;
    // End of function sub_AEBD
  case 0xAF86:
                                                     mon("locret_AF86 RTS                           ; AF86: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xAF87:
                                                     mon("LAF87    LDU   #tbl0xB04F              ; AF87: CE B0 4F      \n");
    clockticks = clockticks + 3; 
    U = 0xb04f; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xAF8A; JUMP; // sstep
case 0xAF8A:
                                                     mon("         LEAU  B,U                     ; AF8A: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xAF8C; JUMP; // sstep
case 0xAF8C:
                                                     mon("         LDA   <$BD                    ; AF8C: 96 BD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAF8E; JUMP; // sstep
case 0xAF8E:
                                                     mon("         BLE   LAF9A                   ; AF8E: 2F 0A         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xaf9a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAF90; JUMP; // sstep
case 0xAF90:
                                                     mon("         LDB   #$3F                    ; AF90: C6 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3f; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAF92; JUMP; // sstep
case 0xAF92:
                                                     mon("         MUL                           ; AF92: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xAF93; JUMP; // sstep
case 0xAF93:
                                                     mon("         LDA   #$63                    ; AF93: 86 63         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x63; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xAF95; JUMP; // sstep
case 0xAF95:
                                                     mon("         STD   ,Y++                    ; AF95: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAF97; JUMP; // sstep
case 0xAF97:
                                                     mon("         JMP   LAFEF                   ; AF97: 7E AF EF      \n");
    clockticks = clockticks + 4; 
    PC = 0xafef; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xAF9A:
                                                     mon("LAF9A    LDX   #$4C00                  ; AF9A: 8E 4C 00      \n");
    clockticks = clockticks + 3; 
    X = 0x4c00; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xAF9D; JUMP; // sstep
case 0xAF9D:
                                                     mon("LAF9D    LDD   ,U++                    ; AF9D: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAF9F; JUMP; // sstep
case 0xAF9F:
                                                     mon("         STD   ,Y++                    ; AF9F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAFA1; JUMP; // sstep
case 0xAFA1:
                                                     mon("         LDD   <$03                    ; AFA1: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xAFA3; JUMP; // sstep
case 0xAFA3:
                                                     mon("         BMI   LAFA8                   ; AFA3: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xafa8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFA5; JUMP; // sstep
case 0xAFA5:
                                                     mon("         ADDD  #$01                    ; AFA5: C3 00 01      \n");
    clockticks = clockticks + 4; 
    val = 0x0001; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAFA8; JUMP; // sstep
case 0xAFA8:
                                                     mon("LAFA8    ASRA                          ; AFA8: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAFA9; JUMP; // sstep
case 0xAFA9:
                                                     mon("         RORB                          ; AFA9: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAFAA; JUMP; // sstep
case 0xAFAA:
                                                     mon("         STD   ,Y                      ; AFAA: ED A4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAFAC; JUMP; // sstep
case 0xAFAC:
                                                     mon("         COMA                          ; AFAC: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAFAD; JUMP; // sstep
case 0xAFAD:
                                                     mon("         NEGB                          ; AFAD: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAFAE; JUMP; // sstep
case 0xAFAE:
                                                     mon("         SBCA  #$FF                    ; AFAE: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAFB0; JUMP; // sstep
case 0xAFB0:
                                                     mon("         ADDD  <$03                    ; AFB0: D3 03         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x03)<<8; 
    ea = ea | rd_mem(DP|0x04); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAFB2; JUMP; // sstep
case 0xAFB2:
                                                     mon("         STD   <$03                    ; AFB2: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAFB4; JUMP; // sstep
case 0xAFB4:
                                                     mon("         LDD   ,Y                      ; AFB4: EC A4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(Y); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(Y+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFB6; JUMP; // sstep
case 0xAFB6:
                                                     mon("         ANDA  #$1F                    ; AFB6: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAFB8; JUMP; // sstep
case 0xAFB8:
                                                     mon("         STD   ,Y++                    ; AFB8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAFBA; JUMP; // sstep
case 0xAFBA:
                                                     mon("         LDD   <$01                    ; AFBA: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xAFBC; JUMP; // sstep
case 0xAFBC:
                                                     mon("         BMI   LAFC1                   ; AFBC: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xafc1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFBE; JUMP; // sstep
case 0xAFBE:
                                                     mon("         ADDD  #$01                    ; AFBE: C3 00 01      \n");
    clockticks = clockticks + 4; 
    val = 0x0001; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAFC1; JUMP; // sstep
case 0xAFC1:
                                                     mon("LAFC1    ASRA                          ; AFC1: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAFC2; JUMP; // sstep
case 0xAFC2:
                                                     mon("         RORB                          ; AFC2: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xAFC3; JUMP; // sstep
case 0xAFC3:
                                                     mon("         STD   ,Y                      ; AFC3: ED A4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAFC5; JUMP; // sstep
case 0xAFC5:
                                                     mon("         COMA                          ; AFC5: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xAFC6; JUMP; // sstep
case 0xAFC6:
                                                     mon("         NEGB                          ; AFC6: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xAFC7; JUMP; // sstep
case 0xAFC7:
                                                     mon("         SBCA  #$FF                    ; AFC7: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xAFC9; JUMP; // sstep
case 0xAFC9:
                                                     mon("         ADDD  <$01                    ; AFC9: D3 01         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x01)<<8; 
    ea = ea | rd_mem(DP|0x02); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAFCB; JUMP; // sstep
case 0xAFCB:
                                                     mon("         STD   <$01                    ; AFCB: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xAFCD; JUMP; // sstep
case 0xAFCD:
                                                     mon("         LDD   ,Y                      ; AFCD: EC A4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(Y); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(Y+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFCF; JUMP; // sstep
case 0xAFCF:
                                                     mon("         ORA   #$E0                    ; AFCF: 8A E0         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0xe0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAFD1; JUMP; // sstep
case 0xAFD1:
                                                     mon("         STD   ,Y++                    ; AFD1: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAFD3; JUMP; // sstep
case 0xAFD3:
                                                     mon("         LDD   <$01                    ; AFD3: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFD5; JUMP; // sstep
case 0xAFD5:
                                                     mon("         ADDD  #$08                    ; AFD5: C3 00 08      \n");
    clockticks = clockticks + 4; 
    val = 0x0008; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAFD8; JUMP; // sstep
case 0xAFD8:
                                                     mon("         BLT   LAF9D                   ; AFD8: 2D C3         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xaf9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFDA; JUMP; // sstep
case 0xAFDA:
                                                     mon("         SUBD  #$10                    ; AFDA: 83 00 10      \n");
    clockticks = clockticks + 4; 
    val = 0x0010; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAFDD; JUMP; // sstep
case 0xAFDD:
                                                     mon("         BGT   LAF9D                   ; AFDD: 2E BE         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xaf9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFDF; JUMP; // sstep
case 0xAFDF:
                                                     mon("         LDD   <$03                    ; AFDF: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFE1; JUMP; // sstep
case 0xAFE1:
                                                     mon("         ADDD  #$08                    ; AFE1: C3 00 08      \n");
    clockticks = clockticks + 4; 
    val = 0x0008; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xAFE4; JUMP; // sstep
case 0xAFE4:
                                                     mon("         BLT   LAF9D                   ; AFE4: 2D B7         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xaf9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFE6; JUMP; // sstep
case 0xAFE6:
                                                     mon("         SUBD  #$10                    ; AFE6: 83 00 10      \n");
    clockticks = clockticks + 4; 
    val = 0x0010; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xAFE9; JUMP; // sstep
case 0xAFE9:
                                                     mon("         BGT   LAF9D                   ; AFE9: 2E B2         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xaf9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFEB; JUMP; // sstep
case 0xAFEB:
                                                     mon("         LDD   ,U++                    ; AFEB: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFED; JUMP; // sstep
case 0xAFED:
                                                     mon("         STD   ,Y++                    ; AFED: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAFEF; JUMP; // sstep
case 0xAFEF:
                                                     mon("LAFEF    LDD   <$03                    ; AFEF: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFF1; JUMP; // sstep
case 0xAFF1:
                                                     mon("         ANDA  #$1F                    ; AFF1: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAFF3; JUMP; // sstep
case 0xAFF3:
                                                     mon("         STD   ,Y++                    ; AFF3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAFF5; JUMP; // sstep
case 0xAFF5:
                                                     mon("         LDD   <$01                    ; AFF5: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xAFF7; JUMP; // sstep
case 0xAFF7:
                                                     mon("         ORA   #$E0                    ; AFF7: 8A E0         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0xe0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xAFF9; JUMP; // sstep
case 0xAFF9:
                                                     mon("         STD   ,Y++                    ; AFF9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xAFFB; JUMP; // sstep
case 0xAFFB:
                                                     mon("         LDA   <$BD                    ; AFFB: 96 BD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xAFFD; JUMP; // sstep
case 0xAFFD:
                                                     mon("         BLE   LB006                   ; AFFD: 2F 07         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xb006; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xAFFF; JUMP; // sstep
case 0xAFFF:
                                                     mon("         LDD   #$A011                  ; AFFF: CC A0 11      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x11; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB002; JUMP; // sstep
case 0xB002:
                                                     mon("         STD   ,Y++                    ; B002: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB004; JUMP; // sstep
case 0xB004:
                                                     mon("         BRA   LB044                   ; B004: 20 3E         \n");
    PC = 0xb044; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB006:
                                                     mon("LB006    BGE   LB044                   ; B006: 2C 3C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xb044; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB008; JUMP; // sstep
case 0xB008:
                                                     mon("         LDB   $4B22                   ; B008: F6 4B 22      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b22); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB00B; JUMP; // sstep
case 0xB00B:
                                                     mon("         LDA   #$71                    ; B00B: 86 71         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x71; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB00D; JUMP; // sstep
case 0xB00D:
                                                     mon("         STD   ,Y++                    ; B00D: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB00F; JUMP; // sstep
case 0xB00F:
                                                     mon("         LDD   $4B20                   ; B00F: FC 4B 20      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b20); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b21); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB012; JUMP; // sstep
case 0xB012:
                                                     mon("         STD   ,Y++                    ; B012: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB014; JUMP; // sstep
case 0xB014:
                                                     mon("         LDA   $4B23                   ; B014: B6 4B 23      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b23); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB017; JUMP; // sstep
case 0xB017:
                                                     mon("         ANDA  #$01                    ; B017: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xB019; JUMP; // sstep
case 0xB019:
                                                     mon("         BEQ   LB020                   ; B019: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb020; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB01B; JUMP; // sstep
case 0xB01B:
                                                     mon("         LDD   #$A01C                  ; B01B: CC A0 1C      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x1c; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB01E; JUMP; // sstep
case 0xB01E:
                                                     mon("         STD   ,Y++                    ; B01E: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB020; JUMP; // sstep
case 0xB020:
                                                     mon("LB020    LDA   $4B23                   ; B020: B6 4B 23      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b23); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB023; JUMP; // sstep
case 0xB023:
                                                     mon("         ANDA  #$02                    ; B023: 84 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x02; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xB025; JUMP; // sstep
case 0xB025:
                                                     mon("         BEQ   LB02C                   ; B025: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb02c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB027; JUMP; // sstep
case 0xB027:
                                                     mon("         LDD   #$A023                  ; B027: CC A0 23      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x23; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB02A; JUMP; // sstep
case 0xB02A:
                                                     mon("         STD   ,Y++                    ; B02A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB02C; JUMP; // sstep
case 0xB02C:
                                                     mon("LB02C    LDA   $4B23                   ; B02C: B6 4B 23      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b23); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB02F; JUMP; // sstep
case 0xB02F:
                                                     mon("         ANDA  #$04                    ; B02F: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xB031; JUMP; // sstep
case 0xB031:
                                                     mon("         BEQ   LB038                   ; B031: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb038; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB033; JUMP; // sstep
case 0xB033:
                                                     mon("         LDD   #$A02A                  ; B033: CC A0 2A      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x2a; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB036; JUMP; // sstep
case 0xB036:
                                                     mon("         STD   ,Y++                    ; B036: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB038; JUMP; // sstep
case 0xB038:
                                                     mon("LB038    LDA   $4B23                   ; B038: B6 4B 23      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b23); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB03B; JUMP; // sstep
case 0xB03B:
                                                     mon("         ANDA  #$08                    ; B03B: 84 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x08; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xB03D; JUMP; // sstep
case 0xB03D:
                                                     mon("         BEQ   LB044                   ; B03D: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb044; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB03F; JUMP; // sstep
case 0xB03F:
                                                     mon("         LDD   #$A031                  ; B03F: CC A0 31      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x31; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB042; JUMP; // sstep
case 0xB042:
                                                     mon("         STD   ,Y++                    ; B042: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB044; JUMP; // sstep
case 0xB044:
                                                     mon("LB044    LDD   #$7200                  ; B044: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB047; JUMP; // sstep
case 0xB047:
                                                     mon("         STD   ,Y++                    ; B047: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB049; JUMP; // sstep
case 0xB049:
                                                     mon("         LDD   #$8040                  ; B049: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB04C; JUMP; // sstep
case 0xB04C:
                                                     mon("         STD   ,Y++                    ; B04C: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_AF87
    // ---------------------------------------------------------------------------
    PC = 0xB04E; JUMP; // sstep
case 0xB04E:
                                                     mon("         RTS                           ; B04E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB071:
                                                     mon("LB071    LDA   <$BC                    ; B071: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB073; JUMP; // sstep
case 0xB073:
                                                     mon("         BEQ   locret_B094             ; B073: 27 1F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb094; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB075; JUMP; // sstep
case 0xB075:
                                                     mon("         JSR   LB095                   ; B075: BD B0 95      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    PC = 0xb095; 
    JUMP;
  case 0xB078:
                                                     mon("LB078    LDD   #$0200                  ; B078: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB07B; JUMP; // sstep
case 0xB07B:
                                                     mon("         STD   $4706                   ; B07B: FD 47 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4706, A); // Care needed with I/O space and word fetches
    wr_mem(0x4707, B); 
    PC = 0xB07E; JUMP; // sstep
case 0xB07E:
                                                     mon("         LDD   <$CC                    ; B07E: DC CC         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xcc); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xcd); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB080; JUMP; // sstep
case 0xB080:
                                                     mon("         BMI   LB089                   ; B080: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb089; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB082; JUMP; // sstep
case 0xB082:
                                                     mon("         LDA   #$04                    ; B082: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB084; JUMP; // sstep
case 0xB084:
                                                     mon("         STA   <$BD                    ; B084: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB086; JUMP; // sstep
case 0xB086:
                                                     mon("         JSR   LAD20                   ; B086: BD AD 20      \n"); // Fireball destroyed
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    PC = 0xad20; 
    JUMP;
  case 0xB089:
                                                     mon("LB089    LDA   <$44                    ; B089: 96 44         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x44); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB08B; JUMP; // sstep
case 0xB08B:
                                                     mon("         BLE   locret_B094             ; B08B: 2F 07         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xb094; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB08D; JUMP; // sstep
case 0xB08D:
                                                     mon("         LDA   #$FF                    ; B08D: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB08F; JUMP; // sstep
case 0xB08F:
                                                     mon("         STA   <$44                    ; B08F: 97 44         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x44; 
    wr_mem(ea, val); 
    PC = 0xB091; JUMP; // sstep
case 0xB091:
                                                     mon("         JSR   LAD3E                   ; B091: BD AD 3E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    PC = 0xad3e; 
    JUMP;
    // End of function sub_B071
  case 0xB094:
                                                     mon("locret_B094 RTS                           ; B094: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB095:
                                                     mon("LB095    LDD   #$7000                  ; B095: CC 70 00      \n");
    clockticks = clockticks + 3; 
    A = 0x70; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB098; JUMP; // sstep
case 0xB098:
                                                     mon("         ADDD  $5040                   ; B098: F3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB09B; JUMP; // sstep
case 0xB09B:
                                                     mon("         STD   <$01                    ; B09B: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB09D; JUMP; // sstep
case 0xB09D:
                                                     mon("         LDD   #$00                    ; B09D: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0A0; JUMP; // sstep
case 0xB0A0:
                                                     mon("         SUBD  <$B8                    ; B0A0: 93 B8         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xb8)<<8; 
    ea = ea | rd_mem(DP|0xb9); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0A2; JUMP; // sstep
case 0xB0A2:
                                                     mon("         JSR   Shift_D_R_3             ; B0A2: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xB0A5:
                                                     mon("LB0A5    ADDD  <$B8                    ; B0A5: D3 B8         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xb8)<<8; 
    ea = ea | rd_mem(DP|0xb9); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB0A7; JUMP; // sstep
case 0xB0A7:
                                                     mon("         ADDD  $5042                   ; B0A7: F3 50 42      \n"); // YT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5042)<<8; 
    ea = ea | rd_mem(0x5043); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB0AA; JUMP; // sstep
case 0xB0AA:
                                                     mon("         STD   <$03                    ; B0AA: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB0AC; JUMP; // sstep
case 0xB0AC:
                                                     mon("         LDD   #$00                    ; B0AC: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0AF; JUMP; // sstep
case 0xB0AF:
                                                     mon("         SUBD  <$BA                    ; B0AF: 93 BA         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xba)<<8; 
    ea = ea | rd_mem(DP|0xbb); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0B1; JUMP; // sstep
case 0xB0B1:
                                                     mon("         JSR   Shift_D_R_3             ; B0B1: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0xB0B4:
                                                     mon("LB0B4    ADDD  <$BA                    ; B0B4: D3 BA         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xba)<<8; 
    ea = ea | rd_mem(DP|0xbb); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB0B6; JUMP; // sstep
case 0xB0B6:
                                                     mon("         ADDD  $5044                   ; B0B6: F3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB0B9; JUMP; // sstep
case 0xB0B9:
                                                     mon("         STD   <$05                    ; B0B9: DD 05         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x05; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB0BB; JUMP; // sstep
case 0xB0BB:
                                                     mon("         LDD   #$F000                  ; B0BB: CC F0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0BE; JUMP; // sstep
case 0xB0BE:
                                                     mon("         SUBD  <$05                    ; B0BE: 93 05         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x05)<<8; 
    ea = ea | rd_mem(DP|0x06); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0C0; JUMP; // sstep
case 0xB0C0:
                                                     mon("         LBLT  LB158                   ; B0C0: 10 2D 00 94   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) <  0) {
    clockticks = clockticks + 1; 
    PC = 0xb158; 
    JUMP;
    }
    PC = 0xB0C4; JUMP; // sstep
case 0xB0C4:
                                                     mon("         STD   $4706                   ; B0C4: FD 47 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4706, A); // Care needed with I/O space and word fetches
    wr_mem(0x4707, B); 
    PC = 0xB0C7; JUMP; // sstep
case 0xB0C7:
                                                     mon("         LDD   $5044                   ; B0C7: FC 50 44      \n"); // ZT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5044); // Care needed with I/O space and word fetches
    B = rd_mem(0x5045); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0CA; JUMP; // sstep
case 0xB0CA:
                                                     mon("         SUBD  <$05                    ; B0CA: 93 05         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x05)<<8; 
    ea = ea | rd_mem(DP|0x06); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0CC; JUMP; // sstep
case 0xB0CC:
                                                     mon("         STD   $4704                   ; B0CC: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xB0CF; JUMP; // sstep
case 0xB0CF:
                                                     mon("         LDD   <$03                    ; B0CF: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0D1; JUMP; // sstep
case 0xB0D1:
                                                     mon("         SUBD  $5042                   ; B0D1: B3 50 42      \n"); // YT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5042)<<8; 
    ea = ea | rd_mem(0x5043); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0D4; JUMP; // sstep
case 0xB0D4:
                                                     mon("         STD   $5002                   ; B0D4: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xB0D7; JUMP; // sstep
case 0xB0D7:
                                                     mon("         LDD   <$01                    ; B0D7: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0D9; JUMP; // sstep
case 0xB0D9:
                                                     mon("         SUBD  $5040                   ; B0D9: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0DC; JUMP; // sstep
case 0xB0DC:
                                                     mon("         STD   $5004                   ; B0DC: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xB0DF; JUMP; // sstep
case 0xB0DF:
                                                     mon("         LDD   $4700                   ; B0DF: FC 47 00      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4700); // Care needed with I/O space and word fetches
    B = rd_mem(0x4701); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0E2; JUMP; // sstep
case 0xB0E2:
                                                     mon("         STD   $5000                   ; B0E2: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xB0E5; JUMP; // sstep
case 0xB0E5:
                                                     mon("         LDA   #$86                    ; B0E5: 86 86         \n"); // Reg02 = Reg02 x Reg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB0E7; JUMP; // sstep
case 0xB0E7:
                                                     mon("         JSR   LCDBA                   ; B0E7: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xea); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xB0EA:
                                                     mon("LB0EA    LDD   <$03                    ; B0EA: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB0EC; JUMP; // sstep
case 0xB0EC:
                                                     mon("         SUBD  $5002                   ; B0EC: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB0EF; JUMP; // sstep
case 0xB0EF:
                                                     mon("         BMI   LB0F9                   ; B0EF: 2B 08         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb0f9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB0F1; JUMP; // sstep
case 0xB0F1:
                                                     mon("         CMPD  #$0400                  ; B0F1: 10 83 04 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0400; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB0F5; JUMP; // sstep
case 0xB0F5:
                                                     mon("         BGT   LB158                   ; B0F5: 2E 61         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb158; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB0F7; JUMP; // sstep
case 0xB0F7:
                                                     mon("         BRA   LB0FF                   ; B0F7: 20 06         \n");
    PC = 0xb0ff; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB0F9:
                                                     mon("LB0F9    CMPD  #$FC00                  ; B0F9: 10 83 FC 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfc00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB0FD; JUMP; // sstep
case 0xB0FD:
                                                     mon("         BLT   LB158                   ; B0FD: 2D 59         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb158; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB0FF; JUMP; // sstep
case 0xB0FF:
                                                     mon("LB0FF    STD   <$03                    ; B0FF: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB101; JUMP; // sstep
case 0xB101:
                                                     mon("         LDD   <$01                    ; B101: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB103; JUMP; // sstep
case 0xB103:
                                                     mon("         SUBD  $5004                   ; B103: B3 50 04      \n"); // Math result Z
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5004)<<8; 
    ea = ea | rd_mem(0x5005); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB106; JUMP; // sstep
case 0xB106:
                                                     mon("         STD   <$01                    ; B106: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB108; JUMP; // sstep
case 0xB108:
                                                     mon("         STD   <$C0                    ; B108: DD C0         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc0; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB10A; JUMP; // sstep
case 0xB10A:
                                                     mon("         LDD   #$F000                  ; B10A: CC F0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB10D; JUMP; // sstep
case 0xB10D:
                                                     mon("         STD   <$05                    ; B10D: DD 05         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x05; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB10F; JUMP; // sstep
case 0xB10F:
                                                     mon("         LDA   #$FF                    ; B10F: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB111; JUMP; // sstep
case 0xB111:
                                                     mon("         STA   <$BD                    ; B111: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB113; JUMP; // sstep
case 0xB113:
                                                     mon("         LDA   #$03                    ; B113: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB115; JUMP; // sstep
case 0xB115:
                                                     mon("         STA   $4B23                   ; B115: B7 4B 23      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b23, val); 
    PC = 0xB118; JUMP; // sstep
case 0xB118:
                                                     mon("         LDA   <$01                    ; B118: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB11A; JUMP; // sstep
case 0xB11A:
                                                     mon("         SUBA  $5040                   ; B11A: B0 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x5040); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xB11D; JUMP; // sstep
case 0xB11D:
                                                     mon("         LDB   #$03                    ; B11D: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB11F; JUMP; // sstep
case 0xB11F:
                                                     mon("         MUL                           ; B11F: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB120; JUMP; // sstep
case 0xB120:
                                                     mon("         CMPD  #$E0                    ; B120: 10 83 00 E0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00e0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB124; JUMP; // sstep
case 0xB124:
                                                     mon("         BCS   LB128                   ; B124: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb128; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB126; JUMP; // sstep
case 0xB126:
                                                     mon("         LDB   #$E0                    ; B126: C6 E0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xe0; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB128; JUMP; // sstep
case 0xB128:
                                                     mon("LB128    STB   $4B22                   ; B128: F7 4B 22      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b22, val); 
    PC = 0xB12B; JUMP; // sstep
case 0xB12B:
                                                     mon("         LDD   #$6280                  ; B12B: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB12E; JUMP; // sstep
case 0xB12E:
                                                     mon("         STD   $4B20                   ; B12E: FD 4B 20      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b20, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b21, B); 
    PC = 0xB131; JUMP; // sstep
case 0xB131:
                                                     mon("         LDA   <$95                    ; B131: 96 95         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x95); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB133; JUMP; // sstep
case 0xB133:
                                                     mon("         BEQ   locret_B157             ; B133: 27 22         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb157; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB135; JUMP; // sstep
case 0xB135:
                                                     mon("         LDA   <$44                    ; B135: 96 44         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x44); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB137; JUMP; // sstep
case 0xB137:
                                                     mon("         BNE   locret_B157             ; B137: 26 1E         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb157; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB139; JUMP; // sstep
case 0xB139:
                                                     mon("         LDD   <$03                    ; B139: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB13B; JUMP; // sstep
case 0xB13B:
                                                     mon("         ADDD  #$0200                  ; B13B: C3 02 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0200; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB13E; JUMP; // sstep
case 0xB13E:
                                                     mon("         BLT   locret_B157             ; B13E: 2D 17         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb157; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB140; JUMP; // sstep
case 0xB140:
                                                     mon("         SUBD  #$0400                  ; B140: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB143; JUMP; // sstep
case 0xB143:
                                                     mon("         BGT   locret_B157             ; B143: 2E 12         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb157; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB145; JUMP; // sstep
case 0xB145:
                                                     mon("         LDD   <$01                    ; B145: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB147; JUMP; // sstep
case 0xB147:
                                                     mon("         SUBD  <$96                    ; B147: 93 96         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x96)<<8; 
    ea = ea | rd_mem(DP|0x97); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB149; JUMP; // sstep
case 0xB149:
                                                     mon("         ADDD  #$0200                  ; B149: C3 02 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0200; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB14C; JUMP; // sstep
case 0xB14C:
                                                     mon("         BLT   locret_B157             ; B14C: 2D 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb157; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB14E; JUMP; // sstep
case 0xB14E:
                                                     mon("         SUBD  #$0400                  ; B14E: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB151; JUMP; // sstep
case 0xB151:
                                                     mon("         BGT   locret_B157             ; B151: 2E 04         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb157; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB153; JUMP; // sstep
case 0xB153:
                                                     mon("         LDA   #$01                    ; B153: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB155; JUMP; // sstep
case 0xB155:
                                                     mon("         STA   <$44                    ; B155: 97 44         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x44; 
    wr_mem(ea, val); 
    PC = 0xB157; JUMP; // sstep
case 0xB157:
                                                     mon("locret_B157 RTS                           ; B157: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB158:
                                                     mon("LB158    LDD   <$03                    ; B158: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB15A; JUMP; // sstep
case 0xB15A:
                                                     mon("         LBPL  LB1E3                   ; B15A: 10 2A 00 85   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N >= 0) {
    clockticks = clockticks + 1; 
    PC = 0xb1e3; 
    JUMP;
    }
    PC = 0xB15E; JUMP; // sstep
case 0xB15E:
                                                     mon("         LDD   #$FC00                  ; B15E: CC FC 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB161; JUMP; // sstep
case 0xB161:
                                                     mon("         SUBD  <$03                    ; B161: 93 03         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x03)<<8; 
    ea = ea | rd_mem(DP|0x04); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB163; JUMP; // sstep
case 0xB163:
                                                     mon("         LBLT  locret_B260             ; B163: 10 2D 00 F9   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) <  0) {
    clockticks = clockticks + 1; 
    PC = 0xb260; 
    JUMP;
    }
    PC = 0xB167; JUMP; // sstep
case 0xB167:
                                                     mon("         STD   $4706                   ; B167: FD 47 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4706, A); // Care needed with I/O space and word fetches
    wr_mem(0x4707, B); 
    PC = 0xB16A; JUMP; // sstep
case 0xB16A:
                                                     mon("         LDD   $5042                   ; B16A: FC 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5042); // Care needed with I/O space and word fetches
    B = rd_mem(0x5043); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB16D; JUMP; // sstep
case 0xB16D:
                                                     mon("         SUBD  <$03                    ; B16D: 93 03         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x03)<<8; 
    ea = ea | rd_mem(DP|0x04); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB16F; JUMP; // sstep
case 0xB16F:
                                                     mon("         STD   $4704                   ; B16F: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xB172; JUMP; // sstep
case 0xB172:
                                                     mon("         LDD   <$05                    ; B172: DC 05         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x05); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x06); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB174; JUMP; // sstep
case 0xB174:
                                                     mon("         SUBD  $5044                   ; B174: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB177; JUMP; // sstep
case 0xB177:
                                                     mon("         STD   $5004                   ; B177: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xB17A; JUMP; // sstep
case 0xB17A:
                                                     mon("         LDD   <$01                    ; B17A: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB17C; JUMP; // sstep
case 0xB17C:
                                                     mon("         SUBD  $5040                   ; B17C: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB17F; JUMP; // sstep
case 0xB17F:
                                                     mon("         STD   $5002                   ; B17F: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xB182; JUMP; // sstep
case 0xB182:
                                                     mon("         LDD   $4700                   ; B182: FC 47 00      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4700); // Care needed with I/O space and word fetches
    B = rd_mem(0x4701); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB185; JUMP; // sstep
case 0xB185:
                                                     mon("         STD   $5000                   ; B185: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xB188; JUMP; // sstep
case 0xB188:
                                                     mon("         LDA   #$86                    ; B188: 86 86         \n"); // Reg02 = Reg02 x Reg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB18A; JUMP; // sstep
case 0xB18A:
                                                     mon("         JSR   LCDBA                   ; B18A: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb1); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xB18D:
                                                     mon("LB18D    LDD   <$05                    ; B18D: DC 05         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x05); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x06); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB18F; JUMP; // sstep
case 0xB18F:
                                                     mon("         SUBD  $5004                   ; B18F: B3 50 04      \n"); // Math result Z
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5004)<<8; 
    ea = ea | rd_mem(0x5005); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB192; JUMP; // sstep
case 0xB192:
                                                     mon("         BMI   LB19E                   ; B192: 2B 0A         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb19e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB194; JUMP; // sstep
case 0xB194:
                                                     mon("         CMPD  #$00                    ; B194: 10 83 00 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB198; JUMP; // sstep
case 0xB198:
                                                     mon("         LBGT  locret_B260             ; B198: 10 2E 00 C4   \n");
    clockticks = clockticks + 5; 
    if (((SINT8)(N^V) >= 0) && Z) {
    clockticks = clockticks + 1; 
    PC = 0xb260; 
    JUMP;
    }
    PC = 0xB19C; JUMP; // sstep
case 0xB19C:
                                                     mon("         BRA   LB1A6                   ; B19C: 20 08         \n");
    PC = 0xb1a6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB19E:
                                                     mon("LB19E    CMPD  #$F000                  ; B19E: 10 83 F0 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xf000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB1A2; JUMP; // sstep
case 0xB1A2:
                                                     mon("         LBLT  locret_B260             ; B1A2: 10 2D 00 BA   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) <  0) {
    clockticks = clockticks + 1; 
    PC = 0xb260; 
    JUMP;
    }
    PC = 0xB1A6; JUMP; // sstep
case 0xB1A6:
                                                     mon("LB1A6    STD   <$05                    ; B1A6: DD 05         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x05; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB1A8; JUMP; // sstep
case 0xB1A8:
                                                     mon("         ADDD  #$1000                  ; B1A8: C3 10 00      \n");
    clockticks = clockticks + 4; 
    val = 0x1000; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB1AB; JUMP; // sstep
case 0xB1AB:
                                                     mon("         STD   <$BE                    ; B1AB: DD BE         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xbe; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB1AD; JUMP; // sstep
case 0xB1AD:
                                                     mon("         LDD   <$01                    ; B1AD: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB1AF; JUMP; // sstep
case 0xB1AF:
                                                     mon("         SUBD  $5002                   ; B1AF: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB1B2; JUMP; // sstep
case 0xB1B2:
                                                     mon("         STD   <$01                    ; B1B2: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB1B4; JUMP; // sstep
case 0xB1B4:
                                                     mon("         STD   <$C0                    ; B1B4: DD C0         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc0; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB1B6; JUMP; // sstep
case 0xB1B6:
                                                     mon("         LDD   #$FC00                  ; B1B6: CC FC 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB1B9; JUMP; // sstep
case 0xB1B9:
                                                     mon("         STD   <$03                    ; B1B9: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB1BB; JUMP; // sstep
case 0xB1BB:
                                                     mon("         LDA   #$FF                    ; B1BB: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB1BD; JUMP; // sstep
case 0xB1BD:
                                                     mon("         STA   <$BD                    ; B1BD: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB1BF; JUMP; // sstep
case 0xB1BF:
                                                     mon("         LDA   #$09                    ; B1BF: 86 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB1C1; JUMP; // sstep
case 0xB1C1:
                                                     mon("         STA   $4B23                   ; B1C1: B7 4B 23      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b23, val); 
    PC = 0xB1C4; JUMP; // sstep
case 0xB1C4:
                                                     mon("         LDA   <$01                    ; B1C4: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB1C6; JUMP; // sstep
case 0xB1C6:
                                                     mon("         SUBA  $5040                   ; B1C6: B0 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x5040); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xB1C9; JUMP; // sstep
case 0xB1C9:
                                                     mon("         LDB   #$03                    ; B1C9: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB1CB; JUMP; // sstep
case 0xB1CB:
                                                     mon("         MUL                           ; B1CB: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB1CC; JUMP; // sstep
case 0xB1CC:
                                                     mon("         CMPD  #$E0                    ; B1CC: 10 83 00 E0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00e0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB1D0; JUMP; // sstep
case 0xB1D0:
                                                     mon("         BCS   LB1D4                   ; B1D0: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb1d4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB1D2; JUMP; // sstep
case 0xB1D2:
                                                     mon("         LDB   #$E0                    ; B1D2: C6 E0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xe0; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB1D4; JUMP; // sstep
case 0xB1D4:
                                                     mon("LB1D4    STB   $4B22                   ; B1D4: F7 4B 22      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b22, val); 
    PC = 0xB1D7; JUMP; // sstep
case 0xB1D7:
                                                     mon("         LDD   #$6280                  ; B1D7: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB1DA; JUMP; // sstep
case 0xB1DA:
                                                     mon("         STD   $4B20                   ; B1DA: FD 4B 20      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b20, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b21, B); 
    PC = 0xB1DD; JUMP; // sstep
case 0xB1DD:
                                                     mon("         LDX   #$4989                  ; B1DD: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xB1E0; JUMP; // sstep
case 0xB1E0:
                                                     mon("         JMP   LB261                   ; B1E0: 7E B2 61      \n");
    clockticks = clockticks + 4; 
    PC = 0xb261; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB1E3:
                                                     mon("LB1E3    SUBD  #$0400                  ; B1E3: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB1E6; JUMP; // sstep
case 0xB1E6:
                                                     mon("         BLT   locret_B260             ; B1E6: 2D 78         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb260; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB1E8; JUMP; // sstep
case 0xB1E8:
                                                     mon("         STD   $4706                   ; B1E8: FD 47 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4706, A); // Care needed with I/O space and word fetches
    wr_mem(0x4707, B); 
    PC = 0xB1EB; JUMP; // sstep
case 0xB1EB:
                                                     mon("         LDD   <$03                    ; B1EB: DC 03         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x03); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x04); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB1ED; JUMP; // sstep
case 0xB1ED:
                                                     mon("         SUBD  $5042                   ; B1ED: B3 50 42      \n"); // YT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5042)<<8; 
    ea = ea | rd_mem(0x5043); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB1F0; JUMP; // sstep
case 0xB1F0:
                                                     mon("         STD   $4704                   ; B1F0: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xB1F3; JUMP; // sstep
case 0xB1F3:
                                                     mon("         LDD   <$05                    ; B1F3: DC 05         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x05); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x06); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB1F5; JUMP; // sstep
case 0xB1F5:
                                                     mon("         SUBD  $5044                   ; B1F5: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB1F8; JUMP; // sstep
case 0xB1F8:
                                                     mon("         STD   $5004                   ; B1F8: FD 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5004, A); // Care needed with I/O space and word fetches
    wr_mem(0x5005, B); 
    PC = 0xB1FB; JUMP; // sstep
case 0xB1FB:
                                                     mon("         LDD   <$01                    ; B1FB: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB1FD; JUMP; // sstep
case 0xB1FD:
                                                     mon("         SUBD  $5040                   ; B1FD: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB200; JUMP; // sstep
case 0xB200:
                                                     mon("         STD   $5002                   ; B200: FD 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5002, A); // Care needed with I/O space and word fetches
    wr_mem(0x5003, B); 
    PC = 0xB203; JUMP; // sstep
case 0xB203:
                                                     mon("         LDD   $4700                   ; B203: FC 47 00      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4700); // Care needed with I/O space and word fetches
    B = rd_mem(0x4701); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB206; JUMP; // sstep
case 0xB206:
                                                     mon("         STD   $5000                   ; B206: FD 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5000, A); // Care needed with I/O space and word fetches
    wr_mem(0x5001, B); 
    PC = 0xB209; JUMP; // sstep
case 0xB209:
                                                     mon("         LDA   #$86                    ; B209: 86 86         \n"); // Reg02 = Reg02 x Reg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB20B; JUMP; // sstep
case 0xB20B:
                                                     mon("         JSR   LCDBA                   ; B20B: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xB20E:
                                                     mon("LB20E    LDD   <$05                    ; B20E: DC 05         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x05); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x06); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB210; JUMP; // sstep
case 0xB210:
                                                     mon("         SUBD  $5004                   ; B210: B3 50 04      \n"); // Math result Z
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5004)<<8; 
    ea = ea | rd_mem(0x5005); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB213; JUMP; // sstep
case 0xB213:
                                                     mon("         BMI   LB21D                   ; B213: 2B 08         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb21d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB215; JUMP; // sstep
case 0xB215:
                                                     mon("         CMPD  #$00                    ; B215: 10 83 00 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB219; JUMP; // sstep
case 0xB219:
                                                     mon("         BGT   locret_B260             ; B219: 2E 45         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb260; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB21B; JUMP; // sstep
case 0xB21B:
                                                     mon("         BRA   LB223                   ; B21B: 20 06         \n");
    PC = 0xb223; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB21D:
                                                     mon("LB21D    CMPD  #$F000                  ; B21D: 10 83 F0 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xf000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB221; JUMP; // sstep
case 0xB221:
                                                     mon("         BLT   locret_B260             ; B221: 2D 3D         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb260; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB223; JUMP; // sstep
case 0xB223:
                                                     mon("LB223    STD   <$05                    ; B223: DD 05         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x05; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB225; JUMP; // sstep
case 0xB225:
                                                     mon("         ADDD  #$1000                  ; B225: C3 10 00      \n");
    clockticks = clockticks + 4; 
    val = 0x1000; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB228; JUMP; // sstep
case 0xB228:
                                                     mon("         STD   <$BE                    ; B228: DD BE         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xbe; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB22A; JUMP; // sstep
case 0xB22A:
                                                     mon("         LDD   <$01                    ; B22A: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB22C; JUMP; // sstep
case 0xB22C:
                                                     mon("         SUBD  $5002                   ; B22C: B3 50 02      \n"); // Math result Y
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5002)<<8; 
    ea = ea | rd_mem(0x5003); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB22F; JUMP; // sstep
case 0xB22F:
                                                     mon("         STD   <$01                    ; B22F: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB231; JUMP; // sstep
case 0xB231:
                                                     mon("         STD   <$C0                    ; B231: DD C0         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc0; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB233; JUMP; // sstep
case 0xB233:
                                                     mon("         LDD   #$0400                  ; B233: CC 04 00      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB236; JUMP; // sstep
case 0xB236:
                                                     mon("         STD   <$03                    ; B236: DD 03         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB238; JUMP; // sstep
case 0xB238:
                                                     mon("         LDA   #$FF                    ; B238: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB23A; JUMP; // sstep
case 0xB23A:
                                                     mon("         STA   <$BD                    ; B23A: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB23C; JUMP; // sstep
case 0xB23C:
                                                     mon("         LDA   #$06                    ; B23C: 86 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB23E; JUMP; // sstep
case 0xB23E:
                                                     mon("         STA   $4B23                   ; B23E: B7 4B 23      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b23, val); 
    PC = 0xB241; JUMP; // sstep
case 0xB241:
                                                     mon("         LDA   <$01                    ; B241: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB243; JUMP; // sstep
case 0xB243:
                                                     mon("         SUBA  $5040                   ; B243: B0 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x5040); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xB246; JUMP; // sstep
case 0xB246:
                                                     mon("         LDB   #$03                    ; B246: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB248; JUMP; // sstep
case 0xB248:
                                                     mon("         MUL                           ; B248: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB249; JUMP; // sstep
case 0xB249:
                                                     mon("         CMPD  #$E0                    ; B249: 10 83 00 E0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00e0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB24D; JUMP; // sstep
case 0xB24D:
                                                     mon("         BCS   LB251                   ; B24D: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb251; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB24F; JUMP; // sstep
case 0xB24F:
                                                     mon("         LDB   #$E0                    ; B24F: C6 E0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xe0; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB251; JUMP; // sstep
case 0xB251:
                                                     mon("LB251    STB   $4B22                   ; B251: F7 4B 22      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b22, val); 
    PC = 0xB254; JUMP; // sstep
case 0xB254:
                                                     mon("         LDD   #$6280                  ; B254: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB257; JUMP; // sstep
case 0xB257:
                                                     mon("         STD   $4B20                   ; B257: FD 4B 20      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b20, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b21, B); 
    PC = 0xB25A; JUMP; // sstep
case 0xB25A:
                                                     mon("         LDX   #$4999                  ; B25A: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xB25D; JUMP; // sstep
case 0xB25D:
                                                     mon("         JMP   LB261                   ; B25D: 7E B2 61      \n");
    clockticks = clockticks + 4; 
    PC = 0xb261; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB260:
                                                     mon("locret_B260 RTS                           ; B260: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB261:
                                                     mon("LB261    LDA   <$BC                    ; B261: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB263; JUMP; // sstep
case 0xB263:
                                                     mon("         BNE   LB266                   ; B263: 26 01         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb266; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB265; JUMP; // sstep
case 0xB265:
                                                     mon("         RTS                           ; B265: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB266:
                                                     mon("LB266    LDB   <$C0                    ; B266: D6 C0         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc0); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB268; JUMP; // sstep
case 0xB268:
                                                     mon("         LSRB                          ; B268: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB269; JUMP; // sstep
case 0xB269:
                                                     mon("         LSRB                          ; B269: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB26A; JUMP; // sstep
case 0xB26A:
                                                     mon("         LSRB                          ; B26A: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB26B; JUMP; // sstep
case 0xB26B:
                                                     mon("         ANDB  #$0F                    ; B26B: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB26D; JUMP; // sstep
case 0xB26D:
                                                     mon("         ABX                           ; B26D: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xB26E; JUMP; // sstep
case 0xB26E:
                                                     mon("         LDD   <$C0                    ; B26E: DC C0         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xc0); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xc1); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB270; JUMP; // sstep
case 0xB270:
                                                     mon("         ANDA  #$07                    ; B270: 84 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x07; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB272; JUMP; // sstep
case 0xB272:
                                                     mon("         SUBD  #$01C0                  ; B272: 83 01 C0      \n");
    clockticks = clockticks + 4; 
    val = 0x01c0; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB275; JUMP; // sstep
case 0xB275:
                                                     mon("         BLT   locret_B29B             ; B275: 2D 24         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb29b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB277; JUMP; // sstep
case 0xB277:
                                                     mon("         SUBD  #$0480                  ; B277: 83 04 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0480; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB27A; JUMP; // sstep
case 0xB27A:
                                                     mon("         BGT   locret_B29B             ; B27A: 2E 1F         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb29b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB27C; JUMP; // sstep
case 0xB27C:
                                                     mon("         LDA   #$03                    ; B27C: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB27E; JUMP; // sstep
case 0xB27E:
                                                     mon("         STA   <$01                    ; B27E: 97 01         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, val); 
    PC = 0xB280; JUMP; // sstep
case 0xB280:
                                                     mon("         LDD   <$BE                    ; B280: DC BE         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xbe); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xbf); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB282; JUMP; // sstep
case 0xB282:
                                                     mon("         SUBD  #$40                    ; B282: 83 00 40      \n");
    clockticks = clockticks + 4; 
    val = 0x0040; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB285; JUMP; // sstep
case 0xB285:
                                                     mon("LB285    SUBD  #$0380                  ; B285: 83 03 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0380; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB288; JUMP; // sstep
case 0xB288:
                                                     mon("         BGT   LB292                   ; B288: 2E 08         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb292; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB28A; JUMP; // sstep
case 0xB28A:
                                                     mon("         SUBD  #$FC80                  ; B28A: 83 FC 80      \n");
    clockticks = clockticks + 4; 
    val = 0xfc80; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB28D; JUMP; // sstep
case 0xB28D:
                                                     mon("         BLT   locret_B29B             ; B28D: 2D 0C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb29b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB28F; JUMP; // sstep
case 0xB28F:
                                                     mon("         JMP   LB29C                   ; B28F: 7E B2 9C      \n");
    clockticks = clockticks + 4; 
    PC = 0xb29c; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB292:
                                                     mon("LB292    SUBD  #$80                    ; B292: 83 00 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0080; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB295; JUMP; // sstep
case 0xB295:
                                                     mon("         ASL   <$01                    ; B295: 08 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(DP|0x01, res); 
    clockticks = clockticks + 2; 
    PC = 0xB297; JUMP; // sstep
case 0xB297:
                                                     mon("         ASL   <$01                    ; B297: 08 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    wr_mem(DP|0x01, res); 
    clockticks = clockticks + 2; 
    PC = 0xB299; JUMP; // sstep
case 0xB299:
                                                     mon("         BNE   LB285                   ; B299: 26 EA         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb285; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB29B; JUMP; // sstep
case 0xB29B:
                                                     mon("locret_B29B RTS                           ; B29B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB29C:
                                                     mon("LB29C    LDA   <$01                    ; B29C: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB29E; JUMP; // sstep
case 0xB29E:
                                                     mon("         ANDA  ,X                      ; B29E: A4 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(X); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xB2A0; JUMP; // sstep
case 0xB2A0:
                                                     mon("         BEQ   locret_B2D1             ; B2A0: 27 2F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb2d1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2A2; JUMP; // sstep
case 0xB2A2:
                                                     mon("         STA   <$02                    ; B2A2: 97 02         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x02; 
    wr_mem(ea, val); 
    PC = 0xB2A4; JUMP; // sstep
case 0xB2A4:
                                                     mon("         LDA   <$01                    ; B2A4: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2A6; JUMP; // sstep
case 0xB2A6:
                                                     mon("         ASLA                          ; B2A6: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB2A7; JUMP; // sstep
case 0xB2A7:
                                                     mon("         ANDA  <$01                    ; B2A7: 94 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(DP|0x01); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB2A9; JUMP; // sstep
case 0xB2A9:
                                                     mon("         CMPA  <$02                    ; B2A9: 91 02         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x02); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB2AB; JUMP; // sstep
case 0xB2AB:
                                                     mon("         BEQ   locret_B2D1             ; B2AB: 27 24         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb2d1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2AD; JUMP; // sstep
case 0xB2AD:
                                                     mon("         BLS   LB2C1                   ; B2AD: 23 12         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xb2c1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2AF; JUMP; // sstep
case 0xB2AF:
                                                     mon("         LDA   #$04                    ; B2AF: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2B1; JUMP; // sstep
case 0xB2B1:
                                                     mon("         STA   <$BD                    ; B2B1: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB2B3; JUMP; // sstep
case 0xB2B3:
                                                     mon("         LDA   ,X                      ; B2B3: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2B5; JUMP; // sstep
case 0xB2B5:
                                                     mon("         EORA  <$02                    ; B2B5: 98 02         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(DP|0x02); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB2B7; JUMP; // sstep
case 0xB2B7:
                                                     mon("         STA   ,X                      ; B2B7: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xB2B9; JUMP; // sstep
case 0xB2B9:
                                                     mon("         JSR   L97F2                   ; B2B9: BD 97 F2      \n"); // Trench green squares score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    PC = 0x97f2; 
    JUMP;
  case 0xB2BC:
                                                     mon("LB2BC    JSR   Sound_35                ; B2BC: BD BD FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    PC = 0xbdfd; 
    JUMP;
  case 0xB2BF:
                                                     mon("LB2BF    BRA   locret_B2D1             ; B2BF: 20 10         \n");
    PC = 0xb2d1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB2C1:
                                                     mon("LB2C1    LDA   #$04                    ; B2C1: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2C3; JUMP; // sstep
case 0xB2C3:
                                                     mon("         STA   <$BD                    ; B2C3: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB2C5; JUMP; // sstep
case 0xB2C5:
                                                     mon("         LDA   ,X                      ; B2C5: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2C7; JUMP; // sstep
case 0xB2C7:
                                                     mon("         EORA  <$02                    ; B2C7: 98 02         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(DP|0x02); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB2C9; JUMP; // sstep
case 0xB2C9:
                                                     mon("         STA   ,X                      ; B2C9: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xB2CB; JUMP; // sstep
case 0xB2CB:
                                                     mon("         JSR   L97FC                   ; B2CB: BD 97 FC      \n"); // Trench turrets score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    PC = 0x97fc; 
    JUMP;
  case 0xB2CE:
                                                     mon("LB2CE    JSR   Sound_35                ; B2CE: BD BD FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    PC = 0xbdfd; 
    JUMP;
    // End of function sub_B095
  case 0xB2D1:
                                                     mon("locret_B2D1 RTS                           ; B2D1: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // FUNCTION CHUNK AT ROM:A54B SIZE 00000045 BYTES
  case 0xB2D2:
                                                     mon("LB2D2    LDA   <$BC                    ; B2D2: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB2D4; JUMP; // sstep
case 0xB2D4:
                                                     mon("         BEQ   locret_B2E3             ; B2D4: 27 0D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb2e3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2D6; JUMP; // sstep
case 0xB2D6:
                                                     mon("         LDD   <$CC                    ; B2D6: DC CC         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xcc); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xcd); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB2D8; JUMP; // sstep
case 0xB2D8:
                                                     mon("         BMI   LB2E1                   ; B2D8: 2B 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb2e1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2DA; JUMP; // sstep
case 0xB2DA:
                                                     mon("         LDA   #$04                    ; B2DA: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2DC; JUMP; // sstep
case 0xB2DC:
                                                     mon("         STA   <$BD                    ; B2DC: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB2DE; JUMP; // sstep
case 0xB2DE:
                                                     mon("         JSR   LAD20                   ; B2DE: BD AD 20      \n"); // Fireball destroyed
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    PC = 0xad20; 
    JUMP;
  case 0xB2E1:
                                                     mon("LB2E1    BRA   LB2E4                   ; B2E1: 20 01         \n");
    PC = 0xb2e4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB2E3:
                                                     mon("locret_B2E3 RTS                           ; B2E3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB2E4:
                                                     mon("LB2E4    LDD   <$C4                    ; B2E4: DC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xc4); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xc5); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB2E6; JUMP; // sstep
case 0xB2E6:
                                                     mon("         BMI   LB2F8                   ; B2E6: 2B 10         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb2f8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2E8; JUMP; // sstep
case 0xB2E8:
                                                     mon("         CMPD  <$C8                    ; B2E8: 10 93 C8      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc8)<<8; 
    ea = ea | rd_mem(DP|0xc9); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xB2EB; JUMP; // sstep
case 0xB2EB:
                                                     mon("         BHI   LB2F8                   ; B2EB: 22 0B         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xb2f8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2ED; JUMP; // sstep
case 0xB2ED:
                                                     mon("         SUBD  <$D0                    ; B2ED: 93 D0         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xd0)<<8; 
    ea = ea | rd_mem(DP|0xd1); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB2EF; JUMP; // sstep
case 0xB2EF:
                                                     mon("         BHI   LB307                   ; B2EF: 22 16         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xb307; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2F1; JUMP; // sstep
case 0xB2F1:
                                                     mon("         LDA   #$04                    ; B2F1: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB2F3; JUMP; // sstep
case 0xB2F3:
                                                     mon("         STA   <$BD                    ; B2F3: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB2F5; JUMP; // sstep
case 0xB2F5:
                                                     mon("         JMP   L8ACF                   ; B2F5: 7E 8A CF      \n");
    clockticks = clockticks + 4; 
    PC = 0x8acf; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB2F8:
                                                     mon("LB2F8    LDD   <$C8                    ; B2F8: DC C8         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xc8); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xc9); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB2FA; JUMP; // sstep
case 0xB2FA:
                                                     mon("         BMI   LB307                   ; B2FA: 2B 0B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb307; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB2FC; JUMP; // sstep
case 0xB2FC:
                                                     mon("         SUBD  <$D0                    ; B2FC: 93 D0         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xd0)<<8; 
    ea = ea | rd_mem(DP|0xd1); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB2FE; JUMP; // sstep
case 0xB2FE:
                                                     mon("         BHI   LB307                   ; B2FE: 22 07         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xb307; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB300; JUMP; // sstep
case 0xB300:
                                                     mon("         LDA   #$04                    ; B300: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB302; JUMP; // sstep
case 0xB302:
                                                     mon("         STA   <$BD                    ; B302: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB304; JUMP; // sstep
case 0xB304:
                                                     mon("         JMP   LA54B                   ; B304: 7E A5 4B      \n");
    clockticks = clockticks + 4; 
    PC = 0xa54b; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB307:
                                                     mon("LB307    LDD   <$D0                    ; B307: DC D0         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xd0); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xd1); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB309; JUMP; // sstep
case 0xB309:
                                                     mon("         BMI   locret_B32A             ; B309: 2B 1F         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb32a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB30B; JUMP; // sstep
case 0xB30B:
                                                     mon("         LDA   #$FF                    ; B30B: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB30D; JUMP; // sstep
case 0xB30D:
                                                     mon("         STA   <$BD                    ; B30D: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB30F; JUMP; // sstep
case 0xB30F:
                                                     mon("         LDA   #$0F                    ; B30F: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB311; JUMP; // sstep
case 0xB311:
                                                     mon("         STA   $4B23                   ; B311: B7 4B 23      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b23, val); 
    PC = 0xB314; JUMP; // sstep
case 0xB314:
                                                     mon("         LDA   <$D0                    ; B314: 96 D0         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xd0); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB316; JUMP; // sstep
case 0xB316:
                                                     mon("         LDB   #$03                    ; B316: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB318; JUMP; // sstep
case 0xB318:
                                                     mon("         MUL                           ; B318: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB319; JUMP; // sstep
case 0xB319:
                                                     mon("         CMPD  #$E0                    ; B319: 10 83 00 E0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00e0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB31D; JUMP; // sstep
case 0xB31D:
                                                     mon("         BCS   LB321                   ; B31D: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb321; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB31F; JUMP; // sstep
case 0xB31F:
                                                     mon("         LDB   #$E0                    ; B31F: C6 E0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xe0; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB321; JUMP; // sstep
case 0xB321:
                                                     mon("LB321    STB   $4B22                   ; B321: F7 4B 22      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b22, val); 
    PC = 0xB324; JUMP; // sstep
case 0xB324:
                                                     mon("         LDD   #$6680                  ; B324: CC 66 80      \n");
    clockticks = clockticks + 3; 
    A = 0x66; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB327; JUMP; // sstep
case 0xB327:
                                                     mon("         STD   $4B20                   ; B327: FD 4B 20      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b20, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b21, B); 
    // End of function sub_B2D2
    PC = 0xB32A; JUMP; // sstep
case 0xB32A:
                                                     mon("locret_B32A RTS                           ; B32A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // FUNCTION CHUNK AT ROM:8ACF SIZE 0000009E BYTES
  case 0xB32B:
                                                     mon("LB32B    LDA   <$BC                    ; B32B: 96 BC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xbc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB32D; JUMP; // sstep
case 0xB32D:
                                                     mon("         BEQ   locret_B33D             ; B32D: 27 0E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb33d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB32F; JUMP; // sstep
case 0xB32F:
                                                     mon("         LDD   <$CC                    ; B32F: DC CC         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xcc); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xcd); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB331; JUMP; // sstep
case 0xB331:
                                                     mon("         BMI   LB339                   ; B331: 2B 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb339; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB333; JUMP; // sstep
case 0xB333:
                                                     mon("         SUBD  <$C4                    ; B333: 93 C4         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc4)<<8; 
    ea = ea | rd_mem(DP|0xc5); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB335; JUMP; // sstep
case 0xB335:
                                                     mon("         BCS   LB33E                   ; B335: 25 07         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb33e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB337; JUMP; // sstep
case 0xB337:
                                                     mon("         BRA   LB345                   ; B337: 20 0C         \n");
    PC = 0xb345; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB339:
                                                     mon("LB339    LDA   <$C4                    ; B339: 96 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc4); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB33B; JUMP; // sstep
case 0xB33B:
                                                     mon("         BGE   LB345                   ; B33B: 2C 08         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xb345; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB33D; JUMP; // sstep
case 0xB33D:
                                                     mon("locret_B33D RTS                           ; B33D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB33E:
                                                     mon("LB33E    LDA   #$04                    ; B33E: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB340; JUMP; // sstep
case 0xB340:
                                                     mon("         STA   <$BD                    ; B340: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0xB342; JUMP; // sstep
case 0xB342:
                                                     mon("         JMP   LAD20                   ; B342: 7E AD 20      \n"); // Fireball destroyed
    clockticks = clockticks + 4; 
    PC = 0xad20; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB345:
                                                     mon("LB345    LDA   #$04                    ; B345: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB347; JUMP; // sstep
case 0xB347:
                                                     mon("         STA   <$BD                    ; B347: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    // End of function sub_B32B
    // ---------------------------------------------------------------------------
    PC = 0xB349; JUMP; // sstep
case 0xB349:
                                                     mon("         JMP   L8ACF                   ; B349: 7E 8A CF      \n");
    clockticks = clockticks + 4; 
    PC = 0x8acf; 
    JUMP;
    
                   // FCB   $28                     ; B3CB:  '(' 28 41          BVC   $B40E ; 
                   // FCB   $41                     ; B3CC:  'A' 41             Invalid ; 
                   // FCB   $4C                     ; B3CD:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; B3CE:  'L' 4C             INCA  ; 
                   // FCB   $59                     ; B3CF:  'Y' 59             ROLB  ; 
                   // FCB   $20                     ; B3D0:  ' ' 20 57          BRA   $B429 ; 
                   // FCB   $57                     ; B3D1:  'W' 57             ASRB  ; 
                   // FCB   $41                     ; B3D2:  'A' 41             Invalid ; 
                   // FCB   $53                     ; B3D3:  'S' 53             COMB  ; 
                   // FCB   $20                     ; B3D4:  ' ' 20 54          BRA   $B42A ; 
                   // FCB   $54                     ; B3D5:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; B3D6:  'H' 48             ASLA  ; 
                   // FCB   $45                     ; B3D7:  'E' 45             Invalid ; 
                   // FCB   $20                     ; B3D8:  ' ' 20 57          BRA   $B431 ; 
                   // FCB   $57                     ; B3D9:  'W' 57             ASRB  ; 
                   // FCB   $48                     ; B3DA:  'H' 48             ASLA  ; 
                   // FCB   $49                     ; B3DB:  'I' 49             ROLA  ; 
                   // FCB   $50                     ; B3DC:  'P' 50             NEGB  ; 
                   // FCB   $43                     ; B3DD:  'C' 43             COMA  ; 
                   // FCB   $52                     ; B3DE:  'R' 52             Invalid ; 
                   // FCB   $41                     ; B3DF:  'A' 41             Invalid ; 
                   // FCB   $43                     ; B3E0:  'C' 43             COMA  ; 
                   // FCB   $4B                     ; B3E1:  'K' 4B             Invalid ; 
                   // FCB   $45                     ; B3E2:  'E' 45             Invalid ; 
                   // FCB   $52                     ; B3E3:  'R' 52             Invalid ; 
    // =============== S U B R O U T I N E =======================================
  case 0xB3E4:
                                                     mon("LB3E4    LDA   $49C0                   ; B3E4: B6 49 C0      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c0); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    // End of function sub_B3E4
    PC = 0xB3E7; JUMP; // sstep
case 0xB3E7:
                                                     mon("         CMPA  #$03                    ; B3E7: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    // =============== S U B R O U T I N E =======================================
    PC = 0xB3E9; JUMP; // sstep
case 0xB3E9:
                                                     mon("LB3E9    BCS   LB3F0                   ; B3E9: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb3f0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB3EB; JUMP; // sstep
case 0xB3EB:
                                                     mon("         LDA   #$00                    ; B3EB: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB3ED; JUMP; // sstep
case 0xB3ED:
                                                     mon("         STA   $49C0                   ; B3ED: B7 49 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c0, val); 
    PC = 0xB3F0; JUMP; // sstep
case 0xB3F0:
                                                     mon("LB3F0    LDA   #$01                    ; B3F0: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB3F2; JUMP; // sstep
case 0xB3F2:
                                                     mon("         STA   <$9C                    ; B3F2: 97 9C         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9c; 
    wr_mem(ea, val); 
    PC = 0xB3F4; JUMP; // sstep
case 0xB3F4:
                                                     mon("         LDA   #$0B                    ; B3F4: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB3F6; JUMP; // sstep
case 0xB3F6:
                                                     mon("         STA   <$DC                    ; B3F6: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB3F8; JUMP; // sstep
case 0xB3F8:
                                                     mon("         STA   <$9D                    ; B3F8: 97 9D         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x9d; 
    wr_mem(ea, val); 
    PC = 0xB3FA; JUMP; // sstep
case 0xB3FA:
                                                     mon("         JSR   LCD38                   ; B3FA: BD CD 38      \n"); // Trench left side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb3); 
    clockticks = clockticks + 1; 
    PC = 0xcd38; 
    JUMP;
  case 0xB3FD:
                                                     mon("LB3FD    JSR   LB43F                   ; B3FD: BD B4 3F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x00); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xb43f; 
    JUMP;
  case 0xB400:
                                                     mon("LB400    LDA   <$9D                    ; B400: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB402; JUMP; // sstep
case 0xB402:
                                                     mon("         STA   <$DC                    ; B402: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB404; JUMP; // sstep
case 0xB404:
                                                     mon("         JSR   LCD44                   ; B404: BD CD 44      \n"); // Trench right side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xcd44; 
    JUMP;
  case 0xB407:
                                                     mon("LB407    JSR   LB579                   ; B407: BD B5 79      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xb579; 
    JUMP;
  case 0xB40A:
                                                     mon("LB40A    LDA   #$02                    ; B40A: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB40C; JUMP; // sstep
case 0xB40C:
                                                     mon("         STA   <$9C                    ; B40C: 97 9C         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9c; 
    wr_mem(ea, val); 
    PC = 0xB40E; JUMP; // sstep
case 0xB40E:
                                                     mon("         LDA   #$0E                    ; B40E: 86 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB410; JUMP; // sstep
case 0xB410:
                                                     mon("         STA   <$DC                    ; B410: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB412; JUMP; // sstep
case 0xB412:
                                                     mon("         STA   <$9D                    ; B412: 97 9D         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x9d; 
    wr_mem(ea, val); 
    PC = 0xB414; JUMP; // sstep
case 0xB414:
                                                     mon("         JSR   LCD38                   ; B414: BD CD 38      \n"); // Trench left side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xcd38; 
    JUMP;
  case 0xB417:
                                                     mon("LB417    JSR   LB43F                   ; B417: BD B4 3F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xb43f; 
    JUMP;
  case 0xB41A:
                                                     mon("LB41A    LDA   <$9D                    ; B41A: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB41C; JUMP; // sstep
case 0xB41C:
                                                     mon("         STA   <$DC                    ; B41C: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB41E; JUMP; // sstep
case 0xB41E:
                                                     mon("         JSR   LCD44                   ; B41E: BD CD 44      \n"); // Trench right side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xcd44; 
    JUMP;
  case 0xB421:
                                                     mon("LB421    JSR   LB579                   ; B421: BD B5 79      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x24); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xb579; 
    JUMP;
  case 0xB424:
                                                     mon("LB424    LDA   #$03                    ; B424: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB426; JUMP; // sstep
case 0xB426:
                                                     mon("         STA   <$9C                    ; B426: 97 9C         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9c; 
    wr_mem(ea, val); 
    PC = 0xB428; JUMP; // sstep
case 0xB428:
                                                     mon("         LDA   #$0C                    ; B428: 86 0C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0c; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB42A; JUMP; // sstep
case 0xB42A:
                                                     mon("         STA   <$DC                    ; B42A: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB42C; JUMP; // sstep
case 0xB42C:
                                                     mon("         STA   <$9D                    ; B42C: 97 9D         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x9d; 
    wr_mem(ea, val); 
    PC = 0xB42E; JUMP; // sstep
case 0xB42E:
                                                     mon("         JSR   LCD38                   ; B42E: BD CD 38      \n"); // Trench left side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x31); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xcd38; 
    JUMP;
  case 0xB431:
                                                     mon("LB431    JSR   LB43F                   ; B431: BD B4 3F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x34); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xb43f; 
    JUMP;
  case 0xB434:
                                                     mon("LB434    LDA   <$9D                    ; B434: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB436; JUMP; // sstep
case 0xB436:
                                                     mon("         STA   <$DC                    ; B436: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB438; JUMP; // sstep
case 0xB438:
                                                     mon("         JSR   LCD44                   ; B438: BD CD 44      \n"); // Trench right side turret calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xcd44; 
    JUMP;
  case 0xB43B:
                                                     mon("LB43B    JSR   LB579                   ; B43B: BD B5 79      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xb579; 
    JUMP;
    // End of function sub_B3E9
  case 0xB43E:
                                                     mon("LB43E    RTS                           ; B43E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB43F:
                                                     mon("LB43F    LDA   #$00                    ; B43F: 86 00         \n"); // Trench
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB441; JUMP; // sstep
case 0xB441:
                                                     mon("         STA   $49BD                   ; B441: B7 49 BD      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49bd, val); 
    PC = 0xB444; JUMP; // sstep
case 0xB444:
                                                     mon("         LDA   $49C0                   ; B444: B6 49 C0      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c0); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB447; JUMP; // sstep
case 0xB447:
                                                     mon("         STA   $49BE                   ; B447: B7 49 BE      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49be, val); 
    PC = 0xB44A; JUMP; // sstep
case 0xB44A:
                                                     mon("         LDA   #$88                    ; B44A: 86 88         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x88; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB44C; JUMP; // sstep
case 0xB44C:
                                                     mon("         STA   $49C1                   ; B44C: B7 49 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c1, val); 
    PC = 0xB44F; JUMP; // sstep
case 0xB44F:
                                                     mon("         LDB   $5040                   ; B44F: F6 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5040); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB452; JUMP; // sstep
case 0xB452:
                                                     mon("         LSRB                          ; B452: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB453; JUMP; // sstep
case 0xB453:
                                                     mon("         LSRB                          ; B453: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB454; JUMP; // sstep
case 0xB454:
                                                     mon("         LSRB                          ; B454: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB455; JUMP; // sstep
case 0xB455:
                                                     mon("         ANDB  #$0F                    ; B455: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB457; JUMP; // sstep
case 0xB457:
                                                     mon("         LDX   #$4989                  ; B457: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB45A; JUMP; // sstep
case 0xB45A:
                                                     mon("         ABX                           ; B45A: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xB45B; JUMP; // sstep
case 0xB45B:
                                                     mon("         STX   <$64                    ; B45B: 9F 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x64; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xB45D; JUMP; // sstep
case 0xB45D:
                                                     mon("         LDA   $5040                   ; B45D: B6 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5040); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB460; JUMP; // sstep
case 0xB460:
                                                     mon("         ANDA  #$F8                    ; B460: 84 F8         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf8; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB462; JUMP; // sstep
case 0xB462:
                                                     mon("         ADDA  #$04                    ; B462: 8B 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB464; JUMP; // sstep
case 0xB464:
                                                     mon("         LDB   #$00                    ; B464: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB466; JUMP; // sstep
case 0xB466:
                                                     mon("         STD   $5078                   ; B466: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xB469; JUMP; // sstep
case 0xB469:
                                                     mon("         LDD   #$FC00                  ; B469: CC FC 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB46C; JUMP; // sstep
case 0xB46C:
                                                     mon("         STD   $507A                   ; B46C: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xB46F; JUMP; // sstep
case 0xB46F:
                                                     mon("LB46F    LDD   #$F200                  ; B46F: CC F2 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf2; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB472; JUMP; // sstep
case 0xB472:
                                                     mon("         STD   $507C                   ; B472: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xB475; JUMP; // sstep
case 0xB475:
                                                     mon("         LDX   <$64                    ; B475: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB477; JUMP; // sstep
case 0xB477:
                                                     mon("         CMPX  #$4999                  ; B477: 8C 49 99      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4999; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB47A; JUMP; // sstep
case 0xB47A:
                                                     mon("         BCS   LB47F                   ; B47A: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb47f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB47C; JUMP; // sstep
case 0xB47C:
                                                     mon("         LEAX  -$10,X                  ; B47C: 30 88 F0      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0xf0); 
/**/Z = X; 
    PC = 0xB47F; JUMP; // sstep
case 0xB47F:
                                                     mon("LB47F    LDA   ,X+                     ; B47F: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xB481; JUMP; // sstep
case 0xB481:
                                                     mon("         STX   <$64                    ; B481: 9F 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x64; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xB483; JUMP; // sstep
case 0xB483:
                                                     mon("LB483    STA   <$9E                    ; B483: 97 9E         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9e; 
    wr_mem(ea, val); 
    PC = 0xB485; JUMP; // sstep
case 0xB485:
                                                     mon("         ANDA  #$03                    ; B485: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB487; JUMP; // sstep
case 0xB487:
                                                     mon("         CMPA  <$9C                    ; B487: 91 9C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9c); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB489; JUMP; // sstep
case 0xB489:
                                                     mon("         LBNE  LB516                   ; B489: 10 26 00 89   \n");
    clockticks = clockticks + 5; 
    if (Z) {
    clockticks = clockticks + 1; 
    PC = 0xb516; 
    JUMP;
    }
    PC = 0xB48D; JUMP; // sstep
case 0xB48D:
                                                     mon("         LDA   <$9D                    ; B48D: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB48F; JUMP; // sstep
case 0xB48F:
                                                     mon("         STA   <$DC                    ; B48F: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB491; JUMP; // sstep
case 0xB491:
                                                     mon("         LDD   #$0F                    ; B491: CC 00 0F      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB494; JUMP; // sstep
case 0xB494:
                                                     mon("         STD   $4701                   ; B494: FD 47 01      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xB497; JUMP; // sstep
case 0xB497:
                                                     mon("         LDA   #$67                    ; B497: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB499; JUMP; // sstep
case 0xB499:
                                                     mon("         JSR   LCDBA                   ; B499: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xB49C:
                                                     mon("LB49C    LDA   <$9C                    ; B49C: 96 9C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9c); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB49E; JUMP; // sstep
case 0xB49E:
                                                     mon("         CMPA  #$02                    ; B49E: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB4A0; JUMP; // sstep
case 0xB4A0:
                                                     mon("         BNE   LB4B5                   ; B4A0: 26 13         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb4b5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4A2; JUMP; // sstep
case 0xB4A2:
                                                     mon("         INC   $49BD                   ; B4A2: 7C 49 BD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bd); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x49bd, res); 
    clockticks = clockticks + 2; 
    PC = 0xB4A5; JUMP; // sstep
case 0xB4A5:
                                                     mon("         LDB   $49BE                   ; B4A5: F6 49 BE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49be); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB4A8; JUMP; // sstep
case 0xB4A8:
                                                     mon("         ASLB                          ; B4A8: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB4A9; JUMP; // sstep
case 0xB4A9:
                                                     mon("         LDX   #word_B6B3              ; B4A9: 8E B6 B3      \n");
    clockticks = clockticks + 3; 
    X = 0xb6b3; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB4AC; JUMP; // sstep
case 0xB4AC:
                                                     mon("         LDD   B,X                     ; B4AC: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB4AE; JUMP; // sstep
case 0xB4AE:
                                                     mon("         STD   ,Y++                    ; B4AE: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB4B0; JUMP; // sstep
case 0xB4B0:
                                                     mon("         LDA   $49C1                   ; B4B0: B6 49 C1      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c1); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB4B3; JUMP; // sstep
case 0xB4B3:
                                                     mon("         STA   -1,Y                    ; B4B3: A7 3F         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(Y + 0xffff); 
    wr_mem(ea, val); 
    PC = 0xB4B5; JUMP; // sstep
case 0xB4B5:
                                                     mon("LB4B5    LDD   $5078                   ; B4B5: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB4B8; JUMP; // sstep
case 0xB4B8:
                                                     mon("         SUBD  $5040                   ; B4B8: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB4BB; JUMP; // sstep
case 0xB4BB:
                                                     mon("         CMPD  #$1000                  ; B4BB: 10 83 10 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x1000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB4BF; JUMP; // sstep
case 0xB4BF:
                                                     mon("         BGT   LB510                   ; B4BF: 2E 4F         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb510; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4C1; JUMP; // sstep
case 0xB4C1:
                                                     mon("         LDA   <$9D                    ; B4C1: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB4C3; JUMP; // sstep
case 0xB4C3:
                                                     mon("         CMPA  #$0E                    ; B4C3: 81 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB4C5; JUMP; // sstep
case 0xB4C5:
                                                     mon("         BNE   LB50B                   ; B4C5: 26 44         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb50b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4C7; JUMP; // sstep
case 0xB4C7:
                                                     mon("         LDD   $5000                   ; B4C7: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB4CA; JUMP; // sstep
case 0xB4CA:
                                                     mon("         SUBD  #$00                    ; B4CA: 83 00 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB4CD; JUMP; // sstep
case 0xB4CD:
                                                     mon("         BLT   LB516                   ; B4CD: 2D 47         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb516; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4CF; JUMP; // sstep
case 0xB4CF:
                                                     mon("         LDD   $5042                   ; B4CF: FC 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5042); // Care needed with I/O space and word fetches
    B = rd_mem(0x5043); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB4D2; JUMP; // sstep
case 0xB4D2:
                                                     mon("         BGT   LB50B                   ; B4D2: 2E 37         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb50b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4D4; JUMP; // sstep
case 0xB4D4:
                                                     mon("         LDD   $507C                   ; B4D4: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB4D7; JUMP; // sstep
case 0xB4D7:
                                                     mon("         ADDD  #$0200                  ; B4D7: C3 02 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0200; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB4DA; JUMP; // sstep
case 0xB4DA:
                                                     mon("         SUBD  $5044                   ; B4DA: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB4DD; JUMP; // sstep
case 0xB4DD:
                                                     mon("         BLT   LB50B                   ; B4DD: 2D 2C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb50b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4DF; JUMP; // sstep
case 0xB4DF:
                                                     mon("         SUBD  #$0400                  ; B4DF: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB4E2; JUMP; // sstep
case 0xB4E2:
                                                     mon("         BGT   LB50B                   ; B4E2: 2E 27         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb50b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4E4; JUMP; // sstep
case 0xB4E4:
                                                     mon("         LDD   $5078                   ; B4E4: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB4E7; JUMP; // sstep
case 0xB4E7:
                                                     mon("         SUBD  $5040                   ; B4E7: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB4EA; JUMP; // sstep
case 0xB4EA:
                                                     mon("         SUBD  #$0400                  ; B4EA: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB4ED; JUMP; // sstep
case 0xB4ED:
                                                     mon("         BHI   LB50B                   ; B4ED: 22 1C         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xb50b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4EF; JUMP; // sstep
case 0xB4EF:
                                                     mon("         LDA   #$0F                    ; B4EF: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB4F1; JUMP; // sstep
case 0xB4F1:
                                                     mon("         STA   <$DC                    ; B4F1: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB4F3; JUMP; // sstep
case 0xB4F3:
                                                     mon("         LDA   <$60                    ; B4F3: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB4F5; JUMP; // sstep
case 0xB4F5:
                                                     mon("         BLT   LB4FD                   ; B4F5: 2D 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb4fd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB4F7; JUMP; // sstep
case 0xB4F7:
                                                     mon("         JSR   L9874                   ; B4F7: BD 98 74      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfa); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0x9874; 
    JUMP;
  case 0xB4FA:
                                                     mon("LB4FA    JSR   Sound_26                ; B4FA: BD BD B2      \n"); // Explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    PC = 0xbdb2; 
    JUMP;
  case 0xB4FD:
                                                     mon("LB4FD    LDA   <$63                    ; B4FD: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB4FF; JUMP; // sstep
case 0xB4FF:
                                                     mon("         BNE   LB50B                   ; B4FF: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb50b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB501; JUMP; // sstep
case 0xB501:
                                                     mon("         LDA   #$4E                    ; B501: 86 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4e; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB503; JUMP; // sstep
case 0xB503:
                                                     mon("         LDB   $4703                   ; B503: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB506; JUMP; // sstep
case 0xB506:
                                                     mon("         BPL   LB509                   ; B506: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xb509; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB508; JUMP; // sstep
case 0xB508:
                                                     mon("         NEGA                          ; B508: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB509; JUMP; // sstep
case 0xB509:
                                                     mon("LB509    STA   <$63                    ; B509: 97 63         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0xB50B; JUMP; // sstep
case 0xB50B:
                                                     mon("LB50B    JSR   LCD5C                   ; B50B: BD CD 5C      \n"); // Trench calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    PC = 0xcd5c; 
    JUMP;
  case 0xB50E:
                                                     mon("LB50E    BRA   LB513                   ; B50E: 20 03         \n");
    PC = 0xb513; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB510:
                                                     mon("LB510    JSR   LCD50                   ; B510: BD CD 50      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x13); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    PC = 0xcd50; 
    JUMP;
  case 0xB513:
                                                     mon("LB513    JSR   LCD74                   ; B513: BD CD 74      \n"); // Function select for an object
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    PC = 0xcd74; 
    JUMP;
  case 0xB516:
                                                     mon("LB516    LDD   $507C                   ; B516: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB519; JUMP; // sstep
case 0xB519:
                                                     mon("         ADDD  #$0400                  ; B519: C3 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB51C; JUMP; // sstep
case 0xB51C:
                                                     mon("         STD   $507C                   ; B51C: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xB51F; JUMP; // sstep
case 0xB51F:
                                                     mon("         LDA   <$9E                    ; B51F: 96 9E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0xB521; JUMP; // sstep
case 0xB521:
                                                     mon("         LSRA                          ; B521: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB522; JUMP; // sstep
case 0xB522:
                                                     mon("         LSRA                          ; B522: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB523; JUMP; // sstep
case 0xB523:
                                                     mon("         LBNE  LB483                   ; B523: 10 26 FF 5C   \n");
    clockticks = clockticks + 5; 
    if (Z) {
    clockticks = clockticks + 1; 
    PC = 0xb483; 
    JUMP;
    }
    PC = 0xB527; JUMP; // sstep
case 0xB527:
                                                     mon("         LDA   <$9C                    ; B527: 96 9C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9c); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB529; JUMP; // sstep
case 0xB529:
                                                     mon("         CMPA  #$02                    ; B529: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB52B; JUMP; // sstep
case 0xB52B:
                                                     mon("         BNE   LB565                   ; B52B: 26 38         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb565; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB52D; JUMP; // sstep
case 0xB52D:
                                                     mon("         LDX   <$64                    ; B52D: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB52F; JUMP; // sstep
case 0xB52F:
                                                     mon("         LDA   $000F,X                 ; B52F: A6 89 00 0F   \n");
    clockticks = clockticks + 8; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000f)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB533; JUMP; // sstep
case 0xB533:
                                                     mon("LB533    ASLA                          ; B533: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB534; JUMP; // sstep
case 0xB534:
                                                     mon("         BCC   LB53D                   ; B534: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xb53d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB536; JUMP; // sstep
case 0xB536:
                                                     mon("         BMI   LB53D                   ; B536: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb53d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB538; JUMP; // sstep
case 0xB538:
                                                     mon("         INC   $49BD                   ; B538: 7C 49 BD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bd); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x49bd, res); 
    clockticks = clockticks + 2; 
    PC = 0xB53B; JUMP; // sstep
case 0xB53B:
                                                     mon("         BRA   LB540                   ; B53B: 20 03         \n");
    PC = 0xb540; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB53D:
                                                     mon("LB53D    ASLA                          ; B53D: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB53E; JUMP; // sstep
case 0xB53E:
                                                     mon("         BNE   LB533                   ; B53E: 26 F3         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb533; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB540; JUMP; // sstep
case 0xB540:
                                                     mon("LB540    LDA   $49BD                   ; B540: B6 49 BD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB543; JUMP; // sstep
case 0xB543:
                                                     mon("         BEQ   LB565                   ; B543: 27 20         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb565; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB545; JUMP; // sstep
case 0xB545:
                                                     mon("         LDA   $49BE                   ; B545: B6 49 BE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49be); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB548; JUMP; // sstep
case 0xB548:
                                                     mon("         INCA                          ; B548: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB549; JUMP; // sstep
case 0xB549:
                                                     mon("         CMPA  #$03                    ; B549: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB54B; JUMP; // sstep
case 0xB54B:
                                                     mon("         BCS   LB54F                   ; B54B: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb54f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB54D; JUMP; // sstep
case 0xB54D:
                                                     mon("         LDA   #$00                    ; B54D: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB54F; JUMP; // sstep
case 0xB54F:
                                                     mon("LB54F    STA   $49BE                   ; B54F: B7 49 BE      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49be, val); 
    PC = 0xB552; JUMP; // sstep
case 0xB552:
                                                     mon("         LDA   $49C1                   ; B552: B6 49 C1      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c1); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB555; JUMP; // sstep
case 0xB555:
                                                     mon("         SUBA  #$08                    ; B555: 80 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xB557; JUMP; // sstep
case 0xB557:
                                                     mon("         CMPA  #$40                    ; B557: 81 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x40; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB559; JUMP; // sstep
case 0xB559:
                                                     mon("         BCC   LB55D                   ; B559: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xb55d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB55B; JUMP; // sstep
case 0xB55B:
                                                     mon("         LDA   #$40                    ; B55B: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB55D; JUMP; // sstep
case 0xB55D:
                                                     mon("LB55D    STA   $49C1                   ; B55D: B7 49 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c1, val); 
    PC = 0xB560; JUMP; // sstep
case 0xB560:
                                                     mon("         LDA   #$00                    ; B560: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB562; JUMP; // sstep
case 0xB562:
                                                     mon("         STA   $49BD                   ; B562: B7 49 BD      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49bd, val); 
    PC = 0xB565; JUMP; // sstep
case 0xB565:
                                                     mon("LB565    LDD   $5078                   ; B565: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB568; JUMP; // sstep
case 0xB568:
                                                     mon("         ADDD  #$0800                  ; B568: C3 08 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0800; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB56B; JUMP; // sstep
case 0xB56B:
                                                     mon("         STD   $5078                   ; B56B: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xB56E; JUMP; // sstep
case 0xB56E:
                                                     mon("         SUBD  $5040                   ; B56E: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB571; JUMP; // sstep
case 0xB571:
                                                     mon("         SUBD  #$7000                  ; B571: 83 70 00      \n");
    clockticks = clockticks + 4; 
    val = 0x7000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB574; JUMP; // sstep
case 0xB574:
                                                     mon("         LBCS  LB46F                   ; B574: 10 25 FE F7   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0xb46f; 
    JUMP;
    }
    // End of function sub_B43F
    PC = 0xB578; JUMP; // sstep
case 0xB578:
                                                     mon("         RTS                           ; B578: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB579:
                                                     mon("LB579    LDA   #$00                    ; B579: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB57B; JUMP; // sstep
case 0xB57B:
                                                     mon("         STA   $49BD                   ; B57B: B7 49 BD      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49bd, val); 
    PC = 0xB57E; JUMP; // sstep
case 0xB57E:
                                                     mon("         LDA   $49C0                   ; B57E: B6 49 C0      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c0); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB581; JUMP; // sstep
case 0xB581:
                                                     mon("         STA   $49BE                   ; B581: B7 49 BE      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49be, val); 
    PC = 0xB584; JUMP; // sstep
case 0xB584:
                                                     mon("         LDA   #$88                    ; B584: 86 88         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x88; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB586; JUMP; // sstep
case 0xB586:
                                                     mon("         STA   $49C1                   ; B586: B7 49 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c1, val); 
    PC = 0xB589; JUMP; // sstep
case 0xB589:
                                                     mon("         LDB   $5040                   ; B589: F6 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5040); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB58C; JUMP; // sstep
case 0xB58C:
                                                     mon("         LSRB                          ; B58C: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB58D; JUMP; // sstep
case 0xB58D:
                                                     mon("         LSRB                          ; B58D: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB58E; JUMP; // sstep
case 0xB58E:
                                                     mon("         LSRB                          ; B58E: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB58F; JUMP; // sstep
case 0xB58F:
                                                     mon("         ANDB  #$0F                    ; B58F: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB591; JUMP; // sstep
case 0xB591:
                                                     mon("         LDX   #$4999                  ; B591: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB594; JUMP; // sstep
case 0xB594:
                                                     mon("         ABX                           ; B594: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xB595; JUMP; // sstep
case 0xB595:
                                                     mon("         STX   <$64                    ; B595: 9F 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x64; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xB597; JUMP; // sstep
case 0xB597:
                                                     mon("         LDA   $5040                   ; B597: B6 50 40      \n"); // XT2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5040); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB59A; JUMP; // sstep
case 0xB59A:
                                                     mon("         ANDA  #$F8                    ; B59A: 84 F8         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf8; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB59C; JUMP; // sstep
case 0xB59C:
                                                     mon("         ADDA  #$04                    ; B59C: 8B 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB59E; JUMP; // sstep
case 0xB59E:
                                                     mon("         LDB   #$00                    ; B59E: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB5A0; JUMP; // sstep
case 0xB5A0:
                                                     mon("         STD   $5078                   ; B5A0: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xB5A3; JUMP; // sstep
case 0xB5A3:
                                                     mon("         LDD   #$0400                  ; B5A3: CC 04 00      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB5A6; JUMP; // sstep
case 0xB5A6:
                                                     mon("         STD   $507A                   ; B5A6: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xB5A9; JUMP; // sstep
case 0xB5A9:
                                                     mon("LB5A9    LDD   #$F200                  ; B5A9: CC F2 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf2; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB5AC; JUMP; // sstep
case 0xB5AC:
                                                     mon("         STD   $507C                   ; B5AC: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xB5AF; JUMP; // sstep
case 0xB5AF:
                                                     mon("         LDX   <$64                    ; B5AF: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB5B1; JUMP; // sstep
case 0xB5B1:
                                                     mon("         CMPX  #$49A9                  ; B5B1: 8C 49 A9      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x49a9; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB5B4; JUMP; // sstep
case 0xB5B4:
                                                     mon("         BCS   LB5B9                   ; B5B4: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb5b9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB5B6; JUMP; // sstep
case 0xB5B6:
                                                     mon("         LEAX  -$10,X                  ; B5B6: 30 88 F0      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0xf0); 
/**/Z = X; 
    PC = 0xB5B9; JUMP; // sstep
case 0xB5B9:
                                                     mon("LB5B9    LDA   ,X+                     ; B5B9: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xB5BB; JUMP; // sstep
case 0xB5BB:
                                                     mon("         STX   <$64                    ; B5BB: 9F 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x64; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xB5BD; JUMP; // sstep
case 0xB5BD:
                                                     mon("LB5BD    STA   <$9E                    ; B5BD: 97 9E         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9e; 
    wr_mem(ea, val); 
    PC = 0xB5BF; JUMP; // sstep
case 0xB5BF:
                                                     mon("         ANDA  #$03                    ; B5BF: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB5C1; JUMP; // sstep
case 0xB5C1:
                                                     mon("         CMPA  <$9C                    ; B5C1: 91 9C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9c); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB5C3; JUMP; // sstep
case 0xB5C3:
                                                     mon("         LBNE  LB650                   ; B5C3: 10 26 00 89   \n");
    clockticks = clockticks + 5; 
    if (Z) {
    clockticks = clockticks + 1; 
    PC = 0xb650; 
    JUMP;
    }
    PC = 0xB5C7; JUMP; // sstep
case 0xB5C7:
                                                     mon("         LDA   <$9D                    ; B5C7: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB5C9; JUMP; // sstep
case 0xB5C9:
                                                     mon("         STA   <$DC                    ; B5C9: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB5CB; JUMP; // sstep
case 0xB5CB:
                                                     mon("         LDD   #$0F                    ; B5CB: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB5CE; JUMP; // sstep
case 0xB5CE:
                                                     mon("         STD   $4701                   ; B5CE: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xB5D1; JUMP; // sstep
case 0xB5D1:
                                                     mon("         LDA   #$67                    ; B5D1: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB5D3; JUMP; // sstep
case 0xB5D3:
                                                     mon("         JSR   LCDBA                   ; B5D3: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xB5D6:
                                                     mon("LB5D6    LDA   <$9C                    ; B5D6: 96 9C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9c); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB5D8; JUMP; // sstep
case 0xB5D8:
                                                     mon("         CMPA  #$02                    ; B5D8: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB5DA; JUMP; // sstep
case 0xB5DA:
                                                     mon("         BNE   LB5EF                   ; B5DA: 26 13         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb5ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB5DC; JUMP; // sstep
case 0xB5DC:
                                                     mon("         INC   $49BD                   ; B5DC: 7C 49 BD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bd); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x49bd, res); 
    clockticks = clockticks + 2; 
    PC = 0xB5DF; JUMP; // sstep
case 0xB5DF:
                                                     mon("         LDB   $49BE                   ; B5DF: F6 49 BE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49be); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB5E2; JUMP; // sstep
case 0xB5E2:
                                                     mon("         ASLB                          ; B5E2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB5E3; JUMP; // sstep
case 0xB5E3:
                                                     mon("         LDX   #word_B6B3              ; B5E3: 8E B6 B3      \n");
    clockticks = clockticks + 3; 
    X = 0xb6b3; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB5E6; JUMP; // sstep
case 0xB5E6:
                                                     mon("         LDD   B,X                     ; B5E6: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB5E8; JUMP; // sstep
case 0xB5E8:
                                                     mon("         STD   ,Y++                    ; B5E8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB5EA; JUMP; // sstep
case 0xB5EA:
                                                     mon("         LDA   $49C1                   ; B5EA: B6 49 C1      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c1); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB5ED; JUMP; // sstep
case 0xB5ED:
                                                     mon("         STA   -1,Y                    ; B5ED: A7 3F         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(Y + 0xffff); 
    wr_mem(ea, val); 
    PC = 0xB5EF; JUMP; // sstep
case 0xB5EF:
                                                     mon("LB5EF    LDD   $5078                   ; B5EF: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB5F2; JUMP; // sstep
case 0xB5F2:
                                                     mon("         SUBD  $5040                   ; B5F2: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB5F5; JUMP; // sstep
case 0xB5F5:
                                                     mon("         CMPD  #$1000                  ; B5F5: 10 83 10 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x1000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB5F9; JUMP; // sstep
case 0xB5F9:
                                                     mon("         BGT   LB64A                   ; B5F9: 2E 4F         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb64a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB5FB; JUMP; // sstep
case 0xB5FB:
                                                     mon("         LDA   <$9D                    ; B5FB: 96 9D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9d); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB5FD; JUMP; // sstep
case 0xB5FD:
                                                     mon("         CMPA  #$0E                    ; B5FD: 81 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB5FF; JUMP; // sstep
case 0xB5FF:
                                                     mon("         BNE   LB645                   ; B5FF: 26 44         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb645; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB601; JUMP; // sstep
case 0xB601:
                                                     mon("         LDD   $5000                   ; B601: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB604; JUMP; // sstep
case 0xB604:
                                                     mon("         SUBD  #$00                    ; B604: 83 00 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB607; JUMP; // sstep
case 0xB607:
                                                     mon("         BLT   LB650                   ; B607: 2D 47         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb650; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB609; JUMP; // sstep
case 0xB609:
                                                     mon("         LDD   $5042                   ; B609: FC 50 42      \n"); // YT2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5042); // Care needed with I/O space and word fetches
    B = rd_mem(0x5043); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB60C; JUMP; // sstep
case 0xB60C:
                                                     mon("         BLT   LB645                   ; B60C: 2D 37         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb645; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB60E; JUMP; // sstep
case 0xB60E:
                                                     mon("         LDD   $507C                   ; B60E: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB611; JUMP; // sstep
case 0xB611:
                                                     mon("         ADDD  #$0200                  ; B611: C3 02 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0200; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB614; JUMP; // sstep
case 0xB614:
                                                     mon("         SUBD  $5044                   ; B614: B3 50 44      \n"); // ZT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5044)<<8; 
    ea = ea | rd_mem(0x5045); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB617; JUMP; // sstep
case 0xB617:
                                                     mon("         BLT   LB645                   ; B617: 2D 2C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb645; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB619; JUMP; // sstep
case 0xB619:
                                                     mon("         SUBD  #$0400                  ; B619: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB61C; JUMP; // sstep
case 0xB61C:
                                                     mon("         BGT   LB645                   ; B61C: 2E 27         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xb645; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB61E; JUMP; // sstep
case 0xB61E:
                                                     mon("         LDD   $5078                   ; B61E: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB621; JUMP; // sstep
case 0xB621:
                                                     mon("         SUBD  $5040                   ; B621: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB624; JUMP; // sstep
case 0xB624:
                                                     mon("         SUBD  #$0400                  ; B624: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB627; JUMP; // sstep
case 0xB627:
                                                     mon("         BHI   LB645                   ; B627: 22 1C         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xb645; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB629; JUMP; // sstep
case 0xB629:
                                                     mon("         LDA   #$0F                    ; B629: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB62B; JUMP; // sstep
case 0xB62B:
                                                     mon("         STA   <$DC                    ; B62B: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xB62D; JUMP; // sstep
case 0xB62D:
                                                     mon("         LDA   <$60                    ; B62D: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB62F; JUMP; // sstep
case 0xB62F:
                                                     mon("         BLT   LB637                   ; B62F: 2D 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0xb637; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB631; JUMP; // sstep
case 0xB631:
                                                     mon("         JSR   L9874                   ; B631: BD 98 74      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x34); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0x9874; 
    JUMP;
  case 0xB634:
                                                     mon("LB634    JSR   Sound_26                ; B634: BD BD B2      \n"); // Explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x37); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xbdb2; 
    JUMP;
  case 0xB637:
                                                     mon("LB637    LDA   <$63                    ; B637: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB639; JUMP; // sstep
case 0xB639:
                                                     mon("         BNE   LB645                   ; B639: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb645; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB63B; JUMP; // sstep
case 0xB63B:
                                                     mon("         LDA   #$4E                    ; B63B: 86 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4e; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB63D; JUMP; // sstep
case 0xB63D:
                                                     mon("         LDB   $4703                   ; B63D: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB640; JUMP; // sstep
case 0xB640:
                                                     mon("         BPL   LB643                   ; B640: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xb643; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB642; JUMP; // sstep
case 0xB642:
                                                     mon("         NEGA                          ; B642: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB643; JUMP; // sstep
case 0xB643:
                                                     mon("LB643    STA   <$63                    ; B643: 97 63         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0xB645; JUMP; // sstep
case 0xB645:
                                                     mon("LB645    JSR   LCD5C                   ; B645: BD CD 5C      \n"); // Trench calcs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x48); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xcd5c; 
    JUMP;
  case 0xB648:
                                                     mon("LB648    BRA   LB64D                   ; B648: 20 03         \n");
    PC = 0xb64d; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB64A:
                                                     mon("LB64A    JSR   LCD50                   ; B64A: BD CD 50      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xcd50; 
    JUMP;
  case 0xB64D:
                                                     mon("LB64D    JSR   LCD74                   ; B64D: BD CD 74      \n"); // Function select for an object
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x50); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xcd74; 
    JUMP;
  case 0xB650:
                                                     mon("LB650    LDD   $507C                   ; B650: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB653; JUMP; // sstep
case 0xB653:
                                                     mon("         ADDD  #$0400                  ; B653: C3 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB656; JUMP; // sstep
case 0xB656:
                                                     mon("         STD   $507C                   ; B656: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xB659; JUMP; // sstep
case 0xB659:
                                                     mon("         LDA   <$9E                    ; B659: 96 9E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0xB65B; JUMP; // sstep
case 0xB65B:
                                                     mon("         LSRA                          ; B65B: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB65C; JUMP; // sstep
case 0xB65C:
                                                     mon("         LSRA                          ; B65C: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xB65D; JUMP; // sstep
case 0xB65D:
                                                     mon("         LBNE  LB5BD                   ; B65D: 10 26 FF 5C   \n");
    clockticks = clockticks + 5; 
    if (Z) {
    clockticks = clockticks + 1; 
    PC = 0xb5bd; 
    JUMP;
    }
    PC = 0xB661; JUMP; // sstep
case 0xB661:
                                                     mon("         LDA   <$9C                    ; B661: 96 9C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x9c); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB663; JUMP; // sstep
case 0xB663:
                                                     mon("         CMPA  #$02                    ; B663: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB665; JUMP; // sstep
case 0xB665:
                                                     mon("         BNE   LB69F                   ; B665: 26 38         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb69f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB667; JUMP; // sstep
case 0xB667:
                                                     mon("         LDX   <$64                    ; B667: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB669; JUMP; // sstep
case 0xB669:
                                                     mon("         LDA   -$0011,X                ; B669: A6 89 FF EF   \n");
    clockticks = clockticks + 8; 
    val = (UINT8)rd_mem((UINT16)(X + 0xffef)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB66D; JUMP; // sstep
case 0xB66D:
                                                     mon("LB66D    ASLA                          ; B66D: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB66E; JUMP; // sstep
case 0xB66E:
                                                     mon("         BCC   LB677                   ; B66E: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xb677; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB670; JUMP; // sstep
case 0xB670:
                                                     mon("         BMI   LB677                   ; B670: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xb677; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB672; JUMP; // sstep
case 0xB672:
                                                     mon("         INC   $49BD                   ; B672: 7C 49 BD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bd); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x49bd, res); 
    clockticks = clockticks + 2; 
    PC = 0xB675; JUMP; // sstep
case 0xB675:
                                                     mon("         BRA   LB67A                   ; B675: 20 03         \n");
    PC = 0xb67a; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB677:
                                                     mon("LB677    ASLA                          ; B677: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB678; JUMP; // sstep
case 0xB678:
                                                     mon("         BNE   LB66D                   ; B678: 26 F3         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xb66d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB67A; JUMP; // sstep
case 0xB67A:
                                                     mon("LB67A    LDA   $49BD                   ; B67A: B6 49 BD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49bd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB67D; JUMP; // sstep
case 0xB67D:
                                                     mon("         BEQ   LB69F                   ; B67D: 27 20         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb69f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB67F; JUMP; // sstep
case 0xB67F:
                                                     mon("         LDA   $49BE                   ; B67F: B6 49 BE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49be); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB682; JUMP; // sstep
case 0xB682:
                                                     mon("         INCA                          ; B682: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB683; JUMP; // sstep
case 0xB683:
                                                     mon("         CMPA  #$03                    ; B683: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB685; JUMP; // sstep
case 0xB685:
                                                     mon("         BCS   LB689                   ; B685: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb689; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB687; JUMP; // sstep
case 0xB687:
                                                     mon("         LDA   #$00                    ; B687: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB689; JUMP; // sstep
case 0xB689:
                                                     mon("LB689    STA   $49BE                   ; B689: B7 49 BE      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49be, val); 
    PC = 0xB68C; JUMP; // sstep
case 0xB68C:
                                                     mon("         LDA   $49C1                   ; B68C: B6 49 C1      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49c1); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB68F; JUMP; // sstep
case 0xB68F:
                                                     mon("         SUBA  #$08                    ; B68F: 80 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xB691; JUMP; // sstep
case 0xB691:
                                                     mon("         CMPA  #$40                    ; B691: 81 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x40; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB693; JUMP; // sstep
case 0xB693:
                                                     mon("         BCC   LB697                   ; B693: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xb697; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB695; JUMP; // sstep
case 0xB695:
                                                     mon("         LDA   #$40                    ; B695: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB697; JUMP; // sstep
case 0xB697:
                                                     mon("LB697    STA   $49C1                   ; B697: B7 49 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c1, val); 
    PC = 0xB69A; JUMP; // sstep
case 0xB69A:
                                                     mon("         LDA   #$00                    ; B69A: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB69C; JUMP; // sstep
case 0xB69C:
                                                     mon("         STA   $49BD                   ; B69C: B7 49 BD      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49bd, val); 
    PC = 0xB69F; JUMP; // sstep
case 0xB69F:
                                                     mon("LB69F    LDD   $5078                   ; B69F: FC 50 78      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5078); // Care needed with I/O space and word fetches
    B = rd_mem(0x5079); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB6A2; JUMP; // sstep
case 0xB6A2:
                                                     mon("         ADDD  #$0800                  ; B6A2: C3 08 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0800; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB6A5; JUMP; // sstep
case 0xB6A5:
                                                     mon("         STD   $5078                   ; B6A5: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xB6A8; JUMP; // sstep
case 0xB6A8:
                                                     mon("         SUBD  $5040                   ; B6A8: B3 50 40      \n"); // XT2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5040)<<8; 
    ea = ea | rd_mem(0x5041); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB6AB; JUMP; // sstep
case 0xB6AB:
                                                     mon("         SUBD  #$7000                  ; B6AB: 83 70 00      \n");
    clockticks = clockticks + 4; 
    val = 0x7000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB6AE; JUMP; // sstep
case 0xB6AE:
                                                     mon("         LBCS  LB5A9                   ; B6AE: 10 25 FE F7   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0xb5a9; 
    JUMP;
    }
    // End of function sub_B579
    // ---------------------------------------------------------------------------
    PC = 0xB6B2; JUMP; // sstep
case 0xB6B2:
                                                     mon("         RTS                           ; B6B2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert vector instructions at joystick position for laser explosion 2
  case 0xB6B9:
                                                     mon("LB6B9    JSR   LB6C7                   ; B6B9: BD B6 C7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xb6c7; 
    JUMP;
  case 0xB6BC:
                                                     mon("LB6BC    JSR   LB6D7                   ; B6BC: BD B6 D7      \n"); // Insert vector instructions at joystick position for laser explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xb6d7; 
    JUMP;
    // End of function sub_B6B9
  case 0xB6BF:
                                                     mon("LB6BF    RTS                           ; B6BF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert vector instructions at joystick position for laser explosion 3
  case 0xB6C0:
                                                     mon("LB6C0    JSR   LB6CC                   ; B6C0: BD B6 CC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xb6cc; 
    JUMP;
  case 0xB6C3:
                                                     mon("LB6C3    JSR   LB6D7                   ; B6C3: BD B6 D7      \n"); // Insert vector instructions at joystick position for laser explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    PC = 0xb6d7; 
    JUMP;
    // End of function sub_B6C0
  case 0xB6C6:
                                                     mon("LB6C6    RTS                           ; B6C6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB6C7:
                                                     mon("LB6C7    LDD   #$6380                  ; B6C7: CC 63 80      \n");
    clockticks = clockticks + 3; 
    A = 0x63; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    // End of function sub_B6C7
    PC = 0xB6CA; JUMP; // sstep
case 0xB6CA:
                                                     mon("         STD   ,Y++                    ; B6CA: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xB6CC; JUMP; // sstep
case 0xB6CC:
                                                     mon("LB6CC    LDD   #$A012                  ; B6CC: CC A0 12      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x12; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB6CF; JUMP; // sstep
case 0xB6CF:
                                                     mon("         STD   ,Y++                    ; B6CF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xB6D1; JUMP; // sstep
case 0xB6D1:
                                                     mon("         LDD   $32FE                   ; B6D1: FC 32 FE      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x32fe); // Care needed with I/O space and word fetches
    B = rd_mem(0x32ff); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB6D4; JUMP; // sstep
case 0xB6D4:
                                                     mon("         STD   ,Y++                    ; B6D4: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_B6CC
    PC = 0xB6D6; JUMP; // sstep
case 0xB6D6:
                                                     mon("         RTS                           ; B6D6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert vector instructions at joystick position for laser explosion
  case 0xB6D7:
                                                     mon("LB6D7    LDA   <$7D                    ; B6D7: 96 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB6D9; JUMP; // sstep
case 0xB6D9:
                                                     mon("         BPL   LB6DC                   ; B6D9: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xb6dc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB6DB; JUMP; // sstep
case 0xB6DB:
                                                     mon("         NEGA                          ; B6DB: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB6DC; JUMP; // sstep
case 0xB6DC:
                                                     mon("LB6DC    LDB   #$6E                    ; B6DC: C6 6E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x6e; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB6DE; JUMP; // sstep
case 0xB6DE:
                                                     mon("         MUL                           ; B6DE: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB6DF; JUMP; // sstep
case 0xB6DF:
                                                     mon("         LDB   <$7D                    ; B6DF: D6 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB6E1; JUMP; // sstep
case 0xB6E1:
                                                     mon("         BPL   LB6E4                   ; B6E1: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xb6e4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB6E3; JUMP; // sstep
case 0xB6E3:
                                                     mon("         NEGA                          ; B6E3: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB6E4; JUMP; // sstep
case 0xB6E4:
                                                     mon("LB6E4    TFR   A,B                     ; B6E4: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xB6E6; JUMP; // sstep
case 0xB6E6:
                                                     mon("         SEX                           ; B6E6: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0xB6E7; JUMP; // sstep
case 0xB6E7:
                                                     mon("         STD   $4B1C                   ; B6E7: FD 4B 1C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b1c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b1d, B); 
    PC = 0xB6EA; JUMP; // sstep
case 0xB6EA:
                                                     mon("         ANDA  #$1F                    ; B6EA: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB6EC; JUMP; // sstep
case 0xB6EC:
                                                     mon("         STD   $02,Y                   ; B6EC: ED 22         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB6EE; JUMP; // sstep
case 0xB6EE:
                                                     mon("         STD   $08,Y                   ; B6EE: ED 28         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB6F0; JUMP; // sstep
case 0xB6F0:
                                                     mon("         STD   $0E,Y                   ; B6F0: ED 2E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x000e); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB6F2; JUMP; // sstep
case 0xB6F2:
                                                     mon("         STD   $14,Y                   ; B6F2: ED A8 14      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x14); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB6F5; JUMP; // sstep
case 0xB6F5:
                                                     mon("         STD   $1A,Y                   ; B6F5: ED A8 1A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x1a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB6F8; JUMP; // sstep
case 0xB6F8:
                                                     mon("         LDA   <$7F                    ; B6F8: 96 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7f); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB6FA; JUMP; // sstep
case 0xB6FA:
                                                     mon("         BPL   LB6FD                   ; B6FA: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xb6fd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB6FC; JUMP; // sstep
case 0xB6FC:
                                                     mon("LB6FC    NEGA                          ; B6FC: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB6FD; JUMP; // sstep
case 0xB6FD:
                                                     mon("LB6FD    LDB   #$50                    ; B6FD: C6 50         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x50; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB6FF; JUMP; // sstep
case 0xB6FF:
                                                     mon("         MUL                           ; B6FF: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB700; JUMP; // sstep
case 0xB700:
                                                     mon("         LDB   <$7F                    ; B700: D6 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7f); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB702; JUMP; // sstep
case 0xB702:
                                                     mon("         BPL   LB705                   ; B702: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xb705; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB704; JUMP; // sstep
case 0xB704:
                                                     mon("         NEGA                          ; B704: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB705; JUMP; // sstep
case 0xB705:
                                                     mon("LB705    TFR   A,B                     ; B705: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xB707; JUMP; // sstep
case 0xB707:
                                                     mon("         SEX                           ; B707: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0xB708; JUMP; // sstep
case 0xB708:
                                                     mon("         STD   $4B1E                   ; B708: FD 4B 1E      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b1e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b1f, B); 
    PC = 0xB70B; JUMP; // sstep
case 0xB70B:
                                                     mon("         ANDA  #$1F                    ; B70B: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xB70D; JUMP; // sstep
case 0xB70D:
                                                     mon("         STD   ,Y                      ; B70D: ED A4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB70F; JUMP; // sstep
case 0xB70F:
                                                     mon("         STD   $06,Y                   ; B70F: ED 26         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB711; JUMP; // sstep
case 0xB711:
                                                     mon("         STD   $0C,Y                   ; B711: ED 2C         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB713; JUMP; // sstep
case 0xB713:
                                                     mon("         STD   $12,Y                   ; B713: ED A8 12      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x12); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB716; JUMP; // sstep
case 0xB716:
                                                     mon("         STD   $18,Y                   ; B716: ED A8 18      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x18); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB719; JUMP; // sstep
case 0xB719:
                                                     mon("         LDD   #LBAAC                  ; B719: CC BA AC      \n");
    clockticks = clockticks + 3; 
    A = 0xba; 
    B = 0xac; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB71C; JUMP; // sstep
case 0xB71C:
                                                     mon("         STD   $04,Y                   ; B71C: ED 24         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB71E; JUMP; // sstep
case 0xB71E:
                                                     mon("         LDD   #$BA0D                  ; B71E: CC BA 0D      \n");
    clockticks = clockticks + 3; 
    A = 0xba; 
    B = 0x0d; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB721; JUMP; // sstep
case 0xB721:
                                                     mon("         STD   $0A,Y                   ; B721: ED 2A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB723; JUMP; // sstep
case 0xB723:
                                                     mon("         LDD   #$BB33                  ; B723: CC BB 33      \n");
    clockticks = clockticks + 3; 
    A = 0xbb; 
    B = 0x33; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB726; JUMP; // sstep
case 0xB726:
                                                     mon("         STD   $10,Y                   ; B726: ED A8 10      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x10); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB729; JUMP; // sstep
case 0xB729:
                                                     mon("         LDD   #$BAE6                  ; B729: CC BA E6      \n");
    clockticks = clockticks + 3; 
    A = 0xba; 
    B = 0xe6; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB72C; JUMP; // sstep
case 0xB72C:
                                                     mon("         STD   $16,Y                   ; B72C: ED A8 16      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x16); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB72F; JUMP; // sstep
case 0xB72F:
                                                     mon("         LDD   #$BA5A                  ; B72F: CC BA 5A      \n");
    clockticks = clockticks + 3; 
    A = 0xba; 
    B = 0x5a; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB732; JUMP; // sstep
case 0xB732:
                                                     mon("         STD   $1C,Y                   ; B732: ED A8 1C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(Y + (SINT8)0x1c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB735; JUMP; // sstep
case 0xB735:
                                                     mon("         LEAY  $1E,Y                   ; B735: 31 A8 1E      \n");
    clockticks = clockticks + 5; 
    Y = (Y + (SINT8)0x1e); 
    Z = Y; 
    // End of function sub_B6D7
    PC = 0xB738; JUMP; // sstep
case 0xB738:
                                                     mon("         RTS                           ; B738: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB739:
                                                     mon("LB739    LDA   #$00                    ; B739: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB73B; JUMP; // sstep
case 0xB73B:
                                                     mon("         STA   $03,X                   ; B73B: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xB73D; JUMP; // sstep
case 0xB73D:
                                                     mon("         JSR   L8E1C                   ; B73D: BD 8E 1C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x40); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0x8e1c; 
    JUMP;
  case 0xB740:
                                                     mon("LB740    PSHS  U,X                     ; B740: 34 50         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 2; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    PC = 0xB742; JUMP; // sstep
case 0xB742:
                                                     mon("         JSR   LB76C                   ; B742: BD B7 6C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x45); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xb76c; 
    JUMP;
  case 0xB745:
                                                     mon("LB745    PULS  X,U                     ; B745: 35 50         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    X = rd_mem(S)<<8; 
    S = S + 1; 
    X = X | rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    U = rd_mem(S)<<8; 
    S = S + 1; 
    U = U | rd_mem(S); 
    S = S + 1; 
    // End of function sub_B739
    // ---------------------------------------------------------------------------
    PC = 0xB747; JUMP; // sstep
case 0xB747:
                                                     mon("         RTS                           ; B747: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB76C:
                                                     mon("LB76C    LDU   ,X                      ; B76C: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xB76E; JUMP; // sstep
case 0xB76E:
                                                     mon("         JSR   LB948                   ; B76E: BD B9 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xb948; 
    JUMP;
  case 0xB771:
                                                     mon("LB771    LDA   #$06                    ; B771: 86 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB773; JUMP; // sstep
case 0xB773:
                                                     mon("         STA   $0C,X                   ; B773: A7 0C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000c); 
    wr_mem(ea, val); 
    PC = 0xB775; JUMP; // sstep
case 0xB775:
                                                     mon("         LDA   #$18                    ; B775: 86 18         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x18; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB777; JUMP; // sstep
case 0xB777:
                                                     mon("         STA   $0D,X                   ; B777: A7 0D         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB779; JUMP; // sstep
case 0xB779:
                                                     mon("         LDD   #$00                    ; B779: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB77C; JUMP; // sstep
case 0xB77C:
                                                     mon("         SUBD  -14,U                   ; B77C: A3 52         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfff2))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfff2))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB77E; JUMP; // sstep
case 0xB77E:
                                                     mon("         JSR   Shift_D_R_6             ; B77E: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x81); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0xB781:
                                                     mon("LB781    STD   $06,X                   ; B781: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB783; JUMP; // sstep
case 0xB783:
                                                     mon("         ADDD  $08,U                   ; B783: E3 48         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0008))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0008))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB785; JUMP; // sstep
case 0xB785:
                                                     mon("         STD   ,X                      ; B785: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB787; JUMP; // sstep
case 0xB787:
                                                     mon("         LDD   #$00                    ; B787: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB78A; JUMP; // sstep
case 0xB78A:
                                                     mon("         SUBD  -6,U                    ; B78A: A3 5A         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0xfffa))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0xfffa))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB78C; JUMP; // sstep
case 0xB78C:
                                                     mon("         JSR   Shift_D_R_6             ; B78C: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0xB78F:
                                                     mon("LB78F    STD   $08,X                   ; B78F: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB791; JUMP; // sstep
case 0xB791:
                                                     mon("         ADDD  $0A,U                   ; B791: E3 4A         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x000a))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x000a))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB793; JUMP; // sstep
case 0xB793:
                                                     mon("         STD   $02,X                   ; B793: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB795; JUMP; // sstep
case 0xB795:
                                                     mon("         LDD   #$00                    ; B795: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB798; JUMP; // sstep
case 0xB798:
                                                     mon("         SUBD  $02,U                   ; B798: A3 42         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB79A; JUMP; // sstep
case 0xB79A:
                                                     mon("         JSR   Shift_D_R_6             ; B79A: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0xB79D:
                                                     mon("LB79D    STD   $0A,X                   ; B79D: ED 0A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB79F; JUMP; // sstep
case 0xB79F:
                                                     mon("         ADDD  $0C,U                   ; B79F: E3 4C         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x000c))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x000c))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB7A1; JUMP; // sstep
case 0xB7A1:
                                                     mon("         STD   $04,X                   ; B7A1: ED 04         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7A3; JUMP; // sstep
case 0xB7A3:
                                                     mon("         JSR   LB83F                   ; B7A3: BD B8 3F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xb83f; 
    JUMP;
  case 0xB7A6:
                                                     mon("LB7A6    JSR   LB948                   ; B7A6: BD B9 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xb948; 
    JUMP;
  case 0xB7A9:
                                                     mon("LB7A9    LDA   #$07                    ; B7A9: 86 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB7AB; JUMP; // sstep
case 0xB7AB:
                                                     mon("         STA   $0C,X                   ; B7AB: A7 0C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000c); 
    wr_mem(ea, val); 
    PC = 0xB7AD; JUMP; // sstep
case 0xB7AD:
                                                     mon("         LDA   #$18                    ; B7AD: 86 18         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x18; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB7AF; JUMP; // sstep
case 0xB7AF:
                                                     mon("         STA   $0D,X                   ; B7AF: A7 0D         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB7B1; JUMP; // sstep
case 0xB7B1:
                                                     mon("         LDD   -14,U                   ; B7B1: EC 52         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff2); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB7B3; JUMP; // sstep
case 0xB7B3:
                                                     mon("         JSR   Shift_D_R_6             ; B7B3: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0xB7B6:
                                                     mon("LB7B6    STD   $06,X                   ; B7B6: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7B8; JUMP; // sstep
case 0xB7B8:
                                                     mon("         ADDD  $08,U                   ; B7B8: E3 48         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0008))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0008))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB7BA; JUMP; // sstep
case 0xB7BA:
                                                     mon("         STD   ,X                      ; B7BA: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7BC; JUMP; // sstep
case 0xB7BC:
                                                     mon("         LDD   -6,U                    ; B7BC: EC 5A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfffa); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB7BE; JUMP; // sstep
case 0xB7BE:
                                                     mon("         JSR   Shift_D_R_6             ; B7BE: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0xB7C1:
                                                     mon("LB7C1    STD   $08,X                   ; B7C1: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7C3; JUMP; // sstep
case 0xB7C3:
                                                     mon("         ADDD  $0A,U                   ; B7C3: E3 4A         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x000a))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x000a))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB7C5; JUMP; // sstep
case 0xB7C5:
                                                     mon("         STD   $02,X                   ; B7C5: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7C7; JUMP; // sstep
case 0xB7C7:
                                                     mon("         LDD   $02,U                   ; B7C7: EC 42         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xB7C9; JUMP; // sstep
case 0xB7C9:
                                                     mon("         JSR   Shift_D_R_6             ; B7C9: BD CD 9C      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xcd9c; 
    JUMP;
  case 0xB7CC:
                                                     mon("LB7CC    STD   $0A,X                   ; B7CC: ED 0A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7CE; JUMP; // sstep
case 0xB7CE:
                                                     mon("         ADDD  $0C,U                   ; B7CE: E3 4C         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x000c))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x000c))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB7D0; JUMP; // sstep
case 0xB7D0:
                                                     mon("         STD   $04,X                   ; B7D0: ED 04         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7D2; JUMP; // sstep
case 0xB7D2:
                                                     mon("         JSR   LB83F                   ; B7D2: BD B8 3F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xb83f; 
    JUMP;
  case 0xB7D5:
                                                     mon("LB7D5    JSR   LB948                   ; B7D5: BD B9 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    PC = 0xb948; 
    JUMP;
  case 0xB7D8:
                                                     mon("LB7D8    LDA   #$08                    ; B7D8: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB7DA; JUMP; // sstep
case 0xB7DA:
                                                     mon("         STA   $0C,X                   ; B7DA: A7 0C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000c); 
    wr_mem(ea, val); 
    PC = 0xB7DC; JUMP; // sstep
case 0xB7DC:
                                                     mon("         LDA   #$10                    ; B7DC: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB7DE; JUMP; // sstep
case 0xB7DE:
                                                     mon("         STA   $0D,X                   ; B7DE: A7 0D         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB7E0; JUMP; // sstep
case 0xB7E0:
                                                     mon("         LDD   $08,U                   ; B7E0: EC 48         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB7E2; JUMP; // sstep
case 0xB7E2:
                                                     mon("         STD   ,X                      ; B7E2: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7E4; JUMP; // sstep
case 0xB7E4:
                                                     mon("         STD   $06,X                   ; B7E4: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7E6; JUMP; // sstep
case 0xB7E6:
                                                     mon("         LDD   $0A,U                   ; B7E6: EC 4A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x000a); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB7E8; JUMP; // sstep
case 0xB7E8:
                                                     mon("         STD   $02,X                   ; B7E8: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7EA; JUMP; // sstep
case 0xB7EA:
                                                     mon("         STD   $08,X                   ; B7EA: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7EC; JUMP; // sstep
case 0xB7EC:
                                                     mon("         LDD   $0C,U                   ; B7EC: EC 4C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x000c); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB7EE; JUMP; // sstep
case 0xB7EE:
                                                     mon("         STD   $04,X                   ; B7EE: ED 04         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7F0; JUMP; // sstep
case 0xB7F0:
                                                     mon("         STD   $0A,X                   ; B7F0: ED 0A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB7F2; JUMP; // sstep
case 0xB7F2:
                                                     mon("         LDA   $06,X                   ; B7F2: A6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB7F4; JUMP; // sstep
case 0xB7F4:
                                                     mon("         LDB   #$80                    ; B7F4: C6 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB7F6; JUMP; // sstep
case 0xB7F6:
                                                     mon("LB7F6    ASLB                          ; B7F6: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB7F7; JUMP; // sstep
case 0xB7F7:
                                                     mon("         ROLA                          ; B7F7: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xB7F8; JUMP; // sstep
case 0xB7F8:
                                                     mon("         BVC   LB7FE                   ; B7F8: 28 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0xb7fe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB7FA; JUMP; // sstep
case 0xB7FA:
                                                     mon("         RORA                          ; B7FA: 46            \n");
    res = ((UINT8)A) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xB7FB; JUMP; // sstep
case 0xB7FB:
                                                     mon("         RORB                          ; B7FB: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB7FC; JUMP; // sstep
case 0xB7FC:
                                                     mon("         BRA   LB81C                   ; B7FC: 20 1E         \n");
    PC = 0xb81c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB7FE:
                                                     mon("LB7FE    ASL   $09,X                   ; B7FE: 68 09         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0009)); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem((UINT16)(X + 0x0009), res); 
    clockticks = clockticks + 2; 
    PC = 0xB800; JUMP; // sstep
case 0xB800:
                                                     mon("         ROL   $08,X                   ; B800: 69 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0008)); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    wr_mem((UINT16)(X + 0x0008), (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0xB802; JUMP; // sstep
case 0xB802:
                                                     mon("         BVC   LB80C                   ; B802: 28 08         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0xb80c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB804; JUMP; // sstep
case 0xB804:
                                                     mon("         ROR   $08,X                   ; B804: 66 08         \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem((UINT16)(X + 0x0008))) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem((UINT16)(X + 0x0008), res); 
    clockticks = clockticks + 2; 
    PC = 0xB806; JUMP; // sstep
case 0xB806:
                                                     mon("         ROR   $09,X                   ; B806: 66 09         \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem((UINT16)(X + 0x0009))) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem((UINT16)(X + 0x0009), res); 
    clockticks = clockticks + 2; 
    PC = 0xB808; JUMP; // sstep
case 0xB808:
                                                     mon("         ASRA                          ; B808: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB809; JUMP; // sstep
case 0xB809:
                                                     mon("         RORB                          ; B809: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB80A; JUMP; // sstep
case 0xB80A:
                                                     mon("         BRA   LB81C                   ; B80A: 20 10         \n");
    PC = 0xb81c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xB80C:
                                                     mon("LB80C    ASL   $0B,X                   ; B80C: 68 0B         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000b)); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem((UINT16)(X + 0x000b), res); 
    clockticks = clockticks + 2; 
    PC = 0xB80E; JUMP; // sstep
case 0xB80E:
                                                     mon("         ROL   $0A,X                   ; B80E: 69 0A         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000a)); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    wr_mem((UINT16)(X + 0x000a), (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0xB810; JUMP; // sstep
case 0xB810:
                                                     mon("         BVC   LB7F6                   ; B810: 28 E4         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0xb7f6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB812; JUMP; // sstep
case 0xB812:
                                                     mon("         ROR   $0A,X                   ; B812: 66 0A         \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem((UINT16)(X + 0x000a))) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem((UINT16)(X + 0x000a), res); 
    clockticks = clockticks + 2; 
    PC = 0xB814; JUMP; // sstep
case 0xB814:
                                                     mon("         ROR   $0B,X                   ; B814: 66 0B         \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem((UINT16)(X + 0x000b))) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem((UINT16)(X + 0x000b), res); 
    clockticks = clockticks + 2; 
    PC = 0xB816; JUMP; // sstep
case 0xB816:
                                                     mon("         ASR   $08,X                   ; B816: 67 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0008)); 
/**/C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    wr_mem((UINT16)(X + 0x0008), val); 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB818; JUMP; // sstep
case 0xB818:
                                                     mon("         ASR   $09,X                   ; B818: 67 09         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0009)); 
/**/C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    wr_mem((UINT16)(X + 0x0009), val); 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB81A; JUMP; // sstep
case 0xB81A:
                                                     mon("         ASRA                          ; B81A: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xB81B; JUMP; // sstep
case 0xB81B:
                                                     mon("         RORB                          ; B81B: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB81C; JUMP; // sstep
case 0xB81C:
                                                     mon("LB81C    SUBD  ,X                      ; B81C: A3 84         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB81E; JUMP; // sstep
case 0xB81E:
                                                     mon("         JSR   Shift_D_R_4             ; B81E: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xB821:
                                                     mon("LB821    LDB   $4703                   ; B821: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB824; JUMP; // sstep
case 0xB824:
                                                     mon("         STD   $06,X                   ; B824: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB826; JUMP; // sstep
case 0xB826:
                                                     mon("         LDD   $08,X                   ; B826: EC 08         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB828; JUMP; // sstep
case 0xB828:
                                                     mon("         SUBD  $02,X                   ; B828: A3 02         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB82A; JUMP; // sstep
case 0xB82A:
                                                     mon("         JSR   Shift_D_R_4             ; B82A: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xB82D:
                                                     mon("LB82D    LDB   $4703                   ; B82D: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB830; JUMP; // sstep
case 0xB830:
                                                     mon("         STD   $08,X                   ; B830: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB832; JUMP; // sstep
case 0xB832:
                                                     mon("         LDD   $0A,X                   ; B832: EC 0A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x000a); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB834; JUMP; // sstep
case 0xB834:
                                                     mon("         SUBD  $04,X                   ; B834: A3 04         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB836; JUMP; // sstep
case 0xB836:
                                                     mon("LB836    JSR   Shift_D_R_4             ; B836: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x39); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0xB839:
                                                     mon("LB839    LDB   $4703                   ; B839: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB83C; JUMP; // sstep
case 0xB83C:
                                                     mon("         STD   $0A,X                   ; B83C: ED 0A         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_B76C
    PC = 0xB83E; JUMP; // sstep
case 0xB83E:
                                                     mon("         RTS                           ; B83E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB83F:
                                                     mon("LB83F    LDD   -10,U                   ; B83F: EC 56         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfff6); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB841; JUMP; // sstep
case 0xB841:
                                                     mon("         ADDD  $06,X                   ; B841: E3 06         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB843; JUMP; // sstep
case 0xB843:
                                                     mon("         STD   $06,X                   ; B843: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB845; JUMP; // sstep
case 0xB845:
                                                     mon("         LDD   -2,U                    ; B845: EC 5E         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfffe); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB847; JUMP; // sstep
case 0xB847:
                                                     mon("         ADDD  $08,X                   ; B847: E3 08         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0008))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0008))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB849; JUMP; // sstep
case 0xB849:
                                                     mon("         STD   $08,X                   ; B849: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB84B; JUMP; // sstep
case 0xB84B:
                                                     mon("LB84B    LDD   $06,U                   ; B84B: EC 46         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0x0006); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB84D; JUMP; // sstep
case 0xB84D:
                                                     mon("         ADDD  $0A,X                   ; B84D: E3 0A         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000a))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000a))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB84F; JUMP; // sstep
case 0xB84F:
                                                     mon("         STD   $0A,X                   ; B84F: ED 0A         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_B83F
    PC = 0xB851; JUMP; // sstep
case 0xB851:
                                                     mon("         RTS                           ; B851: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB852:
                                                     mon("LB852    LDD   #$01                    ; B852: CC 00 01      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB855; JUMP; // sstep
case 0xB855:
                                                     mon("         STD   <$01                    ; B855: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB857; JUMP; // sstep
case 0xB857:
                                                     mon("         LDD   #$0203                  ; B857: CC 02 03      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x03; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB85A; JUMP; // sstep
case 0xB85A:
                                                     mon("         STD   <$03                    ; B85A: DD 03         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_B852
    PC = 0xB85C; JUMP; // sstep
case 0xB85C:
                                                     mon("         BRA   LB868                   ; B85C: 20 0A         \n");
    PC = 0xb868; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xB85E:
                                                     mon("LB85E    LDD   #$0304                  ; B85E: CC 03 04      \n");
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0x04; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB861; JUMP; // sstep
case 0xB861:
                                                     mon("         STD   <$01                    ; B861: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB863; JUMP; // sstep
case 0xB863:
                                                     mon("         LDD   #$0502                  ; B863: CC 05 02      \n");
    clockticks = clockticks + 3; 
    A = 0x05; 
    B = 0x02; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB866; JUMP; // sstep
case 0xB866:
                                                     mon("         STD   <$03                    ; B866: DD 03         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x03; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB868; JUMP; // sstep
case 0xB868:
                                                     mon("LB868    JSR   LB948                   ; B868: BD B9 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xb948; 
    JUMP;
  case 0xB86B:
                                                     mon("LB86B    LDA   <$01                    ; B86B: 96 01         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB86D; JUMP; // sstep
case 0xB86D:
                                                     mon("         STA   $0C,X                   ; B86D: A7 0C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000c); 
    wr_mem(ea, val); 
    PC = 0xB86F; JUMP; // sstep
case 0xB86F:
                                                     mon("         LDA   #$20                    ; B86F: 86 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB871; JUMP; // sstep
case 0xB871:
                                                     mon("         STA   $0D,X                   ; B871: A7 0D         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB873; JUMP; // sstep
case 0xB873:
                                                     mon("         LDD   $5018                   ; B873: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB876; JUMP; // sstep
case 0xB876:
                                                     mon("LB876    STD   ,X                      ; B876: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB878; JUMP; // sstep
case 0xB878:
                                                     mon("         LDD   $501A                   ; B878: FC 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501a); // Care needed with I/O space and word fetches
    B = rd_mem(0x501b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB87B; JUMP; // sstep
case 0xB87B:
                                                     mon("         ADDA  #$FE                    ; B87B: 8B FE         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xfe; 
    res = val + (UINT8)arg; 
/**/C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB87D; JUMP; // sstep
case 0xB87D:
                                                     mon("LB87D    STD   $02,X                   ; B87D: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB87F; JUMP; // sstep
case 0xB87F:
                                                     mon("         LDD   $501C                   ; B87F: FC 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501c); // Care needed with I/O space and word fetches
    B = rd_mem(0x501d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB882; JUMP; // sstep
case 0xB882:
                                                     mon("         STD   $04,X                   ; B882: ED 04         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB884; JUMP; // sstep
case 0xB884:
                                                     mon("         LDD   $5098                   ; B884: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB887; JUMP; // sstep
case 0xB887:
                                                     mon("         ADDA  #$7F                    ; B887: 8B 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7f; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB889; JUMP; // sstep
case 0xB889:
                                                     mon("         SUBD  $5018                   ; B889: B3 50 18      \n"); // XT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5018)<<8; 
    ea = ea | rd_mem(0x5019); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB88C; JUMP; // sstep
case 0xB88C:
                                                     mon("         JSR   Shift_D_R_5             ; B88C: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB88F:
                                                     mon("LB88F    LDB   $4703                   ; B88F: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB892; JUMP; // sstep
case 0xB892:
                                                     mon("         STD   $06,X                   ; B892: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB894; JUMP; // sstep
case 0xB894:
                                                     mon("         LDD   $509A                   ; B894: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB897; JUMP; // sstep
case 0xB897:
                                                     mon("         ADDA  #$C1                    ; B897: 8B C1         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xc1; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB899; JUMP; // sstep
case 0xB899:
                                                     mon("         SUBD  $501A                   ; B899: B3 50 1A      \n"); // YT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x501a)<<8; 
    ea = ea | rd_mem(0x501b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB89C; JUMP; // sstep
case 0xB89C:
                                                     mon("         JSR   Shift_D_R_5             ; B89C: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB89F:
                                                     mon("LB89F    LDB   $4703                   ; B89F: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8A2; JUMP; // sstep
case 0xB8A2:
                                                     mon("         STD   $08,X                   ; B8A2: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8A4; JUMP; // sstep
case 0xB8A4:
                                                     mon("         LDA   <$04                    ; B8A4: 96 04         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x04); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8A6; JUMP; // sstep
case 0xB8A6:
                                                     mon("         LDB   $4703                   ; B8A6: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB8A9; JUMP; // sstep
case 0xB8A9:
                                                     mon("         JSR   Shift_D_L_2             ; B8A9: BD CD B5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xac); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcdb5; 
    JUMP;
  case 0xB8AC:
                                                     mon("LB8AC    STD   $0A,X                   ; B8AC: ED 0A         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8AE; JUMP; // sstep
case 0xB8AE:
                                                     mon("         JSR   LB948                   ; B8AE: BD B9 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xb948; 
    JUMP;
  case 0xB8B1:
                                                     mon("LB8B1    LDA   <$02                    ; B8B1: 96 02         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x02); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8B3; JUMP; // sstep
case 0xB8B3:
                                                     mon("         STA   $0C,X                   ; B8B3: A7 0C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000c); 
    wr_mem(ea, val); 
    PC = 0xB8B5; JUMP; // sstep
case 0xB8B5:
                                                     mon("         LDA   #$20                    ; B8B5: 86 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8B7; JUMP; // sstep
case 0xB8B7:
                                                     mon("         STA   $0D,X                   ; B8B7: A7 0D         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB8B9; JUMP; // sstep
case 0xB8B9:
                                                     mon("         LDD   $5018                   ; B8B9: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB8BC; JUMP; // sstep
case 0xB8BC:
                                                     mon("         ADDA  #$02                    ; B8BC: 8B 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
/**/C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB8BE; JUMP; // sstep
case 0xB8BE:
                                                     mon("         STD   ,X                      ; B8BE: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8C0; JUMP; // sstep
case 0xB8C0:
                                                     mon("         LDD   $501A                   ; B8C0: FC 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501a); // Care needed with I/O space and word fetches
    B = rd_mem(0x501b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB8C3; JUMP; // sstep
case 0xB8C3:
                                                     mon("         STD   $02,X                   ; B8C3: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8C5; JUMP; // sstep
case 0xB8C5:
                                                     mon("         LDD   $501C                   ; B8C5: FC 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501c); // Care needed with I/O space and word fetches
    B = rd_mem(0x501d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB8C8; JUMP; // sstep
case 0xB8C8:
                                                     mon("         STD   $04,X                   ; B8C8: ED 04         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8CA; JUMP; // sstep
case 0xB8CA:
                                                     mon("         LDD   $5098                   ; B8CA: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB8CD; JUMP; // sstep
case 0xB8CD:
                                                     mon("         ADDA  #$7F                    ; B8CD: 8B 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7f; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB8CF; JUMP; // sstep
case 0xB8CF:
                                                     mon("         SUBD  $5018                   ; B8CF: B3 50 18      \n"); // XT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5018)<<8; 
    ea = ea | rd_mem(0x5019); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB8D2; JUMP; // sstep
case 0xB8D2:
                                                     mon("         JSR   Shift_D_R_5             ; B8D2: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB8D5:
                                                     mon("LB8D5    LDB   $4703                   ; B8D5: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8D8; JUMP; // sstep
case 0xB8D8:
                                                     mon("         STD   $06,X                   ; B8D8: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8DA; JUMP; // sstep
case 0xB8DA:
                                                     mon("         LDD   $509A                   ; B8DA: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB8DD; JUMP; // sstep
case 0xB8DD:
                                                     mon("         SUBD  $501A                   ; B8DD: B3 50 1A      \n"); // YT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x501a)<<8; 
    ea = ea | rd_mem(0x501b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB8E0; JUMP; // sstep
case 0xB8E0:
                                                     mon("         JSR   Shift_D_R_5             ; B8E0: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB8E3:
                                                     mon("LB8E3    LDB   $4703                   ; B8E3: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8E6; JUMP; // sstep
case 0xB8E6:
                                                     mon("         STD   $08,X                   ; B8E6: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8E8; JUMP; // sstep
case 0xB8E8:
                                                     mon("         LDA   <$04                    ; B8E8: 96 04         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x04); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8EA; JUMP; // sstep
case 0xB8EA:
                                                     mon("         LDB   $4703                   ; B8EA: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB8ED; JUMP; // sstep
case 0xB8ED:
                                                     mon("         JSR   Shift_D_L_2             ; B8ED: BD CD B5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xcdb5; 
    JUMP;
  case 0xB8F0:
                                                     mon("LB8F0    STD   $0A,X                   ; B8F0: ED 0A         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB8F2; JUMP; // sstep
case 0xB8F2:
                                                     mon("         JSR   LB948                   ; B8F2: BD B9 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    PC = 0xb948; 
    JUMP;
  case 0xB8F5:
                                                     mon("LB8F5    LDA   <$03                    ; B8F5: 96 03         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x03); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8F7; JUMP; // sstep
case 0xB8F7:
                                                     mon("         STA   $0C,X                   ; B8F7: A7 0C         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000c); 
    wr_mem(ea, val); 
    PC = 0xB8F9; JUMP; // sstep
case 0xB8F9:
                                                     mon("         LDA   #$20                    ; B8F9: 86 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB8FB; JUMP; // sstep
case 0xB8FB:
                                                     mon("         STA   $0D,X                   ; B8FB: A7 0D         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB8FD; JUMP; // sstep
case 0xB8FD:
                                                     mon("         LDD   $5018                   ; B8FD: FC 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    A = rd_mem(0x5018); // Care needed with I/O space and word fetches
    B = rd_mem(0x5019); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB900; JUMP; // sstep
case 0xB900:
                                                     mon("         STD   ,X                      ; B900: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB902; JUMP; // sstep
case 0xB902:
                                                     mon("         LDD   $501A                   ; B902: FC 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501a); // Care needed with I/O space and word fetches
    B = rd_mem(0x501b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB905; JUMP; // sstep
case 0xB905:
                                                     mon("         ADDA  #$02                    ; B905: 8B 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
/**/C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB907; JUMP; // sstep
case 0xB907:
                                                     mon("         STD   $02,X                   ; B907: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB909; JUMP; // sstep
case 0xB909:
                                                     mon("         LDD   $501C                   ; B909: FC 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501c); // Care needed with I/O space and word fetches
    B = rd_mem(0x501d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB90C; JUMP; // sstep
case 0xB90C:
                                                     mon("         STD   $04,X                   ; B90C: ED 04         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB90E; JUMP; // sstep
case 0xB90E:
                                                     mon("         LDD   $5098                   ; B90E: FC 50 98      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5098); // Care needed with I/O space and word fetches
    B = rd_mem(0x5099); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB911; JUMP; // sstep
case 0xB911:
                                                     mon("         ADDA  #$7F                    ; B911: 8B 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7f; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB913; JUMP; // sstep
case 0xB913:
                                                     mon("         SUBD  $5018                   ; B913: B3 50 18      \n"); // XT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5018)<<8; 
    ea = ea | rd_mem(0x5019); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB916; JUMP; // sstep
case 0xB916:
                                                     mon("         JSR   Shift_D_R_5             ; B916: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x19); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB919:
                                                     mon("LB919    LDB   $4703                   ; B919: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB91C; JUMP; // sstep
case 0xB91C:
                                                     mon("         STD   $06,X                   ; B91C: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB91E; JUMP; // sstep
case 0xB91E:
                                                     mon("         LDD   $509A                   ; B91E: FC 50 9A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509a); // Care needed with I/O space and word fetches
    B = rd_mem(0x509b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB921; JUMP; // sstep
case 0xB921:
                                                     mon("         ADDA  #$3F                    ; B921: 8B 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x3f; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xB923; JUMP; // sstep
case 0xB923:
                                                     mon("         SUBD  $501A                   ; B923: B3 50 1A      \n"); // YT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x501a)<<8; 
    ea = ea | rd_mem(0x501b); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB926; JUMP; // sstep
case 0xB926:
                                                     mon("         JSR   Shift_D_R_5             ; B926: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB929:
                                                     mon("LB929    LDB   $4703                   ; B929: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB92C; JUMP; // sstep
case 0xB92C:
                                                     mon("         STD   $08,X                   ; B92C: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB92E; JUMP; // sstep
case 0xB92E:
                                                     mon("         LDA   <$04                    ; B92E: 96 04         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x04); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB930; JUMP; // sstep
case 0xB930:
                                                     mon("         LDB   $4703                   ; B930: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB933; JUMP; // sstep
case 0xB933:
                                                     mon("         JSR   Shift_D_L_2             ; B933: BD CD B5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x36); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcdb5; 
    JUMP;
  case 0xB936:
                                                     mon("LB936    STD   $0A,X                   ; B936: ED 0A         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_B85E
    PC = 0xB938; JUMP; // sstep
case 0xB938:
                                                     mon("         RTS                           ; B938: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB939:
                                                     mon("LB939    LDX   #$49E2                  ; B939: 8E 49 E2      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 3; 
    X = 0x49e2; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB93C; JUMP; // sstep
case 0xB93C:
                                                     mon("LB93C    LDA   #$00                    ; B93C: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB93E; JUMP; // sstep
case 0xB93E:
                                                     mon("         STA   $0D,X                   ; B93E: A7 0D         \n"); // Free up object state slot
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x000d); 
    wr_mem(ea, val); 
    PC = 0xB940; JUMP; // sstep
case 0xB940:
                                                     mon("         LEAX  $0E,X                   ; B940: 30 0E         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x000e); 
/**/Z = X; 
    PC = 0xB942; JUMP; // sstep
case 0xB942:
                                                     mon("         CMPX  #$4A52                  ; B942: 8C 4A 52      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4a52; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB945; JUMP; // sstep
case 0xB945:
                                                     mon("         BCS   LB93C                   ; B945: 25 F5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb93c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_B939
    PC = 0xB947; JUMP; // sstep
case 0xB947:
                                                     mon("         RTS                           ; B947: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB948:
                                                     mon("LB948    LDB   <$A2                    ; B948: D6 A2         \n"); // 3D Object slot select
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa2); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB94A; JUMP; // sstep
case 0xB94A:
                                                     mon("         INCB                          ; B94A: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB94B; JUMP; // sstep
case 0xB94B:
                                                     mon("         CMPB  #$08                    ; B94B: C1 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB94D; JUMP; // sstep
case 0xB94D:
                                                     mon("         BCS   LB951                   ; B94D: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb951; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB94F; JUMP; // sstep
case 0xB94F:
                                                     mon("         LDB   #$00                    ; B94F: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB951; JUMP; // sstep
case 0xB951:
                                                     mon("LB951    STB   <$A2                    ; B951: D7 A2         \n"); // 3D Object slot select
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xa2; 
    wr_mem(ea, val); 
    PC = 0xB953; JUMP; // sstep
case 0xB953:
                                                     mon("         LDA   #$0E                    ; B953: 86 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB955; JUMP; // sstep
case 0xB955:
                                                     mon("         MUL                           ; B955: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xB956; JUMP; // sstep
case 0xB956:
                                                     mon("         LDX   #$49E2                  ; B956: 8E 49 E2      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 3; 
    X = 0x49e2; 
/**/Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xB959; JUMP; // sstep
case 0xB959:
                                                     mon("         LEAX  D,X                     ; B959: 30 8B         \n");
    clockticks = clockticks + 8; 
    X = (X + (((UINT8)A<<8)|(UINT8)B)); 
    Z = X; 
    // End of function sub_B948
    PC = 0xB95B; JUMP; // sstep
case 0xB95B:
                                                     mon("         RTS                           ; B95B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_B98B
  case 0xB95C:
                                                     mon("LB95C    LDD   #$14BD                  ; B95C: CC 14 BD      \n");
    clockticks = clockticks + 3; 
    A = 0x14; 
    B = 0xbd; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB95F; JUMP; // sstep
case 0xB95F:
                                                     mon("         STD   $5022                   ; B95F: FD 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5022, A); // Care needed with I/O space and word fetches
    wr_mem(0x5023, B); 
    PC = 0xB962; JUMP; // sstep
case 0xB962:
                                                     mon("         LDD   #$3C8C                  ; B962: CC 3C 8C      \n");
    clockticks = clockticks + 3; 
    A = 0x3c; 
    B = 0x8c; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB965; JUMP; // sstep
case 0xB965:
                                                     mon("         STD   $5024                   ; B965: FD 50 24      \n"); // Cosine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5024, A); // Care needed with I/O space and word fetches
    wr_mem(0x5025, B); 
    PC = 0xB968; JUMP; // sstep
case 0xB968:
                                                     mon("         LDD   #$18                    ; B968: CC 00 18      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x18; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB96B; JUMP; // sstep
case 0xB96B:
                                                     mon("         STD   $4701                   ; B96B: FD 47 01      \n"); // Point BIC to $50C0
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xB96E; JUMP; // sstep
case 0xB96E:
                                                     mon("         LDA   #$00                    ; B96E: 86 00         \n"); // Roll
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB970; JUMP; // sstep
case 0xB970:
                                                     mon("         JSR   LCDBA                   ; B970: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xB973:
                                                     mon("LB973    LDD   #$0590                  ; B973: CC 05 90      \n");
    clockticks = clockticks + 3; 
    A = 0x05; 
    B = 0x90; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB976; JUMP; // sstep
case 0xB976:
                                                     mon("         STD   $5022                   ; B976: FD 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5022, A); // Care needed with I/O space and word fetches
    wr_mem(0x5023, B); 
    PC = 0xB979; JUMP; // sstep
case 0xB979:
                                                     mon("         LDD   #$3FC2                  ; B979: CC 3F C2      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xc2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB97C; JUMP; // sstep
case 0xB97C:
                                                     mon("         STD   $5024                   ; B97C: FD 50 24      \n"); // Cosine for rotation
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5024, A); // Care needed with I/O space and word fetches
    wr_mem(0x5025, B); 
    PC = 0xB97F; JUMP; // sstep
case 0xB97F:
                                                     mon("         LDD   #$18                    ; B97F: CC 00 18      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x18; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB982; JUMP; // sstep
case 0xB982:
                                                     mon("         STD   $4701                   ; B982: FD 47 01      \n"); // Point BIC to $50C0
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xB985; JUMP; // sstep
case 0xB985:
                                                     mon("         LDA   #$0E                    ; B985: 86 0E         \n"); // Pitch
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB987; JUMP; // sstep
case 0xB987:
                                                     mon("         JSR   LCDBA                   ; B987: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
    // END OF FUNCTION CHUNK FOR sub_B98B
  case 0xB98A:
                                                     mon("LB98A    RTS                           ; B98A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Check if tie/bunker/tower been hit
    // FUNCTION CHUNK AT ROM:B95C SIZE 0000002F BYTES
  case 0xB98B:
                                                     mon("LB98B    LDX   #$49E2                  ; B98B: 8E 49 E2      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 3; 
    X = 0x49e2; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB98E; JUMP; // sstep
case 0xB98E:
                                                     mon("LB98E    LDA   $0D,X                   ; B98E: A6 0D         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000d)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB990; JUMP; // sstep
case 0xB990:
                                                     mon("         BEQ   LB9A1                   ; B990: 27 0F         \n"); // If object state slot active then
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb9a1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB992; JUMP; // sstep
case 0xB992:
                                                     mon("         DEC   $0D,X                   ; B992: 6A 0D         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000d)); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem((UINT16)(X + 0x000d), res); 
    clockticks = clockticks + 2; 
    PC = 0xB994; JUMP; // sstep
case 0xB994:
                                                     mon("         LDB   $0C,X                   ; B994: E6 0C         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000c)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xB996; JUMP; // sstep
case 0xB996:
                                                     mon("         CMPB  #$09                    ; B996: C1 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x09; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xB998; JUMP; // sstep
case 0xB998:
                                                     mon("         BCS   LB99B                   ; B998: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb99b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB99A; JUMP; // sstep
case 0xB99A:
                                                     mon("         SWI                           ; B99A: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x9b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xB99B:
                                                     mon("LB99B    LDU   #jt1                    ; B99B: CE B7 48      \n");
    clockticks = clockticks + 3; 
    U = 0xb748; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xB99E; JUMP; // sstep
case 0xB99E:
                                                     mon("         ASLB                          ; B99E: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xB99F; JUMP; // sstep
case 0xB99F:
                                                     mon("         JSR   [B,U]                   ; B99F: AD D5         \n");
    clockticks = clockticks + 3; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    ea = rd_mem((UINT16)(U + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)((U + (SINT8)B) + 1)); 
    S = S - 1; 
    wr_mem(S, 0xa1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = ea; 
    JUMP;
  case 0xB9A1:
                                                     mon("LB9A1    LEAX  $0E,X                   ; B9A1: 30 0E         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x000e); 
/**/Z = X; 
    PC = 0xB9A3; JUMP; // sstep
case 0xB9A3:
                                                     mon("         CMPX  #$4A52                  ; B9A3: 8C 4A 52      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4a52; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB9A6; JUMP; // sstep
case 0xB9A6:
                                                     mon("         BCS   LB98E                   ; B9A6: 25 E6         \n"); // Loop until all 3D Object states processed
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb98e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB9A8; JUMP; // sstep
case 0xB9A8:
                                                     mon("         LDX   #$49E2                  ; B9A8: 8E 49 E2      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 3; 
    X = 0x49e2; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xB9AB; JUMP; // sstep
case 0xB9AB:
                                                     mon("LB9AB    LDA   $0D,X                   ; B9AB: A6 0D         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000d)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xB9AD; JUMP; // sstep
case 0xB9AD:
                                                     mon("         BEQ   LB9B2                   ; B9AD: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xb9b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB9AF; JUMP; // sstep
case 0xB9AF:
                                                     mon("         JMP   LB95C                   ; B9AF: 7E B9 5C      \n");
    clockticks = clockticks + 4; 
    PC = 0xb95c; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xB9B2:
                                                     mon("LB9B2    LEAX  $0E,X                   ; B9B2: 30 0E         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x000e); 
/**/Z = X; 
    PC = 0xB9B4; JUMP; // sstep
case 0xB9B4:
                                                     mon("         CMPX  #$4A52                  ; B9B4: 8C 4A 52      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4a52; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xB9B7; JUMP; // sstep
case 0xB9B7:
                                                     mon("         BCS   LB9AB                   ; B9B7: 25 F2         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xb9ab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB9B9; JUMP; // sstep
case 0xB9B9:
                                                     mon("         LDU   #$50D0                  ; B9B9: CE 50 D0      \n");
    clockticks = clockticks + 3; 
    U = 0x50d0; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xB9BC; JUMP; // sstep
case 0xB9BC:
                                                     mon("         JSR   LCDC3                   ; B9BC: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
    // End of function sub_B98B
  case 0xB9BF:
                                                     mon("LB9BF    RTS                           ; B9BF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB9C0:
                                                     mon("LB9C0    LDD   $06,X                   ; B9C0: EC 06         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0006); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9C2; JUMP; // sstep
case 0xB9C2:
                                                     mon("         ADDD  ,X                      ; B9C2: E3 84         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB9C4; JUMP; // sstep
case 0xB9C4:
                                                     mon("         STD   ,X                      ; B9C4: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB9C6; JUMP; // sstep
case 0xB9C6:
                                                     mon("         LDD   #$00                    ; B9C6: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9C9; JUMP; // sstep
case 0xB9C9:
                                                     mon("         SUBD  $06,X                   ; B9C9: A3 06         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB9CB; JUMP; // sstep
case 0xB9CB:
                                                     mon("         JSR   Shift_D_R_5             ; B9CB: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB9CE:
                                                     mon("LB9CE    ADDD  $06,X                   ; B9CE: E3 06         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0006))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0006))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB9D0; JUMP; // sstep
case 0xB9D0:
                                                     mon("         STD   $06,X                   ; B9D0: ED 06         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB9D2; JUMP; // sstep
case 0xB9D2:
                                                     mon("         LDD   $08,X                   ; B9D2: EC 08         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9D4; JUMP; // sstep
case 0xB9D4:
                                                     mon("         ADDD  $02,X                   ; B9D4: E3 02         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB9D6; JUMP; // sstep
case 0xB9D6:
                                                     mon("         STD   $02,X                   ; B9D6: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB9D8; JUMP; // sstep
case 0xB9D8:
                                                     mon("         LDD   #$00                    ; B9D8: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9DB; JUMP; // sstep
case 0xB9DB:
                                                     mon("         SUBD  $08,X                   ; B9DB: A3 08         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0008))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0008))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB9DD; JUMP; // sstep
case 0xB9DD:
                                                     mon("         JSR   Shift_D_R_5             ; B9DD: BD CD 9E      \n"); // Shift D register right
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    PC = 0xcd9e; 
    JUMP;
  case 0xB9E0:
                                                     mon("LB9E0    ADDD  $08,X                   ; B9E0: E3 08         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0008))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0008))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB9E2; JUMP; // sstep
case 0xB9E2:
                                                     mon("         STD   $08,X                   ; B9E2: ED 08         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB9E4; JUMP; // sstep
case 0xB9E4:
                                                     mon("         LDD   $04,X                   ; B9E4: EC 04         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9E6; JUMP; // sstep
case 0xB9E6:
                                                     mon("         ADDD  $0A,X                   ; B9E6: E3 0A         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x000a))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x000a))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB9E8; JUMP; // sstep
case 0xB9E8:
                                                     mon("         BVS   LB9F1                   ; B9E8: 29 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xb9f1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB9EA; JUMP; // sstep
case 0xB9EA:
                                                     mon("         BGE   LB9EF                   ; B9EA: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xb9ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB9EC; JUMP; // sstep
case 0xB9EC:
                                                     mon("         LDD   #$00                    ; B9EC: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9EF; JUMP; // sstep
case 0xB9EF:
                                                     mon("LB9EF    STD   $04,X                   ; B9EF: ED 04         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xB9F1; JUMP; // sstep
case 0xB9F1:
                                                     mon("LB9F1    LDD   $0A,X                   ; B9F1: EC 0A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x000a); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9F3; JUMP; // sstep
case 0xB9F3:
                                                     mon("         SUBD  #$C8                    ; B9F3: 83 00 C8      \n");
    clockticks = clockticks + 4; 
    val = 0x00c8; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xB9F6; JUMP; // sstep
case 0xB9F6:
                                                     mon("         STD   $0A,X                   ; B9F6: ED 0A         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_B9C0
    PC = 0xB9F8; JUMP; // sstep
case 0xB9F8:
                                                     mon("         RTS                           ; B9F8: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xB9F9:
                                                     mon("LB9F9    LDD   $06,X                   ; B9F9: EC 06         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0006); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xB9FB; JUMP; // sstep
case 0xB9FB:
                                                     mon("         ADDD  ,X                      ; B9FB: E3 84         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xB9FD; JUMP; // sstep
case 0xB9FD:
                                                     mon("         BVS   LBA01                   ; B9FD: 29 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xba01; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xB9FF; JUMP; // sstep
case 0xB9FF:
                                                     mon("         STD   ,X                      ; B9FF: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBA01; JUMP; // sstep
case 0xBA01:
                                                     mon("LBA01    LDD   $08,X                   ; BA01: EC 08         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0008); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA03; JUMP; // sstep
case 0xBA03:
                                                     mon("         ADDD  $02,X                   ; BA03: E3 02         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBA05; JUMP; // sstep
case 0xBA05:
                                                     mon("         BVS   LBA09                   ; BA05: 29 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xba09; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA07; JUMP; // sstep
case 0xBA07:
                                                     mon("         STD   $02,X                   ; BA07: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBA09; JUMP; // sstep
case 0xBA09:
                                                     mon("LBA09    LDD   $0A,X                   ; BA09: EC 0A         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x000a); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA0B; JUMP; // sstep
case 0xBA0B:
                                                     mon("         ADDD  $04,X                   ; BA0B: E3 04         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0004))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0004))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ res) & (val ^ res)) >> 8; 
    N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBA0D; JUMP; // sstep
case 0xBA0D:
                                                     mon("         BVS   locret_BA11             ; BA0D: 29 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0xba11; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA0F; JUMP; // sstep
case 0xBA0F:
                                                     mon("         STD   $04,X                   ; BA0F: ED 04         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_B9F9
    PC = 0xBA11; JUMP; // sstep
case 0xBA11:
                                                     mon("locret_BA11 RTS                           ; BA11: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Process tie/tower/bunker explosions
  case 0xBA12:
                                                     mon("LBA12    LDA   #$18                    ; BA12: 86 18         \n"); // BIC points to $50C0
    clockticks = clockticks + 2; 
    val = (UINT8)0x18; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBA14; JUMP; // sstep
case 0xBA14:
                                                     mon("         JSR   LCE18                   ; BA14: BD CE 18      \n"); // Run math program $80 Copy [BIC] to Matrix 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xce18; 
    JUMP;
  case 0xBA17:
                                                     mon("LBA17    LDA   #$40                    ; BA17: 86 40         \n"); // @      ; Matrix 1 = Matrix 2 x Matrix 3
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBA19; JUMP; // sstep
case 0xBA19:
                                                     mon("         JSR   LCDBA                   ; BA19: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xBA1C:
                                                     mon("LBA1C    LDX   #$49E2                  ; BA1C: 8E 49 E2      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 3; 
    X = 0x49e2; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBA1F; JUMP; // sstep
case 0xBA1F:
                                                     mon("LBA1F    STX   <$64                    ; BA1F: 9F 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0x64; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xBA21; JUMP; // sstep
case 0xBA21:
                                                     mon("         LDA   $0D,X                   ; BA21: A6 0D         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000d)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBA23; JUMP; // sstep
case 0xBA23:
                                                     mon("         BEQ   LBA28                   ; BA23: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xba28; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA25; JUMP; // sstep
case 0xBA25:
                                                     mon("         JSR   LBA32                   ; BA25: BD BA 32      \n"); // Tie/bunker/tower hit explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xba32; 
    JUMP;
  case 0xBA28:
                                                     mon("LBA28    LDX   <$64                    ; BA28: 9E 64         \n"); // Pointer to Tie fighter data
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x64)<<8; 
    ea = ea | rd_mem(DP|0x65); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBA2A; JUMP; // sstep
case 0xBA2A:
                                                     mon("         LEAX  $0E,X                   ; BA2A: 30 0E         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x000e); 
/**/Z = X; 
    PC = 0xBA2C; JUMP; // sstep
case 0xBA2C:
                                                     mon("         CMPX  #$4A52                  ; BA2C: 8C 4A 52      \n"); // 3D Object state data 2. 8 slots of 14 bytes
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4a52; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBA2F; JUMP; // sstep
case 0xBA2F:
                                                     mon("         BCS   LBA1F                   ; BA2F: 25 EE         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xba1f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_BA12
    PC = 0xBA31; JUMP; // sstep
case 0xBA31:
                                                     mon("         RTS                           ; BA31: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBA32:
                                                     mon("LBA32    LDD   ,X                      ; BA32: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA34; JUMP; // sstep
case 0xBA34:
                                                     mon("         STD   $5078                   ; BA34: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xBA37; JUMP; // sstep
case 0xBA37:
                                                     mon("         LDD   $02,X                   ; BA37: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA39; JUMP; // sstep
case 0xBA39:
                                                     mon("         STD   $507A                   ; BA39: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xBA3C; JUMP; // sstep
case 0xBA3C:
                                                     mon("         LDD   $04,X                   ; BA3C: EC 04         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA3E; JUMP; // sstep
case 0xBA3E:
                                                     mon("         STD   $507C                   ; BA3E: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xBA41; JUMP; // sstep
case 0xBA41:
                                                     mon("         LDD   #$0F                    ; BA41: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA44; JUMP; // sstep
case 0xBA44:
                                                     mon("         STD   $4701                   ; BA44: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xBA47; JUMP; // sstep
case 0xBA47:
                                                     mon("         LDA   #$67                    ; BA47: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBA49; JUMP; // sstep
case 0xBA49:
                                                     mon("         JSR   LCDBA                   ; BA49: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xBA4C:
                                                     mon("LBA4C    LDD   $5000                   ; BA4C: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBA4F; JUMP; // sstep
case 0xBA4F:
                                                     mon("         BMI   LBA9D                   ; BA4F: 2B 4C         \n"); // If object behind observer then remove
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xba9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA51; JUMP; // sstep
case 0xBA51:
                                                     mon("         STD   $5018                   ; BA51: FD 50 18      \n"); // XT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5018, A); // Care needed with I/O space and word fetches
    wr_mem(0x5019, B); 
    PC = 0xBA54; JUMP; // sstep
case 0xBA54:
                                                     mon("         STD   $4704                   ; BA54: FD 47 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xBA57; JUMP; // sstep
case 0xBA57:
                                                     mon("         LDD   $5002                   ; BA57: FC 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    A = rd_mem(0x5002); // Care needed with I/O space and word fetches
    B = rd_mem(0x5003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA5A; JUMP; // sstep
case 0xBA5A:
                                                     mon("         STD   $501A                   ; BA5A: FD 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x501a, A); // Care needed with I/O space and word fetches
    wr_mem(0x501b, B); 
    PC = 0xBA5D; JUMP; // sstep
case 0xBA5D:
                                                     mon("         BPL   LBA63                   ; BA5D: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xba63; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA5F; JUMP; // sstep
case 0xBA5F:
                                                     mon("         COMA                          ; BA5F: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xBA60; JUMP; // sstep
case 0xBA60:
                                                     mon("         NEGB                          ; BA60: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xBA61; JUMP; // sstep
case 0xBA61:
                                                     mon("         SBCA  #$FF                    ; BA61: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xBA63; JUMP; // sstep
case 0xBA63:
                                                     mon("LBA63    SUBD  $5018                   ; BA63: B3 50 18      \n"); // XT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5018)<<8; 
    ea = ea | rd_mem(0x5019); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xBA66; JUMP; // sstep
case 0xBA66:
                                                     mon("         BGE   LBA9D                   ; BA66: 2C 35         \n"); // Remove object if outside visible limit
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xba9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA68; JUMP; // sstep
case 0xBA68:
                                                     mon("         LDD   $5004                   ; BA68: FC 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    A = rd_mem(0x5004); // Care needed with I/O space and word fetches
    B = rd_mem(0x5005); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA6B; JUMP; // sstep
case 0xBA6B:
                                                     mon("         STD   $501C                   ; BA6B: FD 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x501c, A); // Care needed with I/O space and word fetches
    wr_mem(0x501d, B); 
    PC = 0xBA6E; JUMP; // sstep
case 0xBA6E:
                                                     mon("         BPL   LBA74                   ; BA6E: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xba74; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA70; JUMP; // sstep
case 0xBA70:
                                                     mon("         COMA                          ; BA70: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xBA71; JUMP; // sstep
case 0xBA71:
                                                     mon("         NEGB                          ; BA71: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xBA72; JUMP; // sstep
case 0xBA72:
                                                     mon("         SBCA  #$FF                    ; BA72: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xBA74; JUMP; // sstep
case 0xBA74:
                                                     mon("LBA74    LSRA                          ; BA74: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBA75; JUMP; // sstep
case 0xBA75:
                                                     mon("         RORB                          ; BA75: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBA76; JUMP; // sstep
case 0xBA76:
                                                     mon("         SUBD  $5018                   ; BA76: B3 50 18      \n"); // XT
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5018)<<8; 
    ea = ea | rd_mem(0x5019); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xBA79; JUMP; // sstep
case 0xBA79:
                                                     mon("         BGE   LBA9D                   ; BA79: 2C 22         \n"); // Remove object if outside visible limit
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xba9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA7B; JUMP; // sstep
case 0xBA7B:
                                                     mon("         LDB   $0C,X                   ; BA7B: E6 0C         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000c)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBA7D; JUMP; // sstep
case 0xBA7D:
                                                     mon("         CMPB  #$09                    ; BA7D: C1 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x09; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xBA7F; JUMP; // sstep
case 0xBA7F:
                                                     mon("         BCS   LBA82                   ; BA7F: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xba82; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBA81; JUMP; // sstep
case 0xBA81:
                                                     mon("         SWI                           ; BA81: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x82); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xBA82:
                                                     mon("LBA82    LDU   #off_B75A               ; BA82: CE B7 5A      \n"); // Tie/bunker/tower fragments table
    clockticks = clockticks + 3; 
    U = 0xb75a; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBA85; JUMP; // sstep
case 0xBA85:
                                                     mon("         ASLB                          ; BA85: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBA86; JUMP; // sstep
case 0xBA86:
                                                     mon("         JSR   [B,U]                   ; BA86: AD D5         \n"); // Work out which colour for tie/bunker/ tower fragments
    clockticks = clockticks + 3; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    ea = rd_mem((UINT16)(U + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)((U + (SINT8)B) + 1)); 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = ea; 
    JUMP;
  case 0xBA88:
                                                     mon("LBA88    JSR   LCCD8                   ; BA88: BD CC D8      \n"); // Copy object 3D data to math ram
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xccd8; 
    JUMP;
  case 0xBA8B:
                                                     mon("LBA8B    JSR   LCD20                   ; BA8B: BD CD 20      \n"); // Do 3D object transform using Matrix 1
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xcd20; 
    JUMP;
  case 0xBA8E:
                                                     mon("LBA8E    JSR   LCD2C                   ; BA8E: BD CD 2C      \n"); // Format vectors for ties, and tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x91); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xcd2c; 
    JUMP;
  case 0xBA91:
                                                     mon("LBA91    LDD   #$7200                  ; BA91: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA94; JUMP; // sstep
case 0xBA94:
                                                     mon("         STD   ,Y++                    ; BA94: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBA96; JUMP; // sstep
case 0xBA96:
                                                     mon("         LDD   #$8040                  ; BA96: CC 80 40      \n"); // Insert vector CNTR instruction
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBA99; JUMP; // sstep
case 0xBA99:
                                                     mon("         STD   ,Y++                    ; BA99: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBA9B; JUMP; // sstep
case 0xBA9B:
                                                     mon("         BRA   locret_BA9F             ; BA9B: 20 02         \n");
    PC = 0xba9f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBA9D:
                                                     mon("LBA9D    CLR   $0D,X                   ; BA9D: 6F 0D         \n"); // Remove/clear object state flag
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x000d), 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_BA32
    PC = 0xBA9F; JUMP; // sstep
case 0xBA9F:
                                                     mon("locret_BA9F RTS                           ; BA9F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBAA0:
                                                     mon("LBAA0    LDA   #$14                    ; BAA0: 86 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x14; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAA2; JUMP; // sstep
case 0xBAA2:
                                                     mon("         BRA   LBABE                   ; BAA2: 20 1A         \n");
    PC = 0xbabe; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBAA4:
                                                     mon("LBAA4    LDA   #$15                    ; BAA4: 86 15         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x15; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAA6; JUMP; // sstep
case 0xBAA6:
                                                     mon("         BRA   LBABE                   ; BAA6: 20 16         \n");
    PC = 0xbabe; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBAA8:
                                                     mon("LBAA8    LDA   #$16                    ; BAA8: 86 16         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x16; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAAA; JUMP; // sstep
case 0xBAAA:
                                                     mon("         BRA   LBABE                   ; BAAA: 20 12         \n");
    PC = 0xbabe; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBAAC:
                                                     mon("LBAAC    LDA   #$11                    ; BAAC: 86 11         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x11; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAAE; JUMP; // sstep
case 0xBAAE:
                                                     mon("         BRA   LBAB8                   ; BAAE: 20 08         \n");
    PC = 0xbab8; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBAB0:
                                                     mon("LBAB0    LDA   #$12                    ; BAB0: 86 12         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x12; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAB2; JUMP; // sstep
case 0xBAB2:
                                                     mon("         BRA   LBAB8                   ; BAB2: 20 04         \n");
    PC = 0xbab8; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBAB4:
                                                     mon("LBAB4    LDA   #$13                    ; BAB4: 86 13         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x13; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAB6; JUMP; // sstep
case 0xBAB6:
                                                     mon("         BRA   LBAB8                   ; BAB6: 20 00         \n");
    PC = 0xbab8; 
    JUMP;
    clockticks = clockticks + 3; 
    
  case 0xBAB8:
                                                     mon("LBAB8    STA   <$DC                    ; BAB8: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xBABA; JUMP; // sstep
case 0xBABA:
                                                     mon("         LDA   #$67                    ; BABA: 86 67         \n"); // g      ; Tower fragments colour
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBABC; JUMP; // sstep
case 0xBABC:
                                                     mon("         BRA   LBAC2                   ; BABC: 20 04         \n");
    PC = 0xbac2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBABE:
                                                     mon("LBABE    STA   <$DC                    ; BABE: 97 DC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xBAC0; JUMP; // sstep
case 0xBAC0:
                                                     mon("         LDA   #$64                    ; BAC0: 86 64         \n"); // d      ; Bunker fragments colour
    clockticks = clockticks + 2; 
    val = (UINT8)0x64; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBAC2; JUMP; // sstep
case 0xBAC2:
                                                     mon("LBAC2    LDB   $0D,X                   ; BAC2: E6 0D         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000d)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBAC4; JUMP; // sstep
case 0xBAC4:
                                                     mon("         CMPB  #$07                    ; BAC4: C1 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x07; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xBAC6; JUMP; // sstep
case 0xBAC6:
                                                     mon("         BHI   LBACE                   ; BAC6: 22 06         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xbace; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBAC8; JUMP; // sstep
case 0xBAC8:
                                                     mon("         ASLB                          ; BAC8: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBAC9; JUMP; // sstep
case 0xBAC9:
                                                     mon("         ASLB                          ; BAC9: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBACA; JUMP; // sstep
case 0xBACA:
                                                     mon("         ASLB                          ; BACA: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBACB; JUMP; // sstep
case 0xBACB:
                                                     mon("         ASLB                          ; BACB: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBACC; JUMP; // sstep
case 0xBACC:
                                                     mon("         BRA   LBAD0                   ; BACC: 20 02         \n");
    PC = 0xbad0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBACE:
                                                     mon("LBACE    LDB   #$80                    ; BACE: C6 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBAD0; JUMP; // sstep
case 0xBAD0:
                                                     mon("LBAD0    STD   ,Y++                    ; BAD0: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBAD2; JUMP; // sstep
case 0xBAD2:
                                                     mon("         LDD   ,X                      ; BAD2: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBAD4; JUMP; // sstep
case 0xBAD4:
                                                     mon("         STD   $5078                   ; BAD4: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0xBAD7; JUMP; // sstep
case 0xBAD7:
                                                     mon("         LDD   $02,X                   ; BAD7: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBAD9; JUMP; // sstep
case 0xBAD9:
                                                     mon("         STD   $507A                   ; BAD9: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0xBADC; JUMP; // sstep
case 0xBADC:
                                                     mon("         LDD   #$00                    ; BADC: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBADF; JUMP; // sstep
case 0xBADF:
                                                     mon("         STD   $507C                   ; BADF: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0xBAE2; JUMP; // sstep
case 0xBAE2:
                                                     mon("         LDD   #$0F                    ; BAE2: CC 00 0F      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x0f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBAE5; JUMP; // sstep
case 0xBAE5:
                                                     mon("         STD   $4701                   ; BAE5: FD 47 01      \n"); // Point BIC to $5078 MReg3C
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xBAE8; JUMP; // sstep
case 0xBAE8:
                                                     mon("         LDD   $501C                   ; BAE8: FC 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
    A = rd_mem(0x501c); // Care needed with I/O space and word fetches
    B = rd_mem(0x501d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBAEB; JUMP; // sstep
case 0xBAEB:
                                                     mon("         PSHS  U,X,B,A                 ; BAEB: 34 56         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 2; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    PC = 0xBAED; JUMP; // sstep
case 0xBAED:
                                                     mon("         LDU   $501A                   ; BAED: FE 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x501a)<<8; 
    ea = ea | rd_mem(0x501b); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBAF0; JUMP; // sstep
case 0xBAF0:
                                                     mon("         LDX   $5018                   ; BAF0: BE 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5018)<<8; 
    ea = ea | rd_mem(0x5019); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBAF3; JUMP; // sstep
case 0xBAF3:
                                                     mon("         LDA   #$67                    ; BAF3: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBAF5; JUMP; // sstep
case 0xBAF5:
                                                     mon("         JSR   LCDBA                   ; BAF5: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0xBAF8:
                                                     mon("LBAF8    STX   $5018                   ; BAF8: BF 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x5018, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x5019, (UINT8)val); 
    PC = 0xBAFB; JUMP; // sstep
case 0xBAFB:
                                                     mon("         STU   $501A                   ; BAFB: FF 50 1A      \n"); // YT
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x501a, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x501b, (UINT8)val); 
    PC = 0xBAFE; JUMP; // sstep
case 0xBAFE:
                                                     mon("         PULS  A,B,X,U                 ; BAFE: 35 56         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 1; 
    A = rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 1; 
    B = rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    X = rd_mem(S)<<8; 
    S = S + 1; 
    X = X | rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    U = rd_mem(S)<<8; 
    S = S + 1; 
    U = U | rd_mem(S); 
    S = S + 1; 
    PC = 0xBB00; JUMP; // sstep
case 0xBB00:
                                                     mon("         STD   $501C                   ; BB00: FD 50 1C      \n"); // ZT
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x501c, A); // Care needed with I/O space and word fetches
    wr_mem(0x501d, B); 
    PC = 0xBB03; JUMP; // sstep
case 0xBB03:
                                                     mon("         LDD   $5000                   ; BB03: FC 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    A = rd_mem(0x5000); // Care needed with I/O space and word fetches
    B = rd_mem(0x5001); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBB06; JUMP; // sstep
case 0xBB06:
                                                     mon("         STD   $4704                   ; BB06: FD 47 04      \n"); // Do division
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4704, A); // Care needed with I/O space and word fetches
    wr_mem(0x4705, B); 
    PC = 0xBB09; JUMP; // sstep
case 0xBB09:
                                                     mon("         JSR   LCCF0                   ; BB09: BD CC F0      \n"); // Get divider result and multiply by Math result Z, insert VCTR instruction
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = 0xccf0; 
    JUMP;
  case 0xBB0C:
                                                     mon("LBB0C    LDA   #$72                    ; BB0C: 86 72         \n"); // r      ; Vector SCAL instruction
    clockticks = clockticks + 2; 
    val = (UINT8)0x72; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBB0E; JUMP; // sstep
case 0xBB0E:
                                                     mon("         LDB   $5018                   ; BB0E: F6 50 18      \n"); // XT
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5018); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBB11; JUMP; // sstep
case 0xBB11:
                                                     mon("         ASLB                          ; BB11: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBB12; JUMP; // sstep
case 0xBB12:
                                                     mon("         ASLB                          ; BB12: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBB13; JUMP; // sstep
case 0xBB13:
                                                     mon("         STD   ,Y++                    ; BB13: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_BAA0
    PC = 0xBB15; JUMP; // sstep
case 0xBB15:
                                                     mon("         RTS                           ; BB15: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBB16:
                                                     mon("LBB16    LDB   #$03                    ; BB16: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_BB16
    PC = 0xBB18; JUMP; // sstep
case 0xBB18:
                                                     mon("         BRA   LBB22                   ; BB18: 20 08         \n");
    PC = 0xbb22; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xBB1A:
                                                     mon("LBB1A    LDB   #$01                    ; BB1A: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_BB1A
    PC = 0xBB1C; JUMP; // sstep
case 0xBB1C:
                                                     mon("         BRA   LBB22                   ; BB1C: 20 04         \n");
    PC = 0xbb22; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xBB1E:
                                                     mon("LBB1E    LDB   #$02                    ; BB1E: C6 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBB20; JUMP; // sstep
case 0xBB20:
                                                     mon("         BRA   LBB22                   ; BB20: 20 00         \n");
    PC = 0xbb22; 
    JUMP;
    clockticks = clockticks + 3; 
    
  case 0xBB22:
                                                     mon("LBB22    STB   <$DC                    ; BB22: D7 DC         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdc; 
    wr_mem(ea, val); 
    PC = 0xBB24; JUMP; // sstep
case 0xBB24:
                                                     mon("         LDB   $0D,X                   ; BB24: E6 0D         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x000d)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBB26; JUMP; // sstep
case 0xBB26:
                                                     mon("         CMPB  #$1F                    ; BB26: C1 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x1f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xBB28; JUMP; // sstep
case 0xBB28:
                                                     mon("         BLS   LBB2F                   ; BB28: 23 05         \n"); // Tie fighter hit colour cycle table
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xbb2f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBB2A; JUMP; // sstep
case 0xBB2A:
                                                     mon("         LDD   #$A018                  ; BB2A: CC A0 18      \n");
    clockticks = clockticks + 3; 
    A = 0xa0; 
    B = 0x18; 
    Z = A|B; 
    N = A; 
    V = 0; 
    // End of function sub_BB1E
    PC = 0xBB2D; JUMP; // sstep
case 0xBB2D:
                                                     mon("         BRA   LBB35                   ; BB2D: 20 06         \n");
    PC = 0xbb35; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Tie fighter hit colour cycle table
  case 0xBB2F:
                                                     mon("LBB2F    LDU   #word_BB3B              ; BB2F: CE BB 3B      \n");
    clockticks = clockticks + 3; 
    U = 0xbb3b; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBB32; JUMP; // sstep
case 0xBB32:
                                                     mon("         ASLB                          ; BB32: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBB33; JUMP; // sstep
case 0xBB33:
                                                     mon("         LDD   B,U                     ; BB33: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBB35; JUMP; // sstep
case 0xBB35:
                                                     mon("LBB35    STD   ,Y++                    ; BB35: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBB37; JUMP; // sstep
case 0xBB37:
                                                     mon("         JSR   LCCF0                   ; BB37: BD CC F0      \n"); // Get divider result and multiply by Math result Z, insert VCTR instruction
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = 0xccf0; 
    JUMP;
    // End of function sub_BB2F
    // ---------------------------------------------------------------------------
  case 0xBB3A:
                                                     mon("LBB3A    RTS                           ; BB3A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBB7B:
                                                     mon("LBB7B    LDA   #$01                    ; BB7B: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBB7D; JUMP; // sstep
case 0xBB7D:
                                                     mon("         STA   <$A1                    ; BB7D: 97 A1         \n"); // Death Star explosion state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xa1; 
    wr_mem(ea, val); 
    PC = 0xBB7F; JUMP; // sstep
case 0xBB7F:
                                                     mon("         LDD   #$01                    ; BB7F: CC 00 01      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBB82; JUMP; // sstep
case 0xBB82:
                                                     mon("         STD   <$9F                    ; BB82: DD 9F         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_BB7B
    PC = 0xBB84; JUMP; // sstep
case 0xBB84:
                                                     mon("         RTS                           ; BB84: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Death Star explosion animation
  case 0xBB85:
                                                     mon("LBB85    LDA   <$A1                    ; BB85: 96 A1         \n"); // Death Star explosion state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa1); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBB87; JUMP; // sstep
case 0xBB87:
                                                     mon("         ASLA                          ; BB87: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xBB88; JUMP; // sstep
case 0xBB88:
                                                     mon("         LDX   #off_BB8E               ; BB88: 8E BB 8E      \n");
    clockticks = clockticks + 3; 
    X = 0xbb8e; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBB8B; JUMP; // sstep
case 0xBB8B:
                                                     mon("         JSR   [A,X]                   ; BB8B: AD 96         \n");
    clockticks = clockticks + 3; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 2; 
    ea = rd_mem((UINT16)(X + (SINT8)A))<<8; 
    ea = ea | rd_mem((UINT16)((X + (SINT8)A) + 1)); 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = ea; 
    JUMP;
    // End of function sub_BB85
    // ---------------------------------------------------------------------------
  case 0xBB8D:
                                                     mon("locret_BB8D RTS                           ; BB8D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBB98:
                                                     mon("LBB98    LDD   #$6480                  ; BB98: CC 64 80      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBB9B; JUMP; // sstep
case 0xBB9B:
                                                     mon("         LDU   #$76F0                  ; BB9B: CE 76 F0      \n");
    clockticks = clockticks + 3; 
    U = 0x76f0; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBB9E; JUMP; // sstep
case 0xBB9E:
                                                     mon("         LDX   <$9F                    ; BB9E: 9E 9F         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x9f)<<8; 
    ea = ea | rd_mem(DP|0xa0); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBBA0; JUMP; // sstep
case 0xBBA0:
                                                     mon("         JSR   LBCAE                   ; BBA0: BD BC AE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = 0xbcae; 
    JUMP;
  case 0xBBA3:
                                                     mon("LBBA3    LDD   <$9F                    ; BBA3: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBBA5; JUMP; // sstep
case 0xBBA5:
                                                     mon("         ADDD  #$02                    ; BBA5: C3 00 02      \n");
    clockticks = clockticks + 4; 
    val = 0x0002; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBBA8; JUMP; // sstep
case 0xBBA8:
                                                     mon("         STD   <$9F                    ; BBA8: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBBAA; JUMP; // sstep
case 0xBBAA:
                                                     mon("         CMPD  #$3F                    ; BBAA: 10 83 00 3F   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x003f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBBAE; JUMP; // sstep
case 0xBBAE:
                                                     mon("         BCC   locret_BBBA             ; BBAE: 24 0A         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xbbba; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBBB0; JUMP; // sstep
case 0xBBB0:
                                                     mon("         LDD   #$01                    ; BBB0: CC 00 01      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBBB3; JUMP; // sstep
case 0xBBB3:
                                                     mon("         STD   <$9F                    ; BBB3: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBBB5; JUMP; // sstep
case 0xBBB5:
                                                     mon("         INC   <$A1                    ; BBB5: 0C A1         \n"); // Death Star explosion state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa1); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0xa1, res); 
    clockticks = clockticks + 2; 
    PC = 0xBBB7; JUMP; // sstep
case 0xBBB7:
                                                     mon("         JSR   Sound_27                ; BBB7: BD BD B7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = 0xbdb7; 
    JUMP;
    // End of function sub_BB98
  case 0xBBBA:
                                                     mon("locret_BBBA RTS                           ; BBBA: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBBBB:
                                                     mon("LBBBB    LDX   <$9F                    ; BBBB: 9E 9F         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x9f)<<8; 
    ea = ea | rd_mem(DP|0xa0); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBBBD; JUMP; // sstep
case 0xBBBD:
                                                     mon("         LDD   #$61FF                  ; BBBD: CC 61 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x61; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBBC0; JUMP; // sstep
case 0xBBC0:
                                                     mon("         LDU   #$76F0                  ; BBC0: CE 76 F0      \n");
    clockticks = clockticks + 3; 
    U = 0x76f0; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xBBC3; JUMP; // sstep
case 0xBBC3:
                                                     mon("         JSR   LBCAE                   ; BBC3: BD BC AE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = 0xbcae; 
    JUMP;
  case 0xBBC6:
                                                     mon("LBBC6    LDD   <$9F                    ; BBC6: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBBC8; JUMP; // sstep
case 0xBBC8:
                                                     mon("         ADDD  #$02                    ; BBC8: C3 00 02      \n");
    clockticks = clockticks + 4; 
    val = 0x0002; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBBCB; JUMP; // sstep
case 0xBBCB:
                                                     mon("         STD   <$9F                    ; BBCB: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBBCD; JUMP; // sstep
case 0xBBCD:
                                                     mon("         CMPD  #$3F                    ; BBCD: 10 83 00 3F   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x003f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBBD1; JUMP; // sstep
case 0xBBD1:
                                                     mon("         BCC   LBC0B                   ; BBD1: 24 38         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xbc0b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBBD3; JUMP; // sstep
case 0xBBD3:
                                                     mon("         LDB   #$3F                    ; BBD3: C6 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3f; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBBD5; JUMP; // sstep
case 0xBBD5:
                                                     mon("         SUBB  <$A0                    ; BBD5: D0 A0         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(DP|0xa0); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xBBD7; JUMP; // sstep
case 0xBBD7:
                                                     mon("         CLRA                          ; BBD7: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBBD8; JUMP; // sstep
case 0xBBD8:
                                                     mon("         TFR   D,X                     ; BBD8: 1F 01         \n");
    X = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBBDA; JUMP; // sstep
case 0xBBDA:
                                                     mon("         LDD   #$64FF                  ; BBDA: CC 64 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBBDD; JUMP; // sstep
case 0xBBDD:
                                                     mon("         JSR   LBCAE                   ; BBDD: BD BC AE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    PC = 0xbcae; 
    JUMP;
  case 0xBBE0:
                                                     mon("LBBE0    LDD   <$9F                    ; BBE0: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBBE2; JUMP; // sstep
case 0xBBE2:
                                                     mon("         ASLB                          ; BBE2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBBE3; JUMP; // sstep
case 0xBBE3:
                                                     mon("         ROLA                          ; BBE3: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xBBE4; JUMP; // sstep
case 0xBBE4:
                                                     mon("         ASLB                          ; BBE4: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBBE5; JUMP; // sstep
case 0xBBE5:
                                                     mon("         ROLA                          ; BBE5: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xBBE6; JUMP; // sstep
case 0xBBE6:
                                                     mon("         ASLB                          ; BBE6: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBBE7; JUMP; // sstep
case 0xBBE7:
                                                     mon("         ROLA                          ; BBE7: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xBBE8; JUMP; // sstep
case 0xBBE8:
                                                     mon("         COMA                          ; BBE8: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xBBE9; JUMP; // sstep
case 0xBBE9:
                                                     mon("         COMB                          ; BBE9: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
    Z = val; 
    N = val; 
    V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xBBEA; JUMP; // sstep
case 0xBBEA:
                                                     mon("         BMI   LBBEF                   ; BBEA: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xbbef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBBEC; JUMP; // sstep
case 0xBBEC:
                                                     mon("         DECA                          ; BBEC: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xBBED; JUMP; // sstep
case 0xBBED:
                                                     mon("         ORB   #$80                    ; BBED: CA 80         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x80; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBBEF; JUMP; // sstep
case 0xBBEF:
                                                     mon("LBBEF    ADDD  #$7670                  ; BBEF: C3 76 70      \n");
    clockticks = clockticks + 4; 
    val = 0x7670; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBBF2; JUMP; // sstep
case 0xBBF2:
                                                     mon("         TSTB                          ; BBF2: 5D            \n");
    val = (UINT8)B; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBBF3; JUMP; // sstep
case 0xBBF3:
                                                     mon("         BMI   LBBF8                   ; BBF3: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xbbf8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBBF5; JUMP; // sstep
case 0xBBF5:
                                                     mon("         DECA                          ; BBF5: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xBBF6; JUMP; // sstep
case 0xBBF6:
                                                     mon("         ANDB  #$7F                    ; BBF6: C4 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x7f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBBF8; JUMP; // sstep
case 0xBBF8:
                                                     mon("LBBF8    TFR   D,U                     ; BBF8: 1F 03         \n");
    U = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBBFA; JUMP; // sstep
case 0xBBFA:
                                                     mon("         LDD   <$9F                    ; BBFA: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBBFC; JUMP; // sstep
case 0xBBFC:
                                                     mon("         LSRB                          ; BBFC: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBBFD; JUMP; // sstep
case 0xBBFD:
                                                     mon("         LSRB                          ; BBFD: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBBFE; JUMP; // sstep
case 0xBBFE:
                                                     mon("         ANDB  #$07                    ; BBFE: C4 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x07; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC00; JUMP; // sstep
case 0xBC00:
                                                     mon("         EORB  #$07                    ; BC00: C8 07         \n");
    clockticks = clockticks + 2; 
    res = B ^ (SINT8)0x07; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC02; JUMP; // sstep
case 0xBC02:
                                                     mon("         INCB                          ; BC02: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC03; JUMP; // sstep
case 0xBC03:
                                                     mon("         TFR   D,X                     ; BC03: 1F 01         \n");
    X = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBC05; JUMP; // sstep
case 0xBC05:
                                                     mon("         LDD   #$64FF                  ; BC05: CC 64 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBC08; JUMP; // sstep
case 0xBC08:
                                                     mon("         JSR   LBCC8                   ; BC08: BD BC C8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbcc8; 
    JUMP;
  case 0xBC0B:
                                                     mon("LBC0B    LDD   <$9F                    ; BC0B: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC0D; JUMP; // sstep
case 0xBC0D:
                                                     mon("         CMPD  #$3F                    ; BC0D: 10 83 00 3F   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x003f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBC11; JUMP; // sstep
case 0xBC11:
                                                     mon("         BCS   locret_BC1D             ; BC11: 25 0A         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbc1d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC13; JUMP; // sstep
case 0xBC13:
                                                     mon("         LDD   #$01                    ; BC13: CC 00 01      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC16; JUMP; // sstep
case 0xBC16:
                                                     mon("         STD   <$9F                    ; BC16: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBC18; JUMP; // sstep
case 0xBC18:
                                                     mon("         INC   <$A1                    ; BC18: 0C A1         \n"); // Death Star explosion state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa1); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0xa1, res); 
    clockticks = clockticks + 2; 
    PC = 0xBC1A; JUMP; // sstep
case 0xBC1A:
                                                     mon("         JSR   Sound_27                ; BC1A: BD BD B7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbdb7; 
    JUMP;
    // End of function sub_BBBB
  case 0xBC1D:
                                                     mon("locret_BC1D RTS                           ; BC1D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBC1E:
                                                     mon("LBC1E    LDX   <$9F                    ; BC1E: 9E 9F         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x9f)<<8; 
    ea = ea | rd_mem(DP|0xa0); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBC20; JUMP; // sstep
case 0xBC20:
                                                     mon("         LDD   #$67FF                  ; BC20: CC 67 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC23; JUMP; // sstep
case 0xBC23:
                                                     mon("         LDU   #$7670                  ; BC23: CE 76 70      \n");
    clockticks = clockticks + 3; 
    U = 0x7670; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xBC26; JUMP; // sstep
case 0xBC26:
                                                     mon("         JSR   LBCAE                   ; BC26: BD BC AE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbcae; 
    JUMP;
  case 0xBC29:
                                                     mon("LBC29    LDD   <$9F                    ; BC29: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC2B; JUMP; // sstep
case 0xBC2B:
                                                     mon("         ADDD  #$03                    ; BC2B: C3 00 03      \n");
    clockticks = clockticks + 4; 
    val = 0x0003; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBC2E; JUMP; // sstep
case 0xBC2E:
                                                     mon("         STD   <$9F                    ; BC2E: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBC30; JUMP; // sstep
case 0xBC30:
                                                     mon("         CMPD  #$3F                    ; BC30: 10 83 00 3F   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x003f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBC34; JUMP; // sstep
case 0xBC34:
                                                     mon("         BCC   LBC43                   ; BC34: 24 0D         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xbc43; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC36; JUMP; // sstep
case 0xBC36:
                                                     mon("         LDB   #$3F                    ; BC36: C6 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3f; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBC38; JUMP; // sstep
case 0xBC38:
                                                     mon("         SUBB  <$A0                    ; BC38: D0 A0         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(DP|0xa0); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xBC3A; JUMP; // sstep
case 0xBC3A:
                                                     mon("         CLRA                          ; BC3A: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBC3B; JUMP; // sstep
case 0xBC3B:
                                                     mon("         TFR   D,X                     ; BC3B: 1F 01         \n");
    X = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBC3D; JUMP; // sstep
case 0xBC3D:
                                                     mon("         LDD   #$61FF                  ; BC3D: CC 61 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x61; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBC40; JUMP; // sstep
case 0xBC40:
                                                     mon("         JSR   LBCAE                   ; BC40: BD BC AE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x43); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbcae; 
    JUMP;
  case 0xBC43:
                                                     mon("LBC43    LDD   <$9F                    ; BC43: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC45; JUMP; // sstep
case 0xBC45:
                                                     mon("         CMPD  #$3F                    ; BC45: 10 83 00 3F   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x003f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBC49; JUMP; // sstep
case 0xBC49:
                                                     mon("         BCC   LBC72                   ; BC49: 24 27         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xbc72; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC4B; JUMP; // sstep
case 0xBC4B:
                                                     mon("         ASLB                          ; BC4B: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC4C; JUMP; // sstep
case 0xBC4C:
                                                     mon("         ROLA                          ; BC4C: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xBC4D; JUMP; // sstep
case 0xBC4D:
                                                     mon("         ASLB                          ; BC4D: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC4E; JUMP; // sstep
case 0xBC4E:
                                                     mon("         ROLA                          ; BC4E: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xBC4F; JUMP; // sstep
case 0xBC4F:
                                                     mon("         ASLB                          ; BC4F: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC50; JUMP; // sstep
case 0xBC50:
                                                     mon("         ROLA                          ; BC50: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xBC51; JUMP; // sstep
case 0xBC51:
                                                     mon("         COMA                          ; BC51: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xBC52; JUMP; // sstep
case 0xBC52:
                                                     mon("         COMB                          ; BC52: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
    Z = val; 
    N = val; 
    V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xBC53; JUMP; // sstep
case 0xBC53:
                                                     mon("         BMI   LBC58                   ; BC53: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xbc58; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC55; JUMP; // sstep
case 0xBC55:
                                                     mon("         DECA                          ; BC55: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC56; JUMP; // sstep
case 0xBC56:
                                                     mon("         ORB   #$80                    ; BC56: CA 80         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x80; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC58; JUMP; // sstep
case 0xBC58:
                                                     mon("LBC58    ADDD  #$7670                  ; BC58: C3 76 70      \n");
    clockticks = clockticks + 4; 
    val = 0x7670; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBC5B; JUMP; // sstep
case 0xBC5B:
                                                     mon("         TSTB                          ; BC5B: 5D            \n");
    val = (UINT8)B; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBC5C; JUMP; // sstep
case 0xBC5C:
                                                     mon("         BMI   LBC61                   ; BC5C: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xbc61; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC5E; JUMP; // sstep
case 0xBC5E:
                                                     mon("         DECA                          ; BC5E: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC5F; JUMP; // sstep
case 0xBC5F:
                                                     mon("         ANDB  #$7F                    ; BC5F: C4 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x7f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC61; JUMP; // sstep
case 0xBC61:
                                                     mon("LBC61    TFR   D,U                     ; BC61: 1F 03         \n");
    U = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBC63; JUMP; // sstep
case 0xBC63:
                                                     mon("         LDD   <$9F                    ; BC63: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC65; JUMP; // sstep
case 0xBC65:
                                                     mon("         ANDB  #$0F                    ; BC65: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC67; JUMP; // sstep
case 0xBC67:
                                                     mon("         EORB  #$0F                    ; BC67: C8 0F         \n");
    clockticks = clockticks + 2; 
    res = B ^ (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC69; JUMP; // sstep
case 0xBC69:
                                                     mon("         INCB                          ; BC69: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC6A; JUMP; // sstep
case 0xBC6A:
                                                     mon("         TFR   D,X                     ; BC6A: 1F 01         \n");
    X = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBC6C; JUMP; // sstep
case 0xBC6C:
                                                     mon("         LDD   #$61FF                  ; BC6C: CC 61 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x61; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBC6F; JUMP; // sstep
case 0xBC6F:
                                                     mon("         JSR   LBCC8                   ; BC6F: BD BC C8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbcc8; 
    JUMP;
  case 0xBC72:
                                                     mon("LBC72    LDD   <$9F                    ; BC72: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC74; JUMP; // sstep
case 0xBC74:
                                                     mon("         CMPD  #$50                    ; BC74: 10 83 00 50   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0050; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBC78; JUMP; // sstep
case 0xBC78:
                                                     mon("         BCS   locret_BC84             ; BC78: 25 0A         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbc84; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC7A; JUMP; // sstep
case 0xBC7A:
                                                     mon("         LDD   #$80                    ; BC7A: CC 00 80      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC7D; JUMP; // sstep
case 0xBC7D:
                                                     mon("         STD   <$9F                    ; BC7D: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBC7F; JUMP; // sstep
case 0xBC7F:
                                                     mon("         INC   <$A1                    ; BC7F: 0C A1         \n"); // Death Star explosion state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa1); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0xa1, res); 
    clockticks = clockticks + 2; 
    PC = 0xBC81; JUMP; // sstep
case 0xBC81:
                                                     mon("         JSR   Sound_27                ; BC81: BD BD B7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbdb7; 
    JUMP;
    // End of function sub_BC1E
  case 0xBC84:
                                                     mon("locret_BC84 RTS                           ; BC84: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBC85:
                                                     mon("LBC85    LDD   <$9F                    ; BC85: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC87; JUMP; // sstep
case 0xBC87:
                                                     mon("         SUBD  #$04                    ; BC87: 83 00 04      \n");
    clockticks = clockticks + 4; 
    val = 0x0004; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xBC8A; JUMP; // sstep
case 0xBC8A:
                                                     mon("         STD   <$9F                    ; BC8A: DD 9F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x9f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xBC8C; JUMP; // sstep
case 0xBC8C:
                                                     mon("         CMPD  #$08                    ; BC8C: 10 83 00 08   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0008; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBC90; JUMP; // sstep
case 0xBC90:
                                                     mon("         BCS   LBCA9                   ; BC90: 25 17         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbca9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBC92; JUMP; // sstep
case 0xBC92:
                                                     mon("         ADDD  #$7500                  ; BC92: C3 75 00      \n");
    clockticks = clockticks + 4; 
    val = 0x7500; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xBC95; JUMP; // sstep
case 0xBC95:
                                                     mon("         TFR   D,U                     ; BC95: 1F 03         \n");
    U = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBC97; JUMP; // sstep
case 0xBC97:
                                                     mon("         LDD   <$9F                    ; BC97: DC 9F         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x9f); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xa0); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBC99; JUMP; // sstep
case 0xBC99:
                                                     mon("         LSRA                          ; BC99: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBC9A; JUMP; // sstep
case 0xBC9A:
                                                     mon("         RORB                          ; BC9A: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBC9B; JUMP; // sstep
case 0xBC9B:
                                                     mon("         ANDB  #$3F                    ; BC9B: C4 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x3f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC9D; JUMP; // sstep
case 0xBC9D:
                                                     mon("         EORB  #$3F                    ; BC9D: C8 3F         \n");
    clockticks = clockticks + 2; 
    res = B ^ (SINT8)0x3f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBC9F; JUMP; // sstep
case 0xBC9F:
                                                     mon("         TFR   D,X                     ; BC9F: 1F 01         \n");
    X = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBCA1; JUMP; // sstep
case 0xBCA1:
                                                     mon("         LDD   #$67FF                  ; BCA1: CC 67 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBCA4; JUMP; // sstep
case 0xBCA4:
                                                     mon("         JSR   LBCC8                   ; BCA4: BD BC C8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    PC = 0xbcc8; 
    JUMP;
  case 0xBCA7:
                                                     mon("LBCA7    BRA   locret_BCAD             ; BCA7: 20 04         \n");
    PC = 0xbcad; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBCA9:
                                                     mon("LBCA9    LDA   #$00                    ; BCA9: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBCAB; JUMP; // sstep
case 0xBCAB:
                                                     mon("         STA   <$A1                    ; BCAB: 97 A1         \n"); // Death Star explosion state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xa1; 
    wr_mem(ea, val); 
    // End of function sub_BC85
    PC = 0xBCAD; JUMP; // sstep
case 0xBCAD:
                                                     mon("locret_BCAD RTS                           ; BCAD: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBCAE:
                                                     mon("LBCAE    STD   ,Y++                    ; BCAE: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCB0; JUMP; // sstep
case 0xBCB0:
                                                     mon("LBCB0    LDD   #$1F98                  ; BCB0: CC 1F 98      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBCB3; JUMP; // sstep
case 0xBCB3:
                                                     mon("         STD   ,Y++                    ; BCB3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCB5; JUMP; // sstep
case 0xBCB5:
                                                     mon("         LDD   #$00                    ; BCB5: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBCB8; JUMP; // sstep
case 0xBCB8:
                                                     mon("         STD   ,Y++                    ; BCB8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCBA; JUMP; // sstep
case 0xBCBA:
                                                     mon("         STU   ,Y++                    ; BCBA: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xBCBC; JUMP; // sstep
case 0xBCBC:
                                                     mon("         LDD   #$BD69                  ; BCBC: CC BD 69      \n");
    clockticks = clockticks + 3; 
    A = 0xbd; 
    B = 0x69; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBCBF; JUMP; // sstep
case 0xBCBF:
                                                     mon("         STD   ,Y++                    ; BCBF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCC1; JUMP; // sstep
case 0xBCC1:
                                                     mon("         LEAU  -2,U                    ; BCC1: 33 5E         \n");
    clockticks = clockticks + 5; 
    U = (U + 0xfffe); 
    PC = 0xBCC3; JUMP; // sstep
case 0xBCC3:
                                                     mon("         LEAX  -1,X                    ; BCC3: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xBCC5; JUMP; // sstep
case 0xBCC5:
                                                     mon("         BNE   LBCB0                   ; BCC5: 26 E9         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xbcb0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_BCAE
    PC = 0xBCC7; JUMP; // sstep
case 0xBCC7:
                                                     mon("         RTS                           ; BCC7: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBCC8:
                                                     mon("LBCC8    STD   ,Y++                    ; BCC8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCCA; JUMP; // sstep
case 0xBCCA:
                                                     mon("LBCCA    LDD   #$1F98                  ; BCCA: CC 1F 98      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBCCD; JUMP; // sstep
case 0xBCCD:
                                                     mon("         STD   ,Y++                    ; BCCD: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCCF; JUMP; // sstep
case 0xBCCF:
                                                     mon("         LDD   #$00                    ; BCCF: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBCD2; JUMP; // sstep
case 0xBCD2:
                                                     mon("         STD   ,Y++                    ; BCD2: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCD4; JUMP; // sstep
case 0xBCD4:
                                                     mon("         STU   ,Y++                    ; BCD4: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xBCD6; JUMP; // sstep
case 0xBCD6:
                                                     mon("         LDD   #$BD69                  ; BCD6: CC BD 69      \n");
    clockticks = clockticks + 3; 
    A = 0xbd; 
    B = 0x69; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBCD9; JUMP; // sstep
case 0xBCD9:
                                                     mon("         STD   ,Y++                    ; BCD9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBCDB; JUMP; // sstep
case 0xBCDB:
                                                     mon("         TFR   U,D                     ; BCDB: 1F 30         \n");
    val = U; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xBCDD; JUMP; // sstep
case 0xBCDD:
                                                     mon("         SUBD  #$04                    ; BCDD: 83 00 04      \n");
    clockticks = clockticks + 4; 
    val = 0x0004; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xBCE0; JUMP; // sstep
case 0xBCE0:
                                                     mon("         ANDB  #$7F                    ; BCE0: C4 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x7f; 
    B = res; 
/**/Z = res; 
    N = res; 
    V = 0; 
    PC = 0xBCE2; JUMP; // sstep
case 0xBCE2:
                                                     mon("         TFR   D,U                     ; BCE2: 1F 03         \n");
    U = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xBCE4; JUMP; // sstep
case 0xBCE4:
                                                     mon("         LEAX  -1,X                    ; BCE4: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xBCE6; JUMP; // sstep
case 0xBCE6:
                                                     mon("         BNE   LBCCA                   ; BCE6: 26 E2         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xbcca; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_BCC8
    PC = 0xBCE8; JUMP; // sstep
case 0xBCE8:
                                                     mon("         RTS                           ; BCE8: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR Sound_3
  case 0xBCE9:
                                                     mon("Write_Sound LDB   #$0E                    ; BCE9: C6 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBCEB; JUMP; // sstep
case 0xBCEB:
                                                     mon("LBCEB    TST   $4401                   ; BCEB: 7D 44 01      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4401); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBCEE; JUMP; // sstep
case 0xBCEE:
                                                     mon("         BPL   LBCF5                   ; BCEE: 2A 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xbcf5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBCF0; JUMP; // sstep
case 0xBCF0:
                                                     mon("         DECB                          ; BCF0: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBCF1; JUMP; // sstep
case 0xBCF1:
                                                     mon("         BNE   LBCEB                   ; BCF1: 26 F8         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xbceb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBCF3; JUMP; // sstep
case 0xBCF3:
                                                     mon("         LDA   #$00                    ; BCF3: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBCF5; JUMP; // sstep
case 0xBCF5:
                                                     mon("LBCF5    STA   $4400                   ; BCF5: B7 44 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4400, val); 
    // END OF FUNCTION CHUNK FOR Sound_3
    PC = 0xBCF8; JUMP; // sstep
case 0xBCF8:
                                                     mon("         RTS                           ; BCF8: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBCF9:
                                                     mon("Sound_1  LDA   #$01                    ; BCF9: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1
    PC = 0xBCFB; JUMP; // sstep
case 0xBCFB:
                                                     mon("         JMP   Write_Sound             ; BCFB: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBCFE:
                                                     mon("Sound_2  LDA   #$02                    ; BCFE: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2
    PC = 0xBD00; JUMP; // sstep
case 0xBD00:
                                                     mon("         JMP   Write_Sound             ; BD00: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
    // FUNCTION CHUNK AT ROM:BCE9 SIZE 00000010 BYTES
  case 0xBD03:
                                                     mon("LBD03    LDA   #$03                    ; BD03: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_3
    PC = 0xBD05; JUMP; // sstep
case 0xBD05:
                                                     mon("         JMP   Write_Sound             ; BD05: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD08:
                                                     mon("Sound_4  LDA   #$04                    ; BD08: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_4
    PC = 0xBD0A; JUMP; // sstep
case 0xBD0A:
                                                     mon("         JMP   Write_Sound             ; BD0A: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD0D:
                                                     mon("Sound_5  LDA   #$05                    ; BD0D: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_5
    PC = 0xBD0F; JUMP; // sstep
case 0xBD0F:
                                                     mon("         JMP   Write_Sound             ; BD0F: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD12:
                                                     mon("Sound_6  LDA   #$06                    ; BD12: 86 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_6
    PC = 0xBD14; JUMP; // sstep
case 0xBD14:
                                                     mon("         JMP   Write_Sound             ; BD14: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD17:
                                                     mon("Sound_7  LDA   #$07                    ; BD17: 86 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_7
    PC = 0xBD19; JUMP; // sstep
case 0xBD19:
                                                     mon("         JMP   Write_Sound             ; BD19: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD1C:
                                                     mon("Sound_8  LDA   #$08                    ; BD1C: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_8
    PC = 0xBD1E; JUMP; // sstep
case 0xBD1E:
                                                     mon("         JMP   Write_Sound             ; BD1E: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD21:
                                                     mon("Sound_9  LDA   #$09                    ; BD21: 86 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_9
    PC = 0xBD23; JUMP; // sstep
case 0xBD23:
                                                     mon("         JMP   Write_Sound             ; BD23: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD26:
                                                     mon("Sound_A  LDA   #$0A                    ; BD26: 86 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0a; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_A
    PC = 0xBD28; JUMP; // sstep
case 0xBD28:
                                                     mon("         JMP   Write_Sound             ; BD28: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD2B:
                                                     mon("Sound_B  LDA   #$0B                    ; BD2B: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_B
    PC = 0xBD2D; JUMP; // sstep
case 0xBD2D:
                                                     mon("         JMP   Write_Sound             ; BD2D: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD30:
                                                     mon("Sound_C  LDA   #$0C                    ; BD30: 86 0C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_C
    PC = 0xBD32; JUMP; // sstep
case 0xBD32:
                                                     mon("         JMP   Write_Sound             ; BD32: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD35:
                                                     mon("Sound_D  LDA   #$0D                    ; BD35: 86 0D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0d; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_D
    PC = 0xBD37; JUMP; // sstep
case 0xBD37:
                                                     mon("         JMP   Write_Sound             ; BD37: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD3A:
                                                     mon("Sound_E  LDA   #$0E                    ; BD3A: 86 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_E
    PC = 0xBD3C; JUMP; // sstep
case 0xBD3C:
                                                     mon("         JMP   Write_Sound             ; BD3C: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD3F:
                                                     mon("Sound_F  LDA   #$0F                    ; BD3F: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_F
    PC = 0xBD41; JUMP; // sstep
case 0xBD41:
                                                     mon("         JMP   Write_Sound             ; BD41: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD44:
                                                     mon("Sound_10 LDA   #$10                    ; BD44: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_10
    PC = 0xBD46; JUMP; // sstep
case 0xBD46:
                                                     mon("         JMP   Write_Sound             ; BD46: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Remember
  case 0xBD49:
                                                     mon("Sound_11 LDA   #$11                    ; BD49: 86 11         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x11; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_11
    PC = 0xBD4B; JUMP; // sstep
case 0xBD4B:
                                                     mon("         JMP   Write_Sound             ; BD4B: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD4E:
                                                     mon("Sound_12 LDA   #$12                    ; BD4E: 86 12         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x12; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_12
    PC = 0xBD50; JUMP; // sstep
case 0xBD50:
                                                     mon("         JMP   Write_Sound             ; BD50: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Look at the size of that thing
  case 0xBD53:
                                                     mon("Sound_13 LDA   #$13                    ; BD53: 86 13         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x13; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_13
    PC = 0xBD55; JUMP; // sstep
case 0xBD55:
                                                     mon("         JMP   Write_Sound             ; BD55: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Stay in attack formation
  case 0xBD58:
                                                     mon("Sound_14 LDA   #$14                    ; BD58: 86 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x14; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_14
    PC = 0xBD5A; JUMP; // sstep
case 0xBD5A:
                                                     mon("         JMP   Write_Sound             ; BD5A: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD5D:
                                                     mon("Sound_15 LDA   #$15                    ; BD5D: 86 15         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x15; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_15
    PC = 0xBD5F; JUMP; // sstep
case 0xBD5F:
                                                     mon("         JMP   Write_Sound             ; BD5F: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Force is strong in this one
  case 0xBD62:
                                                     mon("Sound_16 LDA   #$16                    ; BD62: 86 16         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x16; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_16
    PC = 0xBD64; JUMP; // sstep
case 0xBD64:
                                                     mon("         JMP   Write_Sound             ; BD64: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Red 5 Im going in
  case 0xBD67:
                                                     mon("Sound_17 LDA   #$17                    ; BD67: 86 17         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x17; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_17
    PC = 0xBD69; JUMP; // sstep
case 0xBD69:
                                                     mon("         JMP   Write_Sound             ; BD69: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Luke trust me
  case 0xBD6C:
                                                     mon("Sound_18 LDA   #$18                    ; BD6C: 86 18         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x18; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_18
    PC = 0xBD6E; JUMP; // sstep
case 0xBD6E:
                                                     mon("         JMP   Write_Sound             ; BD6E: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD71:
                                                     mon("Sound_19 LDA   #$19                    ; BD71: 86 19         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x19; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_19
    PC = 0xBD73; JUMP; // sstep
case 0xBD73:
                                                     mon("         JMP   Write_Sound             ; BD73: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Yahoo youre all clear kid
  case 0xBD76:
                                                     mon("Sound_1A LDA   #$1A                    ; BD76: 86 1A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1a; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1A
    PC = 0xBD78; JUMP; // sstep
case 0xBD78:
                                                     mon("         JMP   Write_Sound             ; BD78: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // High score
  case 0xBD7B:
                                                     mon("Sound_1B LDA   #$1B                    ; BD7B: 86 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1B
    PC = 0xBD7D; JUMP; // sstep
case 0xBD7D:
                                                     mon("         JMP   Write_Sound             ; BD7D: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBD80:
                                                     mon("Sound_1C LDA   #$1C                    ; BD80: 86 1C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1C
    PC = 0xBD82; JUMP; // sstep
case 0xBD82:
                                                     mon("         JMP   Write_Sound             ; BD82: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Imperial March
  case 0xBD85:
                                                     mon("Sound_1D LDA   #$1D                    ; BD85: 86 1D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1d; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1D
    PC = 0xBD87; JUMP; // sstep
case 0xBD87:
                                                     mon("         JMP   Write_Sound             ; BD87: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Enter Death Star
  case 0xBD8A:
                                                     mon("Sound_1E LDA   #$1E                    ; BD8A: 86 1E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1E
    PC = 0xBD8C; JUMP; // sstep
case 0xBD8C:
                                                     mon("         JMP   Write_Sound             ; BD8C: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Death Star destroyed
  case 0xBD8F:
                                                     mon("Sound_1F LDA   #$1F                    ; BD8F: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_1F
    PC = 0xBD91; JUMP; // sstep
case 0xBD91:
                                                     mon("         JMP   Write_Sound             ; BD91: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Towers 1 music
  case 0xBD94:
                                                     mon("Sound_20 LDA   #$20                    ; BD94: 86 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_20
    PC = 0xBD96; JUMP; // sstep
case 0xBD96:
                                                     mon("         JMP   Write_Sound             ; BD96: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Towers 2 music
  case 0xBD99:
                                                     mon("Sound_21 LDA   #$21                    ; BD99: 86 21         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x21; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_21
    PC = 0xBD9B; JUMP; // sstep
case 0xBD9B:
                                                     mon("         JMP   Write_Sound             ; BD9B: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench music
  case 0xBD9E:
                                                     mon("Sound_22 LDA   #$22                    ; BD9E: 86 22         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x22; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_22
    PC = 0xBDA0; JUMP; // sstep
case 0xBDA0:
                                                     mon("         JMP   Write_Sound             ; BDA0: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDA3:
                                                     mon("Sound_23 LDA   #$23                    ; BDA3: 86 23         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x23; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_23
    PC = 0xBDA5; JUMP; // sstep
case 0xBDA5:
                                                     mon("         JMP   Write_Sound             ; BDA5: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Space wave 1 music
  case 0xBDA8:
                                                     mon("Sound_24 LDA   #$24                    ; BDA8: 86 24         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x24; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_24
    PC = 0xBDAA; JUMP; // sstep
case 0xBDAA:
                                                     mon("         JMP   Write_Sound             ; BDAA: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Space Wave 2 music
  case 0xBDAD:
                                                     mon("Sound_25 LDA   #$25                    ; BDAD: 86 25         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x25; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_25
    PC = 0xBDAF; JUMP; // sstep
case 0xBDAF:
                                                     mon("         JMP   Write_Sound             ; BDAF: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Explosion
  case 0xBDB2:
                                                     mon("Sound_26 LDA   #$26                    ; BDB2: 86 26         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x26; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_26
    PC = 0xBDB4; JUMP; // sstep
case 0xBDB4:
                                                     mon("         JMP   Write_Sound             ; BDB4: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDB7:
                                                     mon("Sound_27 LDA   #$27                    ; BDB7: 86 27         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x27; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_27
    PC = 0xBDB9; JUMP; // sstep
case 0xBDB9:
                                                     mon("         JMP   Write_Sound             ; BDB9: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDBC:
                                                     mon("Sound_28 LDA   #$28                    ; BDBC: 86 28         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x28; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_28
    PC = 0xBDBE; JUMP; // sstep
case 0xBDBE:
                                                     mon("         JMP   Write_Sound             ; BDBE: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDC1:
                                                     mon("Sound_29 LDA   #$29                    ; BDC1: 86 29         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x29; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_29
    PC = 0xBDC3; JUMP; // sstep
case 0xBDC3:
                                                     mon("         JMP   Write_Sound             ; BDC3: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDC6:
                                                     mon("Sound_2A LDA   #$2A                    ; BDC6: 86 2A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2a; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2A
    PC = 0xBDC8; JUMP; // sstep
case 0xBDC8:
                                                     mon("         JMP   Write_Sound             ; BDC8: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDCB:
                                                     mon("Sound_2B LDA   #$2B                    ; BDCB: 86 2B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2B
    PC = 0xBDCD; JUMP; // sstep
case 0xBDCD:
                                                     mon("         JMP   Write_Sound             ; BDCD: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDD0:
                                                     mon("Sound_2C LDA   #$2C                    ; BDD0: 86 2C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2C
    PC = 0xBDD2; JUMP; // sstep
case 0xBDD2:
                                                     mon("         JMP   Write_Sound             ; BDD2: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDD5:
                                                     mon("LBDD5    LDA   #$2D                    ; BDD5: 86 2D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2d; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2D
    PC = 0xBDD7; JUMP; // sstep
case 0xBDD7:
                                                     mon("         JMP   Write_Sound             ; BDD7: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDDA:
                                                     mon("Sound_2E LDA   #$2E                    ; BDDA: 86 2E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2E
    PC = 0xBDDC; JUMP; // sstep
case 0xBDDC:
                                                     mon("         JMP   Write_Sound             ; BDDC: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDDF:
                                                     mon("Sound_2F LDA   #$2F                    ; BDDF: 86 2F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_2F
    PC = 0xBDE1; JUMP; // sstep
case 0xBDE1:
                                                     mon("         JMP   Write_Sound             ; BDE1: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDE4:
                                                     mon("Sound_30 LDA   #$30                    ; BDE4: 86 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x30; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_30
    PC = 0xBDE6; JUMP; // sstep
case 0xBDE6:
                                                     mon("         JMP   Write_Sound             ; BDE6: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDE9:
                                                     mon("Sound_31 LDA   #$31                    ; BDE9: 86 31         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x31; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_31
    PC = 0xBDEB; JUMP; // sstep
case 0xBDEB:
                                                     mon("         JMP   Write_Sound             ; BDEB: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // R2 beeps entering Death Star
  case 0xBDEE:
                                                     mon("Sound_32 LDA   #$32                    ; BDEE: 86 32         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x32; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_32
    PC = 0xBDF0; JUMP; // sstep
case 0xBDF0:
                                                     mon("         JMP   Write_Sound             ; BDF0: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDF3:
                                                     mon("Sound_33 LDA   #$33                    ; BDF3: 86 33         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x33; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_33
    PC = 0xBDF5; JUMP; // sstep
case 0xBDF5:
                                                     mon("         JMP   Write_Sound             ; BDF5: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDF8:
                                                     mon("LBDF8    LDA   #$34                    ; BDF8: 86 34         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x34; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_34
    PC = 0xBDFA; JUMP; // sstep
case 0xBDFA:
                                                     mon("         JMP   Write_Sound             ; BDFA: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBDFD:
                                                     mon("Sound_35 LDA   #$35                    ; BDFD: 86 35         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x35; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_35
    PC = 0xBDFF; JUMP; // sstep
case 0xBDFF:
                                                     mon("         JMP   Write_Sound             ; BDFF: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBE02:
                                                     mon("Sound_36 LDA   #$36                    ; BE02: 86 36         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x36; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_36
    PC = 0xBE04; JUMP; // sstep
case 0xBE04:
                                                     mon("         JMP   Write_Sound             ; BE04: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBE07:
                                                     mon("Sound_37 LDA   #$37                    ; BE07: 86 37         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x37; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_37
    PC = 0xBE09; JUMP; // sstep
case 0xBE09:
                                                     mon("         JMP   Write_Sound             ; BE09: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBE0C:
                                                     mon("Sound_38 LDA   #$38                    ; BE0C: 86 38         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x38; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_38
    PC = 0xBE0E; JUMP; // sstep
case 0xBE0E:
                                                     mon("         JMP   Write_Sound             ; BE0E: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBE11:
                                                     mon("Sound_39 LDA   #$39                    ; BE11: 86 39         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x39; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_39
    PC = 0xBE13; JUMP; // sstep
case 0xBE13:
                                                     mon("         JMP   Write_Sound             ; BE13: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBE16:
                                                     mon("LBE16    LDA   #$3A                    ; BE16: 86 3A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3a; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_3A
    PC = 0xBE18; JUMP; // sstep
case 0xBE18:
                                                     mon("         JMP   Write_Sound             ; BE18: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xBE1B:
                                                     mon("Sound_3B LDA   #$3B                    ; BE1B: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function Sound_3B
    PC = 0xBE1D; JUMP; // sstep
case 0xBE1D:
                                                     mon("         JMP   Write_Sound             ; BE1D: 7E BC E9      \n");
    clockticks = clockticks + 4; 
    PC = 0xbce9; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Display accounting screen
  case 0xBE20:
                                                     mon("LBE20    LDA   #$59                    ; BE20: 86 59         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x59; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBE22; JUMP; // sstep
case 0xBE22:
                                                     mon("LBE22    JSR   LD8DF                   ; BE22: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x25); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0xBE25:
                                                     mon("LBE25    INCA                          ; BE25: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xBE26; JUMP; // sstep
case 0xBE26:
                                                     mon("         CMPA  #$65                    ; BE26: 81 65         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x65; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xBE28; JUMP; // sstep
case 0xBE28:
                                                     mon("         BCS   LBE22                   ; BE28: 25 F8         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbe22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBE2A; JUMP; // sstep
case 0xBE2A:
                                                     mon("         LDA   #$D3                    ; BE2A: 86 D3         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xd3; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBE2C; JUMP; // sstep
case 0xBE2C:
                                                     mon("         JSR   LD8DF                   ; BE2C: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0xBE2F:
                                                     mon("LBE2F    LDD   #$6480                  ; BE2F: CC 64 80      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE32; JUMP; // sstep
case 0xBE32:
                                                     mon("         STD   ,Y++                    ; BE32: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE34; JUMP; // sstep
case 0xBE34:
                                                     mon("         LDX   #$453C                  ; BE34: 8E 45 3C      \n");
    clockticks = clockticks + 3; 
    X = 0x453c; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBE37; JUMP; // sstep
case 0xBE37:
                                                     mon("         LDU   #word_C7BB              ; BE37: CE C7 BB      \n");
    clockticks = clockticks + 3; 
    U = 0xc7bb; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBE3A; JUMP; // sstep
case 0xBE3A:
                                                     mon("LBE3A    LDD   ,U++                    ; BE3A: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE3C; JUMP; // sstep
case 0xBE3C:
                                                     mon("         STD   ,Y++                    ; BE3C: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE3E; JUMP; // sstep
case 0xBE3E:
                                                     mon("         LDD   #$30                    ; BE3E: CC 00 30      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE41; JUMP; // sstep
case 0xBE41:
                                                     mon("         STD   ,Y++                    ; BE41: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE43; JUMP; // sstep
case 0xBE43:
                                                     mon("         STU   $4AFA                   ; BE43: FF 4A FA      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4afa, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4afb, (UINT8)val); 
    PC = 0xBE46; JUMP; // sstep
case 0xBE46:
                                                     mon("         LDB   #$05                    ; BE46: C6 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBE48; JUMP; // sstep
case 0xBE48:
                                                     mon("         STB   <$AD                    ; BE48: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xBE4A; JUMP; // sstep
case 0xBE4A:
                                                     mon("         LDB   #$05                    ; BE4A: C6 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBE4C; JUMP; // sstep
case 0xBE4C:
                                                     mon("LBE4C    LDA   ,X+                     ; BE4C: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    X = X + 1; 
    PC = 0xBE4E; JUMP; // sstep
case 0xBE4E:
                                                     mon("         JSR   LE7AD                   ; BE4E: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x51); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xBE51:
                                                     mon("LBE51    DECB                          ; BE51: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xBE52; JUMP; // sstep
case 0xBE52:
                                                     mon("         BPL   LBE4C                   ; BE52: 2A F8         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xbe4c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBE54; JUMP; // sstep
case 0xBE54:
                                                     mon("         LDD   #$8040                  ; BE54: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE57; JUMP; // sstep
case 0xBE57:
                                                     mon("         STD   ,Y++                    ; BE57: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE59; JUMP; // sstep
case 0xBE59:
                                                     mon("         LDU   $4AFA                   ; BE59: FE 4A FA      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afa)<<8; 
    ea = ea | rd_mem(0x4afb); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBE5C; JUMP; // sstep
case 0xBE5C:
                                                     mon("         CMPX  #$4554                  ; BE5C: 8C 45 54      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4554; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBE5F; JUMP; // sstep
case 0xBE5F:
                                                     mon("         BCS   LBE3A                   ; BE5F: 25 D9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbe3a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBE61; JUMP; // sstep
case 0xBE61:
                                                     mon("         LDD   word_C7C1               ; BE61: FC C7 C1      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xc7c1); // Care needed with I/O space and word fetches
    B = rd_mem(0xc7c2); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE64; JUMP; // sstep
case 0xBE64:
                                                     mon("         STD   ,Y++                    ; BE64: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE66; JUMP; // sstep
case 0xBE66:
                                                     mon("         LDD   #$013C                  ; BE66: CC 01 3C      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x3c; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE69; JUMP; // sstep
case 0xBE69:
                                                     mon("         STD   ,Y++                    ; BE69: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE6B; JUMP; // sstep
case 0xBE6B:
                                                     mon("         LDA   #$01                    ; BE6B: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBE6D; JUMP; // sstep
case 0xBE6D:
                                                     mon("         STA   <$AD                    ; BE6D: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xBE6F; JUMP; // sstep
case 0xBE6F:
                                                     mon("         LDA   $4588                   ; BE6F: B6 45 88      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4588); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBE72; JUMP; // sstep
case 0xBE72:
                                                     mon("         JSR   LE7AD                   ; BE72: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xBE75:
                                                     mon("LBE75    LDA   $4589                   ; BE75: B6 45 89      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4589); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBE78; JUMP; // sstep
case 0xBE78:
                                                     mon("         JSR   LE7AD                   ; BE78: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xBE7B:
                                                     mon("LBE7B    LDD   #$8040                  ; BE7B: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBE7E; JUMP; // sstep
case 0xBE7E:
                                                     mon("         STD   ,Y++                    ; BE7E: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBE80; JUMP; // sstep
case 0xBE80:
                                                     mon("         LDX   #$4548                  ; BE80: 8E 45 48      \n");
    clockticks = clockticks + 3; 
    X = 0x4548; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBE83; JUMP; // sstep
case 0xBE83:
                                                     mon("         JSR   LC6D4                   ; BE83: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xBE86:
                                                     mon("LBE86    LDU   #$4AFE                  ; BE86: CE 4A FE      \n");
    clockticks = clockticks + 3; 
    U = 0x4afe; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBE89; JUMP; // sstep
case 0xBE89:
                                                     mon("         LDX   #$4542                  ; BE89: 8E 45 42      \n");
    clockticks = clockticks + 3; 
    X = 0x4542; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBE8C; JUMP; // sstep
case 0xBE8C:
                                                     mon("         JSR   LC6D7                   ; BE8C: BD C6 D7      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xc6d7; 
    JUMP;
  case 0xBE8F:
                                                     mon("LBE8F    LDA   $4AFC                   ; BE8F: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBE92; JUMP; // sstep
case 0xBE92:
                                                     mon("         ADDA  $4B00                   ; BE92: BB 4B 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b00); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xBE95; JUMP; // sstep
case 0xBE95:
                                                     mon("         DAA                           ; BE95: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBE96; JUMP; // sstep
case 0xBE96:
                                                     mon("         STA   $4AFC                   ; BE96: B7 4A FC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afc, val); 
    PC = 0xBE99; JUMP; // sstep
case 0xBE99:
                                                     mon("         LDA   $4AFB                   ; BE99: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBE9C; JUMP; // sstep
case 0xBE9C:
                                                     mon("         ADCA  $4AFF                   ; BE9C: B9 4A FF      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4aff); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xBE9F; JUMP; // sstep
case 0xBE9F:
                                                     mon("         DAA                           ; BE9F: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBEA0; JUMP; // sstep
case 0xBEA0:
                                                     mon("         STA   $4AFB                   ; BEA0: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xBEA3; JUMP; // sstep
case 0xBEA3:
                                                     mon("         LDA   $4AFA                   ; BEA3: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBEA6; JUMP; // sstep
case 0xBEA6:
                                                     mon("         ADCA  $4AFE                   ; BEA6: B9 4A FE      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4afe); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xBEA9; JUMP; // sstep
case 0xBEA9:
                                                     mon("         DAA                           ; BEA9: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBEAA; JUMP; // sstep
case 0xBEAA:
                                                     mon("         STA   $4AFA                   ; BEAA: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xBEAD; JUMP; // sstep
case 0xBEAD:
                                                     mon("         LDD   word_C7C3               ; BEAD: FC C7 C3      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xc7c3); // Care needed with I/O space and word fetches
    B = rd_mem(0xc7c4); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBEB0; JUMP; // sstep
case 0xBEB0:
                                                     mon("         STD   ,Y++                    ; BEB0: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBEB2; JUMP; // sstep
case 0xBEB2:
                                                     mon("         LDD   #$30                    ; BEB2: CC 00 30      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBEB5; JUMP; // sstep
case 0xBEB5:
                                                     mon("         STD   ,Y++                    ; BEB5: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBEB7; JUMP; // sstep
case 0xBEB7:
                                                     mon("         LDB   #$05                    ; BEB7: C6 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBEB9; JUMP; // sstep
case 0xBEB9:
                                                     mon("         STB   <$AD                    ; BEB9: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xBEBB; JUMP; // sstep
case 0xBEBB:
                                                     mon("         LDA   $4AFA                   ; BEBB: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBEBE; JUMP; // sstep
case 0xBEBE:
                                                     mon("         JSR   Display_Vect_BCD        ; BEBE: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBEC1:
                                                     mon("LBEC1    LDA   $4AFB                   ; BEC1: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBEC4; JUMP; // sstep
case 0xBEC4:
                                                     mon("         JSR   Display_Vect_BCD        ; BEC4: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBEC7:
                                                     mon("LBEC7    LDA   $4AFC                   ; BEC7: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBECA; JUMP; // sstep
case 0xBECA:
                                                     mon("         JSR   Display_Vect_BCD        ; BECA: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBECD:
                                                     mon("LBECD    LDD   #$8040                  ; BECD: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBED0; JUMP; // sstep
case 0xBED0:
                                                     mon("         STD   ,Y++                    ; BED0: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBED2; JUMP; // sstep
case 0xBED2:
                                                     mon("         LDX   #$4554                  ; BED2: 8E 45 54      \n");
    clockticks = clockticks + 3; 
    X = 0x4554; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBED5; JUMP; // sstep
case 0xBED5:
                                                     mon("         JSR   LC6D4                   ; BED5: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xBED8:
                                                     mon("LBED8    JSR   LC087                   ; BED8: BD C0 87      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xc087; 
    JUMP;
  case 0xBEDB:
                                                     mon("LBEDB    LDD   word_C7C9               ; BEDB: FC C7 C9      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xc7c9); // Care needed with I/O space and word fetches
    B = rd_mem(0xc7ca); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBEDE; JUMP; // sstep
case 0xBEDE:
                                                     mon("         STD   ,Y++                    ; BEDE: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBEE0; JUMP; // sstep
case 0xBEE0:
                                                     mon("         LDD   #$30                    ; BEE0: CC 00 30      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBEE3; JUMP; // sstep
case 0xBEE3:
                                                     mon("         STD   ,Y++                    ; BEE3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBEE5; JUMP; // sstep
case 0xBEE5:
                                                     mon("         LDB   #$07                    ; BEE5: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBEE7; JUMP; // sstep
case 0xBEE7:
                                                     mon("         STB   <$AD                    ; BEE7: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xBEE9; JUMP; // sstep
case 0xBEE9:
                                                     mon("         LDA   $4AFA                   ; BEE9: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBEEC; JUMP; // sstep
case 0xBEEC:
                                                     mon("         JSR   Display_Vect_BCD        ; BEEC: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBEEF:
                                                     mon("LBEEF    LDA   $4AFB                   ; BEEF: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBEF2; JUMP; // sstep
case 0xBEF2:
                                                     mon("         JSR   Display_Vect_BCD        ; BEF2: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBEF5:
                                                     mon("LBEF5    LDA   $4AFC                   ; BEF5: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBEF8; JUMP; // sstep
case 0xBEF8:
                                                     mon("         JSR   Display_Vect_BCD        ; BEF8: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBEFB:
                                                     mon("LBEFB    LDA   $4AFD                   ; BEFB: B6 4A FD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBEFE; JUMP; // sstep
case 0xBEFE:
                                                     mon("         JSR   Display_Vect_BCD        ; BEFE: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x01); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBF01:
                                                     mon("LBF01    LDD   #$8040                  ; BF01: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF04; JUMP; // sstep
case 0xBF04:
                                                     mon("         STD   ,Y++                    ; BF04: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF06; JUMP; // sstep
case 0xBF06:
                                                     mon("         LDX   #$455C                  ; BF06: 8E 45 5C      \n");
    clockticks = clockticks + 3; 
    X = 0x455c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBF09; JUMP; // sstep
case 0xBF09:
                                                     mon("         JSR   LC6D4                   ; BF09: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xBF0C:
                                                     mon("LBF0C    JSR   LC087                   ; BF0C: BD C0 87      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc087; 
    JUMP;
  case 0xBF0F:
                                                     mon("LBF0F    LDD   word_C7CB               ; BF0F: FC C7 CB      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xc7cb); // Care needed with I/O space and word fetches
    B = rd_mem(0xc7cc); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF12; JUMP; // sstep
case 0xBF12:
                                                     mon("         STD   ,Y++                    ; BF12: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF14; JUMP; // sstep
case 0xBF14:
                                                     mon("         LDD   #$30                    ; BF14: CC 00 30      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF17; JUMP; // sstep
case 0xBF17:
                                                     mon("         STD   ,Y++                    ; BF17: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF19; JUMP; // sstep
case 0xBF19:
                                                     mon("         LDB   #$07                    ; BF19: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBF1B; JUMP; // sstep
case 0xBF1B:
                                                     mon("         STB   <$AD                    ; BF1B: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xBF1D; JUMP; // sstep
case 0xBF1D:
                                                     mon("         LDA   $4AFA                   ; BF1D: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBF20; JUMP; // sstep
case 0xBF20:
                                                     mon("         JSR   Display_Vect_BCD        ; BF20: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x23); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBF23:
                                                     mon("LBF23    LDA   $4AFB                   ; BF23: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBF26; JUMP; // sstep
case 0xBF26:
                                                     mon("         JSR   Display_Vect_BCD        ; BF26: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBF29:
                                                     mon("LBF29    LDA   $4AFC                   ; BF29: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBF2C; JUMP; // sstep
case 0xBF2C:
                                                     mon("         JSR   Display_Vect_BCD        ; BF2C: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBF2F:
                                                     mon("LBF2F    LDA   $4AFD                   ; BF2F: B6 4A FD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBF32; JUMP; // sstep
case 0xBF32:
                                                     mon("         JSR   Display_Vect_BCD        ; BF32: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBF35:
                                                     mon("LBF35    LDD   #$8040                  ; BF35: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF38; JUMP; // sstep
case 0xBF38:
                                                     mon("         STD   ,Y++                    ; BF38: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF3A; JUMP; // sstep
case 0xBF3A:
                                                     mon("         LDX   #$454C                  ; BF3A: 8E 45 4C      \n");
    clockticks = clockticks + 3; 
    X = 0x454c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBF3D; JUMP; // sstep
case 0xBF3D:
                                                     mon("         JSR   LC6D4                   ; BF3D: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x40); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xBF40:
                                                     mon("LBF40    CLR   $4AFA                   ; BF40: 7F 4A FA      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4afa, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBF43; JUMP; // sstep
case 0xBF43:
                                                     mon("         LDA   $4AFB                   ; BF43: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBF46; JUMP; // sstep
case 0xBF46:
                                                     mon("         ORA   $4AFC                   ; BF46: BA 4A FC      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem(0x4afc); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBF49; JUMP; // sstep
case 0xBF49:
                                                     mon("         ORA   $4AFD                   ; BF49: BA 4A FD      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem(0x4afd); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xBF4C; JUMP; // sstep
case 0xBF4C:
                                                     mon("         BEQ   LBF7C                   ; BF4C: 27 2E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xbf7c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBF4E; JUMP; // sstep
case 0xBF4E:
                                                     mon("         LDX   #$4554                  ; BF4E: 8E 45 54      \n");
    clockticks = clockticks + 3; 
    X = 0x4554; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBF51; JUMP; // sstep
case 0xBF51:
                                                     mon("         LDU   #$4AFE                  ; BF51: CE 4A FE      \n");
    clockticks = clockticks + 3; 
    U = 0x4afe; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xBF54; JUMP; // sstep
case 0xBF54:
                                                     mon("         JSR   LC6D7                   ; BF54: BD C6 D7      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x57); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc6d7; 
    JUMP;
  case 0xBF57:
                                                     mon("LBF57    JSR   LC02F                   ; BF57: BD C0 2F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc02f; 
    JUMP;
  case 0xBF5A:
                                                     mon("LBF5A    LDA   $4AFA                   ; BF5A: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBF5D; JUMP; // sstep
case 0xBF5D:
                                                     mon("         ANDA  #$0F                    ; BF5D: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBF5F; JUMP; // sstep
case 0xBF5F:
                                                     mon("         CMPA  #$0F                    ; BF5F: 81 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xBF61; JUMP; // sstep
case 0xBF61:
                                                     mon("         LDA   $4AFA                   ; BF61: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBF64; JUMP; // sstep
case 0xBF64:
                                                     mon("         BCS   LBF69                   ; BF64: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbf69; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBF66; JUMP; // sstep
case 0xBF66:
                                                     mon("         INC   $4AFA                   ; BF66: 7C 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4afa, res); 
    clockticks = clockticks + 2; 
    PC = 0xBF69; JUMP; // sstep
case 0xBF69:
                                                     mon("LBF69    LSRA                          ; BF69: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBF6A; JUMP; // sstep
case 0xBF6A:
                                                     mon("         LSRA                          ; BF6A: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBF6B; JUMP; // sstep
case 0xBF6B:
                                                     mon("         LSRA                          ; BF6B: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBF6C; JUMP; // sstep
case 0xBF6C:
                                                     mon("         LSRA                          ; BF6C: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xBF6D; JUMP; // sstep
case 0xBF6D:
                                                     mon("         ADDA  $4AFA                   ; BF6D: BB 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afa); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xBF70; JUMP; // sstep
case 0xBF70:
                                                     mon("         STA   $4AFA                   ; BF70: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xBF73; JUMP; // sstep
case 0xBF73:
                                                     mon("         ANDA  #$0F                    ; BF73: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBF75; JUMP; // sstep
case 0xBF75:
                                                     mon("         CMPA  #$0F                    ; BF75: 81 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xBF77; JUMP; // sstep
case 0xBF77:
                                                     mon("         BCS   LBF7C                   ; BF77: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbf7c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBF79; JUMP; // sstep
case 0xBF79:
                                                     mon("         INC   $4AFA                   ; BF79: 7C 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4afa, res); 
    clockticks = clockticks + 2; 
    PC = 0xBF7C; JUMP; // sstep
case 0xBF7C:
                                                     mon("LBF7C    LDD   word_C7C5               ; BF7C: FC C7 C5      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xc7c5); // Care needed with I/O space and word fetches
    B = rd_mem(0xc7c6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF7F; JUMP; // sstep
case 0xBF7F:
                                                     mon("         STD   ,Y++                    ; BF7F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF81; JUMP; // sstep
case 0xBF81:
                                                     mon("         LDD   #$30                    ; BF81: CC 00 30      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF84; JUMP; // sstep
case 0xBF84:
                                                     mon("         STD   ,Y++                    ; BF84: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF86; JUMP; // sstep
case 0xBF86:
                                                     mon("         LDA   $4AFA                   ; BF86: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBF89; JUMP; // sstep
case 0xBF89:
                                                     mon("         JSR   LC70E                   ; BF89: BD C7 0E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc70e; 
    JUMP;
  case 0xBF8C:
                                                     mon("LBF8C    LDD   #$8040                  ; BF8C: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBF8F; JUMP; // sstep
case 0xBF8F:
                                                     mon("         STD   ,Y++                    ; BF8F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBF91; JUMP; // sstep
case 0xBF91:
                                                     mon("         LDX   #$455C                  ; BF91: 8E 45 5C      \n");
    clockticks = clockticks + 3; 
    X = 0x455c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBF94; JUMP; // sstep
case 0xBF94:
                                                     mon("         JSR   LC6D4                   ; BF94: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xBF97:
                                                     mon("LBF97    LDA   $4AFA                   ; BF97: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBF9A; JUMP; // sstep
case 0xBF9A:
                                                     mon("         ORA   $4AFB                   ; BF9A: BA 4A FB      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem(0x4afb); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBF9D; JUMP; // sstep
case 0xBF9D:
                                                     mon("         ORA   $4AFC                   ; BF9D: BA 4A FC      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem(0x4afc); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xBFA0; JUMP; // sstep
case 0xBFA0:
                                                     mon("         ORA   $4AFD                   ; BFA0: BA 4A FD      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem(0x4afd); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xBFA3; JUMP; // sstep
case 0xBFA3:
                                                     mon("         BEQ   LBFB4                   ; BFA3: 27 0F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xbfb4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBFA5; JUMP; // sstep
case 0xBFA5:
                                                     mon("         LDX   #$4556                  ; BFA5: 8E 45 56      \n");
    clockticks = clockticks + 3; 
    X = 0x4556; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBFA8; JUMP; // sstep
case 0xBFA8:
                                                     mon("         LDU   #$4AFE                  ; BFA8: CE 4A FE      \n");
    clockticks = clockticks + 3; 
    U = 0x4afe; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xBFAB; JUMP; // sstep
case 0xBFAB:
                                                     mon("         JSR   LC6D7                   ; BFAB: BD C6 D7      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xae); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc6d7; 
    JUMP;
  case 0xBFAE:
                                                     mon("LBFAE    CLR   $4B01                   ; BFAE: 7F 4B 01      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4b01, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBFB1; JUMP; // sstep
case 0xBFB1:
                                                     mon("         JSR   LC02F                   ; BFB1: BD C0 2F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xc02f; 
    JUMP;
  case 0xBFB4:
                                                     mon("LBFB4    LDD   word_C7C7               ; BFB4: FC C7 C7      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xc7c7); // Care needed with I/O space and word fetches
    B = rd_mem(0xc7c8); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBFB7; JUMP; // sstep
case 0xBFB7:
                                                     mon("         STD   ,Y++                    ; BFB7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBFB9; JUMP; // sstep
case 0xBFB9:
                                                     mon("         LDD   #$30                    ; BFB9: CC 00 30      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBFBC; JUMP; // sstep
case 0xBFBC:
                                                     mon("         STD   ,Y++                    ; BFBC: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBFBE; JUMP; // sstep
case 0xBFBE:
                                                     mon("         CLRA                          ; BFBE: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xBFBF; JUMP; // sstep
case 0xBFBF:
                                                     mon("         LDB   $4AFA                   ; BFBF: F6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBFC2; JUMP; // sstep
case 0xBFC2:
                                                     mon("         LDX   #$10                    ; BFC2: 8E 00 10      \n");
    clockticks = clockticks + 3; 
    X = 0x0010; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xBFC5; JUMP; // sstep
case 0xBFC5:
                                                     mon("         JSR   $7720                   ; BFC5: BD 77 20      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0x7720; 
    JUMP;
  case 0xBFC8:
                                                     mon("LBFC8    LDB   #$01                    ; BFC8: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBFCA; JUMP; // sstep
case 0xBFCA:
                                                     mon("         STB   <$AD                    ; BFCA: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xBFCC; JUMP; // sstep
case 0xBFCC:
                                                     mon("         LDA   $4AD6                   ; BFCC: B6 4A D6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad6); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xBFCF; JUMP; // sstep
case 0xBFCF:
                                                     mon("         JSR   Display_Vect_BCD        ; BFCF: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xBFD2:
                                                     mon("LBFD2    LDD   #$8040                  ; BFD2: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBFD5; JUMP; // sstep
case 0xBFD5:
                                                     mon("         STD   ,Y++                    ; BFD5: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBFD7; JUMP; // sstep
case 0xBFD7:
                                                     mon("         LDB   #$11                    ; BFD7: C6 11         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x11; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xBFD9; JUMP; // sstep
case 0xBFD9:
                                                     mon("         STB   $4AFA                   ; BFD9: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xBFDC; JUMP; // sstep
case 0xBFDC:
                                                     mon("         LDU   #word_C7CD              ; BFDC: CE C7 CD      \n"); // Table for game time history text positions
    clockticks = clockticks + 3; 
    U = 0xc7cd; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBFDF; JUMP; // sstep
case 0xBFDF:
                                                     mon("         STU   $4AFC                   ; BFDF: FF 4A FC      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4afc, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4afd, (UINT8)val); 
    PC = 0xBFE2; JUMP; // sstep
case 0xBFE2:
                                                     mon("LBFE2    LDU   $4AFC                   ; BFE2: FE 4A FC      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afc)<<8; 
    ea = ea | rd_mem(0x4afd); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xBFE5; JUMP; // sstep
case 0xBFE5:
                                                     mon("         LDD   ,U++                    ; BFE5: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBFE7; JUMP; // sstep
case 0xBFE7:
                                                     mon("         STD   ,Y++                    ; BFE7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBFE9; JUMP; // sstep
case 0xBFE9:
                                                     mon("         CMPU  #$C7E1                  ; BFE9: 11 83 C7 E1   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xc7e1; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xBFED; JUMP; // sstep
case 0xBFED:
                                                     mon("         BCS   LBFF4                   ; BFED: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xbff4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xBFEF; JUMP; // sstep
case 0xBFEF:
                                                     mon("         LDD   #$1ED4                  ; BFEF: CC 1E D4      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0xd4; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xBFF2; JUMP; // sstep
case 0xBFF2:
                                                     mon("         BRA   LBFF7                   ; BFF2: 20 03         \n");
    PC = 0xbff7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xBFF4:
                                                     mon("LBFF4    LDD   #$64                    ; BFF4: CC 00 64      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x64; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xBFF7; JUMP; // sstep
case 0xBFF7:
                                                     mon("LBFF7    STD   ,Y++                    ; BFF7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xBFF9; JUMP; // sstep
case 0xBFF9:
                                                     mon("         STU   $4AFC                   ; BFF9: FF 4A FC      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4afc, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4afd, (UINT8)val); 
    PC = 0xBFFC; JUMP; // sstep
case 0xBFFC:
                                                     mon("         LDX   #unk_C7A3               ; BFFC: 8E C7 A3      \n");
    clockticks = clockticks + 3; 
    X = 0xc7a3; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xBFFF; JUMP; // sstep
case 0xBFFF:
                                                     mon("         LDB   $4AFA                   ; BFFF: F6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC002; JUMP; // sstep
case 0xC002:
                                                     mon("         LDA   B,X                     ; C002: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC004; JUMP; // sstep
case 0xC004:
                                                     mon("         JSR   LC70E                   ; C004: BD C7 0E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xc70e; 
    JUMP;
  case 0xC007:
                                                     mon("LC007    LDD   $3002                   ; C007: FC 30 02      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3002); // Care needed with I/O space and word fetches
    B = rd_mem(0x3003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC00A; JUMP; // sstep
case 0xC00A:
                                                     mon("         STD   ,Y++                    ; C00A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC00C; JUMP; // sstep
case 0xC00C:
                                                     mon("         STD   ,Y++                    ; C00C: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC00E; JUMP; // sstep
case 0xC00E:
                                                     mon("         LDB   #$00                    ; C00E: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC010; JUMP; // sstep
case 0xC010:
                                                     mon("         STB   <$AD                    ; C010: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xC012; JUMP; // sstep
case 0xC012:
                                                     mon("         LDX   #$4564                  ; C012: 8E 45 64      \n");
    clockticks = clockticks + 3; 
    X = 0x4564; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC015; JUMP; // sstep
case 0xC015:
                                                     mon("         LDB   $4AFA                   ; C015: F6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC018; JUMP; // sstep
case 0xC018:
                                                     mon("         ASLB                          ; C018: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC019; JUMP; // sstep
case 0xC019:
                                                     mon("         LDA   B,X                     ; C019: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC01B; JUMP; // sstep
case 0xC01B:
                                                     mon("         JSR   LE7AD                   ; C01B: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xC01E:
                                                     mon("LC01E    INCB                          ; C01E: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC01F; JUMP; // sstep
case 0xC01F:
                                                     mon("         LDA   B,X                     ; C01F: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC021; JUMP; // sstep
case 0xC021:
                                                     mon("         JSR   LE7AD                   ; C021: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x24); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xC024:
                                                     mon("LC024    LDD   #$8040                  ; C024: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC027; JUMP; // sstep
case 0xC027:
                                                     mon("         STD   ,Y++                    ; C027: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC029; JUMP; // sstep
case 0xC029:
                                                     mon("         DEC   $4AFA                   ; C029: 7A 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4afa, res); 
    clockticks = clockticks + 2; 
    PC = 0xC02C; JUMP; // sstep
case 0xC02C:
                                                     mon("         BPL   LBFE2                   ; C02C: 2A B4         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xbfe2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_BE20
    PC = 0xC02E; JUMP; // sstep
case 0xC02E:
                                                     mon("         RTS                           ; C02E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC02F:
                                                     mon("LC02F    LDX   #$4AFE                  ; C02F: 8E 4A FE      \n");
    clockticks = clockticks + 3; 
    X = 0x4afe; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC032; JUMP; // sstep
case 0xC032:
                                                     mon("         LDA   #$01                    ; C032: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC034; JUMP; // sstep
case 0xC034:
                                                     mon("         STA   $4B02                   ; C034: B7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC037; JUMP; // sstep
case 0xC037:
                                                     mon("         LDB   #$03                    ; C037: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC039; JUMP; // sstep
case 0xC039:
                                                     mon("LC039    LDA   #$99                    ; C039: 86 99         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x99; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC03B; JUMP; // sstep
case 0xC03B:
                                                     mon("         SUBA  ,-X                     ; C03B: A0 82         \n");
    clockticks = clockticks + 6; 
    X = X - 1; 
    val = (UINT8)A; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xC03D; JUMP; // sstep
case 0xC03D:
                                                     mon("         ADDA  $4B02                   ; C03D: BB 4B 02      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b02); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC040; JUMP; // sstep
case 0xC040:
                                                     mon("         DAA                           ; C040: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC041; JUMP; // sstep
case 0xC041:
                                                     mon("         STA   ,X                      ; C041: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xC043; JUMP; // sstep
case 0xC043:
                                                     mon("         BCS   LC04A                   ; C043: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc04a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC045; JUMP; // sstep
case 0xC045:
                                                     mon("         CLR   $4B02                   ; C045: 7F 4B 02      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4b02, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC048; JUMP; // sstep
case 0xC048:
                                                     mon("         BRA   LC04F                   ; C048: 20 05         \n");
    PC = 0xc04f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC04A:
                                                     mon("LC04A    LDA   #$01                    ; C04A: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC04C; JUMP; // sstep
case 0xC04C:
                                                     mon("         STA   $4B02                   ; C04C: B7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC04F; JUMP; // sstep
case 0xC04F:
                                                     mon("LC04F    DECB                          ; C04F: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC050; JUMP; // sstep
case 0xC050:
                                                     mon("         BPL   LC039                   ; C050: 2A E7         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc039; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC052; JUMP; // sstep
case 0xC052:
                                                     mon("         LDB   #$FF                    ; C052: C6 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC054; JUMP; // sstep
case 0xC054:
                                                     mon("LC054    INCB                          ; C054: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC055; JUMP; // sstep
case 0xC055:
                                                     mon("         CMPB  #$EF                    ; C055: C1 EF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xef; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC057; JUMP; // sstep
case 0xC057:
                                                     mon("         BEQ   LC083                   ; C057: 27 2A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc083; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC059; JUMP; // sstep
case 0xC059:
                                                     mon("         LDA   $4B01                   ; C059: B6 4B 01      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b01); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC05C; JUMP; // sstep
case 0xC05C:
                                                     mon("         ADDA  $4AFD                   ; C05C: BB 4A FD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afd); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC05F; JUMP; // sstep
case 0xC05F:
                                                     mon("         DAA                           ; C05F: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC060; JUMP; // sstep
case 0xC060:
                                                     mon("         STA   $4B01                   ; C060: B7 4B 01      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b01, val); 
    PC = 0xC063; JUMP; // sstep
case 0xC063:
                                                     mon("         LDA   $4B00                   ; C063: B6 4B 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b00); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC066; JUMP; // sstep
case 0xC066:
                                                     mon("         ADCA  $4AFC                   ; C066: B9 4A FC      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4afc); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC069; JUMP; // sstep
case 0xC069:
                                                     mon("         DAA                           ; C069: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC06A; JUMP; // sstep
case 0xC06A:
                                                     mon("         STA   $4B00                   ; C06A: B7 4B 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b00, val); 
    PC = 0xC06D; JUMP; // sstep
case 0xC06D:
                                                     mon("         LDA   $4AFF                   ; C06D: B6 4A FF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aff); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC070; JUMP; // sstep
case 0xC070:
                                                     mon("         ADCA  $4AFB                   ; C070: B9 4A FB      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4afb); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC073; JUMP; // sstep
case 0xC073:
                                                     mon("         DAA                           ; C073: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC074; JUMP; // sstep
case 0xC074:
                                                     mon("         STA   $4AFF                   ; C074: B7 4A FF      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4aff, val); 
    PC = 0xC077; JUMP; // sstep
case 0xC077:
                                                     mon("         LDA   $4AFE                   ; C077: B6 4A FE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afe); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC07A; JUMP; // sstep
case 0xC07A:
                                                     mon("         ADCA  $4AFA                   ; C07A: B9 4A FA      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4afa); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC07D; JUMP; // sstep
case 0xC07D:
                                                     mon("         DAA                           ; C07D: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC07E; JUMP; // sstep
case 0xC07E:
                                                     mon("         STA   $4AFE                   ; C07E: B7 4A FE      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4afe, val); 
    PC = 0xC081; JUMP; // sstep
case 0xC081:
                                                     mon("         BCS   LC054                   ; C081: 25 D1         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc054; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC083; JUMP; // sstep
case 0xC083:
                                                     mon("LC083    STB   $4AFA                   ; C083: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4afa, val); 
    // End of function sub_C02F
    PC = 0xC086; JUMP; // sstep
case 0xC086:
                                                     mon("         RTS                           ; C086: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC087:
                                                     mon("LC087    BSR   $C089                   ; C087: 8D 00         \n");
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 7; 
    PC = 0xc089; 
    JUMP;
  case 0xC089:
                                                     mon("LC089    ANDCC #$FE                    ; C089: 1C FE         \n");
    C = 0; 
    clockticks = clockticks + 3; 
    PC = 0xC08B; JUMP; // sstep
case 0xC08B:
                                                     mon("         LDB   #$03                    ; C08B: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC08D; JUMP; // sstep
case 0xC08D:
                                                     mon("         LDX   #$4AFD                  ; C08D: 8E 4A FD      \n");
    clockticks = clockticks + 3; 
    X = 0x4afd; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC090; JUMP; // sstep
case 0xC090:
                                                     mon("LC090    LDA   ,X                      ; C090: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC092; JUMP; // sstep
case 0xC092:
                                                     mon("         ADCA  ,X                      ; C092: A9 84         \n");
    clockticks = clockticks + 4; 
    arg = A; 
    val = rd_mem(X); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC094; JUMP; // sstep
case 0xC094:
                                                     mon("         DAA                           ; C094: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC095; JUMP; // sstep
case 0xC095:
                                                     mon("         STA   ,X                      ; C095: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xC097; JUMP; // sstep
case 0xC097:
                                                     mon("         LEAX  -1,X                    ; C097: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
/**/Z = X; 
    PC = 0xC099; JUMP; // sstep
case 0xC099:
                                                     mon("         DECB                          ; C099: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC09A; JUMP; // sstep
case 0xC09A:
                                                     mon("         BPL   LC090                   ; C09A: 2A F4         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc090; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C087
    PC = 0xC09C; JUMP; // sstep
case 0xC09C:
                                                     mon("         RTS                           ; C09C: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC09D:
                                                     mon("LC09D    LDA   #$02                    ; C09D: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC09F; JUMP; // sstep
case 0xC09F:
                                                     mon("         JSR   LC2C3                   ; C09F: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC0A2:
                                                     mon("LC0A2    BNE   locret_C0FE             ; C0A2: 26 5A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc0fe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC0A4; JUMP; // sstep
case 0xC0A4:
                                                     mon("         CLRA                          ; C0A4: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC0A5; JUMP; // sstep
case 0xC0A5:
                                                     mon("         LDB   $4815                   ; C0A5: F6 48 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4815); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0A8; JUMP; // sstep
case 0xC0A8:
                                                     mon("         ASLB                          ; C0A8: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC0A9; JUMP; // sstep
case 0xC0A9:
                                                     mon("         ROLA                          ; C0A9: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC0AA; JUMP; // sstep
case 0xC0AA:
                                                     mon("         LDB   $4816                   ; C0AA: F6 48 16      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4816); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0AD; JUMP; // sstep
case 0xC0AD:
                                                     mon("         ASLB                          ; C0AD: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC0AE; JUMP; // sstep
case 0xC0AE:
                                                     mon("         ROLA                          ; C0AE: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC0AF; JUMP; // sstep
case 0xC0AF:
                                                     mon("         LDB   $4817                   ; C0AF: F6 48 17      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4817); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0B2; JUMP; // sstep
case 0xC0B2:
                                                     mon("         ASLB                          ; C0B2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC0B3; JUMP; // sstep
case 0xC0B3:
                                                     mon("         ROLA                          ; C0B3: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC0B4; JUMP; // sstep
case 0xC0B4:
                                                     mon("         TFR   A,B                     ; C0B4: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xC0B6; JUMP; // sstep
case 0xC0B6:
                                                     mon("         EORB  $4AF4                   ; C0B6: F8 4A F4      \n");
    clockticks = clockticks + 5; 
    res = B ^ rd_mem(0x4af4); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC0B9; JUMP; // sstep
case 0xC0B9:
                                                     mon("         ANDB  $4AF4                   ; C0B9: F4 4A F4      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    res = val & rd_mem(0x4af4); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC0BC; JUMP; // sstep
case 0xC0BC:
                                                     mon("         STA   $4AF4                   ; C0BC: B7 4A F4      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af4, val); 
    PC = 0xC0BF; JUMP; // sstep
case 0xC0BF:
                                                     mon("         LDX   #$4548                  ; C0BF: 8E 45 48      \n");
    clockticks = clockticks + 3; 
    X = 0x4548; 
/**/Z = X; 
/**/N = (X) >> 8; 
    V = 0; 
    PC = 0xC0C2; JUMP; // sstep
case 0xC0C2:
                                                     mon("LC0C2    LSRB                          ; C0C2: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC0C3; JUMP; // sstep
case 0xC0C3:
                                                     mon("         BCC   LC0F7                   ; C0C3: 24 32         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xc0f7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC0C5; JUMP; // sstep
case 0xC0C5:
                                                     mon("         LDU   #$4B5F                  ; C0C5: CE 4B 5F      \n");
    clockticks = clockticks + 3; 
    U = 0x4b5f; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xC0C8; JUMP; // sstep
case 0xC0C8:
                                                     mon("         JSR   LC6D7                   ; C0C8: BD C6 D7      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xc6d7; 
    JUMP;
  case 0xC0CB:
                                                     mon("LC0CB    LDA   $4B61                   ; C0CB: B6 4B 61      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b61); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0CE; JUMP; // sstep
case 0xC0CE:
                                                     mon("         ADDA  #$01                    ; C0CE: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC0D0; JUMP; // sstep
case 0xC0D0:
                                                     mon("         DAA                           ; C0D0: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC0D1; JUMP; // sstep
case 0xC0D1:
                                                     mon("         STA   $4B61                   ; C0D1: B7 4B 61      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b61, val); 
    PC = 0xC0D4; JUMP; // sstep
case 0xC0D4:
                                                     mon("         LDA   $4B60                   ; C0D4: B6 4B 60      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b60); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0D7; JUMP; // sstep
case 0xC0D7:
                                                     mon("         ADCA  #$00                    ; C0D7: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC0D9; JUMP; // sstep
case 0xC0D9:
                                                     mon("         DAA                           ; C0D9: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC0DA; JUMP; // sstep
case 0xC0DA:
                                                     mon("         STA   $4B60                   ; C0DA: B7 4B 60      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b60, val); 
    PC = 0xC0DD; JUMP; // sstep
case 0xC0DD:
                                                     mon("         LDA   $4B5F                   ; C0DD: B6 4B 5F      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b5f); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0E0; JUMP; // sstep
case 0xC0E0:
                                                     mon("         ADCA  #$00                    ; C0E0: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC0E2; JUMP; // sstep
case 0xC0E2:
                                                     mon("         DAA                           ; C0E2: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC0E3; JUMP; // sstep
case 0xC0E3:
                                                     mon("         STA   $4B5F                   ; C0E3: B7 4B 5F      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b5f, val); 
    PC = 0xC0E6; JUMP; // sstep
case 0xC0E6:
                                                     mon("         LDU   #$4B5F                  ; C0E6: CE 4B 5F      \n");
    clockticks = clockticks + 3; 
    U = 0x4b5f; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xC0E9; JUMP; // sstep
case 0xC0E9:
                                                     mon("         JSR   LC6F7                   ; C0E9: BD C6 F7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xec); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xc6f7; 
    JUMP;
  case 0xC0EC:
                                                     mon("LC0EC    LDA   #$02                    ; C0EC: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0EE; JUMP; // sstep
case 0xC0EE:
                                                     mon("         STB   $4B62                   ; C0EE: F7 4B 62      \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b62, val); 
    PC = 0xC0F1; JUMP; // sstep
case 0xC0F1:
                                                     mon("         JSR   LC2B3                   ; C0F1: BD C2 B3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    PC = 0xc2b3; 
    JUMP;
  case 0xC0F4:
                                                     mon("LC0F4    LDB   $4B62                   ; C0F4: F6 4B 62      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b62); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC0F7; JUMP; // sstep
case 0xC0F7:
                                                     mon("LC0F7    LEAX  -6,X                    ; C0F7: 30 1A         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xfffa); 
/**/Z = X; 
    PC = 0xC0F9; JUMP; // sstep
case 0xC0F9:
                                                     mon("         CMPX  #$453C                  ; C0F9: 8C 45 3C      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x453c; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC0FC; JUMP; // sstep
case 0xC0FC:
                                                     mon("         BCC   LC0C2                   ; C0FC: 24 C4         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xc0c2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C09D
    PC = 0xC0FE; JUMP; // sstep
case 0xC0FE:
                                                     mon("locret_C0FE RTS                           ; C0FE: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // NVRAM something
  case 0xC0FF:
                                                     mon("LC0FF    LDA   #$02                    ; C0FF: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC101; JUMP; // sstep
case 0xC101:
                                                     mon("         JSR   LC413                   ; C101: BD C4 13      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x04); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc413; 
    JUMP;
  case 0xC104:
                                                     mon("LC104    LDX   #$4554                  ; C104: 8E 45 54      \n");
    clockticks = clockticks + 3; 
    X = 0x4554; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC107; JUMP; // sstep
case 0xC107:
                                                     mon("         JSR   LC6D4                   ; C107: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xC10A:
                                                     mon("LC10A    LDA   $4AFD                   ; C10A: B6 4A FD      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afd); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC10D; JUMP; // sstep
case 0xC10D:
                                                     mon("         ADDA  $481A                   ; C10D: BB 48 1A      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x481a); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC110; JUMP; // sstep
case 0xC110:
                                                     mon("         DAA                           ; C110: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC111; JUMP; // sstep
case 0xC111:
                                                     mon("         STA   $4AFD                   ; C111: B7 4A FD      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afd, val); 
    PC = 0xC114; JUMP; // sstep
case 0xC114:
                                                     mon("         LDA   $4AFC                   ; C114: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC117; JUMP; // sstep
case 0xC117:
                                                     mon("         ADCA  $4819                   ; C117: B9 48 19      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4819); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC11A; JUMP; // sstep
case 0xC11A:
                                                     mon("         DAA                           ; C11A: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC11B; JUMP; // sstep
case 0xC11B:
                                                     mon("         STA   $4AFC                   ; C11B: B7 4A FC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afc, val); 
    PC = 0xC11E; JUMP; // sstep
case 0xC11E:
                                                     mon("         LDA   $4AFB                   ; C11E: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC121; JUMP; // sstep
case 0xC121:
                                                     mon("         ADCA  #$00                    ; C121: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC123; JUMP; // sstep
case 0xC123:
                                                     mon("         DAA                           ; C123: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC124; JUMP; // sstep
case 0xC124:
                                                     mon("         STA   $4AFB                   ; C124: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC127; JUMP; // sstep
case 0xC127:
                                                     mon("         LDA   $4AFA                   ; C127: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC12A; JUMP; // sstep
case 0xC12A:
                                                     mon("         ADCA  #$00                    ; C12A: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC12C; JUMP; // sstep
case 0xC12C:
                                                     mon("         DAA                           ; C12C: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
    N = res; 
    Z = res; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC12D; JUMP; // sstep
case 0xC12D:
                                                     mon("         BCS   LC132                   ; C12D: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc132; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC12F; JUMP; // sstep
case 0xC12F:
                                                     mon("         STA   $4AFA                   ; C12F: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC132; JUMP; // sstep
case 0xC132:
                                                     mon("LC132    LDA   #$03                    ; C132: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC134; JUMP; // sstep
case 0xC134:
                                                     mon("         STB   $4B02                   ; C134: F7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC137; JUMP; // sstep
case 0xC137:
                                                     mon("         LDU   #$4AFA                  ; C137: CE 4A FA      \n");
    clockticks = clockticks + 3; 
    U = 0x4afa; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xC13A; JUMP; // sstep
case 0xC13A:
                                                     mon("         JSR   LC6F9                   ; C13A: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
  case 0xC13D:
                                                     mon("LC13D    LDX   #$454E                  ; C13D: 8E 45 4E      \n");
    clockticks = clockticks + 3; 
    X = 0x454e; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC140; JUMP; // sstep
case 0xC140:
                                                     mon("         JSR   LC6D4                   ; C140: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x43); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xC143:
                                                     mon("LC143    LDA   $4AFC                   ; C143: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC146; JUMP; // sstep
case 0xC146:
                                                     mon("         ADDA  #$01                    ; C146: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC148; JUMP; // sstep
case 0xC148:
                                                     mon("         DAA                           ; C148: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC149; JUMP; // sstep
case 0xC149:
                                                     mon("         STA   $4AFC                   ; C149: B7 4A FC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afc, val); 
    PC = 0xC14C; JUMP; // sstep
case 0xC14C:
                                                     mon("         LDA   $4AFB                   ; C14C: B6 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afb); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC14F; JUMP; // sstep
case 0xC14F:
                                                     mon("         ADCA  #$00                    ; C14F: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC151; JUMP; // sstep
case 0xC151:
                                                     mon("         DAA                           ; C151: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC152; JUMP; // sstep
case 0xC152:
                                                     mon("         STA   $4AFB                   ; C152: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC155; JUMP; // sstep
case 0xC155:
                                                     mon("         LDA   $4AFA                   ; C155: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC158; JUMP; // sstep
case 0xC158:
                                                     mon("         ADCA  #$00                    ; C158: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xC15A; JUMP; // sstep
case 0xC15A:
                                                     mon("         DAA                           ; C15A: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC15B; JUMP; // sstep
case 0xC15B:
                                                     mon("         STA   $4AFA                   ; C15B: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC15E; JUMP; // sstep
case 0xC15E:
                                                     mon("         JSR   LC6F4                   ; C15E: BD C6 F4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc6f4; 
    JUMP;
  case 0xC161:
                                                     mon("LC161    LDX   #$4588                  ; C161: 8E 45 88      \n");
    clockticks = clockticks + 3; 
    X = 0x4588; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC164; JUMP; // sstep
case 0xC164:
                                                     mon("         JSR   LC6D4                   ; C164: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xC167:
                                                     mon("LC167    LDA   $4B16                   ; C167: B6 4B 16      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b16); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC16A; JUMP; // sstep
case 0xC16A:
                                                     mon("         CMPA  $4AFA                   ; C16A: B1 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afa); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC16D; JUMP; // sstep
case 0xC16D:
                                                     mon("         BLS   LC17B                   ; C16D: 23 0C         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xc17b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC16F; JUMP; // sstep
case 0xC16F:
                                                     mon("         STA   $4AFA                   ; C16F: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC172; JUMP; // sstep
case 0xC172:
                                                     mon("         CLR   $4AFB                   ; C172: 7F 4A FB      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4afb, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC175; JUMP; // sstep
case 0xC175:
                                                     mon("         CLR   $4AFC                   ; C175: 7F 4A FC      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4afc, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC178; JUMP; // sstep
case 0xC178:
                                                     mon("         JSR   LC6F4                   ; C178: BD C6 F4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    PC = 0xc6f4; 
    JUMP;
  case 0xC17B:
                                                     mon("LC17B    LDX   #$4586                  ; C17B: 8E 45 86      \n");
    clockticks = clockticks + 3; 
    X = 0x4586; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC17E; JUMP; // sstep
case 0xC17E:
                                                     mon("         LDA   $4819                   ; C17E: B6 48 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4819); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC181; JUMP; // sstep
case 0xC181:
                                                     mon("         BNE   LC19E                   ; C181: 26 1B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc19e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC183; JUMP; // sstep
case 0xC183:
                                                     mon("         LDA   $481A                   ; C183: B6 48 1A      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC186; JUMP; // sstep
case 0xC186:
                                                     mon("         LDX   #$4564                  ; C186: 8E 45 64      \n");
    clockticks = clockticks + 3; 
    X = 0x4564; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC189; JUMP; // sstep
case 0xC189:
                                                     mon("         LDB   #$9A                    ; C189: C6 9A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x9a; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC18B; JUMP; // sstep
case 0xC18B:
                                                     mon("         SUBB  word_C7A4               ; C18B: F0 C7 A4      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0xc7a4); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xC18E; JUMP; // sstep
case 0xC18E:
                                                     mon("         STB   $4AFA                   ; C18E: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC191; JUMP; // sstep
case 0xC191:
                                                     mon("LC191    ADDA  $4AFA                   ; C191: BB 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afa); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC194; JUMP; // sstep
case 0xC194:
                                                     mon("         DAA                           ; C194: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
    N = res; 
    Z = res; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC195; JUMP; // sstep
case 0xC195:
                                                     mon("         BCC   LC19E                   ; C195: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xc19e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC197; JUMP; // sstep
case 0xC197:
                                                     mon("         LEAX  $02,X                   ; C197: 30 02         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0002); 
/**/Z = X; 
    PC = 0xC199; JUMP; // sstep
case 0xC199:
                                                     mon("         CMPX  #$4586                  ; C199: 8C 45 86      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4586; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC19C; JUMP; // sstep
case 0xC19C:
                                                     mon("         BCS   LC191                   ; C19C: 25 F3         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc191; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC19E; JUMP; // sstep
case 0xC19E:
                                                     mon("LC19E    LDA   $01,X                   ; C19E: A6 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1A0; JUMP; // sstep
case 0xC1A0:
                                                     mon("         ANDA  #$0F                    ; C1A0: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC1A2; JUMP; // sstep
case 0xC1A2:
                                                     mon("         ADDA  #$01                    ; C1A2: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC1A4; JUMP; // sstep
case 0xC1A4:
                                                     mon("         DAA                           ; C1A4: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC1A5; JUMP; // sstep
case 0xC1A5:
                                                     mon("         STA   $01,X                   ; C1A5: A7 01         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC1A7; JUMP; // sstep
case 0xC1A7:
                                                     mon("         ANDA  #$F0                    ; C1A7: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC1A9; JUMP; // sstep
case 0xC1A9:
                                                     mon("         BEQ   LC1E9                   ; C1A9: 27 3E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc1e9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC1AB; JUMP; // sstep
case 0xC1AB:
                                                     mon("         LDA   ,X                      ; C1AB: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1AD; JUMP; // sstep
case 0xC1AD:
                                                     mon("         ANDA  #$0F                    ; C1AD: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC1AF; JUMP; // sstep
case 0xC1AF:
                                                     mon("         ADDA  #$01                    ; C1AF: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC1B1; JUMP; // sstep
case 0xC1B1:
                                                     mon("         DAA                           ; C1B1: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC1B2; JUMP; // sstep
case 0xC1B2:
                                                     mon("         STA   ,X                      ; C1B2: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xC1B4; JUMP; // sstep
case 0xC1B4:
                                                     mon("         ANDA  #$F0                    ; C1B4: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC1B6; JUMP; // sstep
case 0xC1B6:
                                                     mon("         BEQ   LC1E9                   ; C1B6: 27 31         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc1e9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC1B8; JUMP; // sstep
case 0xC1B8:
                                                     mon("         LDX   #$4564                  ; C1B8: 8E 45 64      \n");
    clockticks = clockticks + 3; 
    X = 0x4564; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC1BB; JUMP; // sstep
case 0xC1BB:
                                                     mon("LC1BB    LDA   ,X                      ; C1BB: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1BD; JUMP; // sstep
case 0xC1BD:
                                                     mon("         ASLA                          ; C1BD: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC1BE; JUMP; // sstep
case 0xC1BE:
                                                     mon("         ASLA                          ; C1BE: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC1BF; JUMP; // sstep
case 0xC1BF:
                                                     mon("         ASLA                          ; C1BF: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC1C0; JUMP; // sstep
case 0xC1C0:
                                                     mon("         ASLA                          ; C1C0: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC1C1; JUMP; // sstep
case 0xC1C1:
                                                     mon("         STA   $4AFA                   ; C1C1: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC1C4; JUMP; // sstep
case 0xC1C4:
                                                     mon("         LDA   $01,X                   ; C1C4: A6 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1C6; JUMP; // sstep
case 0xC1C6:
                                                     mon("         ANDA  #$0F                    ; C1C6: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC1C8; JUMP; // sstep
case 0xC1C8:
                                                     mon("         ADDA  $4AFA                   ; C1C8: BB 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afa); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC1CB; JUMP; // sstep
case 0xC1CB:
                                                     mon("         BITA  #$10                    ; C1CB: 85 10         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x10; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC1CD; JUMP; // sstep
case 0xC1CD:
                                                     mon("         BEQ   LC1D1                   ; C1CD: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc1d1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC1CF; JUMP; // sstep
case 0xC1CF:
                                                     mon("         SUBA  #$06                    ; C1CF: 80 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x06; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xC1D1; JUMP; // sstep
case 0xC1D1:
                                                     mon("LC1D1    LSRA                          ; C1D1: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC1D2; JUMP; // sstep
case 0xC1D2:
                                                     mon("         STA   $01,X                   ; C1D2: A7 01         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC1D4; JUMP; // sstep
case 0xC1D4:
                                                     mon("         LSRA                          ; C1D4: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC1D5; JUMP; // sstep
case 0xC1D5:
                                                     mon("         LSRA                          ; C1D5: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC1D6; JUMP; // sstep
case 0xC1D6:
                                                     mon("         LSRA                          ; C1D6: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC1D7; JUMP; // sstep
case 0xC1D7:
                                                     mon("         LSRA                          ; C1D7: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC1D8; JUMP; // sstep
case 0xC1D8:
                                                     mon("         STA   ,X                      ; C1D8: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xC1DA; JUMP; // sstep
case 0xC1DA:
                                                     mon("         LEAX  $02,X                   ; C1DA: 30 02         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0002); 
/**/Z = X; 
    PC = 0xC1DC; JUMP; // sstep
case 0xC1DC:
                                                     mon("         CMPX  #$4588                  ; C1DC: 8C 45 88      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4588; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC1DF; JUMP; // sstep
case 0xC1DF:
                                                     mon("         BCS   LC1BB                   ; C1DF: 25 DA         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc1bb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC1E1; JUMP; // sstep
case 0xC1E1:
                                                     mon("         LDA   #$05                    ; C1E1: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1E3; JUMP; // sstep
case 0xC1E3:
                                                     mon("         STA   ,U                      ; C1E3: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xC1E5; JUMP; // sstep
case 0xC1E5:
                                                     mon("         LDA   #$00                    ; C1E5: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1E7; JUMP; // sstep
case 0xC1E7:
                                                     mon("         STA   $01,U                   ; C1E7: A7 41         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC1E9; JUMP; // sstep
case 0xC1E9:
                                                     mon("LC1E9    LDA   $4866                   ; C1E9: B6 48 66      \n"); // Joystick pitch data structure
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4866); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1EC; JUMP; // sstep
case 0xC1EC:
                                                     mon("         STA   $4AFA                   ; C1EC: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC1EF; JUMP; // sstep
case 0xC1EF:
                                                     mon("         LDA   $4868                   ; C1EF: B6 48 68      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4868); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1F2; JUMP; // sstep
case 0xC1F2:
                                                     mon("         STA   $4AFB                   ; C1F2: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC1F5; JUMP; // sstep
case 0xC1F5:
                                                     mon("         LDA   $486F                   ; C1F5: B6 48 6F      \n"); // Joystick roll data structure
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x486f); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1F8; JUMP; // sstep
case 0xC1F8:
                                                     mon("         STA   $4AFC                   ; C1F8: B7 4A FC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afc, val); 
    PC = 0xC1FB; JUMP; // sstep
case 0xC1FB:
                                                     mon("         LDA   $4871                   ; C1FB: B6 48 71      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4871); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC1FE; JUMP; // sstep
case 0xC1FE:
                                                     mon("         STA   $4AFD                   ; C1FE: B7 4A FD      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afd, val); 
    PC = 0xC201; JUMP; // sstep
case 0xC201:
                                                     mon("         LDX   #$4534                  ; C201: 8E 45 34      \n");
    clockticks = clockticks + 3; 
    X = 0x4534; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC204; JUMP; // sstep
case 0xC204:
                                                     mon("         LDU   #$4AFA                  ; C204: CE 4A FA      \n");
    clockticks = clockticks + 3; 
    U = 0x4afa; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC207; JUMP; // sstep
case 0xC207:
                                                     mon("         LDA   #$03                    ; C207: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_C0FF
    PC = 0xC209; JUMP; // sstep
case 0xC209:
                                                     mon("         JSR   LC6F9                   ; C209: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
    // =============== S U B R O U T I N E =======================================
  case 0xC20C:
                                                     mon("LC20C    LDX   #$455C                  ; C20C: 8E 45 5C      \n");
    clockticks = clockticks + 3; 
    X = 0x455c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC20F; JUMP; // sstep
case 0xC20F:
                                                     mon("         JSR   LC6D4                   ; C20F: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xC212:
                                                     mon("LC212    ORCC  #$10                    ; C212: 1A 10         \n");
    I = 1; 
    clockticks = clockticks + 3; 
    PC = 0xC214; JUMP; // sstep
case 0xC214:
                                                     mon("         LDU   $4B06                   ; C214: FE 4B 06      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b06)<<8; 
    ea = ea | rd_mem(0x4b07); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC217; JUMP; // sstep
case 0xC217:
                                                     mon("         LDD   $4B04                   ; C217: FC 4B 04      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b04); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b05); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC21A; JUMP; // sstep
case 0xC21A:
                                                     mon("         ANDCC #$EF                    ; C21A: 1C EF         \n");
    I = 0; 
    clockticks = clockticks + 3; 
    PC = 0xC21C; JUMP; // sstep
case 0xC21C:
                                                     mon("         CMPD  $4AFA                   ; C21C: 10 B3 4A FA   \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afa)<<8; 
    ea = ea | rd_mem(0x4afb); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xC220; JUMP; // sstep
case 0xC220:
                                                     mon("         BHI   LC22A                   ; C220: 22 08         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xc22a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC222; JUMP; // sstep
case 0xC222:
                                                     mon("         BCS   LC23D                   ; C222: 25 19         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc23d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC224; JUMP; // sstep
case 0xC224:
                                                     mon("         CMPU  $4AFC                   ; C224: 11 B3 4A FC   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afc)<<8; 
    ea = ea | rd_mem(0x4afd); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC228; JUMP; // sstep
case 0xC228:
                                                     mon("         BLS   LC23D                   ; C228: 23 13         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xc23d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC22A; JUMP; // sstep
case 0xC22A:
                                                     mon("LC22A    STD   $4AFA                   ; C22A: FD 4A FA      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4afa, A); // Care needed with I/O space and word fetches
    wr_mem(0x4afb, B); 
    PC = 0xC22D; JUMP; // sstep
case 0xC22D:
                                                     mon("         STU   $4AFC                   ; C22D: FF 4A FC      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4afc, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4afd, (UINT8)val); 
    PC = 0xC230; JUMP; // sstep
case 0xC230:
                                                     mon("         LDX   #$455C                  ; C230: 8E 45 5C      \n");
    clockticks = clockticks + 3; 
    X = 0x455c; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC233; JUMP; // sstep
case 0xC233:
                                                     mon("         LDU   #$4AFA                  ; C233: CE 4A FA      \n");
    clockticks = clockticks + 3; 
    U = 0x4afa; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC236; JUMP; // sstep
case 0xC236:
                                                     mon("         LDA   #$03                    ; C236: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC238; JUMP; // sstep
case 0xC238:
                                                     mon("         JSR   LC6F9                   ; C238: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
  case 0xC23B:
                                                     mon("LC23B    BRA   LC249                   ; C23B: 20 0C         \n");
    PC = 0xc249; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC23D:
                                                     mon("LC23D    LDD   $4AFA                   ; C23D: FC 4A FA      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4afa); // Care needed with I/O space and word fetches
    B = rd_mem(0x4afb); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC240; JUMP; // sstep
case 0xC240:
                                                     mon("         STD   $4B04                   ; C240: FD 4B 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b04, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b05, B); 
    PC = 0xC243; JUMP; // sstep
case 0xC243:
                                                     mon("         LDD   $4AFC                   ; C243: FC 4A FC      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4afc); // Care needed with I/O space and word fetches
    B = rd_mem(0x4afd); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC246; JUMP; // sstep
case 0xC246:
                                                     mon("         STD   $4B06                   ; C246: FD 4B 06      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b06, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b07, B); 
    PC = 0xC249; JUMP; // sstep
case 0xC249:
                                                     mon("LC249    LDA   #$02                    ; C249: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_C20C
    PC = 0xC24B; JUMP; // sstep
case 0xC24B:
                                                     mon("         JMP   LC2B3                   ; C24B: 7E C2 B3      \n");
    clockticks = clockticks + 4; 
    PC = 0xc2b3; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC24E:
                                                     mon("LC24E    CMPA  #$03                    ; C24E: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC250; JUMP; // sstep
case 0xC250:
                                                     mon("         BCC   LC2B3                   ; C250: 24 61         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xc2b3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC252; JUMP; // sstep
case 0xC252:
                                                     mon("         CMPA  #$02                    ; C252: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC254; JUMP; // sstep
case 0xC254:
                                                     mon("         BCS   LC27F                   ; C254: 25 29         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc27f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC256; JUMP; // sstep
case 0xC256:
                                                     mon("         LDX   #word_C7B7              ; C256: 8E C7 B7      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b7; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC259; JUMP; // sstep
case 0xC259:
                                                     mon("         LDB   A,X                     ; C259: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC25B; JUMP; // sstep
case 0xC25B:
                                                     mon("         SUBB  #$02                    ; C25B: C0 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xC25D; JUMP; // sstep
case 0xC25D:
                                                     mon("         STB   $4AFB                   ; C25D: F7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC260; JUMP; // sstep
case 0xC260:
                                                     mon("         LDB   #$45                    ; C260: C6 45         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x45; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC262; JUMP; // sstep
case 0xC262:
                                                     mon("         STB   $4AFA                   ; C262: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC265; JUMP; // sstep
case 0xC265:
                                                     mon("         LDX   #unk_C7B6               ; C265: 8E C7 B6      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC268; JUMP; // sstep
case 0xC268:
                                                     mon("         LDB   A,X                     ; C268: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC26A; JUMP; // sstep
case 0xC26A:
                                                     mon("         LDX   #$C707                  ; C26A: 8E C7 07      \n");
    clockticks = clockticks + 3; 
    X = 0xc707; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC26D; JUMP; // sstep
case 0xC26D:
                                                     mon("         ABX                           ; C26D: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC26E; JUMP; // sstep
case 0xC26E:
                                                     mon("         TFR   X,U                     ; C26E: 1F 13         \n");
    U = X; 
    clockticks = clockticks + 6; 
    PC = 0xC270; JUMP; // sstep
case 0xC270:
                                                     mon("         LDX   #$4500                  ; C270: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC273; JUMP; // sstep
case 0xC273:
                                                     mon("         ABX                           ; C273: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC274; JUMP; // sstep
case 0xC274:
                                                     mon("LC274    LDB   ,U+                     ; C274: E6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xC276; JUMP; // sstep
case 0xC276:
                                                     mon("         STB   ,X+                     ; C276: E7 80         \n");
    clockticks = clockticks + 6; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xC278; JUMP; // sstep
case 0xC278:
                                                     mon("         CPX   $4AFA                   ; C278: BC 4A FA      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afa)<<8; 
    ea = ea | rd_mem(0x4afb); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC27B; JUMP; // sstep
case 0xC27B:
                                                     mon("         BCS   LC274                   ; C27B: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc274; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC27D; JUMP; // sstep
case 0xC27D:
                                                     mon("         BRA   LC2B3                   ; C27D: 20 34         \n");
    PC = 0xc2b3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC27F:
                                                     mon("LC27F    TFR   A,B                     ; C27F: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xC281; JUMP; // sstep
case 0xC281:
                                                     mon("         TSTA                          ; C281: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC282; JUMP; // sstep
case 0xC282:
                                                     mon("         BNE   LC29B                   ; C282: 26 17         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc29b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC284; JUMP; // sstep
case 0xC284:
                                                     mon("         LDA   <$27                    ; C284: 96 27         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x27); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC286; JUMP; // sstep
case 0xC286:
                                                     mon("         STA   $4AFA                   ; C286: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC289; JUMP; // sstep
case 0xC289:
                                                     mon("         LDA   <$24                    ; C289: 96 24         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x24); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC28B; JUMP; // sstep
case 0xC28B:
                                                     mon("         STA   $4AFB                   ; C28B: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC28E; JUMP; // sstep
case 0xC28E:
                                                     mon("         LDA   #$00                    ; C28E: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC290; JUMP; // sstep
case 0xC290:
                                                     mon("         STA   $4AFC                   ; C290: B7 4A FC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afc, val); 
    PC = 0xC293; JUMP; // sstep
case 0xC293:
                                                     mon("         LDX   #$4500                  ; C293: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC296; JUMP; // sstep
case 0xC296:
                                                     mon("         JSR   LC6F4                   ; C296: BD C6 F4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x99); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc6f4; 
    JUMP;
  case 0xC299:
                                                     mon("LC299    BRA   LC2B1                   ; C299: 20 16         \n");
    PC = 0xc2b1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC29B:
                                                     mon("LC29B    LDX   #$4508                  ; C29B: 8E 45 08      \n");
    clockticks = clockticks + 3; 
    X = 0x4508; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC29E; JUMP; // sstep
case 0xC29E:
                                                     mon("         LDU   #word_CC98              ; C29E: CE CC 98      \n"); // High scores init table
    clockticks = clockticks + 3; 
    U = 0xcc98; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC2A1; JUMP; // sstep
case 0xC2A1:
                                                     mon("         LDA   #$0B                    ; C2A1: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC2A3; JUMP; // sstep
case 0xC2A3:
                                                     mon("         JSR   LC6F9                   ; C2A3: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
  case 0xC2A6:
                                                     mon("LC2A6    LDX   #$4520                  ; C2A6: 8E 45 20      \n");
    clockticks = clockticks + 3; 
    X = 0x4520; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC2A9; JUMP; // sstep
case 0xC2A9:
                                                     mon("         LDU   #word_CC7A              ; C2A9: CE CC 7A      \n"); // High score names
    clockticks = clockticks + 3; 
    U = 0xcc7a; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC2AC; JUMP; // sstep
case 0xC2AC:
                                                     mon("         LDA   #$08                    ; C2AC: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC2AE; JUMP; // sstep
case 0xC2AE:
                                                     mon("         JSR   LC6F9                   ; C2AE: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
    // End of function sub_C24E
  case 0xC2B1:
                                                     mon("LC2B1    TFR   B,A                     ; C2B1: 1F 98         \n");
    A = (UINT8)B; 
    clockticks = clockticks + 6; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xC2B3; JUMP; // sstep
case 0xC2B3:
                                                     mon("LC2B3    JSR   LC2C3                   ; C2B3: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC2B6:
                                                     mon("LC2B6    BEQ   locret_C2C2             ; C2B6: 27 0A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc2c2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC2B8; JUMP; // sstep
case 0xC2B8:
                                                     mon("         STB   $01,X                   ; C2B8: E7 01         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC2BA; JUMP; // sstep
case 0xC2BA:
                                                     mon("         LSRB                          ; C2BA: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC2BB; JUMP; // sstep
case 0xC2BB:
                                                     mon("         LSRB                          ; C2BB: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC2BC; JUMP; // sstep
case 0xC2BC:
                                                     mon("         LSRB                          ; C2BC: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC2BD; JUMP; // sstep
case 0xC2BD:
                                                     mon("         LSRB                          ; C2BD: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC2BE; JUMP; // sstep
case 0xC2BE:
                                                     mon("         STB   ,X                      ; C2BE: E7 84         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xC2C0; JUMP; // sstep
case 0xC2C0:
                                                     mon("         LDB   #$FF                    ; C2C0: C6 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_C2B3
    PC = 0xC2C2; JUMP; // sstep
case 0xC2C2:
                                                     mon("locret_C2C2 RTS                           ; C2C2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC2C3:
                                                     mon("LC2C3    LEAS  -3,S                    ; C2C3: 32 7D         \n");
    clockticks = clockticks + 5; 
    S = (S + 0xfffd); 
    PC = 0xC2C5; JUMP; // sstep
case 0xC2C5:
                                                     mon("         LDX   #word_C7B7              ; C2C5: 8E C7 B7      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b7; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC2C8; JUMP; // sstep
case 0xC2C8:
                                                     mon("         LDB   A,X                     ; C2C8: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC2CA; JUMP; // sstep
case 0xC2CA:
                                                     mon("         LDX   #unk_C7B6               ; C2CA: 8E C7 B6      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC2CD; JUMP; // sstep
case 0xC2CD:
                                                     mon("         SUBB  A,X                     ; C2CD: E0 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem((UINT16)(X + (SINT8)A)); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xC2CF; JUMP; // sstep
case 0xC2CF:
                                                     mon("         SUBB  #$02                    ; C2CF: C0 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xC2D1; JUMP; // sstep
case 0xC2D1:
                                                     mon("         STB   ,S                      ; C2D1: E7 E4         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = S; 
    wr_mem(ea, val); 
    PC = 0xC2D3; JUMP; // sstep
case 0xC2D3:
                                                     mon("         LDB   A,X                     ; C2D3: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC2D5; JUMP; // sstep
case 0xC2D5:
                                                     mon("         LDX   #$4500                  ; C2D5: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC2D8; JUMP; // sstep
case 0xC2D8:
                                                     mon("         ABX                           ; C2D8: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC2D9; JUMP; // sstep
case 0xC2D9:
                                                     mon("         LDB   #$00                    ; C2D9: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC2DB; JUMP; // sstep
case 0xC2DB:
                                                     mon("         STB   $01,S                   ; C2DB: E7 61         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(S + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC2DD; JUMP; // sstep
case 0xC2DD:
                                                     mon("         ORCC  #$01                    ; C2DD: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xC2DF; JUMP; // sstep
case 0xC2DF:
                                                     mon("LC2DF    LDB   ,X+                     ; C2DF: E6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xC2E1; JUMP; // sstep
case 0xC2E1:
                                                     mon("         ANDB  #$0F                    ; C2E1: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC2E3; JUMP; // sstep
case 0xC2E3:
                                                     mon("         ADCB  $01,S                   ; C2E3: E9 61         \n");
    clockticks = clockticks + 5; 
    arg = B; 
    val = rd_mem((UINT16)(S + 0x0001)); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    B = (UINT8)res; 
    PC = 0xC2E5; JUMP; // sstep
case 0xC2E5:
                                                     mon("         STB   $01,S                   ; C2E5: E7 61         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(S + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC2E7; JUMP; // sstep
case 0xC2E7:
                                                     mon("         DEC   ,S                      ; C2E7: 6A E4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(S); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(S, res); 
    clockticks = clockticks + 2; 
    PC = 0xC2E9; JUMP; // sstep
case 0xC2E9:
                                                     mon("         BNE   LC2DF                   ; C2E9: 26 F4         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc2df; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC2EB; JUMP; // sstep
case 0xC2EB:
                                                     mon("         ADCB  #$00                    ; C2EB: C9 00         \n");
    clockticks = clockticks + 2; 
    arg = B; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
/**/C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    B = (UINT8)res; 
    PC = 0xC2ED; JUMP; // sstep
case 0xC2ED:
                                                     mon("         STB   $01,S                   ; C2ED: E7 61         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(S + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC2EF; JUMP; // sstep
case 0xC2EF:
                                                     mon("         LDB   ,X                      ; C2EF: E6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC2F1; JUMP; // sstep
case 0xC2F1:
                                                     mon("         ASLB                          ; C2F1: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC2F2; JUMP; // sstep
case 0xC2F2:
                                                     mon("         ASLB                          ; C2F2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC2F3; JUMP; // sstep
case 0xC2F3:
                                                     mon("         ASLB                          ; C2F3: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC2F4; JUMP; // sstep
case 0xC2F4:
                                                     mon("         ASLB                          ; C2F4: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC2F5; JUMP; // sstep
case 0xC2F5:
                                                     mon("         STB   $02,S                   ; C2F5: E7 62         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(S + 0x0002); 
    wr_mem(ea, val); 
    PC = 0xC2F7; JUMP; // sstep
case 0xC2F7:
                                                     mon("         LDB   $01,X                   ; C2F7: E6 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC2F9; JUMP; // sstep
case 0xC2F9:
                                                     mon("         ANDB  #$0F                    ; C2F9: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC2FB; JUMP; // sstep
case 0xC2FB:
                                                     mon("         ADDB  $02,S                   ; C2FB: EB 62         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem((UINT16)(S + 0x0002)); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xC2FD; JUMP; // sstep
case 0xC2FD:
                                                     mon("         STB   $02,S                   ; C2FD: E7 62         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(S + 0x0002); 
    wr_mem(ea, val); 
    PC = 0xC2FF; JUMP; // sstep
case 0xC2FF:
                                                     mon("         LDB   $01,S                   ; C2FF: E6 61         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(S + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC301; JUMP; // sstep
case 0xC301:
                                                     mon("         CMPB  $02,S                   ; C301: E1 62         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem((UINT16)(S + 0x0002)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC303; JUMP; // sstep
case 0xC303:
                                                     mon("         LEAS  $03,S                   ; C303: 32 63         \n");
    clockticks = clockticks + 5; 
    S = (S + 0x0003); 
    // End of function sub_C2C3
    PC = 0xC305; JUMP; // sstep
case 0xC305:
                                                     mon("         RTS                           ; C305: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC306:
                                                     mon("LC306    LDX   #$4500                  ; C306: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC309; JUMP; // sstep
case 0xC309:
                                                     mon("         LDU   #$4C00                  ; C309: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC30C; JUMP; // sstep
case 0xC30C:
                                                     mon("LC30C    LDD   ,X++                    ; C30C: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC30E; JUMP; // sstep
case 0xC30E:
                                                     mon("         STD   ,U++                    ; C30E: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xC310; JUMP; // sstep
case 0xC310:
                                                     mon("         CMPX  #$4600                  ; C310: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC313; JUMP; // sstep
case 0xC313:
                                                     mon("         BCS   LC30C                   ; C313: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc30c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC315; JUMP; // sstep
case 0xC315:
                                                     mon("         LDA   #$FF                    ; C315: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC317; JUMP; // sstep
case 0xC317:
                                                     mon("         STA   $4687                   ; C317: B7 46 87      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4687, val); 
    PC = 0xC31A; JUMP; // sstep
case 0xC31A:
                                                     mon("         LDX   #$0100                  ; C31A: 8E 01 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0100; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC31D; JUMP; // sstep
case 0xC31D:
                                                     mon("LC31D    STA   $4640                   ; C31D: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xC320; JUMP; // sstep
case 0xC320:
                                                     mon("         LEAX  -1,X                    ; C320: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xC322; JUMP; // sstep
case 0xC322:
                                                     mon("         BNE   LC31D                   ; C322: 26 F9         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc31d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC324; JUMP; // sstep
case 0xC324:
                                                     mon("         LDA   #$00                    ; C324: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC326; JUMP; // sstep
case 0xC326:
                                                     mon("         STA   $4687                   ; C326: B7 46 87      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4687, val); 
    PC = 0xC329; JUMP; // sstep
case 0xC329:
                                                     mon("         LDX   #$A000                  ; C329: 8E A0 00      \n");
    clockticks = clockticks + 3; 
    X = 0xa000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC32C; JUMP; // sstep
case 0xC32C:
                                                     mon("LC32C    STA   $4640                   ; C32C: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xC32F; JUMP; // sstep
case 0xC32F:
                                                     mon("         LEAX  -1,X                    ; C32F: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xC331; JUMP; // sstep
case 0xC331:
                                                     mon("         BNE   LC32C                   ; C331: 26 F9         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc32c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC333; JUMP; // sstep
case 0xC333:
                                                     mon("         LDX   #$4500                  ; C333: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC336; JUMP; // sstep
case 0xC336:
                                                     mon("         LDY   #$4C00                  ; C336: 10 8E 4C 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x4c00; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xC33A; JUMP; // sstep
case 0xC33A:
                                                     mon("LC33A    LDU   ,X                      ; C33A: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC33C; JUMP; // sstep
case 0xC33C:
                                                     mon("         LDD   ,Y                      ; C33C: EC A4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(Y); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(Y+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC33E; JUMP; // sstep
case 0xC33E:
                                                     mon("         STU   ,Y++                    ; C33E: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xC340; JUMP; // sstep
case 0xC340:
                                                     mon("         STD   ,X++                    ; C340: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xC342; JUMP; // sstep
case 0xC342:
                                                     mon("         CMPX  #$4600                  ; C342: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC345; JUMP; // sstep
case 0xC345:
                                                     mon("         BCS   LC33A                   ; C345: 25 F3         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc33a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC347; JUMP; // sstep
case 0xC347:
                                                     mon("         LDA   #$03                    ; C347: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC349; JUMP; // sstep
case 0xC349:
                                                     mon("         JSR   LC2C3                   ; C349: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC34C:
                                                     mon("LC34C    BEQ   LC37C                   ; C34C: 27 2E         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc37c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC34E; JUMP; // sstep
case 0xC34E:
                                                     mon("         LDA   #$00                    ; C34E: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC350; JUMP; // sstep
case 0xC350:
                                                     mon("         JSR   LC2C3                   ; C350: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x53); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC353:
                                                     mon("LC353    BEQ   LC36C                   ; C353: 27 17         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc36c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC355; JUMP; // sstep
case 0xC355:
                                                     mon("         JSR   LC3EE                   ; C355: BD C3 EE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc3ee; 
    JUMP;
  case 0xC358:
                                                     mon("LC358    LDA   #$03                    ; C358: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC35A; JUMP; // sstep
case 0xC35A:
                                                     mon("         JSR   LC3EE                   ; C35A: BD C3 EE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc3ee; 
    JUMP;
  case 0xC35D:
                                                     mon("LC35D    JSR   LC2C3                   ; C35D: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC360:
                                                     mon("LC360    BEQ   LC37C                   ; C360: 27 1A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc37c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC362; JUMP; // sstep
case 0xC362:
                                                     mon("         LDA   #$00                    ; C362: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC364; JUMP; // sstep
case 0xC364:
                                                     mon("         JSR   LC2C3                   ; C364: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC367:
                                                     mon("LC367    BEQ   LC36C                   ; C367: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc36c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC369; JUMP; // sstep
case 0xC369:
                                                     mon("LC369    JSR   LC24E                   ; C369: BD C2 4E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc24e; 
    JUMP;
  case 0xC36C:
                                                     mon("LC36C    LDX   #unk_C7B6               ; C36C: 8E C7 B6      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC36F; JUMP; // sstep
case 0xC36F:
                                                     mon("         LDB   $0003,X                 ; C36F: E6 89 00 03   \n");
    clockticks = clockticks + 8; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC373; JUMP; // sstep
case 0xC373:
                                                     mon("         LDX   #$4500                  ; C373: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC376; JUMP; // sstep
case 0xC376:
                                                     mon("         ABX                           ; C376: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC377; JUMP; // sstep
case 0xC377:
                                                     mon("         LDU   #$4500                  ; C377: CE 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    U = 0x4500; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xC37A; JUMP; // sstep
case 0xC37A:
                                                     mon("         BRA   LC3B7                   ; C37A: 20 3B         \n");
    PC = 0xc3b7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC37C:
                                                     mon("LC37C    LDA   #$00                    ; C37C: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC37E; JUMP; // sstep
case 0xC37E:
                                                     mon("         JSR   LC2C3                   ; C37E: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x81); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC381:
                                                     mon("LC381    BNE   LC3A7                   ; C381: 26 24         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc3a7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC383; JUMP; // sstep
case 0xC383:
                                                     mon("         LDA   $4596                   ; C383: B6 45 96      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4596); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC386; JUMP; // sstep
case 0xC386:
                                                     mon("         ANDA  #$0F                    ; C386: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC388; JUMP; // sstep
case 0xC388:
                                                     mon("         STA   $4AFA                   ; C388: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC38B; JUMP; // sstep
case 0xC38B:
                                                     mon("         LDA   $4506                   ; C38B: B6 45 06      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4506); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC38E; JUMP; // sstep
case 0xC38E:
                                                     mon("         ANDA  #$0F                    ; C38E: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC390; JUMP; // sstep
case 0xC390:
                                                     mon("         CMPA  $4AFA                   ; C390: B1 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afa); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC393; JUMP; // sstep
case 0xC393:
                                                     mon("         BNE   LC3A5                   ; C393: 26 10         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc3a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC395; JUMP; // sstep
case 0xC395:
                                                     mon("         LDA   $4597                   ; C395: B6 45 97      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4597); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC398; JUMP; // sstep
case 0xC398:
                                                     mon("         ANDA  #$0F                    ; C398: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC39A; JUMP; // sstep
case 0xC39A:
                                                     mon("         STA   $4AFA                   ; C39A: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC39D; JUMP; // sstep
case 0xC39D:
                                                     mon("         LDA   $4507                   ; C39D: B6 45 07      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4507); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC3A0; JUMP; // sstep
case 0xC3A0:
                                                     mon("         ANDA  #$0F                    ; C3A0: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC3A2; JUMP; // sstep
case 0xC3A2:
                                                     mon("         CMPA  $4AFA                   ; C3A2: B1 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afa); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC3A5; JUMP; // sstep
case 0xC3A5:
                                                     mon("LC3A5    BEQ   LC3C6                   ; C3A5: 27 1F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc3c6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC3A7; JUMP; // sstep
case 0xC3A7:
                                                     mon("LC3A7    LDX   #unk_C7B6               ; C3A7: 8E C7 B6      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC3AA; JUMP; // sstep
case 0xC3AA:
                                                     mon("         LDB   $0003,X                 ; C3AA: E6 89 00 03   \n");
    clockticks = clockticks + 8; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC3AE; JUMP; // sstep
case 0xC3AE:
                                                     mon("         LDX   #$4500                  ; C3AE: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC3B1; JUMP; // sstep
case 0xC3B1:
                                                     mon("         ABX                           ; C3B1: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC3B2; JUMP; // sstep
case 0xC3B2:
                                                     mon("         TFR   X,U                     ; C3B2: 1F 13         \n");
    U = X; 
    clockticks = clockticks + 6; 
    PC = 0xC3B4; JUMP; // sstep
case 0xC3B4:
                                                     mon("         LDX   #$4500                  ; C3B4: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC3B7; JUMP; // sstep
case 0xC3B7:
                                                     mon("LC3B7    LDB   word_C7B7               ; C3B7: F6 C7 B7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0xc7b7); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC3BA; JUMP; // sstep
case 0xC3BA:
                                                     mon("         STB   $4B02                   ; C3BA: F7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC3BD; JUMP; // sstep
case 0xC3BD:
                                                     mon("LC3BD    LDB   ,U+                     ; C3BD: E6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xC3BF; JUMP; // sstep
case 0xC3BF:
                                                     mon("         STB   ,X+                     ; C3BF: E7 80         \n");
    clockticks = clockticks + 6; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xC3C1; JUMP; // sstep
case 0xC3C1:
                                                     mon("         DEC   $4B02                   ; C3C1: 7A 4B 02      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b02); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4b02, res); 
    clockticks = clockticks + 2; 
    PC = 0xC3C4; JUMP; // sstep
case 0xC3C4:
                                                     mon("         BNE   LC3BD                   ; C3C4: 26 F7         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc3bd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC3C6; JUMP; // sstep
case 0xC3C6:
                                                     mon("LC3C6    LDA   #$02                    ; C3C6: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC3C8; JUMP; // sstep
case 0xC3C8:
                                                     mon("LC3C8    JSR   LC2C3                   ; C3C8: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC3CB:
                                                     mon("LC3CB    BEQ   LC3D8                   ; C3CB: 27 0B         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc3d8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC3CD; JUMP; // sstep
case 0xC3CD:
                                                     mon("         JSR   LC3EE                   ; C3CD: BD C3 EE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc3ee; 
    JUMP;
  case 0xC3D0:
                                                     mon("LC3D0    JSR   LC2C3                   ; C3D0: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC3D3:
                                                     mon("LC3D3    BEQ   LC3D8                   ; C3D3: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc3d8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC3D5; JUMP; // sstep
case 0xC3D5:
                                                     mon("         JSR   LC24E                   ; C3D5: BD C2 4E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc24e; 
    JUMP;
  case 0xC3D8:
                                                     mon("LC3D8    DECA                          ; C3D8: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC3D9; JUMP; // sstep
case 0xC3D9:
                                                     mon("         BNE   LC3C8                   ; C3D9: 26 ED         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc3c8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC3DB; JUMP; // sstep
case 0xC3DB:
                                                     mon("         LDX   #$455C                  ; C3DB: 8E 45 5C      \n");
    clockticks = clockticks + 3; 
    X = 0x455c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC3DE; JUMP; // sstep
case 0xC3DE:
                                                     mon("         JSR   LC6D4                   ; C3DE: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0xC3E1:
                                                     mon("LC3E1    LDD   $4AFA                   ; C3E1: FC 4A FA      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4afa); // Care needed with I/O space and word fetches
    B = rd_mem(0x4afb); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC3E4; JUMP; // sstep
case 0xC3E4:
                                                     mon("         STD   $4B04                   ; C3E4: FD 4B 04      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b04, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b05, B); 
    PC = 0xC3E7; JUMP; // sstep
case 0xC3E7:
                                                     mon("         LDD   $4AFC                   ; C3E7: FC 4A FC      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4afc); // Care needed with I/O space and word fetches
    B = rd_mem(0x4afd); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC3EA; JUMP; // sstep
case 0xC3EA:
                                                     mon("         STD   $4B06                   ; C3EA: FD 4B 06      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b06, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b07, B); 
    // End of function sub_C306
    PC = 0xC3ED; JUMP; // sstep
case 0xC3ED:
                                                     mon("         RTS                           ; C3ED: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC3EE:
                                                     mon("LC3EE    LDX   #word_C7B7              ; C3EE: 8E C7 B7      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b7; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC3F1; JUMP; // sstep
case 0xC3F1:
                                                     mon("         LDB   A,X                     ; C3F1: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC3F3; JUMP; // sstep
case 0xC3F3:
                                                     mon("         LDX   #$4500                  ; C3F3: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC3F6; JUMP; // sstep
case 0xC3F6:
                                                     mon("         ABX                           ; C3F6: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC3F7; JUMP; // sstep
case 0xC3F7:
                                                     mon("         STX   $4AFA                   ; C3F7: BF 4A FA      \n");
    clockticks = clockticks + 5; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4afa, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4afb, (UINT8)val); 
    PC = 0xC3FA; JUMP; // sstep
case 0xC3FA:
                                                     mon("         LDX   #unk_C7B6               ; C3FA: 8E C7 B6      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC3FD; JUMP; // sstep
case 0xC3FD:
                                                     mon("         LDB   A,X                     ; C3FD: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC3FF; JUMP; // sstep
case 0xC3FF:
                                                     mon("         LDX   #$4C00                  ; C3FF: 8E 4C 00      \n");
    clockticks = clockticks + 3; 
    X = 0x4c00; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC402; JUMP; // sstep
case 0xC402:
                                                     mon("         ABX                           ; C402: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC403; JUMP; // sstep
case 0xC403:
                                                     mon("         TFR   X,U                     ; C403: 1F 13         \n");
    U = X; 
    clockticks = clockticks + 6; 
    PC = 0xC405; JUMP; // sstep
case 0xC405:
                                                     mon("         LDX   #$4500                  ; C405: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC408; JUMP; // sstep
case 0xC408:
                                                     mon("         ABX                           ; C408: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC409; JUMP; // sstep
case 0xC409:
                                                     mon("LC409    LDB   ,U+                     ; C409: E6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xC40B; JUMP; // sstep
case 0xC40B:
                                                     mon("         STB   ,X+                     ; C40B: E7 80         \n");
    clockticks = clockticks + 6; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xC40D; JUMP; // sstep
case 0xC40D:
                                                     mon("         CPX   $4AFA                   ; C40D: BC 4A FA      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afa)<<8; 
    ea = ea | rd_mem(0x4afb); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC410; JUMP; // sstep
case 0xC410:
                                                     mon("         BCS   LC409                   ; C410: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc409; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C3EE
    PC = 0xC412; JUMP; // sstep
case 0xC412:
                                                     mon("         RTS                           ; C412: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC413:
                                                     mon("LC413    JSR   LC2C3                   ; C413: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC416:
                                                     mon("LC416    BEQ   locret_C44F             ; C416: 27 37         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc44f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC418; JUMP; // sstep
case 0xC418:
                                                     mon("         STA   $4AFA                   ; C418: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC41B; JUMP; // sstep
case 0xC41B:
                                                     mon("         LDX   #$4500                  ; C41B: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC41E; JUMP; // sstep
case 0xC41E:
                                                     mon("         LDU   #$4C00                  ; C41E: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC421; JUMP; // sstep
case 0xC421:
                                                     mon("LC421    LDD   ,X++                    ; C421: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC423; JUMP; // sstep
case 0xC423:
                                                     mon("         STD   ,U++                    ; C423: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xC425; JUMP; // sstep
case 0xC425:
                                                     mon("         CMPX  #$4600                  ; C425: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC428; JUMP; // sstep
case 0xC428:
                                                     mon("         BCS   LC421                   ; C428: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc421; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC42A; JUMP; // sstep
case 0xC42A:
                                                     mon("         JSR   LC6B8                   ; C42A: BD C6 B8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc6b8; 
    JUMP;
  case 0xC42D:
                                                     mon("LC42D    LDX   #$4500                  ; C42D: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC430; JUMP; // sstep
case 0xC430:
                                                     mon("         LDY   #$4C00                  ; C430: 10 8E 4C 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x4c00; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xC434; JUMP; // sstep
case 0xC434:
                                                     mon("LC434    LDU   ,X                      ; C434: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC436; JUMP; // sstep
case 0xC436:
                                                     mon("         LDD   ,Y                      ; C436: EC A4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(Y); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(Y+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC438; JUMP; // sstep
case 0xC438:
                                                     mon("         STU   ,Y++                    ; C438: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xC43A; JUMP; // sstep
case 0xC43A:
                                                     mon("         STD   ,X++                    ; C43A: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xC43C; JUMP; // sstep
case 0xC43C:
                                                     mon("         CMPX  #$4600                  ; C43C: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC43F; JUMP; // sstep
case 0xC43F:
                                                     mon("         BCS   LC434                   ; C43F: 25 F3         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc434; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC441; JUMP; // sstep
case 0xC441:
                                                     mon("         LDA   $4AFA                   ; C441: B6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC444; JUMP; // sstep
case 0xC444:
                                                     mon("         JSR   LC3EE                   ; C444: BD C3 EE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x47); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc3ee; 
    JUMP;
  case 0xC447:
                                                     mon("LC447    JSR   LC2C3                   ; C447: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xC44A:
                                                     mon("LC44A    BEQ   locret_C44F             ; C44A: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc44f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC44C; JUMP; // sstep
case 0xC44C:
                                                     mon("         JSR   LC24E                   ; C44C: BD C2 4E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc24e; 
    JUMP;
    // End of function sub_C413
  case 0xC44F:
                                                     mon("locret_C44F RTS                           ; C44F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC450:
                                                     mon("LC450    LDA   #$65                    ; C450: 86 65         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x65; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC452; JUMP; // sstep
case 0xC452:
                                                     mon("LC452    JSR   LD8DF                   ; C452: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x55); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0xC455:
                                                     mon("LC455    INCA                          ; C455: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC456; JUMP; // sstep
case 0xC456:
                                                     mon("         CMPA  #$74                    ; C456: 81 74         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x74; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC458; JUMP; // sstep
case 0xC458:
                                                     mon("         BCS   LC452                   ; C458: 25 F8         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc452; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC45A; JUMP; // sstep
case 0xC45A:
                                                     mon("         LDA   #$D4                    ; C45A: 86 D4         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xd4; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC45C; JUMP; // sstep
case 0xC45C:
                                                     mon("         JSR   LD8DF                   ; C45C: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0xC45F:
                                                     mon("LC45F    LDD   #$6280                  ; C45F: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC462; JUMP; // sstep
case 0xC462:
                                                     mon("         STD   ,Y++                    ; C462: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC464; JUMP; // sstep
case 0xC464:
                                                     mon("         LDA   #$0B                    ; C464: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC466; JUMP; // sstep
case 0xC466:
                                                     mon("         STA   $4AFE                   ; C466: B7 4A FE      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afe, val); 
    PC = 0xC469; JUMP; // sstep
case 0xC469:
                                                     mon("LC469    LDA   $4AFE                   ; C469: B6 4A FE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afe); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC46C; JUMP; // sstep
case 0xC46C:
                                                     mon("         JSR   LC5A4                   ; C46C: BD C5 A4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc5a4; 
    JUMP;
  case 0xC46F:
                                                     mon("LC46F    DEC   $4AFE                   ; C46F: 7A 4A FE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afe); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4afe, res); 
    clockticks = clockticks + 2; 
    PC = 0xC472; JUMP; // sstep
case 0xC472:
                                                     mon("         BPL   LC469                   ; C472: 2A F5         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc469; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC474; JUMP; // sstep
case 0xC474:
                                                     mon("         JSR   LC690                   ; C474: BD C6 90      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc690; 
    JUMP;
  case 0xC477:
                                                     mon("LC477    LDA   $4598                   ; C477: B6 45 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4598); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC47A; JUMP; // sstep
case 0xC47A:
                                                     mon("         ANDA  #$0F                    ; C47A: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC47C; JUMP; // sstep
case 0xC47C:
                                                     mon("         BEQ   locret_C4EA             ; C47C: 27 6C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc4ea; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC47E; JUMP; // sstep
case 0xC47E:
                                                     mon("         LDB   #$D5                    ; C47E: C6 D5         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xd5; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC480; JUMP; // sstep
case 0xC480:
                                                     mon("         JSR   LE7C7                   ; C480: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xC483:
                                                     mon("LC483    LDA   <$AC                    ; C483: 96 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC485; JUMP; // sstep
case 0xC485:
                                                     mon("         ANDA  #$40                    ; C485: 84 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x40; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC487; JUMP; // sstep
case 0xC487:
                                                     mon("         BEQ   locret_C4EA             ; C487: 27 61         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc4ea; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC489; JUMP; // sstep
case 0xC489:
                                                     mon("         LDA   $4598                   ; C489: B6 45 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4598); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC48C; JUMP; // sstep
case 0xC48C:
                                                     mon("         ANDA  #$08                    ; C48C: 84 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x08; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC48E; JUMP; // sstep
case 0xC48E:
                                                     mon("         BEQ   LC498                   ; C48E: 27 08         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc498; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC490; JUMP; // sstep
case 0xC490:
                                                     mon("         LDA   #$01                    ; C490: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC492; JUMP; // sstep
case 0xC492:
                                                     mon("         JSR   LC24E                   ; C492: BD C2 4E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc24e; 
    JUMP;
  case 0xC495:
                                                     mon("LC495    JSR   LCC18                   ; C495: BD CC 18      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x98); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xcc18; 
    JUMP;
  case 0xC498:
                                                     mon("LC498    LDA   $4598                   ; C498: B6 45 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4598); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC49B; JUMP; // sstep
case 0xC49B:
                                                     mon("         ANDA  #$04                    ; C49B: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC49D; JUMP; // sstep
case 0xC49D:
                                                     mon("         BEQ   LC4B1                   ; C49D: 27 12         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc4b1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC49F; JUMP; // sstep
case 0xC49F:
                                                     mon("         LDX   #$454E                  ; C49F: 8E 45 4E      \n");
    clockticks = clockticks + 3; 
    X = 0x454e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC4A2; JUMP; // sstep
case 0xC4A2:
                                                     mon("         LDD   #$00                    ; C4A2: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC4A5; JUMP; // sstep
case 0xC4A5:
                                                     mon("LC4A5    STD   ,X++                    ; C4A5: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xC4A7; JUMP; // sstep
case 0xC4A7:
                                                     mon("         CMPX  #$458E                  ; C4A7: 8C 45 8E      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x458e; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC4AA; JUMP; // sstep
case 0xC4AA:
                                                     mon("         BCS   LC4A5                   ; C4AA: 25 F9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc4a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4AC; JUMP; // sstep
case 0xC4AC:
                                                     mon("         LDA   #$02                    ; C4AC: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC4AE; JUMP; // sstep
case 0xC4AE:
                                                     mon("         JSR   LC2B3                   ; C4AE: BD C2 B3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc2b3; 
    JUMP;
  case 0xC4B1:
                                                     mon("LC4B1    LDA   $4598                   ; C4B1: B6 45 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4598); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC4B4; JUMP; // sstep
case 0xC4B4:
                                                     mon("         ANDA  #$02                    ; C4B4: 84 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x02; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC4B6; JUMP; // sstep
case 0xC4B6:
                                                     mon("         BEQ   LC4DA                   ; C4B6: 27 22         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc4da; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4B8; JUMP; // sstep
case 0xC4B8:
                                                     mon("         LDA   #$00                    ; C4B8: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC4BA; JUMP; // sstep
case 0xC4BA:
                                                     mon("         JSR   LC24E                   ; C4BA: BD C2 4E      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc24e; 
    JUMP;
  case 0xC4BD:
                                                     mon("LC4BD    LDX   #unk_C7B6               ; C4BD: 8E C7 B6      \n");
    clockticks = clockticks + 3; 
    X = 0xc7b6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC4C0; JUMP; // sstep
case 0xC4C0:
                                                     mon("         LDB   $0003,X                 ; C4C0: E6 89 00 03   \n");
    clockticks = clockticks + 8; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC4C4; JUMP; // sstep
case 0xC4C4:
                                                     mon("         LDX   #$4500                  ; C4C4: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC4C7; JUMP; // sstep
case 0xC4C7:
                                                     mon("         ABX                           ; C4C7: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC4C8; JUMP; // sstep
case 0xC4C8:
                                                     mon("         LDU   #$4500                  ; C4C8: CE 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    U = 0x4500; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC4CB; JUMP; // sstep
case 0xC4CB:
                                                     mon("         LDB   word_C7B7               ; C4CB: F6 C7 B7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0xc7b7); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC4CE; JUMP; // sstep
case 0xC4CE:
                                                     mon("         STB   $4B02                   ; C4CE: F7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC4D1; JUMP; // sstep
case 0xC4D1:
                                                     mon("LC4D1    LDB   ,U+                     ; C4D1: E6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xC4D3; JUMP; // sstep
case 0xC4D3:
                                                     mon("         STB   ,X+                     ; C4D3: E7 80         \n");
    clockticks = clockticks + 6; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xC4D5; JUMP; // sstep
case 0xC4D5:
                                                     mon("         DEC   $4B02                   ; C4D5: 7A 4B 02      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b02); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4b02, res); 
    clockticks = clockticks + 2; 
    PC = 0xC4D8; JUMP; // sstep
case 0xC4D8:
                                                     mon("         BNE   LC4D1                   ; C4D8: 26 F7         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc4d1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4DA; JUMP; // sstep
case 0xC4DA:
                                                     mon("LC4DA    LDA   $4598                   ; C4DA: B6 45 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4598); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC4DD; JUMP; // sstep
case 0xC4DD:
                                                     mon("         ANDA  #$01                    ; C4DD: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC4DF; JUMP; // sstep
case 0xC4DF:
                                                     mon("         BEQ   LC4E4                   ; C4DF: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc4e4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4E1; JUMP; // sstep
case 0xC4E1:
                                                     mon("         JSR   LC5F2                   ; C4E1: BD C5 F2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    PC = 0xc5f2; 
    JUMP;
  case 0xC4E4:
                                                     mon("LC4E4    LDD   #$00                    ; C4E4: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC4E7; JUMP; // sstep
case 0xC4E7:
                                                     mon("         STD   $4598                   ; C4E7: FD 45 98      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4598, A); // Care needed with I/O space and word fetches
    wr_mem(0x4599, B); 
    // End of function sub_C450
    PC = 0xC4EA; JUMP; // sstep
case 0xC4EA:
                                                     mon("locret_C4EA RTS                           ; C4EA: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC4EB:
                                                     mon("LC4EB    LDB   <$43                    ; C4EB: D6 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC4ED; JUMP; // sstep
case 0xC4ED:
                                                     mon("         ANDB  #$0F                    ; C4ED: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC4EF; JUMP; // sstep
case 0xC4EF:
                                                     mon("         BNE   LC519                   ; C4EF: 26 28         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc519; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4F1; JUMP; // sstep
case 0xC4F1:
                                                     mon("         LDB   $487F                   ; C4F1: F6 48 7F      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x487f); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC4F4; JUMP; // sstep
case 0xC4F4:
                                                     mon("         CMPB  #$D0                    ; C4F4: C1 D0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xd0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC4F6; JUMP; // sstep
case 0xC4F6:
                                                     mon("         BCC   LC519                   ; C4F6: 24 21         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xc519; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4F8; JUMP; // sstep
case 0xC4F8:
                                                     mon("         CMPB  #$30                    ; C4F8: C1 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x30; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC4FA; JUMP; // sstep
case 0xC4FA:
                                                     mon("         BLS   LC519                   ; C4FA: 23 1D         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xc519; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4FC; JUMP; // sstep
case 0xC4FC:
                                                     mon("         TSTB                          ; C4FC: 5D            \n");
    val = (UINT8)B; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC4FD; JUMP; // sstep
case 0xC4FD:
                                                     mon("         BMI   LC50C                   ; C4FD: 2B 0D         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc50c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC4FF; JUMP; // sstep
case 0xC4FF:
                                                     mon("         LDB   $4AF6                   ; C4FF: F6 4A F6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af6); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC502; JUMP; // sstep
case 0xC502:
                                                     mon("         DECB                          ; C502: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC503; JUMP; // sstep
case 0xC503:
                                                     mon("         BPL   LC507                   ; C503: 2A 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc507; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC505; JUMP; // sstep
case 0xC505:
                                                     mon("         LDB   #$0B                    ; C505: C6 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC507; JUMP; // sstep
case 0xC507:
                                                     mon("LC507    STB   $4AF6                   ; C507: F7 4A F6      \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4af6, val); 
    PC = 0xC50A; JUMP; // sstep
case 0xC50A:
                                                     mon("         BRA   LC519                   ; C50A: 20 0D         \n");
    PC = 0xc519; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC50C:
                                                     mon("LC50C    LDB   $4AF6                   ; C50C: F6 4A F6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af6); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC50F; JUMP; // sstep
case 0xC50F:
                                                     mon("         INCB                          ; C50F: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC510; JUMP; // sstep
case 0xC510:
                                                     mon("         CMPB  #$0B                    ; C510: C1 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x0b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC512; JUMP; // sstep
case 0xC512:
                                                     mon("         BLS   LC516                   ; C512: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xc516; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC514; JUMP; // sstep
case 0xC514:
                                                     mon("         LDB   #$00                    ; C514: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC516; JUMP; // sstep
case 0xC516:
                                                     mon("LC516    STB   $4AF6                   ; C516: F7 4A F6      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af6, val); 
    PC = 0xC519; JUMP; // sstep
case 0xC519:
                                                     mon("LC519    LDX   #byte_C797              ; C519: 8E C7 97      \n");
    clockticks = clockticks + 3; 
    X = 0xc797; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC51C; JUMP; // sstep
case 0xC51C:
                                                     mon("         LDA   $4AF6                   ; C51C: B6 4A F6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af6); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC51F; JUMP; // sstep
case 0xC51F:
                                                     mon("         LDB   A,X                     ; C51F: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC521; JUMP; // sstep
case 0xC521:
                                                     mon("         STB   $4AFC                   ; C521: F7 4A FC      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afc, val); 
    PC = 0xC524; JUMP; // sstep
case 0xC524:
                                                     mon("         LSRB                          ; C524: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC525; JUMP; // sstep
case 0xC525:
                                                     mon("         LSRB                          ; C525: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC526; JUMP; // sstep
case 0xC526:
                                                     mon("         LSRB                          ; C526: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC527; JUMP; // sstep
case 0xC527:
                                                     mon("         ANDB  #$03                    ; C527: C4 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x03; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC529; JUMP; // sstep
case 0xC529:
                                                     mon("         LDX   #byte_C737              ; C529: 8E C7 37      \n");
    clockticks = clockticks + 3; 
    X = 0xc737; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC52C; JUMP; // sstep
case 0xC52C:
                                                     mon("         LDA   B,X                     ; C52C: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC52E; JUMP; // sstep
case 0xC52E:
                                                     mon("         STA   $4AFA                   ; C52E: B7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC531; JUMP; // sstep
case 0xC531:
                                                     mon("         LDB   <$AC                    ; C531: D6 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC533; JUMP; // sstep
case 0xC533:
                                                     mon("         ANDB  #$80                    ; C533: C4 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x80; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC535; JUMP; // sstep
case 0xC535:
                                                     mon("         BEQ   locret_C5A3             ; C535: 27 6C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc5a3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC537; JUMP; // sstep
case 0xC537:
                                                     mon("         LDB   $4AF5                   ; C537: F6 4A F5      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af5); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC53A; JUMP; // sstep
case 0xC53A:
                                                     mon("         INCB                          ; C53A: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC53B; JUMP; // sstep
case 0xC53B:
                                                     mon("         CMPB  $4AFA                   ; C53B: F1 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x4afa); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC53E; JUMP; // sstep
case 0xC53E:
                                                     mon("         BLS   LC542                   ; C53E: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xc542; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC540; JUMP; // sstep
case 0xC540:
                                                     mon("         LDB   #$00                    ; C540: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC542; JUMP; // sstep
case 0xC542:
                                                     mon("LC542    STA   $4AF5                   ; C542: B7 4A F5      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af5, val); 
    PC = 0xC545; JUMP; // sstep
case 0xC545:
                                                     mon("         LDA   $4AFC                   ; C545: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC548; JUMP; // sstep
case 0xC548:
                                                     mon("         ROLA                          ; C548: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC549; JUMP; // sstep
case 0xC549:
                                                     mon("         ROLA                          ; C549: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC54A; JUMP; // sstep
case 0xC54A:
                                                     mon("         ROLA                          ; C54A: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC54B; JUMP; // sstep
case 0xC54B:
                                                     mon("         ROLA                          ; C54B: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xC54C; JUMP; // sstep
case 0xC54C:
                                                     mon("         ANDA  #$07                    ; C54C: 84 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x07; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC54E; JUMP; // sstep
case 0xC54E:
                                                     mon("LC54E    DECA                          ; C54E: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC54F; JUMP; // sstep
case 0xC54F:
                                                     mon("         BMI   LC557                   ; C54F: 2B 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc557; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC551; JUMP; // sstep
case 0xC551:
                                                     mon("         ASLB                          ; C551: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC552; JUMP; // sstep
case 0xC552:
                                                     mon("         ASL   $4AFA                   ; C552: 78 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    wr_mem(0x4afa, res); 
    clockticks = clockticks + 2; 
    PC = 0xC555; JUMP; // sstep
case 0xC555:
                                                     mon("         BRA   LC54E                   ; C555: 20 F7         \n");
    PC = 0xc54e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC557:
                                                     mon("LC557    LDA   $4AFC                   ; C557: B6 4A FC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afc); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC55A; JUMP; // sstep
case 0xC55A:
                                                     mon("         ANDA  #$07                    ; C55A: 84 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x07; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC55C; JUMP; // sstep
case 0xC55C:
                                                     mon("         ASLA                          ; C55C: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC55D; JUMP; // sstep
case 0xC55D:
                                                     mon("         LDX   #$4590                  ; C55D: 8E 45 90      \n");
    clockticks = clockticks + 3; 
    X = 0x4590; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC560; JUMP; // sstep
case 0xC560:
                                                     mon("         LEAX  A,X                     ; C560: 30 86         \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)A); 
/**/Z = X; 
    PC = 0xC562; JUMP; // sstep
case 0xC562:
                                                     mon("         LDA   ,X                      ; C562: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC564; JUMP; // sstep
case 0xC564:
                                                     mon("         ASLA                          ; C564: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC565; JUMP; // sstep
case 0xC565:
                                                     mon("         ASLA                          ; C565: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC566; JUMP; // sstep
case 0xC566:
                                                     mon("         ASLA                          ; C566: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC567; JUMP; // sstep
case 0xC567:
                                                     mon("         ASLA                          ; C567: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC568; JUMP; // sstep
case 0xC568:
                                                     mon("         STA   $4AFB                   ; C568: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC56B; JUMP; // sstep
case 0xC56B:
                                                     mon("         LDA   $01,X                   ; C56B: A6 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC56D; JUMP; // sstep
case 0xC56D:
                                                     mon("         ANDA  #$0F                    ; C56D: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC56F; JUMP; // sstep
case 0xC56F:
                                                     mon("         ADDA  $4AFB                   ; C56F: BB 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4afb); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC572; JUMP; // sstep
case 0xC572:
                                                     mon("         STA   $4AFB                   ; C572: B7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC575; JUMP; // sstep
case 0xC575:
                                                     mon("         EORB  $4AFB                   ; C575: F8 4A FB      \n");
    clockticks = clockticks + 5; 
    res = B ^ rd_mem(0x4afb); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC578; JUMP; // sstep
case 0xC578:
                                                     mon("         ANDB  $4AFA                   ; C578: F4 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    res = val & rd_mem(0x4afa); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC57B; JUMP; // sstep
case 0xC57B:
                                                     mon("         EORB  $4AFB                   ; C57B: F8 4A FB      \n");
    clockticks = clockticks + 5; 
    res = B ^ rd_mem(0x4afb); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC57E; JUMP; // sstep
case 0xC57E:
                                                     mon("         STB   $01,X                   ; C57E: E7 01         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC580; JUMP; // sstep
case 0xC580:
                                                     mon("         LSRB                          ; C580: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC581; JUMP; // sstep
case 0xC581:
                                                     mon("         LSRB                          ; C581: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC582; JUMP; // sstep
case 0xC582:
                                                     mon("         LSRB                          ; C582: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC583; JUMP; // sstep
case 0xC583:
                                                     mon("         LSRB                          ; C583: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC584; JUMP; // sstep
case 0xC584:
                                                     mon("         STB   ,X                      ; C584: E7 84         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xC586; JUMP; // sstep
case 0xC586:
                                                     mon("         LDA   #$03                    ; C586: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC588; JUMP; // sstep
case 0xC588:
                                                     mon("         JSR   LC2B3                   ; C588: BD C2 B3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    PC = 0xc2b3; 
    JUMP;
  case 0xC58B:
                                                     mon("LC58B    LDX   #$4500                  ; C58B: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC58E; JUMP; // sstep
case 0xC58E:
                                                     mon("         LDU   #$4C00                  ; C58E: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC591; JUMP; // sstep
case 0xC591:
                                                     mon("LC591    LDD   ,X++                    ; C591: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC593; JUMP; // sstep
case 0xC593:
                                                     mon("         STD   ,U++                    ; C593: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xC595; JUMP; // sstep
case 0xC595:
                                                     mon("         CMPX  #$45FF                  ; C595: 8C 45 FF      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x45ff; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC598; JUMP; // sstep
case 0xC598:
                                                     mon("         BCS   LC591                   ; C598: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc591; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC59A; JUMP; // sstep
case 0xC59A:
                                                     mon("         JSR   LC3A7                   ; C59A: BD C3 A7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    PC = 0xc3a7; 
    JUMP;
  case 0xC59D:
                                                     mon("LC59D    LDA   $4AF6                   ; C59D: B6 4A F6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af6); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC5A0; JUMP; // sstep
case 0xC5A0:
                                                     mon("         JSR   LC5A4                   ; C5A0: BD C5 A4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    PC = 0xc5a4; 
    JUMP;
    // End of function sub_C4EB
  case 0xC5A3:
                                                     mon("locret_C5A3 RTS                           ; C5A3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC5A4:
                                                     mon("LC5A4    LDX   #byte_C797              ; C5A4: 8E C7 97      \n");
    clockticks = clockticks + 3; 
    X = 0xc797; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC5A7; JUMP; // sstep
case 0xC5A7:
                                                     mon("         LDB   A,X                     ; C5A7: E6 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)A)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC5A9; JUMP; // sstep
case 0xC5A9:
                                                     mon("         STB   $4AFA                   ; C5A9: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC5AC; JUMP; // sstep
case 0xC5AC:
                                                     mon("         ANDB  #$07                    ; C5AC: C4 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x07; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC5AE; JUMP; // sstep
case 0xC5AE:
                                                     mon("         LDX   #$4590                  ; C5AE: 8E 45 90      \n");
    clockticks = clockticks + 3; 
    X = 0x4590; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC5B1; JUMP; // sstep
case 0xC5B1:
                                                     mon("         ASLB                          ; C5B1: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC5B2; JUMP; // sstep
case 0xC5B2:
                                                     mon("         ABX                           ; C5B2: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC5B3; JUMP; // sstep
case 0xC5B3:
                                                     mon("         LDB   $4AFA                   ; C5B3: F6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC5B6; JUMP; // sstep
case 0xC5B6:
                                                     mon("         LSRB                          ; C5B6: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC5B7; JUMP; // sstep
case 0xC5B7:
                                                     mon("         LSRB                          ; C5B7: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC5B8; JUMP; // sstep
case 0xC5B8:
                                                     mon("         LSRB                          ; C5B8: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC5B9; JUMP; // sstep
case 0xC5B9:
                                                     mon("         STB   $4AFA                   ; C5B9: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC5BC; JUMP; // sstep
case 0xC5BC:
                                                     mon("         ANDB  #$03                    ; C5BC: C4 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x03; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC5BE; JUMP; // sstep
case 0xC5BE:
                                                     mon("         LDU   #byte_C737              ; C5BE: CE C7 37      \n");
    clockticks = clockticks + 3; 
    U = 0xc737; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC5C1; JUMP; // sstep
case 0xC5C1:
                                                     mon("         LEAU  B,U                     ; C5C1: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0xC5C3; JUMP; // sstep
case 0xC5C3:
                                                     mon("         LDB   $4AFA                   ; C5C3: F6 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC5C6; JUMP; // sstep
case 0xC5C6:
                                                     mon("         LSRB                          ; C5C6: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC5C7; JUMP; // sstep
case 0xC5C7:
                                                     mon("         LSRB                          ; C5C7: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC5C8; JUMP; // sstep
case 0xC5C8:
                                                     mon("         STB   $4AFA                   ; C5C8: F7 4A FA      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afa, val); 
    PC = 0xC5CB; JUMP; // sstep
case 0xC5CB:
                                                     mon("         LDB   ,X                      ; C5CB: E6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC5CD; JUMP; // sstep
case 0xC5CD:
                                                     mon("         ASLB                          ; C5CD: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC5CE; JUMP; // sstep
case 0xC5CE:
                                                     mon("         ASLB                          ; C5CE: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC5CF; JUMP; // sstep
case 0xC5CF:
                                                     mon("         ASLB                          ; C5CF: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC5D0; JUMP; // sstep
case 0xC5D0:
                                                     mon("         ASLB                          ; C5D0: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC5D1; JUMP; // sstep
case 0xC5D1:
                                                     mon("         STB   $4AFB                   ; C5D1: F7 4A FB      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4afb, val); 
    PC = 0xC5D4; JUMP; // sstep
case 0xC5D4:
                                                     mon("         LDB   $01,X                   ; C5D4: E6 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC5D6; JUMP; // sstep
case 0xC5D6:
                                                     mon("         ANDB  #$0F                    ; C5D6: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC5D8; JUMP; // sstep
case 0xC5D8:
                                                     mon("         ADDB  $4AFB                   ; C5D8: FB 4A FB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x4afb); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xC5DB; JUMP; // sstep
case 0xC5DB:
                                                     mon("LC5DB    DEC   $4AFA                   ; C5DB: 7A 4A FA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4afa); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4afa, res); 
    clockticks = clockticks + 2; 
    PC = 0xC5DE; JUMP; // sstep
case 0xC5DE:
                                                     mon("         BMI   LC5E3                   ; C5DE: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc5e3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC5E0; JUMP; // sstep
case 0xC5E0:
                                                     mon("         LSRB                          ; C5E0: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC5E1; JUMP; // sstep
case 0xC5E1:
                                                     mon("         BRA   LC5DB                   ; C5E1: 20 F8         \n");
    PC = 0xc5db; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC5E3:
                                                     mon("LC5E3    ANDB  ,U                      ; C5E3: E4 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    res = val & rd_mem(U); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC5E5; JUMP; // sstep
case 0xC5E5:
                                                     mon("         STB   $4AF5                   ; C5E5: F7 4A F5      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af5, val); 
    PC = 0xC5E8; JUMP; // sstep
case 0xC5E8:
                                                     mon("         LDX   #byte_C7F1              ; C5E8: 8E C7 F1      \n");
    clockticks = clockticks + 3; 
    X = 0xc7f1; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC5EB; JUMP; // sstep
case 0xC5EB:
                                                     mon("         LEAX  A,X                     ; C5EB: 30 86         \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)A); 
/**/Z = X; 
    PC = 0xC5ED; JUMP; // sstep
case 0xC5ED:
                                                     mon("         ADDB  ,X                      ; C5ED: EB 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(X); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    // End of function sub_C5A4
    PC = 0xC5EF; JUMP; // sstep
case 0xC5EF:
                                                     mon("         JMP   LE7D3                   ; C5EF: 7E E7 D3      \n");
    clockticks = clockticks + 4; 
    PC = 0xe7d3; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // FUNCTION CHUNK AT ROM:C65B SIZE 0000001F BYTES
  case 0xC5F2:
                                                     mon("LC5F2    LDX   #$4500                  ; C5F2: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC5F5; JUMP; // sstep
case 0xC5F5:
                                                     mon("         LDU   #$4C00                  ; C5F5: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC5F8; JUMP; // sstep
case 0xC5F8:
                                                     mon("LC5F8    LDD   ,X++                    ; C5F8: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC5FA; JUMP; // sstep
case 0xC5FA:
                                                     mon("         STD   ,U++                    ; C5FA: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xC5FC; JUMP; // sstep
case 0xC5FC:
                                                     mon("         CMPX  #$4600                  ; C5FC: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC5FF; JUMP; // sstep
case 0xC5FF:
                                                     mon("         BCS   LC5F8                   ; C5FF: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc5f8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC601; JUMP; // sstep
case 0xC601:
                                                     mon("         LDX   #$4500                  ; C601: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC604; JUMP; // sstep
case 0xC604:
                                                     mon("LC604    LDA   ,X                      ; C604: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC606; JUMP; // sstep
case 0xC606:
                                                     mon("         COMA                          ; C606: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xC607; JUMP; // sstep
case 0xC607:
                                                     mon("         STA   ,X+                     ; C607: A7 80         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xC609; JUMP; // sstep
case 0xC609:
                                                     mon("         CMPX  #$4600                  ; C609: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC60C; JUMP; // sstep
case 0xC60C:
                                                     mon("         BCS   LC604                   ; C60C: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc604; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC60E; JUMP; // sstep
case 0xC60E:
                                                     mon("         STA   $46A0                   ; C60E: B7 46 A0      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x46a0, val); 
    PC = 0xC611; JUMP; // sstep
case 0xC611:
                                                     mon("         JSR   LC688                   ; C611: BD C6 88      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x14); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc688; 
    JUMP;
  case 0xC614:
                                                     mon("LC614    JSR   LC67A                   ; C614: BD C6 7A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc67a; 
    JUMP;
  case 0xC617:
                                                     mon("LC617    JSR   LC6B8                   ; C617: BD C6 B8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc6b8; 
    JUMP;
  case 0xC61A:
                                                     mon("LC61A    LDX   #$4500                  ; C61A: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC61D; JUMP; // sstep
case 0xC61D:
                                                     mon("LC61D    LDA   ,X                      ; C61D: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC61F; JUMP; // sstep
case 0xC61F:
                                                     mon("         COMA                          ; C61F: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xC620; JUMP; // sstep
case 0xC620:
                                                     mon("         STA   ,X+                     ; C620: A7 80         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xC622; JUMP; // sstep
case 0xC622:
                                                     mon("         CMPX  #$4600                  ; C622: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC625; JUMP; // sstep
case 0xC625:
                                                     mon("         BCS   LC61D                   ; C625: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc61d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC627; JUMP; // sstep
case 0xC627:
                                                     mon("         STA   $46A0                   ; C627: B7 46 A0      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x46a0, val); 
    PC = 0xC62A; JUMP; // sstep
case 0xC62A:
                                                     mon("         JSR   LC688                   ; C62A: BD C6 88      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc688; 
    JUMP;
  case 0xC62D:
                                                     mon("LC62D    JSR   LC641                   ; C62D: BD C6 41      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x30); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc641; 
    JUMP;
  case 0xC630:
                                                     mon("LC630    BNE   LC65B                   ; C630: 26 29         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc65b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC632; JUMP; // sstep
case 0xC632:
                                                     mon("         JSR   LC67A                   ; C632: BD C6 7A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc67a; 
    JUMP;
  case 0xC635:
                                                     mon("LC635    JSR   LC6B8                   ; C635: BD C6 B8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc6b8; 
    JUMP;
  case 0xC638:
                                                     mon("LC638    JSR   LC641                   ; C638: BD C6 41      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xc641; 
    JUMP;
  case 0xC63B:
                                                     mon("LC63B    BEQ   locret_C640             ; C63B: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc640; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC63D; JUMP; // sstep
case 0xC63D:
                                                     mon("         JMP   LC65B                   ; C63D: 7E C6 5B      \n");
    clockticks = clockticks + 4; 
    PC = 0xc65b; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // End of function sub_C5F2
  case 0xC640:
                                                     mon("locret_C640 RTS                           ; C640: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC641:
                                                     mon("LC641    LDX   #$4500                  ; C641: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC644; JUMP; // sstep
case 0xC644:
                                                     mon("         LDU   #$4C00                  ; C644: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC647; JUMP; // sstep
case 0xC647:
                                                     mon("LC647    LDA   ,X+                     ; C647: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xC649; JUMP; // sstep
case 0xC649:
                                                     mon("         EORA  ,U+                     ; C649: A8 C0         \n");
    clockticks = clockticks + 6; 
    res = A ^ rd_mem(U); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xC64B; JUMP; // sstep
case 0xC64B:
                                                     mon("         ANDA  #$0F                    ; C64B: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC64D; JUMP; // sstep
case 0xC64D:
                                                     mon("         BNE   locret_C65A             ; C64D: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc65a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC64F; JUMP; // sstep
case 0xC64F:
                                                     mon("         CMPX  #$4600                  ; C64F: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC652; JUMP; // sstep
case 0xC652:
                                                     mon("         BCS   LC647                   ; C652: 25 F3         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc647; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC654; JUMP; // sstep
case 0xC654:
                                                     mon("         LDA   #$01                    ; C654: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC656; JUMP; // sstep
case 0xC656:
                                                     mon("         STA   $4AF7                   ; C656: B7 4A F7      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af7, val); 
    PC = 0xC659; JUMP; // sstep
case 0xC659:
                                                     mon("         CLRA                          ; C659: 4F            \n");
    A = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_C641
    PC = 0xC65A; JUMP; // sstep
case 0xC65A:
                                                     mon("locret_C65A RTS                           ; C65A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_C5F2
  case 0xC65B:
                                                     mon("LC65B    LEAX  -1,X                    ; C65B: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
/**/Z = X; 
    PC = 0xC65D; JUMP; // sstep
case 0xC65D:
                                                     mon("         TFR   X,D                     ; C65D: 1F 10         \n");
    val = X; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xC65F; JUMP; // sstep
case 0xC65F:
                                                     mon("         STD   $4AF8                   ; C65F: FD 4A F8      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4af8, A); // Care needed with I/O space and word fetches
    wr_mem(0x4af9, B); 
    PC = 0xC662; JUMP; // sstep
case 0xC662:
                                                     mon("         LDA   #$FF                    ; C662: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC664; JUMP; // sstep
case 0xC664:
                                                     mon("         STA   $4AF7                   ; C664: B7 4A F7      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af7, val); 
    PC = 0xC667; JUMP; // sstep
case 0xC667:
                                                     mon("         LDX   #$4500                  ; C667: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC66A; JUMP; // sstep
case 0xC66A:
                                                     mon("         LDU   #$4C00                  ; C66A: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC66D; JUMP; // sstep
case 0xC66D:
                                                     mon("LC66D    LDD   ,U++                    ; C66D: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC66F; JUMP; // sstep
case 0xC66F:
                                                     mon("         STD   ,X++                    ; C66F: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xC671; JUMP; // sstep
case 0xC671:
                                                     mon("         CMPX  #$4600                  ; C671: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC674; JUMP; // sstep
case 0xC674:
                                                     mon("         BCS   LC66D                   ; C674: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc66d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC676; JUMP; // sstep
case 0xC676:
                                                     mon("         TST   $4AF7                   ; C676: 7D 4A F7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af7); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    // END OF FUNCTION CHUNK FOR sub_C5F2
    PC = 0xC679; JUMP; // sstep
case 0xC679:
                                                     mon("         RTS                           ; C679: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC67A:
                                                     mon("LC67A    LDX   #$4500                  ; C67A: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC67D; JUMP; // sstep
case 0xC67D:
                                                     mon("         LDD   #$00                    ; C67D: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC680; JUMP; // sstep
case 0xC680:
                                                     mon("LC680    STD   ,X++                    ; C680: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xC682; JUMP; // sstep
case 0xC682:
                                                     mon("         CMPX  #$4600                  ; C682: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC685; JUMP; // sstep
case 0xC685:
                                                     mon("         BCS   LC680                   ; C685: 25 F9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc680; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C67A
    PC = 0xC687; JUMP; // sstep
case 0xC687:
                                                     mon("         RTS                           ; C687: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC688:
                                                     mon("LC688    LDX   #$07D0                  ; C688: 8E 07 D0      \n");
    clockticks = clockticks + 3; 
    X = 0x07d0; 
/**/Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xC68B; JUMP; // sstep
case 0xC68B:
                                                     mon("LC68B    LEAX  -1,X                    ; C68B: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xC68D; JUMP; // sstep
case 0xC68D:
                                                     mon("         BNE   LC68B                   ; C68D: 26 FC         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc68b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C688
    PC = 0xC68F; JUMP; // sstep
case 0xC68F:
                                                     mon("         RTS                           ; C68F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC690:
                                                     mon("LC690    LDA   $4AF7                   ; C690: B6 4A F7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af7); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC693; JUMP; // sstep
case 0xC693:
                                                     mon("         BEQ   locret_C6B7             ; C693: 27 22         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc6b7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC695; JUMP; // sstep
case 0xC695:
                                                     mon("         CMPA  #$01                    ; C695: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC697; JUMP; // sstep
case 0xC697:
                                                     mon("         BNE   LC69D                   ; C697: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc69d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC699; JUMP; // sstep
case 0xC699:
                                                     mon("         LDB   #$9C                    ; C699: C6 9C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x9c; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC69B; JUMP; // sstep
case 0xC69B:
                                                     mon("         BRA   LC6B4                   ; C69B: 20 17         \n");
    PC = 0xc6b4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC69D:
                                                     mon("LC69D    LDD   #$1F6A                  ; C69D: CC 1F 6A      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x6a; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC6A0; JUMP; // sstep
case 0xC6A0:
                                                     mon("         STD   ,Y++                    ; C6A0: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC6A2; JUMP; // sstep
case 0xC6A2:
                                                     mon("         LDD   #$01A4                  ; C6A2: CC 01 A4      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xa4; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC6A5; JUMP; // sstep
case 0xC6A5:
                                                     mon("         STD   ,Y++                    ; C6A5: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC6A7; JUMP; // sstep
case 0xC6A7:
                                                     mon("         LDA   $4AF9                   ; C6A7: B6 4A F9      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af9); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC6AA; JUMP; // sstep
case 0xC6AA:
                                                     mon("         JSR   Display_Vect_BCD        ; C6AA: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xC6AD:
                                                     mon("LC6AD    LDD   #$8040                  ; C6AD: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC6B0; JUMP; // sstep
case 0xC6B0:
                                                     mon("         STD   ,Y++                    ; C6B0: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC6B2; JUMP; // sstep
case 0xC6B2:
                                                     mon("         LDB   #$9D                    ; C6B2: C6 9D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x9d; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC6B4; JUMP; // sstep
case 0xC6B4:
                                                     mon("LC6B4    JSR   LE7C7                   ; C6B4: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // End of function sub_C690
  case 0xC6B7:
                                                     mon("locret_C6B7 RTS                           ; C6B7: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC6B8:
                                                     mon("LC6B8    LDA   #$FF                    ; C6B8: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC6BA; JUMP; // sstep
case 0xC6BA:
                                                     mon("         STA   $4687                   ; C6BA: B7 46 87      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4687, val); 
    PC = 0xC6BD; JUMP; // sstep
case 0xC6BD:
                                                     mon("         JSR   $6005                   ; C6BD: BD 60 05      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0x6005; 
    JUMP;
  case 0xC6C0:
                                                     mon("LC6C0    LDA   #$00                    ; C6C0: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC6C2; JUMP; // sstep
case 0xC6C2:
                                                     mon("         STA   $4687                   ; C6C2: B7 46 87      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4687, val); 
    PC = 0xC6C5; JUMP; // sstep
case 0xC6C5:
                                                     mon("         LDU   #$00                    ; C6C5: CE 00 00      \n");
    clockticks = clockticks + 3; 
    U = 0x0000; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xC6C8; JUMP; // sstep
case 0xC6C8:
                                                     mon("LC6C8    JSR   $6005                   ; C6C8: BD 60 05      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    PC = 0x6005; 
    JUMP;
  case 0xC6CB:
                                                     mon("LC6CB    LEAU  $01,U                   ; C6CB: 33 41         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0001); 
    PC = 0xC6CD; JUMP; // sstep
case 0xC6CD:
                                                     mon("         CMPU  #$20                    ; C6CD: 11 83 00 20   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x0020; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC6D1; JUMP; // sstep
case 0xC6D1:
                                                     mon("         BCS   LC6C8                   ; C6D1: 25 F5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc6c8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C6B8
    PC = 0xC6D3; JUMP; // sstep
case 0xC6D3:
                                                     mon("         RTS                           ; C6D3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Read NOVRAM
    // End of function sub_C6D4
  case 0xC6D4:
                                                     mon("LC6D4    LDU   #$4AFA                  ; C6D4: CE 4A FA      \n");
    clockticks = clockticks + 3; 
    U = 0x4afa; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    // =============== S U B R O U T I N E =======================================
    // Read NOVRAM
    PC = 0xC6D7; JUMP; // sstep
case 0xC6D7:
                                                     mon("LC6D7    LDA   #$03                    ; C6D7: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC6D9; JUMP; // sstep
case 0xC6D9:
                                                     mon("LC6D9    STA   $4B02                   ; C6D9: B7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC6DC; JUMP; // sstep
case 0xC6DC:
                                                     mon("LC6DC    LDA   ,X+                     ; C6DC: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xC6DE; JUMP; // sstep
case 0xC6DE:
                                                     mon("         ASLA                          ; C6DE: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC6DF; JUMP; // sstep
case 0xC6DF:
                                                     mon("         ASLA                          ; C6DF: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC6E0; JUMP; // sstep
case 0xC6E0:
                                                     mon("         ASLA                          ; C6E0: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC6E1; JUMP; // sstep
case 0xC6E1:
                                                     mon("         ASLA                          ; C6E1: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC6E2; JUMP; // sstep
case 0xC6E2:
                                                     mon("         STA   ,U                      ; C6E2: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xC6E4; JUMP; // sstep
case 0xC6E4:
                                                     mon("         LDA   ,X+                     ; C6E4: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xC6E6; JUMP; // sstep
case 0xC6E6:
                                                     mon("         ANDA  #$0F                    ; C6E6: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC6E8; JUMP; // sstep
case 0xC6E8:
                                                     mon("         ADDA  ,U                      ; C6E8: AB C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(U); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC6EA; JUMP; // sstep
case 0xC6EA:
                                                     mon("         STA   ,U+                     ; C6EA: A7 C0         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    U = U + 1; 
    PC = 0xC6EC; JUMP; // sstep
case 0xC6EC:
                                                     mon("         DEC   $4B02                   ; C6EC: 7A 4B 02      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b02); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4b02, res); 
    clockticks = clockticks + 2; 
    PC = 0xC6EF; JUMP; // sstep
case 0xC6EF:
                                                     mon("         BPL   LC6DC                   ; C6EF: 2A EB         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc6dc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC6F1; JUMP; // sstep
case 0xC6F1:
                                                     mon("         LEAX  -8,X                    ; C6F1: 30 18         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xfff8); 
    Z = X; 
    // End of function sub_C6D7
    PC = 0xC6F3; JUMP; // sstep
case 0xC6F3:
                                                     mon("         RTS                           ; C6F3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // End of function sub_C6F4
  case 0xC6F4:
                                                     mon("LC6F4    LDU   #$4AFA                  ; C6F4: CE 4A FA      \n");
    clockticks = clockticks + 3; 
    U = 0x4afa; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xC6F7; JUMP; // sstep
case 0xC6F7:
                                                     mon("LC6F7    LDA   #$02                    ; C6F7: 86 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC6F9; JUMP; // sstep
case 0xC6F9:
                                                     mon("LC6F9    STA   $4B02                   ; C6F9: B7 4B 02      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b02, val); 
    PC = 0xC6FC; JUMP; // sstep
case 0xC6FC:
                                                     mon("LC6FC    LDA   ,U+                     ; C6FC: A6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xC6FE; JUMP; // sstep
case 0xC6FE:
                                                     mon("         STA   $01,X                   ; C6FE: A7 01         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xC700; JUMP; // sstep
case 0xC700:
                                                     mon("         LSRA                          ; C700: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC701; JUMP; // sstep
case 0xC701:
                                                     mon("         LSRA                          ; C701: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC702; JUMP; // sstep
case 0xC702:
                                                     mon("         LSRA                          ; C702: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC703; JUMP; // sstep
case 0xC703:
                                                     mon("         LSRA                          ; C703: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC704; JUMP; // sstep
case 0xC704:
                                                     mon("         STA   ,X++                    ; C704: A7 81         \n");
    clockticks = clockticks + 7; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 2; 
    PC = 0xC706; JUMP; // sstep
case 0xC706:
                                                     mon("LC706    DEC   $4B02                   ; C706: 7A 4B 02      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b02); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(0x4b02, res); 
    clockticks = clockticks + 2; 
    PC = 0xC709; JUMP; // sstep
case 0xC709:
                                                     mon("         BPL   LC6FC                   ; C709: 2A F1         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc6fc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC70B; JUMP; // sstep
case 0xC70B:
                                                     mon("         LEAX  -6,X                    ; C70B: 30 1A         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xfffa); 
    Z = X; 
    // End of function sub_C6F7
    PC = 0xC70D; JUMP; // sstep
case 0xC70D:
                                                     mon("         RTS                           ; C70D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xC70E:
                                                     mon("LC70E    LDB   #$00                    ; C70E: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC710; JUMP; // sstep
case 0xC710:
                                                     mon("         STB   <$AD                    ; C710: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xC712; JUMP; // sstep
case 0xC712:
                                                     mon("         TFR   A,B                     ; C712: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xC714; JUMP; // sstep
case 0xC714:
                                                     mon("         LSRA                          ; C714: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC715; JUMP; // sstep
case 0xC715:
                                                     mon("         LSRA                          ; C715: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC716; JUMP; // sstep
case 0xC716:
                                                     mon("         LSRA                          ; C716: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC717; JUMP; // sstep
case 0xC717:
                                                     mon("         LSRA                          ; C717: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xC718; JUMP; // sstep
case 0xC718:
                                                     mon("         CMPA  #$0A                    ; C718: 81 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC71A; JUMP; // sstep
case 0xC71A:
                                                     mon("         BCS   LC71E                   ; C71A: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc71e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC71C; JUMP; // sstep
case 0xC71C:
                                                     mon("         LDA   #$09                    ; C71C: 86 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC71E; JUMP; // sstep
case 0xC71E:
                                                     mon("LC71E    JSR   LE7AD                   ; C71E: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc7); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xC721:
                                                     mon("LC721    LDA   #$B8                    ; C721: 86 B8         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xb8; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC723; JUMP; // sstep
case 0xC723:
                                                     mon("         STA   ,Y+                     ; C723: A7 A0         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, val); 
    Y = Y + 1; 
    PC = 0xC725; JUMP; // sstep
case 0xC725:
                                                     mon("         LDA   #$DF                    ; C725: 86 DF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xdf; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC727; JUMP; // sstep
case 0xC727:
                                                     mon("         STA   ,Y+                     ; C727: A7 A0         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, val); 
    Y = Y + 1; 
    PC = 0xC729; JUMP; // sstep
case 0xC729:
                                                     mon("         CLRA                          ; C729: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC72A; JUMP; // sstep
case 0xC72A:
                                                     mon("         ANDB  #$0F                    ; C72A: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC72C; JUMP; // sstep
case 0xC72C:
                                                     mon("         BEQ   LC734                   ; C72C: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xc734; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC72E; JUMP; // sstep
case 0xC72E:
                                                     mon("LC72E    ADDA  #$04                    ; C72E: 8B 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xC730; JUMP; // sstep
case 0xC730:
                                                     mon("         DAA                           ; C730: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC731; JUMP; // sstep
case 0xC731:
                                                     mon("         DECB                          ; C731: 5A            \n");
    val = (UINT8)B; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC732; JUMP; // sstep
case 0xC732:
                                                     mon("         BNE   LC72E                   ; C732: 26 FA         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc72e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_C70E
    // ---------------------------------------------------------------------------
    PC = 0xC734; JUMP; // sstep
case 0xC734:
                                                     mon("LC734    JMP   Display_Vect_BCD        ; C734: 7E E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 4; 
    PC = 0xe790; 
    JUMP;
    
                   // FCB   $90                     ; C7B9:  ' ' 90 98          SUBA  <$98 ; 
                   // FCB   $98                     ; C7BA:  ' ' 98 01          EORA  <$01 ; 
    // =============== S U B R O U T I N E =======================================
    // Display high scores
  case 0xC7FD:
                                                     mon("LC7FD    TST   $4AEC                   ; C7FD: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC800; JUMP; // sstep
case 0xC800:
                                                     mon("         BMI   LC811                   ; C800: 2B 0F         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc811; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC802; JUMP; // sstep
case 0xC802:
                                                     mon("         LDA   #$3E                    ; C802: 86 3E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC804; JUMP; // sstep
case 0xC804:
                                                     mon("         JSR   LD8DF                   ; C804: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0xC807:
                                                     mon("LC807    LDD   #$7200                  ; C807: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC80A; JUMP; // sstep
case 0xC80A:
                                                     mon("         STD   ,Y++                    ; C80A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC80C; JUMP; // sstep
case 0xC80C:
                                                     mon("         LDD   #word_CA64              ; C80C: CC CA 64      \n"); // High scores text position table
    clockticks = clockticks + 3; 
    A = 0xca; 
    B = 0x64; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC80F; JUMP; // sstep
case 0xC80F:
                                                     mon("         BRA   LC81E                   ; C80F: 20 0D         \n");
    PC = 0xc81e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC811:
                                                     mon("LC811    LDA   #$3F                    ; C811: 86 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xC813; JUMP; // sstep
case 0xC813:
                                                     mon("         JSR   LD8DF                   ; C813: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0xC816:
                                                     mon("LC816    LDD   #$7140                  ; C816: CC 71 40      \n"); // High scores text size
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC819; JUMP; // sstep
case 0xC819:
                                                     mon("         STD   ,Y++                    ; C819: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC81B; JUMP; // sstep
case 0xC81B:
                                                     mon("         LDD   #word_CA78              ; C81B: CC CA 78      \n");
    clockticks = clockticks + 3; 
    A = 0xca; 
    B = 0x78; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC81E; JUMP; // sstep
case 0xC81E:
                                                     mon("LC81E    STD   $4AF1                   ; C81E: FD 4A F1      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4af1, A); // Care needed with I/O space and word fetches
    wr_mem(0x4af2, B); 
    PC = 0xC821; JUMP; // sstep
case 0xC821:
                                                     mon("         LDA   #$00                    ; C821: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC823; JUMP; // sstep
case 0xC823:
                                                     mon("         STA   $4AEA                   ; C823: B7 4A EA      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4aea, val); 
    PC = 0xC826; JUMP; // sstep
case 0xC826:
                                                     mon("LC826    LDU   $4AF1                   ; C826: FE 4A F1      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4af1)<<8; 
    ea = ea | rd_mem(0x4af2); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC829; JUMP; // sstep
case 0xC829:
                                                     mon("         LDD   ,U                      ; C829: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC82B; JUMP; // sstep
case 0xC82B:
                                                     mon("         STD   ,Y++                    ; C82B: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC82D; JUMP; // sstep
case 0xC82D:
                                                     mon("         LDD   #$1F80                  ; C82D: CC 1F 80      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC830; JUMP; // sstep
case 0xC830:
                                                     mon("         STD   ,Y++                    ; C830: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC832; JUMP; // sstep
case 0xC832:
                                                     mon("         LDB   $4AEA                   ; C832: F6 4A EA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aea); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC835; JUMP; // sstep
case 0xC835:
                                                     mon("         ASLB                          ; C835: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC836; JUMP; // sstep
case 0xC836:
                                                     mon("         ADDB  $4AEA                   ; C836: FB 4A EA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x4aea); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xC839; JUMP; // sstep
case 0xC839:
                                                     mon("         LDX   #$4AB6                  ; C839: 8E 4A B6      \n");
    clockticks = clockticks + 3; 
    X = 0x4ab6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC83C; JUMP; // sstep
case 0xC83C:
                                                     mon("         ABX                           ; C83C: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC83D; JUMP; // sstep
case 0xC83D:
                                                     mon("         CPX   $4AEC                   ; C83D: BC 4A EC      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4aec)<<8; 
    ea = ea | rd_mem(0x4aed); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC840; JUMP; // sstep
case 0xC840:
                                                     mon("         BNE   LC847                   ; C840: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc847; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC842; JUMP; // sstep
case 0xC842:
                                                     mon("         LDD   #$6780                  ; C842: CC 67 80      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0x80; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC845; JUMP; // sstep
case 0xC845:
                                                     mon("         BRA   LC84A                   ; C845: 20 03         \n");
    PC = 0xc84a; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC847:
                                                     mon("LC847    LDD   $4B10                   ; C847: FC 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b10); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b11); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC84A; JUMP; // sstep
case 0xC84A:
                                                     mon("LC84A    STD   ,Y++                    ; C84A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC84C; JUMP; // sstep
case 0xC84C:
                                                     mon("         STD   <$01                    ; C84C: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xC84E; JUMP; // sstep
case 0xC84E:
                                                     mon("         LDU   #$3016                  ; C84E: CE 30 16      \n");
    clockticks = clockticks + 3; 
    U = 0x3016; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC851; JUMP; // sstep
case 0xC851:
                                                     mon("         TST   $4AEC                   ; C851: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC854; JUMP; // sstep
case 0xC854:
                                                     mon("         BMI   LC871                   ; C854: 2B 1B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc871; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC856; JUMP; // sstep
case 0xC856:
                                                     mon("         LDA   $4AEE                   ; C856: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC859; JUMP; // sstep
case 0xC859:
                                                     mon("         CMPA  #$00                    ; C859: 81 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x00; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC85B; JUMP; // sstep
case 0xC85B:
                                                     mon("         BNE   LC86D                   ; C85B: 26 10         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc86d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC85D; JUMP; // sstep
case 0xC85D:
                                                     mon("         LDA   $4843                   ; C85D: B6 48 43      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4843); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC860; JUMP; // sstep
case 0xC860:
                                                     mon("         ANDA  #$01                    ; C860: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC862; JUMP; // sstep
case 0xC862:
                                                     mon("         BNE   LC869                   ; C862: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc869; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC864; JUMP; // sstep
case 0xC864:
                                                     mon("         LDD   $4B10                   ; C864: FC 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b10); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b11); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC867; JUMP; // sstep
case 0xC867:
                                                     mon("         BRA   LC86B                   ; C867: 20 02         \n");
    PC = 0xc86b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC869:
                                                     mon("LC869    LDD   <$01                    ; C869: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC86B; JUMP; // sstep
case 0xC86B:
                                                     mon("LC86B    BRA   LC86F                   ; C86B: 20 02         \n");
    PC = 0xc86f; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC86D:
                                                     mon("LC86D    LDD   <$01                    ; C86D: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC86F; JUMP; // sstep
case 0xC86F:
                                                     mon("LC86F    STD   ,Y++                    ; C86F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC871; JUMP; // sstep
case 0xC871:
                                                     mon("LC871    LDA   ,X+                     ; C871: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    X = X + 1; 
    PC = 0xC873; JUMP; // sstep
case 0xC873:
                                                     mon("         BNE   LC884                   ; C873: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc884; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC875; JUMP; // sstep
case 0xC875:
                                                     mon("         TST   $4AEC                   ; C875: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC878; JUMP; // sstep
case 0xC878:
                                                     mon("         BMI   LC87F                   ; C878: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc87f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC87A; JUMP; // sstep
case 0xC87A:
                                                     mon("         LDD   $3054                   ; C87A: FC 30 54      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3054); // Care needed with I/O space and word fetches
    B = rd_mem(0x3055); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC87D; JUMP; // sstep
case 0xC87D:
                                                     mon("         BRA   LC882                   ; C87D: 20 03         \n");
    PC = 0xc882; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC87F:
                                                     mon("LC87F    LDD   $3002                   ; C87F: FC 30 02      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3002); // Care needed with I/O space and word fetches
    B = rd_mem(0x3003); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC882; JUMP; // sstep
case 0xC882:
                                                     mon("LC882    BRA   LC887                   ; C882: 20 03         \n");
    PC = 0xc887; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC884:
                                                     mon("LC884    ASLA                          ; C884: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC885; JUMP; // sstep
case 0xC885:
                                                     mon("         LDD   A,U                     ; C885: EC C6         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)A); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC887; JUMP; // sstep
case 0xC887:
                                                     mon("LC887    STD   ,Y++                    ; C887: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC889; JUMP; // sstep
case 0xC889:
                                                     mon("         TST   $4AEC                   ; C889: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC88C; JUMP; // sstep
case 0xC88C:
                                                     mon("         BMI   LC8A9                   ; C88C: 2B 1B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc8a9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC88E; JUMP; // sstep
case 0xC88E:
                                                     mon("         LDA   $4AEE                   ; C88E: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC891; JUMP; // sstep
case 0xC891:
                                                     mon("         CMPA  #$01                    ; C891: 81 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC893; JUMP; // sstep
case 0xC893:
                                                     mon("         BNE   LC8A5                   ; C893: 26 10         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc8a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC895; JUMP; // sstep
case 0xC895:
                                                     mon("         LDA   $4843                   ; C895: B6 48 43      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4843); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC898; JUMP; // sstep
case 0xC898:
                                                     mon("         ANDA  #$01                    ; C898: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC89A; JUMP; // sstep
case 0xC89A:
                                                     mon("         BNE   LC8A1                   ; C89A: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc8a1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC89C; JUMP; // sstep
case 0xC89C:
                                                     mon("         LDD   $4B10                   ; C89C: FC 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b10); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b11); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC89F; JUMP; // sstep
case 0xC89F:
                                                     mon("         BRA   LC8A3                   ; C89F: 20 02         \n");
    PC = 0xc8a3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8A1:
                                                     mon("LC8A1    LDD   <$01                    ; C8A1: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8A3; JUMP; // sstep
case 0xC8A3:
                                                     mon("LC8A3    BRA   LC8A7                   ; C8A3: 20 02         \n");
    PC = 0xc8a7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8A5:
                                                     mon("LC8A5    LDD   <$01                    ; C8A5: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC8A7; JUMP; // sstep
case 0xC8A7:
                                                     mon("LC8A7    STD   ,Y++                    ; C8A7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC8A9; JUMP; // sstep
case 0xC8A9:
                                                     mon("LC8A9    LDA   ,X+                     ; C8A9: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    X = X + 1; 
    PC = 0xC8AB; JUMP; // sstep
case 0xC8AB:
                                                     mon("         BNE   LC8BC                   ; C8AB: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc8bc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8AD; JUMP; // sstep
case 0xC8AD:
                                                     mon("         TST   $4AEC                   ; C8AD: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC8B0; JUMP; // sstep
case 0xC8B0:
                                                     mon("         BMI   LC8B7                   ; C8B0: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc8b7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8B2; JUMP; // sstep
case 0xC8B2:
                                                     mon("         LDD   $3054                   ; C8B2: FC 30 54      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3054); // Care needed with I/O space and word fetches
    B = rd_mem(0x3055); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8B5; JUMP; // sstep
case 0xC8B5:
                                                     mon("         BRA   LC8BA                   ; C8B5: 20 03         \n");
    PC = 0xc8ba; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8B7:
                                                     mon("LC8B7    LDD   $3002                   ; C8B7: FC 30 02      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3002); // Care needed with I/O space and word fetches
    B = rd_mem(0x3003); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8BA; JUMP; // sstep
case 0xC8BA:
                                                     mon("LC8BA    BRA   LC8BF                   ; C8BA: 20 03         \n");
    PC = 0xc8bf; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8BC:
                                                     mon("LC8BC    ASLA                          ; C8BC: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC8BD; JUMP; // sstep
case 0xC8BD:
                                                     mon("         LDD   A,U                     ; C8BD: EC C6         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)A); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC8BF; JUMP; // sstep
case 0xC8BF:
                                                     mon("LC8BF    STD   ,Y++                    ; C8BF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC8C1; JUMP; // sstep
case 0xC8C1:
                                                     mon("         TST   $4AEC                   ; C8C1: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC8C4; JUMP; // sstep
case 0xC8C4:
                                                     mon("         BMI   LC8E1                   ; C8C4: 2B 1B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc8e1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8C6; JUMP; // sstep
case 0xC8C6:
                                                     mon("         LDA   $4AEE                   ; C8C6: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC8C9; JUMP; // sstep
case 0xC8C9:
                                                     mon("         CMPA  #$02                    ; C8C9: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC8CB; JUMP; // sstep
case 0xC8CB:
                                                     mon("         BNE   LC8DD                   ; C8CB: 26 10         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc8dd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8CD; JUMP; // sstep
case 0xC8CD:
                                                     mon("         LDA   $4843                   ; C8CD: B6 48 43      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4843); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC8D0; JUMP; // sstep
case 0xC8D0:
                                                     mon("         ANDA  #$01                    ; C8D0: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xC8D2; JUMP; // sstep
case 0xC8D2:
                                                     mon("         BNE   LC8D9                   ; C8D2: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc8d9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8D4; JUMP; // sstep
case 0xC8D4:
                                                     mon("         LDD   $4B10                   ; C8D4: FC 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b10); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b11); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8D7; JUMP; // sstep
case 0xC8D7:
                                                     mon("         BRA   LC8DB                   ; C8D7: 20 02         \n");
    PC = 0xc8db; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8D9:
                                                     mon("LC8D9    LDD   <$01                    ; C8D9: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8DB; JUMP; // sstep
case 0xC8DB:
                                                     mon("LC8DB    BRA   LC8DF                   ; C8DB: 20 02         \n");
    PC = 0xc8df; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8DD:
                                                     mon("LC8DD    LDD   <$01                    ; C8DD: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC8DF; JUMP; // sstep
case 0xC8DF:
                                                     mon("LC8DF    STD   ,Y++                    ; C8DF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC8E1; JUMP; // sstep
case 0xC8E1:
                                                     mon("LC8E1    LDA   ,X+                     ; C8E1: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    X = X + 1; 
    PC = 0xC8E3; JUMP; // sstep
case 0xC8E3:
                                                     mon("         BNE   LC8F4                   ; C8E3: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc8f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8E5; JUMP; // sstep
case 0xC8E5:
                                                     mon("         TST   $4AEC                   ; C8E5: 7D 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xC8E8; JUMP; // sstep
case 0xC8E8:
                                                     mon("         BMI   LC8EF                   ; C8E8: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xc8ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC8EA; JUMP; // sstep
case 0xC8EA:
                                                     mon("         LDD   $3054                   ; C8EA: FC 30 54      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3054); // Care needed with I/O space and word fetches
    B = rd_mem(0x3055); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8ED; JUMP; // sstep
case 0xC8ED:
                                                     mon("         BRA   LC8F2                   ; C8ED: 20 03         \n");
    PC = 0xc8f2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8EF:
                                                     mon("LC8EF    LDD   $3002                   ; C8EF: FC 30 02      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3002); // Care needed with I/O space and word fetches
    B = rd_mem(0x3003); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC8F2; JUMP; // sstep
case 0xC8F2:
                                                     mon("LC8F2    BRA   LC8F7                   ; C8F2: 20 03         \n");
    PC = 0xc8f7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC8F4:
                                                     mon("LC8F4    ASLA                          ; C8F4: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC8F5; JUMP; // sstep
case 0xC8F5:
                                                     mon("         LDD   A,U                     ; C8F5: EC C6         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)A); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC8F7; JUMP; // sstep
case 0xC8F7:
                                                     mon("LC8F7    STD   ,Y++                    ; C8F7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC8F9; JUMP; // sstep
case 0xC8F9:
                                                     mon("         LDD   <$01                    ; C8F9: DC 01         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x01); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x02); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC8FB; JUMP; // sstep
case 0xC8FB:
                                                     mon("         STD   ,Y++                    ; C8FB: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC8FD; JUMP; // sstep
case 0xC8FD:
                                                     mon("         LDD   #$8040                  ; C8FD: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC900; JUMP; // sstep
case 0xC900:
                                                     mon("         STD   ,Y++                    ; C900: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC902; JUMP; // sstep
case 0xC902:
                                                     mon("         LDU   $4AF1                   ; C902: FE 4A F1      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4af1)<<8; 
    ea = ea | rd_mem(0x4af2); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC905; JUMP; // sstep
case 0xC905:
                                                     mon("         LDD   ,U                      ; C905: EC C4         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC907; JUMP; // sstep
case 0xC907:
                                                     mon("         STD   ,Y++                    ; C907: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC909; JUMP; // sstep
case 0xC909:
                                                     mon("         LDD   #$1F38                  ; C909: CC 1F 38      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x38; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC90C; JUMP; // sstep
case 0xC90C:
                                                     mon("         STD   ,Y++                    ; C90C: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC90E; JUMP; // sstep
case 0xC90E:
                                                     mon("         LDA   $4AEA                   ; C90E: B6 4A EA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aea); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC911; JUMP; // sstep
case 0xC911:
                                                     mon("         INCA                          ; C911: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xC912; JUMP; // sstep
case 0xC912:
                                                     mon("         CMPA  #$0A                    ; C912: 81 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC914; JUMP; // sstep
case 0xC914:
                                                     mon("         BCS   LC918                   ; C914: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc918; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC916; JUMP; // sstep
case 0xC916:
                                                     mon("         LDA   #$10                    ; C916: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC918; JUMP; // sstep
case 0xC918:
                                                     mon("LC918    LDB   #$01                    ; C918: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC91A; JUMP; // sstep
case 0xC91A:
                                                     mon("         STB   <$AD                    ; C91A: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xC91C; JUMP; // sstep
case 0xC91C:
                                                     mon("         JSR   Display_Vect_BCD        ; C91C: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc9); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xC91F:
                                                     mon("LC91F    LDD   #$B8DC                  ; C91F: CC B8 DC      \n");
    clockticks = clockticks + 3; 
    A = 0xb8; 
    B = 0xdc; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC922; JUMP; // sstep
case 0xC922:
                                                     mon("         STD   ,Y++                    ; C922: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC924; JUMP; // sstep
case 0xC924:
                                                     mon("         LDD   #$8040                  ; C924: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC927; JUMP; // sstep
case 0xC927:
                                                     mon("         STD   ,Y++                    ; C927: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC929; JUMP; // sstep
case 0xC929:
                                                     mon("         LDB   $4AEA                   ; C929: F6 4A EA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aea); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC92C; JUMP; // sstep
case 0xC92C:
                                                     mon("         ASLB                          ; C92C: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC92D; JUMP; // sstep
case 0xC92D:
                                                     mon("         ASLB                          ; C92D: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xC92E; JUMP; // sstep
case 0xC92E:
                                                     mon("         LDX   #$4A8E                  ; C92E: 8E 4A 8E      \n"); // High scores RAM
    clockticks = clockticks + 3; 
    X = 0x4a8e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC931; JUMP; // sstep
case 0xC931:
                                                     mon("         ABX                           ; C931: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xC932; JUMP; // sstep
case 0xC932:
                                                     mon("         LDU   $4AF1                   ; C932: FE 4A F1      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4af1)<<8; 
    ea = ea | rd_mem(0x4af2); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC935; JUMP; // sstep
case 0xC935:
                                                     mon("         LDD   ,U++                    ; C935: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC937; JUMP; // sstep
case 0xC937:
                                                     mon("         STD   ,Y++                    ; C937: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC939; JUMP; // sstep
case 0xC939:
                                                     mon("         LDD   #$1FF0                  ; C939: CC 1F F0      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0xf0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC93C; JUMP; // sstep
case 0xC93C:
                                                     mon("         STD   ,Y++                    ; C93C: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC93E; JUMP; // sstep
case 0xC93E:
                                                     mon("         STU   $4AF1                   ; C93E: FF 4A F1      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4af1, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4af2, (UINT8)val); 
    PC = 0xC941; JUMP; // sstep
case 0xC941:
                                                     mon("         LDB   #$06                    ; C941: C6 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC943; JUMP; // sstep
case 0xC943:
                                                     mon("         STB   <$AD                    ; C943: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0xC945; JUMP; // sstep
case 0xC945:
                                                     mon("         JSR   LE764                   ; C945: BD E7 64      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x48); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xc9); 
    clockticks = clockticks + 1; 
    PC = 0xe764; 
    JUMP;
  case 0xC948:
                                                     mon("LC948    LEAX  $04,X                   ; C948: 30 04         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0004); 
/**/Z = X; 
    PC = 0xC94A; JUMP; // sstep
case 0xC94A:
                                                     mon("         LDD   #$8040                  ; C94A: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC94D; JUMP; // sstep
case 0xC94D:
                                                     mon("         STD   ,Y++                    ; C94D: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC94F; JUMP; // sstep
case 0xC94F:
                                                     mon("         INC   $4AEA                   ; C94F: 7C 4A EA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aea); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4aea, res); 
    clockticks = clockticks + 2; 
    PC = 0xC952; JUMP; // sstep
case 0xC952:
                                                     mon("         LDA   $4AEA                   ; C952: B6 4A EA      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aea); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC955; JUMP; // sstep
case 0xC955:
                                                     mon("         CMPA  #$0A                    ; C955: 81 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC957; JUMP; // sstep
case 0xC957:
                                                     mon("         LBCS  LC826                   ; C957: 10 25 FE CB   \n");
    clockticks = clockticks + 5; 
    if (C) {
    clockticks = clockticks + 1; 
    PC = 0xc826; 
    JUMP;
    }
    PC = 0xC95B; JUMP; // sstep
case 0xC95B:
                                                     mon("         LDD   #$7200                  ; C95B: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC95E; JUMP; // sstep
case 0xC95E:
                                                     mon("         STD   ,Y++                    ; C95E: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC960; JUMP; // sstep
case 0xC960:
                                                     mon("         LDD   $4AEC                   ; C960: FC 4A EC      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4aec); // Care needed with I/O space and word fetches
    B = rd_mem(0x4aed); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC963; JUMP; // sstep
case 0xC963:
                                                     mon("         BPL   LC966                   ; C963: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xc966; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC965; JUMP; // sstep
case 0xC965:
                                                     mon("         RTS                           ; C965: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xC966:
                                                     mon("LC966    LDD   #$6480                  ; C966: CC 64 80      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC969; JUMP; // sstep
case 0xC969:
                                                     mon("         STD   ,Y++                    ; C969: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC96B; JUMP; // sstep
case 0xC96B:
                                                     mon("         LDX   #$CBA8                  ; C96B: 8E CB A8      \n");
    clockticks = clockticks + 3; 
    X = 0xcba8; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xC96E; JUMP; // sstep
case 0xC96E:
                                                     mon("         LDU   #$3018                  ; C96E: CE 30 18      \n");
    clockticks = clockticks + 3; 
    U = 0x3018; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xC971; JUMP; // sstep
case 0xC971:
                                                     mon("LC971    LDD   $02,X                   ; C971: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC973; JUMP; // sstep
case 0xC973:
                                                     mon("         ANDA  #$1F                    ; C973: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC975; JUMP; // sstep
case 0xC975:
                                                     mon("         STD   ,Y++                    ; C975: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC977; JUMP; // sstep
case 0xC977:
                                                     mon("         LDD   ,X                      ; C977: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC979; JUMP; // sstep
case 0xC979:
                                                     mon("         ANDA  #$1F                    ; C979: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC97B; JUMP; // sstep
case 0xC97B:
                                                     mon("         STD   ,Y++                    ; C97B: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC97D; JUMP; // sstep
case 0xC97D:
                                                     mon("         LDD   ,U++                    ; C97D: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC97F; JUMP; // sstep
case 0xC97F:
                                                     mon("         STD   ,Y++                    ; C97F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC981; JUMP; // sstep
case 0xC981:
                                                     mon("         LDD   #$8040                  ; C981: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC984; JUMP; // sstep
case 0xC984:
                                                     mon("         STD   ,Y++                    ; C984: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC986; JUMP; // sstep
case 0xC986:
                                                     mon("         LEAX  $04,X                   ; C986: 30 04         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0004); 
/**/Z = X; 
    PC = 0xC988; JUMP; // sstep
case 0xC988:
                                                     mon("         CMPX  #word_CC10              ; C988: 8C CC 10      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0xcc10; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xC98B; JUMP; // sstep
case 0xC98B:
                                                     mon("         BCS   LC971                   ; C98B: 25 E4         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xc971; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC98D; JUMP; // sstep
case 0xC98D:
                                                     mon("         LDD   word_CBA6               ; C98D: FC CB A6      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xcba6); // Care needed with I/O space and word fetches
    B = rd_mem(0xcba7); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC990; JUMP; // sstep
case 0xC990:
                                                     mon("         ANDA  #$1F                    ; C990: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC992; JUMP; // sstep
case 0xC992:
                                                     mon("         STD   ,Y++                    ; C992: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC994; JUMP; // sstep
case 0xC994:
                                                     mon("         LDD   word_CBA4               ; C994: FC CB A4      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xcba4); // Care needed with I/O space and word fetches
    B = rd_mem(0xcba5); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC997; JUMP; // sstep
case 0xC997:
                                                     mon("         ANDA  #$1F                    ; C997: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC999; JUMP; // sstep
case 0xC999:
                                                     mon("         STD   ,Y++                    ; C999: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC99B; JUMP; // sstep
case 0xC99B:
                                                     mon("         LDD   $3054                   ; C99B: FC 30 54      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3054); // Care needed with I/O space and word fetches
    B = rd_mem(0x3055); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC99E; JUMP; // sstep
case 0xC99E:
                                                     mon("         STD   ,Y++                    ; C99E: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9A0; JUMP; // sstep
case 0xC9A0:
                                                     mon("         LDD   #$7200                  ; C9A0: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9A3; JUMP; // sstep
case 0xC9A3:
                                                     mon("         STD   ,Y++                    ; C9A3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9A5; JUMP; // sstep
case 0xC9A5:
                                                     mon("         LDD   #$8040                  ; C9A5: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9A8; JUMP; // sstep
case 0xC9A8:
                                                     mon("         STD   ,Y++                    ; C9A8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9AA; JUMP; // sstep
case 0xC9AA:
                                                     mon("         LDB   $4AEF                   ; C9AA: F6 4A EF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aef); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC9AD; JUMP; // sstep
case 0xC9AD:
                                                     mon("         CMPB  #$1B                    ; C9AD: C1 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC9AF; JUMP; // sstep
case 0xC9AF:
                                                     mon("         BNE   LC9B6                   ; C9AF: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc9b6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC9B1; JUMP; // sstep
case 0xC9B1:
                                                     mon("         LDD   #$6750                  ; C9B1: CC 67 50      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0x50; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC9B4; JUMP; // sstep
case 0xC9B4:
                                                     mon("         BRA   LC9B9                   ; C9B4: 20 03         \n");
    PC = 0xc9b9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC9B6:
                                                     mon("LC9B6    LDD   #$6450                  ; C9B6: CC 64 50      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9B9; JUMP; // sstep
case 0xC9B9:
                                                     mon("LC9B9    STD   ,Y++                    ; C9B9: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9BB; JUMP; // sstep
case 0xC9BB:
                                                     mon("         LDD   $02,X                   ; C9BB: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9BD; JUMP; // sstep
case 0xC9BD:
                                                     mon("         ANDA  #$1F                    ; C9BD: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC9BF; JUMP; // sstep
case 0xC9BF:
                                                     mon("         STD   ,Y++                    ; C9BF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9C1; JUMP; // sstep
case 0xC9C1:
                                                     mon("         LDD   ,X                      ; C9C1: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9C3; JUMP; // sstep
case 0xC9C3:
                                                     mon("         SUBD  #$08                    ; C9C3: 83 00 08      \n");
    clockticks = clockticks + 4; 
    val = 0x0008; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xC9C6; JUMP; // sstep
case 0xC9C6:
                                                     mon("         ANDA  #$1F                    ; C9C6: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC9C8; JUMP; // sstep
case 0xC9C8:
                                                     mon("         STD   ,Y++                    ; C9C8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9CA; JUMP; // sstep
case 0xC9CA:
                                                     mon("         LDD   #$71C0                  ; C9CA: CC 71 C0      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9CD; JUMP; // sstep
case 0xC9CD:
                                                     mon("         STD   ,Y++                    ; C9CD: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9CF; JUMP; // sstep
case 0xC9CF:
                                                     mon("         LDD   $303A                   ; C9CF: FC 30 3A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x303a); // Care needed with I/O space and word fetches
    B = rd_mem(0x303b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9D2; JUMP; // sstep
case 0xC9D2:
                                                     mon("         STD   ,Y++                    ; C9D2: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9D4; JUMP; // sstep
case 0xC9D4:
                                                     mon("         LDD   $3040                   ; C9D4: FC 30 40      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3040); // Care needed with I/O space and word fetches
    B = rd_mem(0x3041); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9D7; JUMP; // sstep
case 0xC9D7:
                                                     mon("         STD   ,Y++                    ; C9D7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9D9; JUMP; // sstep
case 0xC9D9:
                                                     mon("         LDD   $301A                   ; C9D9: FC 30 1A      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x301a); // Care needed with I/O space and word fetches
    B = rd_mem(0x301b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9DC; JUMP; // sstep
case 0xC9DC:
                                                     mon("         STD   ,Y++                    ; C9DC: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9DE; JUMP; // sstep
case 0xC9DE:
                                                     mon("         LDD   #$7200                  ; C9DE: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9E1; JUMP; // sstep
case 0xC9E1:
                                                     mon("         STD   ,Y++                    ; C9E1: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9E3; JUMP; // sstep
case 0xC9E3:
                                                     mon("         LDD   #$8040                  ; C9E3: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9E6; JUMP; // sstep
case 0xC9E6:
                                                     mon("         STD   ,Y++                    ; C9E6: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9E8; JUMP; // sstep
case 0xC9E8:
                                                     mon("         LDB   $4AEF                   ; C9E8: F6 4A EF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aef); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xC9EB; JUMP; // sstep
case 0xC9EB:
                                                     mon("         CMPB  #$1C                    ; C9EB: C1 1C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x1c; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xC9ED; JUMP; // sstep
case 0xC9ED:
                                                     mon("         BNE   LC9F4                   ; C9ED: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xc9f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xC9EF; JUMP; // sstep
case 0xC9EF:
                                                     mon("         LDD   #$6750                  ; C9EF: CC 67 50      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0x50; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xC9F2; JUMP; // sstep
case 0xC9F2:
                                                     mon("         BRA   LC9F7                   ; C9F2: 20 03         \n");
    PC = 0xc9f7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xC9F4:
                                                     mon("LC9F4    LDD   #$6450                  ; C9F4: CC 64 50      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9F7; JUMP; // sstep
case 0xC9F7:
                                                     mon("LC9F7    STD   ,Y++                    ; C9F7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9F9; JUMP; // sstep
case 0xC9F9:
                                                     mon("         LDD   $06,X                   ; C9F9: EC 06         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0006); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xC9FB; JUMP; // sstep
case 0xC9FB:
                                                     mon("         ANDA  #$1F                    ; C9FB: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xC9FD; JUMP; // sstep
case 0xC9FD:
                                                     mon("         STD   ,Y++                    ; C9FD: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xC9FF; JUMP; // sstep
case 0xC9FF:
                                                     mon("         LDD   $04,X                   ; C9FF: EC 04         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0004); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA01; JUMP; // sstep
case 0xCA01:
                                                     mon("         SUBD  #$08                    ; CA01: 83 00 08      \n");
    clockticks = clockticks + 4; 
    val = 0x0008; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCA04; JUMP; // sstep
case 0xCA04:
                                                     mon("         ANDA  #$1F                    ; CA04: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xCA06; JUMP; // sstep
case 0xCA06:
                                                     mon("         STD   ,Y++                    ; CA06: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA08; JUMP; // sstep
case 0xCA08:
                                                     mon("         LDD   #$71C0                  ; CA08: CC 71 C0      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA0B; JUMP; // sstep
case 0xCA0B:
                                                     mon("         STD   ,Y++                    ; CA0B: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA0D; JUMP; // sstep
case 0xCA0D:
                                                     mon("         LDD   $3020                   ; CA0D: FC 30 20      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3020); // Care needed with I/O space and word fetches
    B = rd_mem(0x3021); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA10; JUMP; // sstep
case 0xCA10:
                                                     mon("         STD   ,Y++                    ; CA10: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA12; JUMP; // sstep
case 0xCA12:
                                                     mon("         LDD   $3032                   ; CA12: FC 30 32      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3032); // Care needed with I/O space and word fetches
    B = rd_mem(0x3033); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA15; JUMP; // sstep
case 0xCA15:
                                                     mon("         STD   ,Y++                    ; CA15: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA17; JUMP; // sstep
case 0xCA17:
                                                     mon("         LDD   $301E                   ; CA17: FC 30 1E      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x301e); // Care needed with I/O space and word fetches
    B = rd_mem(0x301f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA1A; JUMP; // sstep
case 0xCA1A:
                                                     mon("         STD   ,Y++                    ; CA1A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA1C; JUMP; // sstep
case 0xCA1C:
                                                     mon("         LDD   #$7200                  ; CA1C: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA1F; JUMP; // sstep
case 0xCA1F:
                                                     mon("         STD   ,Y++                    ; CA1F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA21; JUMP; // sstep
case 0xCA21:
                                                     mon("         LDD   #$8040                  ; CA21: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA24; JUMP; // sstep
case 0xCA24:
                                                     mon("         STD   ,Y++                    ; CA24: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA26; JUMP; // sstep
case 0xCA26:
                                                     mon("         LDD   #$6780                  ; CA26: CC 67 80      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA29; JUMP; // sstep
case 0xCA29:
                                                     mon("         STD   ,Y++                    ; CA29: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA2B; JUMP; // sstep
case 0xCA2B:
                                                     mon("         LDB   $4AEF                   ; CA2B: F6 4A EF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aef); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCA2E; JUMP; // sstep
case 0xCA2E:
                                                     mon("         CMPB  #$1B                    ; CA2E: C1 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCA30; JUMP; // sstep
case 0xCA30:
                                                     mon("         BCC   LCA5B                   ; CA30: 24 29         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xca5b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCA32; JUMP; // sstep
case 0xCA32:
                                                     mon("         ASLB                          ; CA32: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCA33; JUMP; // sstep
case 0xCA33:
                                                     mon("         ASLB                          ; CA33: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCA34; JUMP; // sstep
case 0xCA34:
                                                     mon("         LDX   #word_CBA4              ; CA34: 8E CB A4      \n");
    clockticks = clockticks + 3; 
    X = 0xcba4; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCA37; JUMP; // sstep
case 0xCA37:
                                                     mon("         ABX                           ; CA37: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xCA38; JUMP; // sstep
case 0xCA38:
                                                     mon("         LDD   $02,X                   ; CA38: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA3A; JUMP; // sstep
case 0xCA3A:
                                                     mon("         ANDA  #$1F                    ; CA3A: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xCA3C; JUMP; // sstep
case 0xCA3C:
                                                     mon("         STD   ,Y++                    ; CA3C: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA3E; JUMP; // sstep
case 0xCA3E:
                                                     mon("         LDD   ,X                      ; CA3E: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA40; JUMP; // sstep
case 0xCA40:
                                                     mon("         ANDA  #$1F                    ; CA40: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xCA42; JUMP; // sstep
case 0xCA42:
                                                     mon("         STD   ,Y++                    ; CA42: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA44; JUMP; // sstep
case 0xCA44:
                                                     mon("         LDB   $4AEF                   ; CA44: F6 4A EF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aef); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCA47; JUMP; // sstep
case 0xCA47:
                                                     mon("         BNE   LCA4E                   ; CA47: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xca4e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCA49; JUMP; // sstep
case 0xCA49:
                                                     mon("         LDD   $3054                   ; CA49: FC 30 54      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3054); // Care needed with I/O space and word fetches
    B = rd_mem(0x3055); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xCA4C; JUMP; // sstep
case 0xCA4C:
                                                     mon("         BRA   LCA54                   ; CA4C: 20 06         \n");
    PC = 0xca54; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xCA4E:
                                                     mon("LCA4E    ASLB                          ; CA4E: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCA4F; JUMP; // sstep
case 0xCA4F:
                                                     mon("         LDX   #$3016                  ; CA4F: 8E 30 16      \n");
    clockticks = clockticks + 3; 
    X = 0x3016; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCA52; JUMP; // sstep
case 0xCA52:
                                                     mon("         LDD   B,X                     ; CA52: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA54; JUMP; // sstep
case 0xCA54:
                                                     mon("LCA54    STD   ,Y++                    ; CA54: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA56; JUMP; // sstep
case 0xCA56:
                                                     mon("         LDD   #$8040                  ; CA56: CC 80 40      \n"); // Vector CNTR instruction
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA59; JUMP; // sstep
case 0xCA59:
                                                     mon("         STD   ,Y++                    ; CA59: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA5B; JUMP; // sstep
case 0xCA5B:
                                                     mon("LCA5B    LDD   #$6680                  ; CA5B: CC 66 80      \n");
    clockticks = clockticks + 3; 
    A = 0x66; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA5E; JUMP; // sstep
case 0xCA5E:
                                                     mon("         STD   ,Y++                    ; CA5E: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xCA60; JUMP; // sstep
case 0xCA60:
                                                     mon("         JSR   LB6CC                   ; CA60: BD B6 CC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xca); 
    clockticks = clockticks + 1; 
    PC = 0xb6cc; 
    JUMP;
    // End of function sub_C7FD
    // ---------------------------------------------------------------------------
  case 0xCA63:
                                                     mon("LCA63    RTS                           ; CA63: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Score
  case 0xCA8C:
                                                     mon("LCA8C    LDX   #$4A8E                  ; CA8C: 8E 4A 8E      \n"); // High scores RAM
    clockticks = clockticks + 3; 
    X = 0x4a8e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCA8F; JUMP; // sstep
case 0xCA8F:
                                                     mon("LCA8F    LDD   <$5C                    ; CA8F: DC 5C         \n"); // Score millions
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x5c); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x5d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA91; JUMP; // sstep
case 0xCA91:
                                                     mon("         SUBD  ,X                      ; CA91: A3 84         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCA93; JUMP; // sstep
case 0xCA93:
                                                     mon("         BHI   LCAA5                   ; CA93: 22 10         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xcaa5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCA95; JUMP; // sstep
case 0xCA95:
                                                     mon("         BNE   LCA9D                   ; CA95: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xca9d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCA97; JUMP; // sstep
case 0xCA97:
                                                     mon("         LDD   <$5E                    ; CA97: DC 5E         \n"); // Score thousands
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x5e); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x5f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCA99; JUMP; // sstep
case 0xCA99:
                                                     mon("         SUBD  $02,X                   ; CA99: A3 02         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCA9B; JUMP; // sstep
case 0xCA9B:
                                                     mon("         BCC   LCAA5                   ; CA9B: 24 08         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcaa5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCA9D; JUMP; // sstep
case 0xCA9D:
                                                     mon("LCA9D    LEAX  $04,X                   ; CA9D: 30 04         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0004); 
/**/Z = X; 
    PC = 0xCA9F; JUMP; // sstep
case 0xCA9F:
                                                     mon("         CMPX  #$4AB6                  ; CA9F: 8C 4A B6      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4ab6; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCAA2; JUMP; // sstep
case 0xCAA2:
                                                     mon("         BCS   LCA8F                   ; CAA2: 25 EB         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xca8f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCAA4; JUMP; // sstep
case 0xCAA4:
                                                     mon("         RTS                           ; CAA4: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xCAA5:
                                                     mon("LCAA5    JSR   LCAB7                   ; CAA5: BD CA B7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xca); 
    clockticks = clockticks + 1; 
    PC = 0xcab7; 
    JUMP;
  case 0xCAA8:
                                                     mon("LCAA8    LDA   #$00                    ; CAA8: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCAAA; JUMP; // sstep
case 0xCAAA:
                                                     mon("         STA   $4AEE                   ; CAAA: B7 4A EE      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4aee, val); 
    PC = 0xCAAD; JUMP; // sstep
case 0xCAAD:
                                                     mon("         LDD   #$00                    ; CAAD: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCAB0; JUMP; // sstep
case 0xCAB0:
                                                     mon("         STD   $4AEF                   ; CAB0: FD 4A EF      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4aef, A); // Care needed with I/O space and word fetches
    wr_mem(0x4af0, B); 
    PC = 0xCAB3; JUMP; // sstep
case 0xCAB3:
                                                     mon("         LDX   #$4AB6                  ; CAB3: 8E 4A B6      \n");
    clockticks = clockticks + 3; 
    X = 0x4ab6; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    // End of function sub_CA8C
    PC = 0xCAB6; JUMP; // sstep
case 0xCAB6:
                                                     mon("         RTS                           ; CAB6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCAB7:
                                                     mon("LCAB7    STX   $4AEC                   ; CAB7: BF 4A EC      \n");
    clockticks = clockticks + 5; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4aec, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4aed, (UINT8)val); 
    PC = 0xCABA; JUMP; // sstep
case 0xCABA:
                                                     mon("         LDU   #$4AD1                  ; CABA: CE 4A D1      \n");
    clockticks = clockticks + 3; 
    U = 0x4ad1; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCABD; JUMP; // sstep
case 0xCABD:
                                                     mon("         LDX   #$4AB2                  ; CABD: 8E 4A B2      \n");
    clockticks = clockticks + 3; 
    X = 0x4ab2; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCAC0; JUMP; // sstep
case 0xCAC0:
                                                     mon("         CPX   $4AEC                   ; CAC0: BC 4A EC      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4aec)<<8; 
    ea = ea | rd_mem(0x4aed); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCAC3; JUMP; // sstep
case 0xCAC3:
                                                     mon("         BEQ   LCADE                   ; CAC3: 27 19         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xcade; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCAC5; JUMP; // sstep
case 0xCAC5:
                                                     mon("LCAC5    LDD   -4,X                    ; CAC5: EC 1C         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0xfffc); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCAC7; JUMP; // sstep
case 0xCAC7:
                                                     mon("         STD   ,X                      ; CAC7: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCAC9; JUMP; // sstep
case 0xCAC9:
                                                     mon("         LDD   -2,X                    ; CAC9: EC 1E         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0xfffe); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCACB; JUMP; // sstep
case 0xCACB:
                                                     mon("         STD   $02,X                   ; CACB: ED 02         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCACD; JUMP; // sstep
case 0xCACD:
                                                     mon("         LDD   -3,U                    ; CACD: EC 5D         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + 0xfffd); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCACF; JUMP; // sstep
case 0xCACF:
                                                     mon("         STD   ,U                      ; CACF: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCAD1; JUMP; // sstep
case 0xCAD1:
                                                     mon("         LDA   -1,U                    ; CAD1: A6 5F         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0xffff)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCAD3; JUMP; // sstep
case 0xCAD3:
                                                     mon("         STA   $02,U                   ; CAD3: A7 42         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, val); 
    PC = 0xCAD5; JUMP; // sstep
case 0xCAD5:
                                                     mon("         LEAU  -3,U                    ; CAD5: 33 5D         \n");
    clockticks = clockticks + 5; 
    U = (U + 0xfffd); 
    PC = 0xCAD7; JUMP; // sstep
case 0xCAD7:
                                                     mon("         LEAX  -4,X                    ; CAD7: 30 1C         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xfffc); 
/**/Z = X; 
    PC = 0xCAD9; JUMP; // sstep
case 0xCAD9:
                                                     mon("         CPX   $4AEC                   ; CAD9: BC 4A EC      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4aec)<<8; 
    ea = ea | rd_mem(0x4aed); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCADC; JUMP; // sstep
case 0xCADC:
                                                     mon("         BHI   LCAC5                   ; CADC: 22 E7         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xcac5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCADE; JUMP; // sstep
case 0xCADE:
                                                     mon("LCADE    STU   $4AEC                   ; CADE: FF 4A EC      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4aec, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4aed, (UINT8)val); 
    PC = 0xCAE1; JUMP; // sstep
case 0xCAE1:
                                                     mon("         LDA   #$00                    ; CAE1: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCAE3; JUMP; // sstep
case 0xCAE3:
                                                     mon("         STA   ,U                      ; CAE3: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xCAE5; JUMP; // sstep
case 0xCAE5:
                                                     mon("         LDD   #$00                    ; CAE5: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCAE8; JUMP; // sstep
case 0xCAE8:
                                                     mon("         STD   $01,U                   ; CAE8: ED 41         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0001); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCAEA; JUMP; // sstep
case 0xCAEA:
                                                     mon("         LDD   <$5C                    ; CAEA: DC 5C         \n"); // Score millions
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x5c); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x5d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCAEC; JUMP; // sstep
case 0xCAEC:
                                                     mon("         STD   ,X                      ; CAEC: ED 84         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCAEE; JUMP; // sstep
case 0xCAEE:
                                                     mon("         LDD   <$5E                    ; CAEE: DC 5E         \n"); // Score thousands
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x5e); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x5f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCAF0; JUMP; // sstep
case 0xCAF0:
                                                     mon("         STD   $02,X                   ; CAF0: ED 02         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_CAB7
    PC = 0xCAF2; JUMP; // sstep
case 0xCAF2:
                                                     mon("         RTS                           ; CAF2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCAF3:
                                                     mon("LCAF3    LDX   $4AEC                   ; CAF3: BE 4A EC      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4aec)<<8; 
    ea = ea | rd_mem(0x4aed); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCAF6; JUMP; // sstep
case 0xCAF6:
                                                     mon("         LDB   $4AEE                   ; CAF6: F6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCAF9; JUMP; // sstep
case 0xCAF9:
                                                     mon("         ABX                           ; CAF9: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xCAFA; JUMP; // sstep
case 0xCAFA:
                                                     mon("         TFR   X,U                     ; CAFA: 1F 13         \n");
    U = X; 
    clockticks = clockticks + 6; 
    PC = 0xCAFC; JUMP; // sstep
case 0xCAFC:
                                                     mon("         LDA   $4AEE                   ; CAFC: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCAFF; JUMP; // sstep
case 0xCAFF:
                                                     mon("         CMPA  #$03                    ; CAFF: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCB01; JUMP; // sstep
case 0xCB01:
                                                     mon("         BCS   LCB08                   ; CB01: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcb08; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB03; JUMP; // sstep
case 0xCB03:
                                                     mon("         LDX   #word_CC10              ; CB03: 8E CC 10      \n");
    clockticks = clockticks + 3; 
    X = 0xcc10; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xCB06; JUMP; // sstep
case 0xCB06:
                                                     mon("         BRA   LCB0B                   ; CB06: 20 03         \n");
    PC = 0xcb0b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xCB08:
                                                     mon("LCB08    LDX   #word_CBA4              ; CB08: 8E CB A4      \n");
    clockticks = clockticks + 3; 
    X = 0xcba4; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCB0B; JUMP; // sstep
case 0xCB0B:
                                                     mon("LCB0B    LDD   $4879                   ; CB0B: FC 48 79      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4879); // Care needed with I/O space and word fetches
    B = rd_mem(0x487a); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCB0E; JUMP; // sstep
case 0xCB0E:
                                                     mon("         SUBD  #$08                    ; CB0E: 83 00 08      \n");
    clockticks = clockticks + 4; 
    val = 0x0008; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCB11; JUMP; // sstep
case 0xCB11:
                                                     mon("         SUBD  ,X                      ; CB11: A3 84         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCB13; JUMP; // sstep
case 0xCB13:
                                                     mon("         TSTA                          ; CB13: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xCB14; JUMP; // sstep
case 0xCB14:
                                                     mon("         BPL   LCB1A                   ; CB14: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xcb1a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB16; JUMP; // sstep
case 0xCB16:
                                                     mon("         COMA                          ; CB16: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xCB17; JUMP; // sstep
case 0xCB17:
                                                     mon("         NEGB                          ; CB17: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCB18; JUMP; // sstep
case 0xCB18:
                                                     mon("         SBCA  #$FF                    ; CB18: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xCB1A; JUMP; // sstep
case 0xCB1A:
                                                     mon("LCB1A    STD   <$01                    ; CB1A: DD 01         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x01; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCB1C; JUMP; // sstep
case 0xCB1C:
                                                     mon("         CMPD  #$18                    ; CB1C: 10 83 00 18   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0018; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCB20; JUMP; // sstep
case 0xCB20:
                                                     mon("         BCC   LCB49                   ; CB20: 24 27         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcb49; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB22; JUMP; // sstep
case 0xCB22:
                                                     mon("         LDD   $487B                   ; CB22: FC 48 7B      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x487b); // Care needed with I/O space and word fetches
    B = rd_mem(0x487c); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCB25; JUMP; // sstep
case 0xCB25:
                                                     mon("         ADDD  #$FF8C                  ; CB25: C3 FF 8C      \n");
    clockticks = clockticks + 4; 
    val = 0xff8c; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xCB28; JUMP; // sstep
case 0xCB28:
                                                     mon("         SUBD  $02,X                   ; CB28: A3 02         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0002))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCB2A; JUMP; // sstep
case 0xCB2A:
                                                     mon("         TSTA                          ; CB2A: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xCB2B; JUMP; // sstep
case 0xCB2B:
                                                     mon("         BPL   LCB31                   ; CB2B: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xcb31; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB2D; JUMP; // sstep
case 0xCB2D:
                                                     mon("         COMA                          ; CB2D: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xCB2E; JUMP; // sstep
case 0xCB2E:
                                                     mon("         NEGB                          ; CB2E: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCB2F; JUMP; // sstep
case 0xCB2F:
                                                     mon("         SBCA  #$FF                    ; CB2F: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xCB31; JUMP; // sstep
case 0xCB31:
                                                     mon("LCB31    CMPD  #$18                    ; CB31: 10 83 00 18   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0018; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCB35; JUMP; // sstep
case 0xCB35:
                                                     mon("         BCC   LCB49                   ; CB35: 24 12         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcb49; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB37; JUMP; // sstep
case 0xCB37:
                                                     mon("         ADDD  <$01                    ; CB37: D3 01         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x01)<<8; 
    ea = ea | rd_mem(DP|0x02); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xCB39; JUMP; // sstep
case 0xCB39:
                                                     mon("         CMPD  #$20                    ; CB39: 10 83 00 20   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0020; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCB3D; JUMP; // sstep
case 0xCB3D:
                                                     mon("         BCC   LCB49                   ; CB3D: 24 0A         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcb49; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB3F; JUMP; // sstep
case 0xCB3F:
                                                     mon("         TFR   X,D                     ; CB3F: 1F 10         \n");
    val = X; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xCB41; JUMP; // sstep
case 0xCB41:
                                                     mon("         SUBD  #word_CBA4              ; CB41: 83 CB A4      \n");
    clockticks = clockticks + 4; 
    val = 0xcba4; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xCB44; JUMP; // sstep
case 0xCB44:
                                                     mon("         LSRB                          ; CB44: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xCB45; JUMP; // sstep
case 0xCB45:
                                                     mon("         LSRB                          ; CB45: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xCB46; JUMP; // sstep
case 0xCB46:
                                                     mon("         STB   $4AEF                   ; CB46: F7 4A EF      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4aef, val); 
    PC = 0xCB49; JUMP; // sstep
case 0xCB49:
                                                     mon("LCB49    LEAX  $04,X                   ; CB49: 30 04         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0004); 
/**/Z = X; 
    PC = 0xCB4B; JUMP; // sstep
case 0xCB4B:
                                                     mon("         CMPX  #LCC18                  ; CB4B: 8C CC 18      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0xcc18; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCB4E; JUMP; // sstep
case 0xCB4E:
                                                     mon("         BCS   LCB0B                   ; CB4E: 25 BB         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcb0b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB50; JUMP; // sstep
case 0xCB50:
                                                     mon("         LDA   $4AEF                   ; CB50: B6 4A EF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aef); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB53; JUMP; // sstep
case 0xCB53:
                                                     mon("         CMPA  #$1B                    ; CB53: 81 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCB55; JUMP; // sstep
case 0xCB55:
                                                     mon("         BCC   LCB59                   ; CB55: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcb59; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB57; JUMP; // sstep
case 0xCB57:
                                                     mon("         STA   ,U                      ; CB57: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xCB59; JUMP; // sstep
case 0xCB59:
                                                     mon("LCB59    LDA   <$AC                    ; CB59: 96 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB5B; JUMP; // sstep
case 0xCB5B:
                                                     mon("         ANDA  #$F0                    ; CB5B: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xCB5D; JUMP; // sstep
case 0xCB5D:
                                                     mon("         BEQ   locret_CBA3             ; CB5D: 27 44         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xcba3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB5F; JUMP; // sstep
case 0xCB5F:
                                                     mon("         LDA   $4AEF                   ; CB5F: B6 4A EF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aef); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB62; JUMP; // sstep
case 0xCB62:
                                                     mon("         CMPA  #$1B                    ; CB62: 81 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCB64; JUMP; // sstep
case 0xCB64:
                                                     mon("         BNE   LCB82                   ; CB64: 26 1C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xcb82; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB66; JUMP; // sstep
case 0xCB66:
                                                     mon("         LDA   $4AEE                   ; CB66: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB69; JUMP; // sstep
case 0xCB69:
                                                     mon("         CMPA  #$02                    ; CB69: 81 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCB6B; JUMP; // sstep
case 0xCB6B:
                                                     mon("         BHI   LCB71                   ; CB6B: 22 04         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0xcb71; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB6D; JUMP; // sstep
case 0xCB6D:
                                                     mon("         LDA   #$00                    ; CB6D: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB6F; JUMP; // sstep
case 0xCB6F:
                                                     mon("         STA   ,U                      ; CB6F: A7 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    PC = 0xCB71; JUMP; // sstep
case 0xCB71:
                                                     mon("LCB71    LDA   $4AEE                   ; CB71: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCB74; JUMP; // sstep
case 0xCB74:
                                                     mon("         BEQ   LCB7D                   ; CB74: 27 07         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xcb7d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB76; JUMP; // sstep
case 0xCB76:
                                                     mon("         DEC   $4AEE                   ; CB76: 7A 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(0x4aee, res); 
    clockticks = clockticks + 2; 
    PC = 0xCB79; JUMP; // sstep
case 0xCB79:
                                                     mon("         LDA   #$00                    ; CB79: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB7B; JUMP; // sstep
case 0xCB7B:
                                                     mon("         STA   -1,U                    ; CB7B: A7 5F         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(U + 0xffff); 
    wr_mem(ea, val); 
    PC = 0xCB7D; JUMP; // sstep
case 0xCB7D:
                                                     mon("LCB7D    JSR   LBDF8                   ; CB7D: BD BD F8      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x80); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    PC = 0xbdf8; 
    JUMP;
  case 0xCB80:
                                                     mon("LCB80    BRA   locret_CBA3             ; CB80: 20 21         \n");
    PC = 0xcba3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xCB82:
                                                     mon("LCB82    CMPA  #$1C                    ; CB82: 81 1C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1c; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCB84; JUMP; // sstep
case 0xCB84:
                                                     mon("         BNE   LCB91                   ; CB84: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xcb91; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB86; JUMP; // sstep
case 0xCB86:
                                                     mon("         LDD   #$FFFF                  ; CB86: CC FF FF      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCB89; JUMP; // sstep
case 0xCB89:
                                                     mon("         STD   $4AEC                   ; CB89: FD 4A EC      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4aec, A); // Care needed with I/O space and word fetches
    wr_mem(0x4aed, B); 
    PC = 0xCB8C; JUMP; // sstep
case 0xCB8C:
                                                     mon("         JSR   LBDD5                   ; CB8C: BD BD D5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    PC = 0xbdd5; 
    JUMP;
  case 0xCB8F:
                                                     mon("LCB8F    BRA   locret_CBA3             ; CB8F: 20 12         \n");
    PC = 0xcba3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xCB91:
                                                     mon("LCB91    INC   $4AEE                   ; CB91: 7C 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4aee, res); 
    clockticks = clockticks + 2; 
    PC = 0xCB94; JUMP; // sstep
case 0xCB94:
                                                     mon("         LDA   $4AEE                   ; CB94: B6 4A EE      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aee); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB97; JUMP; // sstep
case 0xCB97:
                                                     mon("         CMPA  #$03                    ; CB97: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCB99; JUMP; // sstep
case 0xCB99:
                                                     mon("         BCS   LCBA0                   ; CB99: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcba0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCB9B; JUMP; // sstep
case 0xCB9B:
                                                     mon("         LDA   #$1C                    ; CB9B: 86 1C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1c; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCB9D; JUMP; // sstep
case 0xCB9D:
                                                     mon("         STA   $4AEF                   ; CB9D: B7 4A EF      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4aef, val); 
    PC = 0xCBA0; JUMP; // sstep
case 0xCBA0:
                                                     mon("LCBA0    JSR   LBE16                   ; CBA0: BD BE 16      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    PC = 0xbe16; 
    JUMP;
    // End of function sub_CAF3
    // ---------------------------------------------------------------------------
  case 0xCBA3:
                                                     mon("locret_CBA3 RTS                           ; CBA3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCC18:
                                                     mon("LCC18    JSR   LCC5B                   ; CC18: BD CC 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0xcc5b; 
    JUMP;
  case 0xCC1B:
                                                     mon("LCC1B    LDA   #$01                    ; CC1B: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCC1D; JUMP; // sstep
case 0xCC1D:
                                                     mon("         JSR   LC2C3                   ; CC1D: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x20); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0xCC20:
                                                     mon("LCC20    BNE   LCC38                   ; CC20: 26 16         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xcc38; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCC22; JUMP; // sstep
case 0xCC22:
                                                     mon("         LDU   #$4AB6                  ; CC22: CE 4A B6      \n");
    clockticks = clockticks + 3; 
    U = 0x4ab6; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCC25; JUMP; // sstep
case 0xCC25:
                                                     mon("         LDX   #$4520                  ; CC25: 8E 45 20      \n");
    clockticks = clockticks + 3; 
    X = 0x4520; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCC28; JUMP; // sstep
case 0xCC28:
                                                     mon("         LDA   #$08                    ; CC28: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCC2A; JUMP; // sstep
case 0xCC2A:
                                                     mon("         JSR   LC6D9                   ; CC2A: BD C6 D9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0xc6d9; 
    JUMP;
  case 0xCC2D:
                                                     mon("LCC2D    LDU   #$4A8E                  ; CC2D: CE 4A 8E      \n"); // High scores RAM
    clockticks = clockticks + 3; 
    U = 0x4a8e; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCC30; JUMP; // sstep
case 0xCC30:
                                                     mon("         LDX   #$4508                  ; CC30: 8E 45 08      \n");
    clockticks = clockticks + 3; 
    X = 0x4508; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCC33; JUMP; // sstep
case 0xCC33:
                                                     mon("         LDA   #$0B                    ; CC33: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCC35; JUMP; // sstep
case 0xCC35:
                                                     mon("         JSR   LC6D9                   ; CC35: BD C6 D9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0xc6d9; 
    JUMP;
  case 0xCC38:
                                                     mon("LCC38    LDX   #$4AB6                  ; CC38: 8E 4A B6      \n");
    clockticks = clockticks + 3; 
    X = 0x4ab6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCC3B; JUMP; // sstep
case 0xCC3B:
                                                     mon("LCC3B    LDA   ,X+                     ; CC3B: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xCC3D; JUMP; // sstep
case 0xCC3D:
                                                     mon("         CMPA  #$1B                    ; CC3D: 81 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCC3F; JUMP; // sstep
case 0xCC3F:
                                                     mon("         BCC   LCC5B                   ; CC3F: 24 1A         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcc5b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCC41; JUMP; // sstep
case 0xCC41:
                                                     mon("         CMPX  #$4AD4                  ; CC41: 8C 4A D4      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4ad4; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCC44; JUMP; // sstep
case 0xCC44:
                                                     mon("         BCS   LCC3B                   ; CC44: 25 F5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcc3b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCC46; JUMP; // sstep
case 0xCC46:
                                                     mon("         LDX   #$4A8E                  ; CC46: 8E 4A 8E      \n"); // High scores RAM
    clockticks = clockticks + 3; 
    X = 0x4a8e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCC49; JUMP; // sstep
case 0xCC49:
                                                     mon("LCC49    LDA   ,X+                     ; CC49: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xCC4B; JUMP; // sstep
case 0xCC4B:
                                                     mon("         CMPA  #$A0                    ; CC4B: 81 A0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xa0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCC4D; JUMP; // sstep
case 0xCC4D:
                                                     mon("         BCC   LCC5B                   ; CC4D: 24 0C         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcc5b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCC4F; JUMP; // sstep
case 0xCC4F:
                                                     mon("         ANDA  #$0F                    ; CC4F: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xCC51; JUMP; // sstep
case 0xCC51:
                                                     mon("         CMPA  #$0A                    ; CC51: 81 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xCC53; JUMP; // sstep
case 0xCC53:
                                                     mon("         BCC   LCC5B                   ; CC53: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xcc5b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCC55; JUMP; // sstep
case 0xCC55:
                                                     mon("         CMPX  #$4AB6                  ; CC55: 8C 4A B6      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4ab6; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCC58; JUMP; // sstep
case 0xCC58:
                                                     mon("         BCS   LCC49                   ; CC58: 25 EF         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcc49; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_CC18
    PC = 0xCC5A; JUMP; // sstep
case 0xCC5A:
                                                     mon("         RTS                           ; CC5A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCC5B:
                                                     mon("LCC5B    LDX   #$4AB6                  ; CC5B: 8E 4A B6      \n");
    clockticks = clockticks + 3; 
    X = 0x4ab6; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCC5E; JUMP; // sstep
case 0xCC5E:
                                                     mon("         LDU   #word_CC7A              ; CC5E: CE CC 7A      \n"); // High score names
    clockticks = clockticks + 3; 
    U = 0xcc7a; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCC61; JUMP; // sstep
case 0xCC61:
                                                     mon("LCC61    LDD   ,U++                    ; CC61: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCC63; JUMP; // sstep
case 0xCC63:
                                                     mon("         STD   ,X++                    ; CC63: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xCC65; JUMP; // sstep
case 0xCC65:
                                                     mon("         CMPX  #$4AD4                  ; CC65: 8C 4A D4      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4ad4; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCC68; JUMP; // sstep
case 0xCC68:
                                                     mon("         BCS   LCC61                   ; CC68: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcc61; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xCC6A; JUMP; // sstep
case 0xCC6A:
                                                     mon("         LDX   #$4A8E                  ; CC6A: 8E 4A 8E      \n"); // High scores RAM
    clockticks = clockticks + 3; 
    X = 0x4a8e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xCC6D; JUMP; // sstep
case 0xCC6D:
                                                     mon("         LDU   #word_CC98              ; CC6D: CE CC 98      \n"); // High scores init table
    clockticks = clockticks + 3; 
    U = 0xcc98; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCC70; JUMP; // sstep
case 0xCC70:
                                                     mon("LCC70    LDD   ,U++                    ; CC70: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCC72; JUMP; // sstep
case 0xCC72:
                                                     mon("         STD   ,X++                    ; CC72: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xCC74; JUMP; // sstep
case 0xCC74:
                                                     mon("         CMPX  #$4AB6                  ; CC74: 8C 4A B6      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4ab6; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xCC77; JUMP; // sstep
case 0xCC77:
                                                     mon("         BCS   LCC70                   ; CC77: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xcc70; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_CC5B
    // ---------------------------------------------------------------------------
    PC = 0xCC79; JUMP; // sstep
case 0xCC79:
                                                     mon("         RTS                           ; CC79: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Initialise object?
  case 0xCCC0:
                                                     mon("LCCC0    ORCC  #$01                    ; CCC0: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCCC2; JUMP; // sstep
case 0xCCC2:
                                                     mon("         ROR   $4684                   ; CCC2: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCCC5; JUMP; // sstep
case 0xCCC5:
                                                     mon("         JSR   $670D                   ; CCC5: BD 67 0D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0x670d; 
    JUMP;
  case 0xCCC8:
                                                     mon("LCCC8    CLR   $4684                   ; CCC8: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CCC0
    PC = 0xCCCB; JUMP; // sstep
case 0xCCCB:
                                                     mon("         RTS                           ; CCCB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Copy XYZ data to math RAM
  case 0xCCCC:
                                                     mon("LCCCC    ORCC  #$01                    ; CCCC: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCCCE; JUMP; // sstep
case 0xCCCE:
                                                     mon("         ROR   $4684                   ; CCCE: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCCD1; JUMP; // sstep
case 0xCCD1:
                                                     mon("         JSR   $6724                   ; CCD1: BD 67 24      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0x6724; 
    JUMP;
  case 0xCCD4:
                                                     mon("LCCD4    CLR   $4684                   ; CCD4: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CCCC
    PC = 0xCCD7; JUMP; // sstep
case 0xCCD7:
                                                     mon("         RTS                           ; CCD7: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Copy object 3D data to math ram
  case 0xCCD8:
                                                     mon("LCCD8    ORCC  #$01                    ; CCD8: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCCDA; JUMP; // sstep
case 0xCCDA:
                                                     mon("         ROR   $4684                   ; CCDA: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCCDD; JUMP; // sstep
case 0xCCDD:
                                                     mon("         JSR   $6726                   ; CCDD: BD 67 26      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0x6726; 
    JUMP;
  case 0xCCE0:
                                                     mon("LCCE0    CLR   $4684                   ; CCE0: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CCD8
    PC = 0xCCE3; JUMP; // sstep
case 0xCCE3:
                                                     mon("         RTS                           ; CCE3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCCE4:
                                                     mon("LCCE4    ORCC  #$01                    ; CCE4: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCCE6; JUMP; // sstep
case 0xCCE6:
                                                     mon("         ROR   $4684                   ; CCE6: 76 46 84      \n"); // Change memory page
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCCE9; JUMP; // sstep
case 0xCCE9:
                                                     mon("         JSR   $6761                   ; CCE9: BD 67 61      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xec); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0x6761; 
    JUMP;
  case 0xCCEC:
                                                     mon("LCCEC    CLR   $4684                   ; CCEC: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CCE4
    PC = 0xCCEF; JUMP; // sstep
case 0xCCEF:
                                                     mon("         RTS                           ; CCEF: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Get divider result and multiply by Math result Z, insert VCTR instruction
  case 0xCCF0:
                                                     mon("LCCF0    ORCC  #$01                    ; CCF0: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCCF2; JUMP; // sstep
case 0xCCF2:
                                                     mon("         ROR   $4684                   ; CCF2: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCCF5; JUMP; // sstep
case 0xCCF5:
                                                     mon("         JSR   $6761                   ; CCF5: BD 67 61      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    PC = 0x6761; 
    JUMP;
  case 0xCCF8:
                                                     mon("LCCF8    CLR   $4684                   ; CCF8: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CCF0
    PC = 0xCCFB; JUMP; // sstep
case 0xCCFB:
                                                     mon("         RTS                           ; CCFB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench floor lines calcs
  case 0xCCFC:
                                                     mon("LCCFC    ORCC  #$01                    ; CCFC: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCCFE; JUMP; // sstep
case 0xCCFE:
                                                     mon("         ROR   $4684                   ; CCFE: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD01; JUMP; // sstep
case 0xCD01:
                                                     mon("         JSR   $6782                   ; CD01: BD 67 82      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x04); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x6782; 
    JUMP;
  case 0xCD04:
                                                     mon("LCD04    CLR   $4684                   ; CD04: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CCFC
    PC = 0xCD07; JUMP; // sstep
case 0xCD07:
                                                     mon("         RTS                           ; CD07: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench side vertical lines calcs
  case 0xCD08:
                                                     mon("LCD08    ORCC  #$01                    ; CD08: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD0A; JUMP; // sstep
case 0xCD0A:
                                                     mon("         ROR   $4684                   ; CD0A: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD0D; JUMP; // sstep
case 0xCD0D:
                                                     mon("         JSR   $67AA                   ; CD0D: BD 67 AA      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x10); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x67aa; 
    JUMP;
  case 0xCD10:
                                                     mon("LCD10    CLR   $4684                   ; CD10: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD08
    PC = 0xCD13; JUMP; // sstep
case 0xCD13:
                                                     mon("         RTS                           ; CD13: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Math program 0x50. Matrix Multiply - Transposed
    // Then do perspective division?
  case 0xCD14:
                                                     mon("LCD14    ORCC  #$01                    ; CD14: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD16; JUMP; // sstep
case 0xCD16:
                                                     mon("         ROR   $4684                   ; CD16: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD19; JUMP; // sstep
case 0xCD19:
                                                     mon("         JSR   $67D2                   ; CD19: BD 67 D2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x67d2; 
    JUMP;
  case 0xCD1C:
                                                     mon("LCD1C    CLR   $4684                   ; CD1C: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD14
    PC = 0xCD1F; JUMP; // sstep
case 0xCD1F:
                                                     mon("         RTS                           ; CD1F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Do 3D object transform using Matrix 1
  case 0xCD20:
                                                     mon("LCD20    ORCC  #$01                    ; CD20: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD22; JUMP; // sstep
case 0xCD22:
                                                     mon("         ROR   $4684                   ; CD22: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD25; JUMP; // sstep
case 0xCD25:
                                                     mon("         JSR   $67D4                   ; CD25: BD 67 D4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x67d4; 
    JUMP;
  case 0xCD28:
                                                     mon("LCD28    CLR   $4684                   ; CD28: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD20
    PC = 0xCD2B; JUMP; // sstep
case 0xCD2B:
                                                     mon("         RTS                           ; CD2B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Format vectors for ties, and tower/bunker explosions
  case 0xCD2C:
                                                     mon("LCD2C    ORCC  #$01                    ; CD2C: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD2E; JUMP; // sstep
case 0xCD2E:
                                                     mon("         ROR   $4684                   ; CD2E: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD31; JUMP; // sstep
case 0xCD31:
                                                     mon("         JSR   $6819                   ; CD31: BD 68 19      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x34); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x6819; 
    JUMP;
  case 0xCD34:
                                                     mon("LCD34    CLR   $4684                   ; CD34: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD2C
    PC = 0xCD37; JUMP; // sstep
case 0xCD37:
                                                     mon("         RTS                           ; CD37: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench left side turret calcs
  case 0xCD38:
                                                     mon("LCD38    ORCC  #$01                    ; CD38: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD3A; JUMP; // sstep
case 0xCD3A:
                                                     mon("         ROR   $4684                   ; CD3A: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD3D; JUMP; // sstep
case 0xCD3D:
                                                     mon("         JSR   $6864                   ; CD3D: BD 68 64      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x40); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x6864; 
    JUMP;
  case 0xCD40:
                                                     mon("LCD40    CLR   $4684                   ; CD40: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD38
    PC = 0xCD43; JUMP; // sstep
case 0xCD43:
                                                     mon("         RTS                           ; CD43: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench right side turret calcs
  case 0xCD44:
                                                     mon("LCD44    ORCC  #$01                    ; CD44: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD46; JUMP; // sstep
case 0xCD46:
                                                     mon("         ROR   $4684                   ; CD46: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD49; JUMP; // sstep
case 0xCD49:
                                                     mon("         JSR   $68C7                   ; CD49: BD 68 C7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x68c7; 
    JUMP;
  case 0xCD4C:
                                                     mon("LCD4C    CLR   $4684                   ; CD4C: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD44
    PC = 0xCD4F; JUMP; // sstep
case 0xCD4F:
                                                     mon("         RTS                           ; CD4F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCD50:
                                                     mon("LCD50    ORCC  #$01                    ; CD50: 1A 01         \n"); // Called during towers
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD52; JUMP; // sstep
case 0xCD52:
                                                     mon("         ROR   $4684                   ; CD52: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD55; JUMP; // sstep
case 0xCD55:
                                                     mon("         JSR   $692D                   ; CD55: BD 69 2D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x692d; 
    JUMP;
  case 0xCD58:
                                                     mon("LCD58    CLR   $4684                   ; CD58: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD50
    PC = 0xCD5B; JUMP; // sstep
case 0xCD5B:
                                                     mon("         RTS                           ; CD5B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench calcs
  case 0xCD5C:
                                                     mon("LCD5C    ORCC  #$01                    ; CD5C: 1A 01         \n"); // Called during trench start
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD5E; JUMP; // sstep
case 0xCD5E:
                                                     mon("         ROR   $4684                   ; CD5E: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD61; JUMP; // sstep
case 0xCD61:
                                                     mon("         JSR   $6978                   ; CD61: BD 69 78      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x6978; 
    JUMP;
  case 0xCD64:
                                                     mon("LCD64    CLR   $4684                   ; CD64: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD5C
    PC = 0xCD67; JUMP; // sstep
case 0xCD67:
                                                     mon("         RTS                           ; CD67: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xCD68:
                                                     mon("LCD68    ORCC  #$01                    ; CD68: 1A 01         \n"); // Called during towers
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD6A; JUMP; // sstep
case 0xCD6A:
                                                     mon("         ROR   $4684                   ; CD6A: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD6D; JUMP; // sstep
case 0xCD6D:
                                                     mon("         JSR   $6A0C                   ; CD6D: BD 6A 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x6a0c; 
    JUMP;
  case 0xCD70:
                                                     mon("LCD70    CLR   $4684                   ; CD70: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD68
    PC = 0xCD73; JUMP; // sstep
case 0xCD73:
                                                     mon("         RTS                           ; CD73: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Function select for an object
  case 0xCD74:
                                                     mon("LCD74    ORCC  #$01                    ; CD74: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD76; JUMP; // sstep
case 0xCD76:
                                                     mon("         ROR   $4684                   ; CD76: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD79; JUMP; // sstep
case 0xCD79:
                                                     mon("         JSR   $6AA0                   ; CD79: BD 6A A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x6aa0; 
    JUMP;
  case 0xCD7C:
                                                     mon("LCD7C    CLR   $4684                   ; CD7C: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD74
    PC = 0xCD7F; JUMP; // sstep
case 0xCD7F:
                                                     mon("         RTS                           ; CD7F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Starfield
  case 0xCD80:
                                                     mon("LCD80    ORCC  #$01                    ; CD80: 1A 01         \n"); // Starfield attract screen 1 + 3 + 4
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD82; JUMP; // sstep
case 0xCD82:
                                                     mon("         ROR   $4684                   ; CD82: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD85; JUMP; // sstep
case 0xCD85:
                                                     mon("         JSR   $7D9A                   ; CD85: BD 7D 9A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x7d9a; 
    JUMP;
  case 0xCD88:
                                                     mon("LCD88    CLR   $4684                   ; CD88: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD80
    PC = 0xCD8B; JUMP; // sstep
case 0xCD8B:
                                                     mon("         RTS                           ; CD8B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Towers surface dots
  case 0xCD8C:
                                                     mon("LCD8C    ORCC  #$01                    ; CD8C: 1A 01         \n");
    C = 1; 
    clockticks = clockticks + 3; 
    PC = 0xCD8E; JUMP; // sstep
case 0xCD8E:
                                                     mon("         ROR   $4684                   ; CD8E: 76 46 84      \n");
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x4684)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x4684, res); 
    clockticks = clockticks + 2; 
    PC = 0xCD91; JUMP; // sstep
case 0xCD91:
                                                     mon("         JSR   $7EAF                   ; CD91: BD 7E AF      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    PC = 0x7eaf; 
    JUMP;
  case 0xCD94:
                                                     mon("LCD94    CLR   $4684                   ; CD94: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_CD8C
    PC = 0xCD97; JUMP; // sstep
case 0xCD97:
                                                     mon("         RTS                           ; CD97: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Unused
  case 0xCD98:
                                                     mon("LCD98    ASRA                          ; CD98: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCD99; JUMP; // sstep
case 0xCD99:
                                                     mon("         RORB                          ; CD99: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCD9A; JUMP; // sstep
case 0xCD9A:
                                                     mon("         ASRA                          ; CD9A: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    // End of function sub_CD98
    PC = 0xCD9B; JUMP; // sstep
case 0xCD9B:
                                                     mon("         RORB                          ; CD9B: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    // =============== S U B R O U T I N E =======================================
    // Shift D register right
    PC = 0xCD9C; JUMP; // sstep
case 0xCD9C:
                                                     mon("Shift_D_R_6 ASRA                          ; CD9C: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    // End of function Shift_D_R_6
    PC = 0xCD9D; JUMP; // sstep
case 0xCD9D:
                                                     mon("         RORB                          ; CD9D: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    // =============== S U B R O U T I N E =======================================
    // Shift D register right
    PC = 0xCD9E; JUMP; // sstep
case 0xCD9E:
                                                     mon("Shift_D_R_5 ASRA                          ; CD9E: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCD9F; JUMP; // sstep
case 0xCD9F:
                                                     mon("         RORB                          ; CD9F: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDA0; JUMP; // sstep
case 0xCDA0:
                                                     mon("Shift_D_R_4 ASRA                          ; CDA0: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCDA1; JUMP; // sstep
case 0xCDA1:
                                                     mon("         RORB                          ; CDA1: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDA2; JUMP; // sstep
case 0xCDA2:
                                                     mon("Shift_D_R_3 ASRA                          ; CDA2: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCDA3; JUMP; // sstep
case 0xCDA3:
                                                     mon("         RORB                          ; CDA3: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDA4; JUMP; // sstep
case 0xCDA4:
                                                     mon("         ASRA                          ; CDA4: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCDA5; JUMP; // sstep
case 0xCDA5:
                                                     mon("         RORB                          ; CDA5: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDA6; JUMP; // sstep
case 0xCDA6:
                                                     mon("         ASRA                          ; CDA6: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xCDA7; JUMP; // sstep
case 0xCDA7:
                                                     mon("         RORB                          ; CDA7: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    // End of function Shift_D_R_5
    PC = 0xCDA8; JUMP; // sstep
case 0xCDA8:
                                                     mon("         RTS                           ; CDA8: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Shift D register left
  case 0xCDA9:
                                                     mon("LCDA9    ASLB                          ; CDA9: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    // End of function sub_CDA9
    PC = 0xCDAA; JUMP; // sstep
case 0xCDAA:
                                                     mon("         ROLA                          ; CDAA: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xCDAB; JUMP; // sstep
case 0xCDAB:
                                                     mon("Shift_D_L_7 ASLB                          ; CDAB: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDAC; JUMP; // sstep
case 0xCDAC:
                                                     mon("         ROLA                          ; CDAC: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xCDAD; JUMP; // sstep
case 0xCDAD:
                                                     mon("         ASLB                          ; CDAD: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDAE; JUMP; // sstep
case 0xCDAE:
                                                     mon("         ROLA                          ; CDAE: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xCDAF; JUMP; // sstep
case 0xCDAF:
                                                     mon("         ASLB                          ; CDAF: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB0; JUMP; // sstep
case 0xCDB0:
                                                     mon("         ROLA                          ; CDB0: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB1; JUMP; // sstep
case 0xCDB1:
                                                     mon("Shift_D_L_4 ASLB                          ; CDB1: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB2; JUMP; // sstep
case 0xCDB2:
                                                     mon("         ROLA                          ; CDB2: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB3; JUMP; // sstep
case 0xCDB3:
                                                     mon("         ASLB                          ; CDB3: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB4; JUMP; // sstep
case 0xCDB4:
                                                     mon("         ROLA                          ; CDB4: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB5; JUMP; // sstep
case 0xCDB5:
                                                     mon("Shift_D_L_2 ASLB                          ; CDB5: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB6; JUMP; // sstep
case 0xCDB6:
                                                     mon("         ROLA                          ; CDB6: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB7; JUMP; // sstep
case 0xCDB7:
                                                     mon("         ASLB                          ; CDB7: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xCDB8; JUMP; // sstep
case 0xCDB8:
                                                     mon("         ROLA                          ; CDB8: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    // End of function Shift_D_L_7
    PC = 0xCDB9; JUMP; // sstep
case 0xCDB9:
                                                     mon("         RTS                           ; CDB9: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Do math program run
  case 0xCDBA:
                                                     mon("LCDBA    STA   $4700                   ; CDBA: B7 47 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4700, val); 
    PC = 0xCDBD; JUMP; // sstep
case 0xCDBD:
                                                     mon("Math_Wait_Til_Halt TST   $4320                   ; CDBD: 7D 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xCDC0; JUMP; // sstep
case 0xCDC0:
                                                     mon("         BMI   Math_Wait_Til_Halt      ; CDC0: 2B FB         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xcdbd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function Math_Run_Start
    PC = 0xCDC2; JUMP; // sstep
case 0xCDC2:
                                                     mon("         RTS                           ; CDC2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Initialise math registers matrix
  case 0xCDC3:
                                                     mon("LCDC3    LDD   #$00                    ; CDC3: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCDC6; JUMP; // sstep
case 0xCDC6:
                                                     mon("         STD   -10,U                   ; CDC6: ED 56         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff6); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDC8; JUMP; // sstep
case 0xCDC8:
                                                     mon("         STD   -2,U                    ; CDC8: ED 5E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffe); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDCA; JUMP; // sstep
case 0xCDCA:
                                                     mon("         STD   $06,U                   ; CDCA: ED 46         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDCC; JUMP; // sstep
case 0xCDCC:
                                                     mon("         STD   $08,U                   ; CDCC: ED 48         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDCE; JUMP; // sstep
case 0xCDCE:
                                                     mon("         STD   $0A,U                   ; CDCE: ED 4A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDD0; JUMP; // sstep
case 0xCDD0:
                                                     mon("         STD   $0C,U                   ; CDD0: ED 4C         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDD2; JUMP; // sstep
case 0xCDD2:
                                                     mon("         STD   -14,U                   ; CDD2: ED 52         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff2); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDD4; JUMP; // sstep
case 0xCDD4:
                                                     mon("         STD   -12,U                   ; CDD4: ED 54         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff4); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDD6; JUMP; // sstep
case 0xCDD6:
                                                     mon("         STD   -8,U                    ; CDD6: ED 58         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff8); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDD8; JUMP; // sstep
case 0xCDD8:
                                                     mon("         STD   -4,U                    ; CDD8: ED 5C         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffc); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDDA; JUMP; // sstep
case 0xCDDA:
                                                     mon("         STD   ,U                      ; CDDA: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDDC; JUMP; // sstep
case 0xCDDC:
                                                     mon("         STD   $02,U                   ; CDDC: ED 42         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDDE; JUMP; // sstep
case 0xCDDE:
                                                     mon("         LDA   #$40                    ; CDDE: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCDE0; JUMP; // sstep
case 0xCDE0:
                                                     mon("         STD   -16,U                   ; CDE0: ED 50         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfff0); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDE2; JUMP; // sstep
case 0xCDE2:
                                                     mon("         STD   -6,U                    ; CDE2: ED 5A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0xfffa); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCDE4; JUMP; // sstep
case 0xCDE4:
                                                     mon("         STD   $04,U                   ; CDE4: ED 44         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_CDC3
    PC = 0xCDE6; JUMP; // sstep
case 0xCDE6:
                                                     mon("         RTS                           ; CDE6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Swap Matrix 2  x, y, z to  x, y, z
  case 0xCDE7:
                                                     mon("LCDE7    LDD   $502A                   ; CDE7: FC 50 2A      \n"); // Ay2
    clockticks = clockticks + 5; 
    A = rd_mem(0x502a); // Care needed with I/O space and word fetches
    B = rd_mem(0x502b); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCDEA; JUMP; // sstep
case 0xCDEA:
                                                     mon("         LDU   $5030                   ; CDEA: FE 50 30      \n"); // Bx2
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5030)<<8; 
    ea = ea | rd_mem(0x5031); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCDED; JUMP; // sstep
case 0xCDED:
                                                     mon("         STD   $5030                   ; CDED: FD 50 30      \n"); // Bx2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5030, A); // Care needed with I/O space and word fetches
    wr_mem(0x5031, B); 
    PC = 0xCDF0; JUMP; // sstep
case 0xCDF0:
                                                     mon("         STU   $502A                   ; CDF0: FF 50 2A      \n"); // Ay2
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x502a, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x502b, (UINT8)val); 
    PC = 0xCDF3; JUMP; // sstep
case 0xCDF3:
                                                     mon("         LDD   $502C                   ; CDF3: FC 50 2C      \n"); // Az2
    clockticks = clockticks + 5; 
    A = rd_mem(0x502c); // Care needed with I/O space and word fetches
    B = rd_mem(0x502d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCDF6; JUMP; // sstep
case 0xCDF6:
                                                     mon("         LDU   $5038                   ; CDF6: FE 50 38      \n"); // Cx2
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5038)<<8; 
    ea = ea | rd_mem(0x5039); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCDF9; JUMP; // sstep
case 0xCDF9:
                                                     mon("         STD   $5038                   ; CDF9: FD 50 38      \n"); // Cx2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5038, A); // Care needed with I/O space and word fetches
    wr_mem(0x5039, B); 
    PC = 0xCDFC; JUMP; // sstep
case 0xCDFC:
                                                     mon("         STU   $502C                   ; CDFC: FF 50 2C      \n"); // Az2
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x502c, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x502d, (UINT8)val); 
    PC = 0xCDFF; JUMP; // sstep
case 0xCDFF:
                                                     mon("         LDD   $5034                   ; CDFF: FC 50 34      \n"); // Bz2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5034); // Care needed with I/O space and word fetches
    B = rd_mem(0x5035); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCE02; JUMP; // sstep
case 0xCE02:
                                                     mon("         LDU   $503A                   ; CE02: FE 50 3A      \n"); // Cy2
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x503a)<<8; 
    ea = ea | rd_mem(0x503b); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xCE05; JUMP; // sstep
case 0xCE05:
                                                     mon("         STD   $503A                   ; CE05: FD 50 3A      \n"); // Cy2
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x503a, A); // Care needed with I/O space and word fetches
    wr_mem(0x503b, B); 
    PC = 0xCE08; JUMP; // sstep
case 0xCE08:
                                                     mon("         STU   $5034                   ; CE08: FF 50 34      \n"); // Bz2
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x5034, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x5035, (UINT8)val); 
    // End of function sub_CDE7
    PC = 0xCE0B; JUMP; // sstep
case 0xCE0B:
                                                     mon("         RTS                           ; CE0B: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Copy transform data from [BIC] to matrix 2
  case 0xCE0C:
                                                     mon("LCE0C    STA   $4702                   ; CE0C: B7 47 02      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4702, val); 
    PC = 0xCE0F; JUMP; // sstep
case 0xCE0F:
                                                     mon("         CLR   $4701                   ; CE0F: 7F 47 01      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4701, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xCE12; JUMP; // sstep
case 0xCE12:
                                                     mon("         LDA   #$77                    ; CE12: 86 77         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x77; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCE14; JUMP; // sstep
case 0xCE14:
                                                     mon("         JSR   LCDBA                   ; CE14: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
    // End of function sub_CE0C
  case 0xCE17:
                                                     mon("LCE17    RTS                           ; CE17: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Run math program $80 Copy [BIC] to Matrix 3
  case 0xCE18:
                                                     mon("LCE18    STA   $4702                   ; CE18: B7 47 02      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4702, val); 
    PC = 0xCE1B; JUMP; // sstep
case 0xCE1B:
                                                     mon("         CLR   $4701                   ; CE1B: 7F 47 01      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4701, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xCE1E; JUMP; // sstep
case 0xCE1E:
                                                     mon("         LDA   #$80                    ; CE1E: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xCE20; JUMP; // sstep
case 0xCE20:
                                                     mon("         JSR   LCDBA                   ; CE20: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x23); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
    // End of function sub_CE18
  case 0xCE23:
                                                     mon("LCE23    RTS                           ; CE23: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Run math program $00 Roll on Matrix 4
  case 0xCE24:
                                                     mon("LCE24    LDD   #$10                    ; CE24: CC 00 10      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x10; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCE27; JUMP; // sstep
case 0xCE27:
                                                     mon("         STD   $4701                   ; CE27: FD 47 01      \n"); // Point BIC to $5080 MReg40 Matrix 4
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xCE2A; JUMP; // sstep
case 0xCE2A:
                                                     mon("         LDA   #$00                    ; CE2A: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_CE24
    PC = 0xCE2C; JUMP; // sstep
case 0xCE2C:
                                                     mon("         JMP   LCDBA                   ; CE2C: 7E CD BA      \n"); // Do math program run
    clockticks = clockticks + 4; 
    PC = 0xcdba; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Run math program $0E Pitch on Matrix 4
  case 0xCE2F:
                                                     mon("LCE2F    LDD   #$10                    ; CE2F: CC 00 10      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x10; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCE32; JUMP; // sstep
case 0xCE32:
                                                     mon("         STD   $4701                   ; CE32: FD 47 01      \n"); // Point BIC to $5080 MReg40 Matrix 4
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xCE35; JUMP; // sstep
case 0xCE35:
                                                     mon("         LDA   #$0E                    ; CE35: 86 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_CE2F
    PC = 0xCE37; JUMP; // sstep
case 0xCE37:
                                                     mon("         JMP   LCDBA                   ; CE37: 7E CD BA      \n"); // Do math program run
    clockticks = clockticks + 4; 
    PC = 0xcdba; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Run math program $1C Yaw on Matrix 4
  case 0xCE3A:
                                                     mon("LCE3A    LDD   #$10                    ; CE3A: CC 00 10      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x10; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCE3D; JUMP; // sstep
case 0xCE3D:
                                                     mon("         STD   $4701                   ; CE3D: FD 47 01      \n"); // Point BIC to $5080 MReg40 Matrix 4
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4701, A); // Care needed with I/O space and word fetches
    wr_mem(0x4702, B); 
    PC = 0xCE40; JUMP; // sstep
case 0xCE40:
                                                     mon("         LDA   #$1C                    ; CE40: 86 1C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_CE3A
    PC = 0xCE42; JUMP; // sstep
case 0xCE42:
                                                     mon("         JMP   LCDBA                   ; CE42: 7E CD BA      \n"); // Do math program run
    clockticks = clockticks + 4; 
    PC = 0xcdba; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Update random numbers
  case 0xCE45:
                                                     mon("Gen_Random LDD   <$53                    ; CE45: DC 53         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x53); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x54); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xCE47; JUMP; // sstep
case 0xCE47:
                                                     mon("         STD   <$54                    ; CE47: DD 54         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x54; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xCE49; JUMP; // sstep
case 0xCE49:
                                                     mon("         LDA   $4703                   ; CE49: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xCE4C; JUMP; // sstep
case 0xCE4C:
                                                     mon("         STA   <$53                    ; CE4C: 97 53         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x53; 
    wr_mem(ea, val); 
    // End of function Gen_Random
    // ---------------------------------------------------------------------------
    PC = 0xCE4E; JUMP; // sstep
case 0xCE4E:
                                                     mon("         RTS                           ; CE4E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xD660:
                                                     mon("LD660    JSR   LD68D                   ; D660: BD D6 8D      \n"); // Point U to vector RAM $38
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd68d; 
    JUMP;
  case 0xD663:
                                                     mon("LD663    JSR   LD690                   ; D663: BD D6 90      \n"); // Animate laser target hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd690; 
    JUMP;
  case 0xD666:
                                                     mon("LD666    LDD   #$C000                  ; D666: CC C0 00      \n"); // Vector RTSL instruction
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD669; JUMP; // sstep
case 0xD669:
                                                     mon("         STD   ,U++                    ; D669: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD66B; JUMP; // sstep
case 0xD66B:
                                                     mon("         JSR   LD6A0                   ; D66B: BD D6 A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd6a0; 
    JUMP;
  case 0xD66E:
                                                     mon("LD66E    JSR   LD6A3                   ; D66E: BD D6 A3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd6a3; 
    JUMP;
  case 0xD671:
                                                     mon("LD671    LDD   #$C000                  ; D671: CC C0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD674; JUMP; // sstep
case 0xD674:
                                                     mon("         STD   ,U++                    ; D674: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD676; JUMP; // sstep
case 0xD676:
                                                     mon("         JSR   LD6BC                   ; D676: BD D6 BC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd6bc; 
    JUMP;
  case 0xD679:
                                                     mon("LD679    JSR   LD6BF                   ; D679: BD D6 BF      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd6bf; 
    JUMP;
  case 0xD67C:
                                                     mon("LD67C    LDD   #$C000                  ; D67C: CC C0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD67F; JUMP; // sstep
case 0xD67F:
                                                     mon("         STD   ,U++                    ; D67F: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD681; JUMP; // sstep
case 0xD681:
                                                     mon("         JSR   LD6E7                   ; D681: BD D6 E7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd6e7; 
    JUMP;
  case 0xD684:
                                                     mon("LD684    JSR   LD6EA                   ; D684: BD D6 EA      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd6ea; 
    JUMP;
  case 0xD687:
                                                     mon("LD687    LDD   #$C000                  ; D687: CC C0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD68A; JUMP; // sstep
case 0xD68A:
                                                     mon("         STD   ,U++                    ; D68A: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    // End of function sub_D660
    PC = 0xD68C; JUMP; // sstep
case 0xD68C:
                                                     mon("         RTS                           ; D68C: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Point U to vector RAM $38
    // End of function sub_D68D
  case 0xD68D:
                                                     mon("LD68D    LDU   #$38                    ; D68D: CE 00 38      \n");
    clockticks = clockticks + 3; 
    U = 0x0038; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // =============== S U B R O U T I N E =======================================
    // Animate laser target hit
    PC = 0xD690; JUMP; // sstep
case 0xD690:
                                                     mon("LD690    JSR   LD709                   ; D690: BD D7 09      \n"); // Laser target animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x93); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd709; 
    JUMP;
  case 0xD693:
                                                     mon("LD693    LDD   ,X++                    ; D693: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD695; JUMP; // sstep
case 0xD695:
                                                     mon("         STD   ,U++                    ; D695: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD697; JUMP; // sstep
case 0xD697:
                                                     mon("         LDD   ,X++                    ; D697: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD699; JUMP; // sstep
case 0xD699:
                                                     mon("         STD   ,U++                    ; D699: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD69B; JUMP; // sstep
case 0xD69B:
                                                     mon("         LDD   ,X                      ; D69B: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD69D; JUMP; // sstep
case 0xD69D:
                                                     mon("         STD   ,U++                    ; D69D: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    // End of function sub_D690
    PC = 0xD69F; JUMP; // sstep
case 0xD69F:
                                                     mon("         RTS                           ; D69F: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // End of function sub_D6A0
  case 0xD6A0:
                                                     mon("LD6A0    LDU   #$46                    ; D6A0: CE 00 46      \n");
    clockticks = clockticks + 3; 
    U = 0x0046; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xD6A3; JUMP; // sstep
case 0xD6A3:
                                                     mon("LD6A3    JSR   LD709                   ; D6A3: BD D7 09      \n"); // Laser target animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd709; 
    JUMP;
  case 0xD6A6:
                                                     mon("LD6A6    LDD   ,X++                    ; D6A6: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6A8; JUMP; // sstep
case 0xD6A8:
                                                     mon("         NEGB                          ; D6A8: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6A9; JUMP; // sstep
case 0xD6A9:
                                                     mon("         ANDB  #$1F                    ; D6A9: C4 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x1f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6AB; JUMP; // sstep
case 0xD6AB:
                                                     mon("         STD   ,U++                    ; D6AB: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD6AD; JUMP; // sstep
case 0xD6AD:
                                                     mon("         LDD   ,X++                    ; D6AD: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6AF; JUMP; // sstep
case 0xD6AF:
                                                     mon("         NEGB                          ; D6AF: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6B0; JUMP; // sstep
case 0xD6B0:
                                                     mon("         ORB   #$E0                    ; D6B0: CA E0         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0xe0; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6B2; JUMP; // sstep
case 0xD6B2:
                                                     mon("         STD   ,U++                    ; D6B2: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD6B4; JUMP; // sstep
case 0xD6B4:
                                                     mon("         LDD   ,X                      ; D6B4: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6B6; JUMP; // sstep
case 0xD6B6:
                                                     mon("         NEGB                          ; D6B6: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6B7; JUMP; // sstep
case 0xD6B7:
                                                     mon("         ANDB  #$1F                    ; D6B7: C4 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x1f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6B9; JUMP; // sstep
case 0xD6B9:
                                                     mon("         STD   ,U++                    ; D6B9: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    // End of function sub_D6A3
    PC = 0xD6BB; JUMP; // sstep
case 0xD6BB:
                                                     mon("         RTS                           ; D6BB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // End of function sub_D6BC
  case 0xD6BC:
                                                     mon("LD6BC    LDU   #$54                    ; D6BC: CE 00 54      \n");
    clockticks = clockticks + 3; 
    U = 0x0054; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xD6BF; JUMP; // sstep
case 0xD6BF:
                                                     mon("LD6BF    JSR   LD709                   ; D6BF: BD D7 09      \n"); // Laser target animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd709; 
    JUMP;
  case 0xD6C2:
                                                     mon("LD6C2    LDD   ,X++                    ; D6C2: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6C4; JUMP; // sstep
case 0xD6C4:
                                                     mon("         NEGA                          ; D6C4: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6C5; JUMP; // sstep
case 0xD6C5:
                                                     mon("         ANDA  #$1F                    ; D6C5: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6C7; JUMP; // sstep
case 0xD6C7:
                                                     mon("         ORA   #$40                    ; D6C7: 8A 40         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x40; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6C9; JUMP; // sstep
case 0xD6C9:
                                                     mon("         NEGB                          ; D6C9: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6CA; JUMP; // sstep
case 0xD6CA:
                                                     mon("         ANDB  #$1F                    ; D6CA: C4 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x1f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6CC; JUMP; // sstep
case 0xD6CC:
                                                     mon("         STD   ,U++                    ; D6CC: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD6CE; JUMP; // sstep
case 0xD6CE:
                                                     mon("         LDD   ,X++                    ; D6CE: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6D0; JUMP; // sstep
case 0xD6D0:
                                                     mon("         NEGA                          ; D6D0: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6D1; JUMP; // sstep
case 0xD6D1:
                                                     mon("         ANDA  #$1F                    ; D6D1: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6D3; JUMP; // sstep
case 0xD6D3:
                                                     mon("         ORA   #$40                    ; D6D3: 8A 40         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x40; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6D5; JUMP; // sstep
case 0xD6D5:
                                                     mon("         NEGB                          ; D6D5: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6D6; JUMP; // sstep
case 0xD6D6:
                                                     mon("         ORB   #$E0                    ; D6D6: CA E0         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0xe0; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6D8; JUMP; // sstep
case 0xD6D8:
                                                     mon("         STD   ,U++                    ; D6D8: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD6DA; JUMP; // sstep
case 0xD6DA:
                                                     mon("         LDD   ,X                      ; D6DA: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6DC; JUMP; // sstep
case 0xD6DC:
                                                     mon("         NEGA                          ; D6DC: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6DD; JUMP; // sstep
case 0xD6DD:
                                                     mon("         ANDA  #$1F                    ; D6DD: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6DF; JUMP; // sstep
case 0xD6DF:
                                                     mon("         ORA   #$40                    ; D6DF: 8A 40         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x40; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6E1; JUMP; // sstep
case 0xD6E1:
                                                     mon("         NEGB                          ; D6E1: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6E2; JUMP; // sstep
case 0xD6E2:
                                                     mon("         ANDB  #$1F                    ; D6E2: C4 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x1f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6E4; JUMP; // sstep
case 0xD6E4:
                                                     mon("         STD   ,U++                    ; D6E4: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    // End of function sub_D6BF
    PC = 0xD6E6; JUMP; // sstep
case 0xD6E6:
                                                     mon("         RTS                           ; D6E6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // End of function sub_D6E7
  case 0xD6E7:
                                                     mon("LD6E7    LDU   #$62                    ; D6E7: CE 00 62      \n");
    clockticks = clockticks + 3; 
    U = 0x0062; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    // =============== S U B R O U T I N E =======================================
    PC = 0xD6EA; JUMP; // sstep
case 0xD6EA:
                                                     mon("LD6EA    JSR   LD709                   ; D6EA: BD D7 09      \n"); // Laser target animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xed); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd6); 
    clockticks = clockticks + 1; 
    PC = 0xd709; 
    JUMP;
  case 0xD6ED:
                                                     mon("LD6ED    LDD   ,X++                    ; D6ED: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6EF; JUMP; // sstep
case 0xD6EF:
                                                     mon("         NEGA                          ; D6EF: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6F0; JUMP; // sstep
case 0xD6F0:
                                                     mon("         ANDA  #$1F                    ; D6F0: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6F2; JUMP; // sstep
case 0xD6F2:
                                                     mon("         ORA   #$40                    ; D6F2: 8A 40         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x40; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6F4; JUMP; // sstep
case 0xD6F4:
                                                     mon("         STD   ,U++                    ; D6F4: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD6F6; JUMP; // sstep
case 0xD6F6:
                                                     mon("         LDD   ,X++                    ; D6F6: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD6F8; JUMP; // sstep
case 0xD6F8:
                                                     mon("         NEGA                          ; D6F8: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD6F9; JUMP; // sstep
case 0xD6F9:
                                                     mon("         ANDA  #$1F                    ; D6F9: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6FB; JUMP; // sstep
case 0xD6FB:
                                                     mon("         ORA   #$40                    ; D6FB: 8A 40         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x40; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD6FD; JUMP; // sstep
case 0xD6FD:
                                                     mon("         STD   ,U++                    ; D6FD: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD6FF; JUMP; // sstep
case 0xD6FF:
                                                     mon("         LDD   ,X                      ; D6FF: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD701; JUMP; // sstep
case 0xD701:
                                                     mon("         NEGA                          ; D701: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD702; JUMP; // sstep
case 0xD702:
                                                     mon("         ANDA  #$1F                    ; D702: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD704; JUMP; // sstep
case 0xD704:
                                                     mon("         ORA   #$40                    ; D704: 8A 40         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x40; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD706; JUMP; // sstep
case 0xD706:
                                                     mon("         STD   ,U++                    ; D706: ED C1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    // End of function sub_D6EA
    PC = 0xD708; JUMP; // sstep
case 0xD708:
                                                     mon("         RTS                           ; D708: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Laser target animation
  case 0xD709:
                                                     mon("LD709    LDA   $4703                   ; D709: B6 47 03      \n"); // Get random number
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD70C; JUMP; // sstep
case 0xD70C:
                                                     mon("         ANDA  #$0F                    ; D70C: 84 0F         \n"); // Mask 0-15
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD70E; JUMP; // sstep
case 0xD70E:
                                                     mon("         LDB   #$06                    ; D70E: C6 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD710; JUMP; // sstep
case 0xD710:
                                                     mon("         MUL                           ; D710: 3D            \n"); // Multiply by 6 for 0- 90 range
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xD711; JUMP; // sstep
case 0xD711:
                                                     mon("         LDX   #word_D716              ; D711: 8E D7 16      \n"); // Table of vector SVEC instructions for laser hit target animation
    clockticks = clockticks + 3; 
    X = 0xd716; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xD714; JUMP; // sstep
case 0xD714:
                                                     mon("         ABX                           ; D714: 3A            \n"); // Point X reg to word from table
    X = X + B; 
    clockticks = clockticks + 3; 
    // End of function sub_D709
    // ---------------------------------------------------------------------------
    PC = 0xD715; JUMP; // sstep
case 0xD715:
                                                     mon("         RTS                           ; D715: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Check coin inputs
  case 0xD776:
                                                     mon("LD776    LDA   $4300                   ; D776: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD779; JUMP; // sstep
case 0xD779:
                                                     mon("         ANDA  #$0F                    ; D779: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD77B; JUMP; // sstep
case 0xD77B:
                                                     mon("         CMPA  #$0F                    ; D77B: 81 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD77D; JUMP; // sstep
case 0xD77D:
                                                     mon("         BEQ   LD783                   ; D77D: 27 04         \n"); // Check for coin or slam inputs
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd783; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD77F; JUMP; // sstep
case 0xD77F:
                                                     mon("         LDA   #$FF                    ; D77F: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD781; JUMP; // sstep
case 0xD781:
                                                     mon("         STA   <$18                    ; D781: 97 18         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x18; 
    wr_mem(ea, val); 
    PC = 0xD783; JUMP; // sstep
case 0xD783:
                                                     mon("LD783    LDA   <$18                    ; D783: 96 18         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x18); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xD785; JUMP; // sstep
case 0xD785:
                                                     mon("         BNE   LD788                   ; D785: 26 01         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd788; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD787; JUMP; // sstep
case 0xD787:
                                                     mon("         RTS                           ; D787: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xD788:
                                                     mon("LD788    DEC   <$18                    ; D788: 0A 18         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x18); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0x18, res); 
    clockticks = clockticks + 2; 
    PC = 0xD78A; JUMP; // sstep
case 0xD78A:
                                                     mon("         LDA   #$12                    ; D78A: 86 12         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x12; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD78C; JUMP; // sstep
case 0xD78C:
                                                     mon("         CMPA  <$14                    ; D78C: 91 14         \n"); // Credits
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x14); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD78E; JUMP; // sstep
case 0xD78E:
                                                     mon("         BCC   LD792                   ; D78E: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd792; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD790; JUMP; // sstep
case 0xD790:
                                                     mon("         STA   <$14                    ; D790: 97 14         \n"); // Credits
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x14; 
    wr_mem(ea, val); 
    PC = 0xD792; JUMP; // sstep
case 0xD792:
                                                     mon("LD792    LDA   <$17                    ; D792: 96 17         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x17); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD794; JUMP; // sstep
case 0xD794:
                                                     mon("         STA   $4681                   ; D794: B7 46 81      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4681, val); 
    PC = 0xD797; JUMP; // sstep
case 0xD797:
                                                     mon("         LDB   <$16                    ; D797: D6 16         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x16); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD799; JUMP; // sstep
case 0xD799:
                                                     mon("         STB   $4680                   ; D799: F7 46 80      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4680, val); 
    PC = 0xD79C; JUMP; // sstep
case 0xD79C:
                                                     mon("         ORA   <$16                    ; D79C: 9A 16         \n");
    clockticks = clockticks + 4; 
    res = A | (UINT8)rd_mem(DP|0x16); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD79E; JUMP; // sstep
case 0xD79E:
                                                     mon("         ORA   <$15                    ; D79E: 9A 15         \n");
    clockticks = clockticks + 4; 
    res = A | (UINT8)rd_mem(DP|0x15); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD7A0; JUMP; // sstep
case 0xD7A0:
                                                     mon("         BEQ   LD7A6                   ; D7A0: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd7a6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7A2; JUMP; // sstep
case 0xD7A2:
                                                     mon("         LDA   #$FF                    ; D7A2: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7A4; JUMP; // sstep
case 0xD7A4:
                                                     mon("         STA   <$18                    ; D7A4: 97 18         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x18; 
    wr_mem(ea, val); 
    PC = 0xD7A6; JUMP; // sstep
case 0xD7A6:
                                                     mon("LD7A6    LDA   $4300                   ; D7A6: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7A9; JUMP; // sstep
case 0xD7A9:
                                                     mon("         ANDA  #$10                    ; D7A9: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD7AB; JUMP; // sstep
case 0xD7AB:
                                                     mon("         BNE   LD7B0                   ; D7AB: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd7b0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7AD; JUMP; // sstep
case 0xD7AD:
                                                     mon("         JMP   LD8AE                   ; D7AD: 7E D8 AE      \n");
    clockticks = clockticks + 4; 
    PC = 0xd8ae; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xD7B0:
                                                     mon("LD7B0    LDA   $4590                   ; D7B0: B6 45 90      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4590); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7B3; JUMP; // sstep
case 0xD7B3:
                                                     mon("         ASLA                          ; D7B3: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xD7B4; JUMP; // sstep
case 0xD7B4:
                                                     mon("         ASLA                          ; D7B4: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xD7B5; JUMP; // sstep
case 0xD7B5:
                                                     mon("         ASLA                          ; D7B5: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xD7B6; JUMP; // sstep
case 0xD7B6:
                                                     mon("         ASLA                          ; D7B6: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xD7B7; JUMP; // sstep
case 0xD7B7:
                                                     mon("         STA   <$09                    ; D7B7: 97 09         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x09; 
    wr_mem(ea, val); 
    PC = 0xD7B9; JUMP; // sstep
case 0xD7B9:
                                                     mon("         LDA   $4591                   ; D7B9: B6 45 91      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4591); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7BC; JUMP; // sstep
case 0xD7BC:
                                                     mon("         ANDA  #$0F                    ; D7BC: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD7BE; JUMP; // sstep
case 0xD7BE:
                                                     mon("         ORA   <$09                    ; D7BE: 9A 09         \n");
    clockticks = clockticks + 4; 
    res = A | (UINT8)rd_mem(DP|0x09); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD7C0; JUMP; // sstep
case 0xD7C0:
                                                     mon("         STA   <$09                    ; D7C0: 97 09         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x09; 
    wr_mem(ea, val); 
    PC = 0xD7C2; JUMP; // sstep
case 0xD7C2:
                                                     mon("         LDA   <$0A                    ; D7C2: 96 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7C4; JUMP; // sstep
case 0xD7C4:
                                                     mon("         ANDA  #$03                    ; D7C4: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD7C6; JUMP; // sstep
case 0xD7C6:
                                                     mon("         BNE   LD7CB                   ; D7C6: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd7cb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7C8; JUMP; // sstep
case 0xD7C8:
                                                     mon("         JSR   LC09D                   ; D7C8: BD C0 9D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd7); 
    clockticks = clockticks + 1; 
    PC = 0xc09d; 
    JUMP;
  case 0xD7CB:
                                                     mon("LD7CB    LDX   #$480E                  ; D7CB: 8E 48 0E      \n");
    clockticks = clockticks + 3; 
    X = 0x480e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD7CE; JUMP; // sstep
case 0xD7CE:
                                                     mon("LD7CE    LDA   $4300                   ; D7CE: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7D1; JUMP; // sstep
case 0xD7D1:
                                                     mon("         CMPX  #$480D                  ; D7D1: 8C 48 0D      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x480d; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD7D4; JUMP; // sstep
case 0xD7D4:
                                                     mon("         BEQ   LD7D9                   ; D7D4: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd7d9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7D6; JUMP; // sstep
case 0xD7D6:
                                                     mon("         BCC   LD7DA                   ; D7D6: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd7da; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7D8; JUMP; // sstep
case 0xD7D8:
                                                     mon("         LSRA                          ; D7D8: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD7D9; JUMP; // sstep
case 0xD7D9:
                                                     mon("LD7D9    LSRA                          ; D7D9: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD7DA; JUMP; // sstep
case 0xD7DA:
                                                     mon("LD7DA    LSRA                          ; D7DA: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD7DB; JUMP; // sstep
case 0xD7DB:
                                                     mon("         LDA   ,X                      ; D7DB: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7DD; JUMP; // sstep
case 0xD7DD:
                                                     mon("         ANDA  #$1F                    ; D7DD: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD7DF; JUMP; // sstep
case 0xD7DF:
                                                     mon("         BCS   LD812                   ; D7DF: 25 31         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd812; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7E1; JUMP; // sstep
case 0xD7E1:
                                                     mon("         BEQ   LD7EF                   ; D7E1: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd7ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7E3; JUMP; // sstep
case 0xD7E3:
                                                     mon("         CMPA  #$1B                    ; D7E3: 81 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD7E5; JUMP; // sstep
case 0xD7E5:
                                                     mon("         BCC   LD7ED                   ; D7E5: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd7ed; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7E7; JUMP; // sstep
case 0xD7E7:
                                                     mon("         LDB   <$0A                    ; D7E7: D6 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7E9; JUMP; // sstep
case 0xD7E9:
                                                     mon("         ANDB  #$01                    ; D7E9: C4 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x01; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD7EB; JUMP; // sstep
case 0xD7EB:
                                                     mon("         BNE   LD7EF                   ; D7EB: 26 02         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd7ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7ED; JUMP; // sstep
case 0xD7ED:
                                                     mon("LD7ED    SUBA  #$01                    ; D7ED: 80 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xD7EF; JUMP; // sstep
case 0xD7EF:
                                                     mon("LD7EF    STA   ,X                      ; D7EF: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xD7F1; JUMP; // sstep
case 0xD7F1:
                                                     mon("         LDA   $4300                   ; D7F1: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7F4; JUMP; // sstep
case 0xD7F4:
                                                     mon("         ANDA  #$08                    ; D7F4: 84 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x08; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD7F6; JUMP; // sstep
case 0xD7F6:
                                                     mon("         BNE   LD7FC                   ; D7F6: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd7fc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD7F8; JUMP; // sstep
case 0xD7F8:
                                                     mon("         LDA   #$F0                    ; D7F8: 86 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xf0; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD7FA; JUMP; // sstep
case 0xD7FA:
                                                     mon("         STA   <$0B                    ; D7FA: 97 0B         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x0b; 
    wr_mem(ea, val); 
    PC = 0xD7FC; JUMP; // sstep
case 0xD7FC:
                                                     mon("LD7FC    LDA   <$0B                    ; D7FC: 96 0B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0b); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xD7FE; JUMP; // sstep
case 0xD7FE:
                                                     mon("         BEQ   LD808                   ; D7FE: 27 08         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd808; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD800; JUMP; // sstep
case 0xD800:
                                                     mon("         DEC   <$0B                    ; D800: 0A 0B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0b); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0x0b, res); 
    clockticks = clockticks + 2; 
    PC = 0xD802; JUMP; // sstep
case 0xD802:
                                                     mon("         LDA   #$00                    ; D802: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD804; JUMP; // sstep
case 0xD804:
                                                     mon("         STA   ,X                      ; D804: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xD806; JUMP; // sstep
case 0xD806:
                                                     mon("         STA   $03,X                   ; D806: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xD808; JUMP; // sstep
case 0xD808:
                                                     mon("LD808    LDA   $03,X                   ; D808: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xD80A; JUMP; // sstep
case 0xD80A:
                                                     mon("         BEQ   LD860                   ; D80A: 27 54         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd860; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD80C; JUMP; // sstep
case 0xD80C:
                                                     mon("         DEC   $03,X                   ; D80C: 6A 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem((UINT16)(X + 0x0003), res); 
    clockticks = clockticks + 2; 
    PC = 0xD80E; JUMP; // sstep
case 0xD80E:
                                                     mon("         BEQ   LD82F                   ; D80E: 27 1F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd82f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD810; JUMP; // sstep
case 0xD810:
                                                     mon("         BRA   LD860                   ; D810: 20 4E         \n");
    PC = 0xd860; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xD812:
                                                     mon("LD812    CMPA  #$1B                    ; D812: 81 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1b; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD814; JUMP; // sstep
case 0xD814:
                                                     mon("         BCC   LD81E                   ; D814: 24 08         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd81e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD816; JUMP; // sstep
case 0xD816:
                                                     mon("         LDA   ,X                      ; D816: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD818; JUMP; // sstep
case 0xD818:
                                                     mon("         ADDA  #$20                    ; D818: 8B 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x20; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xD81A; JUMP; // sstep
case 0xD81A:
                                                     mon("         BCC   LD7EF                   ; D81A: 24 D3         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd7ef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD81C; JUMP; // sstep
case 0xD81C:
                                                     mon("         BNE   LD822                   ; D81C: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd822; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD81E; JUMP; // sstep
case 0xD81E:
                                                     mon("LD81E    LDA   #$1F                    ; D81E: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xD820; JUMP; // sstep
case 0xD820:
                                                     mon("         BRA   LD7EF                   ; D820: 20 CD         \n");
    PC = 0xd7ef; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xD822:
                                                     mon("LD822    LDA   #$1F                    ; D822: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD824; JUMP; // sstep
case 0xD824:
                                                     mon("         STA   ,X                      ; D824: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xD826; JUMP; // sstep
case 0xD826:
                                                     mon("         LDB   $03,X                   ; D826: E6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD828; JUMP; // sstep
case 0xD828:
                                                     mon("         LDA   #$78                    ; D828: 86 78         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x78; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD82A; JUMP; // sstep
case 0xD82A:
                                                     mon("         STA   $03,X                   ; D82A: A7 03         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0003); 
    wr_mem(ea, val); 
    PC = 0xD82C; JUMP; // sstep
case 0xD82C:
                                                     mon("         TSTB                          ; D82C: 5D            \n");
    val = (UINT8)B; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xD82D; JUMP; // sstep
case 0xD82D:
                                                     mon("         BEQ   LD860                   ; D82D: 27 31         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd860; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD82F; JUMP; // sstep
case 0xD82F:
                                                     mon("LD82F    CLRA                          ; D82F: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xD830; JUMP; // sstep
case 0xD830:
                                                     mon("         CMPX  #$480D                  ; D830: 8C 48 0D      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x480d; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD833; JUMP; // sstep
case 0xD833:
                                                     mon("         BCS   LD853                   ; D833: 25 1E         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd853; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD835; JUMP; // sstep
case 0xD835:
                                                     mon("         BEQ   LD84B                   ; D835: 27 14         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd84b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD837; JUMP; // sstep
case 0xD837:
                                                     mon("         LDA   <$09                    ; D837: 96 09         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x09); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD839; JUMP; // sstep
case 0xD839:
                                                     mon("         ANDA  #$0C                    ; D839: 84 0C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0c; 
    A = res; 
/**/Z = res; 
/**/N = res; 
    V = 0; 
    PC = 0xD83B; JUMP; // sstep
case 0xD83B:
                                                     mon("         LSRA                          ; D83B: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD83C; JUMP; // sstep
case 0xD83C:
                                                     mon("         LSRA                          ; D83C: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD83D; JUMP; // sstep
case 0xD83D:
                                                     mon("         BEQ   LD853                   ; D83D: 27 14         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd853; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD83F; JUMP; // sstep
case 0xD83F:
                                                     mon("         ADDA  #$02                    ; D83F: 8B 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    // ---------------------------------------------------------------------------
    PC = 0xD841; JUMP; // sstep
case 0xD841:
                                                     mon("         BRA   LD853                   ; D841: 20 10         \n");
    PC = 0xd853; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xD84B:
                                                     mon("LD84B    LDA   <$09                    ; D84B: 96 09         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x09); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD84D; JUMP; // sstep
case 0xD84D:
                                                     mon("         ANDA  #$10                    ; D84D: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD84F; JUMP; // sstep
case 0xD84F:
                                                     mon("         BEQ   LD853                   ; D84F: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd853; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD851; JUMP; // sstep
case 0xD851:
                                                     mon("         LDA   #$01                    ; D851: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD853; JUMP; // sstep
case 0xD853:
                                                     mon("LD853    INCA                          ; D853: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xD854; JUMP; // sstep
case 0xD854:
                                                     mon("         TFR   A,B                     ; D854: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xD856; JUMP; // sstep
case 0xD856:
                                                     mon("         ADDB  <$13                    ; D856: DB 13         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(DP|0x13); 
    res = val + (UINT8)arg; 
/**/C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xD858; JUMP; // sstep
case 0xD858:
                                                     mon("         STB   <$13                    ; D858: D7 13         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x13; 
    wr_mem(ea, val); 
    PC = 0xD85A; JUMP; // sstep
case 0xD85A:
                                                     mon("         ADDA  <$12                    ; D85A: 9B 12         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x12); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xD85C; JUMP; // sstep
case 0xD85C:
                                                     mon("         STA   <$12                    ; D85C: 97 12         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x12; 
    wr_mem(ea, val); 
    PC = 0xD85E; JUMP; // sstep
case 0xD85E:
                                                     mon("         INC   $09,X                   ; D85E: 6C 09         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0009)); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem((UINT16)(X + 0x0009), res); 
    clockticks = clockticks + 2; 
    PC = 0xD860; JUMP; // sstep
case 0xD860:
                                                     mon("LD860    LEAX  -1,X                    ; D860: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
/**/Z = X; 
    PC = 0xD862; JUMP; // sstep
case 0xD862:
                                                     mon("         CMPX  #$480C                  ; D862: 8C 48 0C      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x480c; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD865; JUMP; // sstep
case 0xD865:
                                                     mon("         LBGE  LD7CE                   ; D865: 10 2C FF 65   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)(N^V) >= 0) {
    clockticks = clockticks + 1; 
    PC = 0xd7ce; 
    JUMP;
    }
    PC = 0xD869; JUMP; // sstep
case 0xD869:
                                                     mon("         LDA   <$09                    ; D869: 96 09         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x09); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD86B; JUMP; // sstep
case 0xD86B:
                                                     mon("         LSRA                          ; D86B: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD86C; JUMP; // sstep
case 0xD86C:
                                                     mon("         LSRA                          ; D86C: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD86D; JUMP; // sstep
case 0xD86D:
                                                     mon("         LSRA                          ; D86D: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD86E; JUMP; // sstep
case 0xD86E:
                                                     mon("         LSRA                          ; D86E: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD86F; JUMP; // sstep
case 0xD86F:
                                                     mon("         LSRA                          ; D86F: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD870; JUMP; // sstep
case 0xD870:
                                                     mon("         LDB   <$13                    ; D870: D6 13         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x13); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD872; JUMP; // sstep
case 0xD872:
                                                     mon("         ASLB                          ; D872: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xD873; JUMP; // sstep
case 0xD873:
                                                     mon("         LDX   #byte_D843              ; D873: 8E D8 43      \n");
    clockticks = clockticks + 3; 
    X = 0xd843; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD876; JUMP; // sstep
case 0xD876:
                                                     mon("         SUBB  A,X                     ; D876: E0 86         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem((UINT16)(X + (SINT8)A)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xD878; JUMP; // sstep
case 0xD878:
                                                     mon("         BCS   LD88B                   ; D878: 25 11         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd88b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD87A; JUMP; // sstep
case 0xD87A:
                                                     mon("         ASL   <$13                    ; D87A: 08 13         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x13); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(DP|0x13, res); 
    clockticks = clockticks + 2; 
    PC = 0xD87C; JUMP; // sstep
case 0xD87C:
                                                     mon("         RORB                          ; D87C: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xD87D; JUMP; // sstep
case 0xD87D:
                                                     mon("         CMPA  #$03                    ; D87D: 81 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD87F; JUMP; // sstep
case 0xD87F:
                                                     mon("         BEQ   LD885                   ; D87F: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd885; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD881; JUMP; // sstep
case 0xD881:
                                                     mon("         ADDB  #$80                    ; D881: CB 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x80; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xD883; JUMP; // sstep
case 0xD883:
                                                     mon("         BCC   LD889                   ; D883: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd889; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD885; JUMP; // sstep
case 0xD885:
                                                     mon("LD885    INC   <$12                    ; D885: 0C 12         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x12); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x12, res); 
    clockticks = clockticks + 2; 
    PC = 0xD887; JUMP; // sstep
case 0xD887:
                                                     mon("         INC   <$12                    ; D887: 0C 12         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x12); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x12, res); 
    clockticks = clockticks + 2; 
    PC = 0xD889; JUMP; // sstep
case 0xD889:
                                                     mon("LD889    STB   <$13                    ; D889: D7 13         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x13; 
    wr_mem(ea, val); 
    PC = 0xD88B; JUMP; // sstep
case 0xD88B:
                                                     mon("LD88B    LDA   <$09                    ; D88B: 96 09         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x09); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD88D; JUMP; // sstep
case 0xD88D:
                                                     mon("         ANDA  #$03                    ; D88D: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD88F; JUMP; // sstep
case 0xD88F:
                                                     mon("         BEQ   LD8AC                   ; D88F: 27 1B         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd8ac; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD891; JUMP; // sstep
case 0xD891:
                                                     mon("         TFR   A,B                     ; D891: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xD893; JUMP; // sstep
case 0xD893:
                                                     mon("         NEGA                          ; D893: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD894; JUMP; // sstep
case 0xD894:
                                                     mon("         ASRA                          ; D894: 47            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xD895; JUMP; // sstep
case 0xD895:
                                                     mon("         ADDA  <$12                    ; D895: 9B 12         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x12); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xD897; JUMP; // sstep
case 0xD897:
                                                     mon("         BPL   LD8A4                   ; D897: 2A 0B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xd8a4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD899; JUMP; // sstep
case 0xD899:
                                                     mon("         TST   <$13                    ; D899: 0D 13         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x13); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xD89B; JUMP; // sstep
case 0xD89B:
                                                     mon("         BPL   LD8AE                   ; D89B: 2A 11         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xd8ae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD89D; JUMP; // sstep
case 0xD89D:
                                                     mon("         INCA                          ; D89D: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xD89E; JUMP; // sstep
case 0xD89E:
                                                     mon("         BMI   LD8AE                   ; D89E: 2B 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xd8ae; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8A0; JUMP; // sstep
case 0xD8A0:
                                                     mon("         ASL   <$13                    ; D8A0: 08 13         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x13); 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(DP|0x13, res); 
    clockticks = clockticks + 2; 
    PC = 0xD8A2; JUMP; // sstep
case 0xD8A2:
                                                     mon("         LSR   <$13                    ; D8A2: 04 13         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x13); 
/**/C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x13, val); 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xD8A4; JUMP; // sstep
case 0xD8A4:
                                                     mon("LD8A4    CMPB  #$01                    ; D8A4: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD8A6; JUMP; // sstep
case 0xD8A6:
                                                     mon("         BNE   LD8AA                   ; D8A6: 26 02         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd8aa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8A8; JUMP; // sstep
case 0xD8A8:
                                                     mon("         INC   <$14                    ; D8A8: 0C 14         \n"); // Credits
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x14); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x14, res); 
    clockticks = clockticks + 2; 
    PC = 0xD8AA; JUMP; // sstep
case 0xD8AA:
                                                     mon("LD8AA    INC   <$14                    ; D8AA: 0C 14         \n"); // Credits
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x14); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x14, res); 
    clockticks = clockticks + 2; 
    PC = 0xD8AC; JUMP; // sstep
case 0xD8AC:
                                                     mon("LD8AC    STA   <$12                    ; D8AC: 97 12         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x12; 
    wr_mem(ea, val); 
    PC = 0xD8AE; JUMP; // sstep
case 0xD8AE:
                                                     mon("LD8AE    LDB   <$0A                    ; D8AE: D6 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD8B0; JUMP; // sstep
case 0xD8B0:
                                                     mon("         ANDB  #$0F                    ; D8B0: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xD8B2; JUMP; // sstep
case 0xD8B2:
                                                     mon("         BNE   locret_D8DE             ; D8B2: 26 2A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd8de; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8B4; JUMP; // sstep
case 0xD8B4:
                                                     mon("         LDX   #$4817                  ; D8B4: 8E 48 17      \n");
    clockticks = clockticks + 3; 
    X = 0x4817; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD8B7; JUMP; // sstep
case 0xD8B7:
                                                     mon("LD8B7    LDA   ,X                      ; D8B7: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xD8B9; JUMP; // sstep
case 0xD8B9:
                                                     mon("         BPL   LD8C0                   ; D8B9: 2A 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xd8c0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8BB; JUMP; // sstep
case 0xD8BB:
                                                     mon("         ANDA  #$7F                    ; D8BB: 84 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x7f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD8BD; JUMP; // sstep
case 0xD8BD:
                                                     mon("         INCB                          ; D8BD: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xD8BE; JUMP; // sstep
case 0xD8BE:
                                                     mon("         STA   ,X                      ; D8BE: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xD8C0; JUMP; // sstep
case 0xD8C0:
                                                     mon("LD8C0    LEAX  -1,X                    ; D8C0: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
/**/Z = X; 
    PC = 0xD8C2; JUMP; // sstep
case 0xD8C2:
                                                     mon("         CMPX  #$4815                  ; D8C2: 8C 48 15      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4815; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD8C5; JUMP; // sstep
case 0xD8C5:
                                                     mon("         BGE   LD8B7                   ; D8C5: 2C F0         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xd8b7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8C7; JUMP; // sstep
case 0xD8C7:
                                                     mon("         TSTB                          ; D8C7: 5D            \n");
    val = (UINT8)B; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xD8C8; JUMP; // sstep
case 0xD8C8:
                                                     mon("         BNE   locret_D8DE             ; D8C8: 26 14         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd8de; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8CA; JUMP; // sstep
case 0xD8CA:
                                                     mon("         LDX   #$4817                  ; D8CA: 8E 48 17      \n");
    clockticks = clockticks + 3; 
    X = 0x4817; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD8CD; JUMP; // sstep
case 0xD8CD:
                                                     mon("LD8CD    LDA   ,X                      ; D8CD: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xD8CF; JUMP; // sstep
case 0xD8CF:
                                                     mon("         BEQ   LD8D7                   ; D8CF: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd8d7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8D1; JUMP; // sstep
case 0xD8D1:
                                                     mon("         ADDA  #$7F                    ; D8D1: 8B 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x7f; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xD8D3; JUMP; // sstep
case 0xD8D3:
                                                     mon("         STA   ,X                      ; D8D3: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xD8D5; JUMP; // sstep
case 0xD8D5:
                                                     mon("         BRA   locret_D8DE             ; D8D5: 20 07         \n");
    PC = 0xd8de; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xD8D7:
                                                     mon("LD8D7    LEAX  -1,X                    ; D8D7: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
/**/Z = X; 
    PC = 0xD8D9; JUMP; // sstep
case 0xD8D9:
                                                     mon("         CMPX  #$4815                  ; D8D9: 8C 48 15      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4815; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD8DC; JUMP; // sstep
case 0xD8DC:
                                                     mon("         BGE   LD8CD                   ; D8DC: 2C EF         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xd8cd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_D776
    PC = 0xD8DE; JUMP; // sstep
case 0xD8DE:
                                                     mon("locret_D8DE RTS                           ; D8DE: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Called from select screen, attract screen 1 + 3 when writing text
  case 0xD8DF:
                                                     mon("LD8DF    LDX   #$4A52                  ; D8DF: 8E 4A 52      \n");
    clockticks = clockticks + 3; 
    X = 0x4a52; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD8E2; JUMP; // sstep
case 0xD8E2:
                                                     mon("         CPX   $4AD9                   ; D8E2: BC 4A D9      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD8E5; JUMP; // sstep
case 0xD8E5:
                                                     mon("         BCC   LD8F1                   ; D8E5: 24 0A         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd8f1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8E7; JUMP; // sstep
case 0xD8E7:
                                                     mon("LD8E7    CMPA  ,X+                     ; D8E7: A1 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)A; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    X = X + 1; 
    PC = 0xD8E9; JUMP; // sstep
case 0xD8E9:
                                                     mon("         BNE   LD8EC                   ; D8E9: 26 01         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd8ec; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8EB; JUMP; // sstep
case 0xD8EB:
                                                     mon("         RTS                           ; D8EB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xD8EC:
                                                     mon("LD8EC    CPX   $4AD9                   ; D8EC: BC 4A D9      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD8EF; JUMP; // sstep
case 0xD8EF:
                                                     mon("         BCS   LD8E7                   ; D8EF: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd8e7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8F1; JUMP; // sstep
case 0xD8F1:
                                                     mon("LD8F1    STA   ,X+                     ; D8F1: A7 80         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0xD8F3; JUMP; // sstep
case 0xD8F3:
                                                     mon("         STX   $4AD9                   ; D8F3: BF 4A D9      \n");
    clockticks = clockticks + 5; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x4ad9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4ada, (UINT8)val); 
    // End of function sub_D8DF
    PC = 0xD8F6; JUMP; // sstep
case 0xD8F6:
                                                     mon("         RTS                           ; D8F6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Doesnt seem to be used anywhere
  case 0xD8F7:
                                                     mon("LD8F7    LDX   #$4A52                  ; D8F7: 8E 4A 52      \n");
    clockticks = clockticks + 3; 
    X = 0x4a52; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD8FA; JUMP; // sstep
case 0xD8FA:
                                                     mon("LD8FA    CMPA  ,X                      ; D8FA: A1 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD8FC; JUMP; // sstep
case 0xD8FC:
                                                     mon("         BNE   LD912                   ; D8FC: 26 14         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd912; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD8FE; JUMP; // sstep
case 0xD8FE:
                                                     mon("         LDU   $4AD9                   ; D8FE: FE 4A D9      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xD901; JUMP; // sstep
case 0xD901:
                                                     mon("         CMPU  #$4A52                  ; D901: 11 83 4A 52   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x4a52; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD905; JUMP; // sstep
case 0xD905:
                                                     mon("         BLS   LD912                   ; D905: 23 0B         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xd912; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD907; JUMP; // sstep
case 0xD907:
                                                     mon("         LEAU  -1,U                    ; D907: 33 5F         \n");
    clockticks = clockticks + 5; 
    U = (U + 0xffff); 
    PC = 0xD909; JUMP; // sstep
case 0xD909:
                                                     mon("         LDA   ,U                      ; D909: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD90B; JUMP; // sstep
case 0xD90B:
                                                     mon("         STA   ,X                      ; D90B: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xD90D; JUMP; // sstep
case 0xD90D:
                                                     mon("         STU   $4AD9                   ; D90D: FF 4A D9      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4ad9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4ada, (UINT8)val); 
    PC = 0xD910; JUMP; // sstep
case 0xD910:
                                                     mon("         LEAX  ,U                      ; D910: 30 C4         \n");
    clockticks = clockticks + 4; 
    X = U; 
/**/Z = X; 
    PC = 0xD912; JUMP; // sstep
case 0xD912:
                                                     mon("LD912    LEAX  $01,X                   ; D912: 30 01         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0001); 
/**/Z = X; 
    PC = 0xD914; JUMP; // sstep
case 0xD914:
                                                     mon("         CPX   $4AD9                   ; D914: BC 4A D9      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD917; JUMP; // sstep
case 0xD917:
                                                     mon("         BCS   LD8FA                   ; D917: 25 E1         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd8fa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_D8F7
    PC = 0xD919; JUMP; // sstep
case 0xD919:
                                                     mon("         RTS                           ; D919: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xD91A:
                                                     mon("LD91A    LDX   #$4A52                  ; D91A: 8E 4A 52      \n");
    clockticks = clockticks + 3; 
    X = 0x4a52; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD91D; JUMP; // sstep
case 0xD91D:
                                                     mon("         CLR   ,X                      ; D91D: 6F 84         \n");
    clockticks = clockticks + 4; 
    wr_mem(X, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xD91F; JUMP; // sstep
case 0xD91F:
                                                     mon("         STX   $4AD9                   ; D91F: BF 4A D9      \n");
    clockticks = clockticks + 5; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x4ad9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4ada, (UINT8)val); 
    // End of function sub_D91A
    PC = 0xD922; JUMP; // sstep
case 0xD922:
                                                     mon("         RTS                           ; D922: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Called from attract screen 1
  case 0xD923:
                                                     mon("LD923    LDU   #$4A52                  ; D923: CE 4A 52      \n");
    clockticks = clockticks + 3; 
    U = 0x4a52; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xD926; JUMP; // sstep
case 0xD926:
                                                     mon("         CMPU  $4AD9                   ; D926: 11 B3 4A D9   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD92A; JUMP; // sstep
case 0xD92A:
                                                     mon("         BCC   locret_D941             ; D92A: 24 15         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd941; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD92C; JUMP; // sstep
case 0xD92C:
                                                     mon("LD92C    LDB   ,U+                     ; D92C: E6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xD92E; JUMP; // sstep
case 0xD92E:
                                                     mon("         CMPB  #$D6                    ; D92E: C1 D6         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xd6; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD930; JUMP; // sstep
case 0xD930:
                                                     mon("         BCC   LD93B                   ; D930: 24 09         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd93b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD932; JUMP; // sstep
case 0xD932:
                                                     mon("         STB   $48AE                   ; D932: F7 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x48ae, val); 
    PC = 0xD935; JUMP; // sstep
case 0xD935:
                                                     mon("         JSR   LE7DD                   ; D935: BD E7 DD      \n"); // Insert text colour vector instruction
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd9); 
    clockticks = clockticks + 1; 
    PC = 0xe7dd; 
    JUMP;
  case 0xD938:
                                                     mon("LD938    JSR   LE7FC                   ; D938: BD E7 FC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd9); 
    clockticks = clockticks + 1; 
    PC = 0xe7fc; 
    JUMP;
  case 0xD93B:
                                                     mon("LD93B    CMPU  $4AD9                   ; D93B: 11 B3 4A D9   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD93F; JUMP; // sstep
case 0xD93F:
                                                     mon("         BCS   LD92C                   ; D93F: 25 EB         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd92c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_D923
    PC = 0xD941; JUMP; // sstep
case 0xD941:
                                                     mon("locret_D941 RTS                           ; D941: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Called from Attract screen 3 + 4
  case 0xD942:
                                                     mon("LD942    LDU   #$4A52                  ; D942: CE 4A 52      \n");
    clockticks = clockticks + 3; 
    U = 0x4a52; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xD945; JUMP; // sstep
case 0xD945:
                                                     mon("         CMPU  $4AD9                   ; D945: 11 B3 4A D9   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD949; JUMP; // sstep
case 0xD949:
                                                     mon("         BCC   locret_D95D             ; D949: 24 12         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd95d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD94B; JUMP; // sstep
case 0xD94B:
                                                     mon("LD94B    LDB   ,U+                     ; D94B: E6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    U = U + 1; 
    PC = 0xD94D; JUMP; // sstep
case 0xD94D:
                                                     mon("         CMPB  #$D6                    ; D94D: C1 D6         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xd6; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD94F; JUMP; // sstep
case 0xD94F:
                                                     mon("         BCC   LD957                   ; D94F: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd957; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD951; JUMP; // sstep
case 0xD951:
                                                     mon("         STB   $48AE                   ; D951: F7 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x48ae, val); 
    PC = 0xD954; JUMP; // sstep
case 0xD954:
                                                     mon("         JSR   LE7FC                   ; D954: BD E7 FC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x57); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd9); 
    clockticks = clockticks + 1; 
    PC = 0xe7fc; 
    JUMP;
  case 0xD957:
                                                     mon("LD957    CMPU  $4AD9                   ; D957: 11 B3 4A D9   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ad9)<<8; 
    ea = ea | rd_mem(0x4ada); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD95B; JUMP; // sstep
case 0xD95B:
                                                     mon("         BCS   LD94B                   ; D95B: 25 EE         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd94b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_D942
    PC = 0xD95D; JUMP; // sstep
case 0xD95D:
                                                     mon("locret_D95D RTS                           ; D95D: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attract screen 2 text position control
  case 0xD95E:
                                                     mon("LD95E    LDU   $4ADD                   ; D95E: FE 4A DD      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xD961; JUMP; // sstep
case 0xD961:
                                                     mon("         STA   ,U+                     ; D961: A7 C0         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, val); 
    U = U + 1; 
    PC = 0xD963; JUMP; // sstep
case 0xD963:
                                                     mon("         LDD   #$00                    ; D963: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD966; JUMP; // sstep
case 0xD966:
                                                     mon("         STD   ,U++                    ; D966: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD968; JUMP; // sstep
case 0xD968:
                                                     mon("         LDD   #$0100                  ; D968: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD96B; JUMP; // sstep
case 0xD96B:
                                                     mon("         STD   ,U++                    ; D96B: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xD96D; JUMP; // sstep
case 0xD96D:
                                                     mon("         STU   $4ADD                   ; D96D: FF 4A DD      \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x4add, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4ade, (UINT8)val); 
    // End of function sub_D95E
    PC = 0xD970; JUMP; // sstep
case 0xD970:
                                                     mon("         RTS                           ; D970: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xD971:
                                                     mon("LD971    LDU   #$4A66                  ; D971: CE 4A 66      \n");
    clockticks = clockticks + 3; 
    U = 0x4a66; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xD974; JUMP; // sstep
case 0xD974:
                                                     mon("LD974    CMPA  ,U                      ; D974: A1 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(U); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xD976; JUMP; // sstep
case 0xD976:
                                                     mon("         BNE   LD97C                   ; D976: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xd97c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD978; JUMP; // sstep
case 0xD978:
                                                     mon("         LDA   #$00                    ; D978: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD97A; JUMP; // sstep
case 0xD97A:
                                                     mon("         STD   ,U                      ; D97A: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xD97C; JUMP; // sstep
case 0xD97C:
                                                     mon("LD97C    LEAU  $05,U                   ; D97C: 33 45         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0005); 
    PC = 0xD97E; JUMP; // sstep
case 0xD97E:
                                                     mon("         CMPU  $4ADD                   ; D97E: 11 B3 4A DD   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD982; JUMP; // sstep
case 0xD982:
                                                     mon("         BCS   LD974                   ; D982: 25 F0         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd974; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_D971
    PC = 0xD984; JUMP; // sstep
case 0xD984:
                                                     mon("         RTS                           ; D984: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xD985:
                                                     mon("LD985    LDU   #$4A66                  ; D985: CE 4A 66      \n");
    clockticks = clockticks + 3; 
    U = 0x4a66; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xD988; JUMP; // sstep
case 0xD988:
                                                     mon("         CMPU  $4ADD                   ; D988: 11 B3 4A DD   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD98C; JUMP; // sstep
case 0xD98C:
                                                     mon("         BCC   locret_D9DB             ; D98C: 24 4D         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xd9db; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD98E; JUMP; // sstep
case 0xD98E:
                                                     mon("         LDD   #$7200                  ; D98E: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD991; JUMP; // sstep
case 0xD991:
                                                     mon("         STD   ,Y++                    ; D991: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD993; JUMP; // sstep
case 0xD993:
                                                     mon("LD993    LDA   ,U+                     ; D993: A6 C0         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(U); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    U = U + 1; 
    PC = 0xD995; JUMP; // sstep
case 0xD995:
                                                     mon("         BEQ   LD9D3                   ; D995: 27 3C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xd9d3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xD997; JUMP; // sstep
case 0xD997:
                                                     mon("         STA   $48AE                   ; D997: B7 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x48ae, val); 
    PC = 0xD99A; JUMP; // sstep
case 0xD99A:
                                                     mon("         LDD   #$0198                  ; D99A: CC 01 98      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD99D; JUMP; // sstep
case 0xD99D:
                                                     mon("         STD   ,Y++                    ; D99D: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD99F; JUMP; // sstep
case 0xD99F:
                                                     mon("         LDD   #$00                    ; D99F: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9A2; JUMP; // sstep
case 0xD9A2:
                                                     mon("         STD   ,Y++                    ; D9A2: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9A4; JUMP; // sstep
case 0xD9A4:
                                                     mon("         LDB   ,U                      ; D9A4: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD9A6; JUMP; // sstep
case 0xD9A6:
                                                     mon("         LDA   #$71                    ; D9A6: 86 71         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x71; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD9A8; JUMP; // sstep
case 0xD9A8:
                                                     mon("         STD   ,Y++                    ; D9A8: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9AA; JUMP; // sstep
case 0xD9AA:
                                                     mon("         COMB                          ; D9AA: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xD9AB; JUMP; // sstep
case 0xD9AB:
                                                     mon("         ADDB  #$10                    ; D9AB: CB 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x10; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xD9AD; JUMP; // sstep
case 0xD9AD:
                                                     mon("         LDA   #$62                    ; D9AD: 86 62         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x62; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD9AF; JUMP; // sstep
case 0xD9AF:
                                                     mon("         STD   ,Y++                    ; D9AF: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9B1; JUMP; // sstep
case 0xD9B1:
                                                     mon("         LDX   #off_E99E               ; D9B1: 8E E9 9E      \n");
    clockticks = clockticks + 3; 
    X = 0xe99e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xD9B4; JUMP; // sstep
case 0xD9B4:
                                                     mon("         LDB   $48AE                   ; D9B4: F6 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48ae); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD9B7; JUMP; // sstep
case 0xD9B7:
                                                     mon("         ABX                           ; D9B7: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xD9B8; JUMP; // sstep
case 0xD9B8:
                                                     mon("         ABX                           ; D9B8: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xD9B9; JUMP; // sstep
case 0xD9B9:
                                                     mon("         LDD   #$1DD0                  ; D9B9: CC 1D D0      \n");
    clockticks = clockticks + 3; 
    A = 0x1d; 
    B = 0xd0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9BC; JUMP; // sstep
case 0xD9BC:
                                                     mon("         STD   ,Y++                    ; D9BC: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9BE; JUMP; // sstep
case 0xD9BE:
                                                     mon("         LDD   ,X                      ; D9BE: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9C0; JUMP; // sstep
case 0xD9C0:
                                                     mon("         ANDA  #$1F                    ; D9C0: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD9C2; JUMP; // sstep
case 0xD9C2:
                                                     mon("         ORA   #$00                    ; D9C2: 8A 00         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x00; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xD9C4; JUMP; // sstep
case 0xD9C4:
                                                     mon("         STD   ,Y++                    ; D9C4: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9C6; JUMP; // sstep
case 0xD9C6:
                                                     mon("         JSR   LE821                   ; D9C6: BD E8 21      \n"); // Text handling
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xd9); 
    clockticks = clockticks + 1; 
    PC = 0xe821; 
    JUMP;
  case 0xD9C9:
                                                     mon("LD9C9    LDD   #$7200                  ; D9C9: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9CC; JUMP; // sstep
case 0xD9CC:
                                                     mon("         STD   ,Y++                    ; D9CC: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9CE; JUMP; // sstep
case 0xD9CE:
                                                     mon("         LDD   #$8040                  ; D9CE: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9D1; JUMP; // sstep
case 0xD9D1:
                                                     mon("         STD   ,Y++                    ; D9D1: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xD9D3; JUMP; // sstep
case 0xD9D3:
                                                     mon("LD9D3    LEAU  $04,U                   ; D9D3: 33 44         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0004); 
    PC = 0xD9D5; JUMP; // sstep
case 0xD9D5:
                                                     mon("         CMPU  $4ADD                   ; D9D5: 11 B3 4A DD   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xD9D9; JUMP; // sstep
case 0xD9D9:
                                                     mon("         BCS   LD993                   ; D9D9: 25 B8         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xd993; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_D985
    PC = 0xD9DB; JUMP; // sstep
case 0xD9DB:
                                                     mon("locret_D9DB RTS                           ; D9DB: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Initialise before game start
  case 0xD9DC:
                                                     mon("LD9DC    LDD   #$00                    ; D9DC: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9DF; JUMP; // sstep
case 0xD9DF:
                                                     mon("         STD   $4AE4                   ; D9DF: FD 4A E4      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae4, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae5, B); 
    PC = 0xD9E2; JUMP; // sstep
case 0xD9E2:
                                                     mon("         LDD   #$6018                  ; D9E2: CC 60 18      \n");
    clockticks = clockticks + 3; 
    A = 0x60; 
    B = 0x18; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9E5; JUMP; // sstep
case 0xD9E5:
                                                     mon("         STD   $4AE6                   ; D9E5: FD 4A E6      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae6, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae7, B); 
    PC = 0xD9E8; JUMP; // sstep
case 0xD9E8:
                                                     mon("         LDD   #$4A66                  ; D9E8: CC 4A 66      \n");
    clockticks = clockticks + 3; 
    A = 0x4a; 
    B = 0x66; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9EB; JUMP; // sstep
case 0xD9EB:
                                                     mon("         STD   $4ADD                   ; D9EB: FD 4A DD      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4add, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ade, B); 
    PC = 0xD9EE; JUMP; // sstep
case 0xD9EE:
                                                     mon("         LDD   word_DB2F               ; D9EE: FC DB 2F      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0xdb2f); // Care needed with I/O space and word fetches
    B = rd_mem(0xdb30); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9F1; JUMP; // sstep
case 0xD9F1:
                                                     mon("         STD   $4AE2                   ; D9F1: FD 4A E2      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae2, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae3, B); 
    PC = 0xD9F4; JUMP; // sstep
case 0xD9F4:
                                                     mon("         LDA   #$51                    ; D9F4: 86 51         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x51; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xD9F6; JUMP; // sstep
case 0xD9F6:
                                                     mon("         STA   $4ADF                   ; D9F6: B7 4A DF      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4adf, val); 
    // End of function sub_D9DC
    PC = 0xD9F9; JUMP; // sstep
case 0xD9F9:
                                                     mon("         RTS                           ; D9F9: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attract screen 2 large Star Wars logo handling
  case 0xD9FA:
                                                     mon("LD9FA    LDD   $4AE4                   ; D9FA: FC 4A E4      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae4); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae5); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xD9FD; JUMP; // sstep
case 0xD9FD:
                                                     mon("         ADDD  #$01                    ; D9FD: C3 00 01      \n");
    clockticks = clockticks + 4; 
    val = 0x0001; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xDA00; JUMP; // sstep
case 0xDA00:
                                                     mon("         STD   $4AE4                   ; DA00: FD 4A E4      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae4, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae5, B); 
    PC = 0xDA03; JUMP; // sstep
case 0xDA03:
                                                     mon("         CMPD  #$F8                    ; DA03: 10 83 00 F8   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00f8; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDA07; JUMP; // sstep
case 0xDA07:
                                                     mon("         LBCC  LDA94                   ; DA07: 10 24 00 89   \n");
    clockticks = clockticks + 5; 
    if (!C) {
    clockticks = clockticks + 1; 
    PC = 0xda94; 
    JUMP;
    }
    PC = 0xDA0B; JUMP; // sstep
case 0xDA0B:
                                                     mon("         CMPD  #$40                    ; DA0B: 10 83 00 40   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0040; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDA0F; JUMP; // sstep
case 0xDA0F:
                                                     mon("         BCC   LDA1E                   ; DA0F: 24 0D         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xda1e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDA11; JUMP; // sstep
case 0xDA11:
                                                     mon("         LDD   $4AE6                   ; DA11: FC 4A E6      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae6); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae7); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA14; JUMP; // sstep
case 0xDA14:
                                                     mon("         ADDB  #$03                    ; DA14: CB 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xDA16; JUMP; // sstep
case 0xDA16:
                                                     mon("         STD   $4AE6                   ; DA16: FD 4A E6      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae6, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae7, B); 
    PC = 0xDA19; JUMP; // sstep
case 0xDA19:
                                                     mon("         LDD   #$40                    ; DA19: CC 00 40      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x40; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xDA1C; JUMP; // sstep
case 0xDA1C:
                                                     mon("         BRA   LDA2A                   ; DA1C: 20 0C         \n");
    PC = 0xda2a; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xDA1E:
                                                     mon("LDA1E    LDD   $4AE4                   ; DA1E: FC 4A E4      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae4); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae5); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA21; JUMP; // sstep
case 0xDA21:
                                                     mon("         COMB                          ; DA21: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xDA22; JUMP; // sstep
case 0xDA22:
                                                     mon("         ADDB  #$18                    ; DA22: CB 18         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x18; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xDA24; JUMP; // sstep
case 0xDA24:
                                                     mon("         STD   $4AE6                   ; DA24: FD 4A E6      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae6, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae7, B); 
    PC = 0xDA27; JUMP; // sstep
case 0xDA27:
                                                     mon("         LDD   $4AE4                   ; DA27: FC 4A E4      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae4); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae5); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA2A; JUMP; // sstep
case 0xDA2A:
                                                     mon("LDA2A    ORA   #$73                    ; DA2A: 8A 73         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x73; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xDA2C; JUMP; // sstep
case 0xDA2C:
                                                     mon("         STD   $4AE8                   ; DA2C: FD 4A E8      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ae8, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae9, B); 
    PC = 0xDA2F; JUMP; // sstep
case 0xDA2F:
                                                     mon("         LDD   $4AE6                   ; DA2F: FC 4A E6      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae6); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae7); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA32; JUMP; // sstep
case 0xDA32:
                                                     mon("         ORA   #$61                    ; DA32: 8A 61         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x61; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xDA34; JUMP; // sstep
case 0xDA34:
                                                     mon("         STD   ,Y++                    ; DA34: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xDA36; JUMP; // sstep
case 0xDA36:
                                                     mon("         LDD   #$0198                  ; DA36: CC 01 98      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA39; JUMP; // sstep
case 0xDA39:
                                                     mon("         STD   ,Y                      ; DA39: ED A4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA3B; JUMP; // sstep
case 0xDA3B:
                                                     mon("         STD   $08,Y                   ; DA3B: ED 28         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0008); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA3D; JUMP; // sstep
case 0xDA3D:
                                                     mon("         STD   $10,Y                   ; DA3D: ED A8 10      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x10); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA40; JUMP; // sstep
case 0xDA40:
                                                     mon("         STD   $18,Y                   ; DA40: ED A8 18      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x18); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA43; JUMP; // sstep
case 0xDA43:
                                                     mon("         STD   $20,Y                   ; DA43: ED A8 20      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x20); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA46; JUMP; // sstep
case 0xDA46:
                                                     mon("         STD   $28,Y                   ; DA46: ED A8 28      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x28); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA49; JUMP; // sstep
case 0xDA49:
                                                     mon("         LDD   #$00                    ; DA49: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA4C; JUMP; // sstep
case 0xDA4C:
                                                     mon("         STD   $02,Y                   ; DA4C: ED 22         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0002); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA4E; JUMP; // sstep
case 0xDA4E:
                                                     mon("         STD   $0A,Y                   ; DA4E: ED 2A         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x000a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA50; JUMP; // sstep
case 0xDA50:
                                                     mon("         STD   $12,Y                   ; DA50: ED A8 12      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x12); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA53; JUMP; // sstep
case 0xDA53:
                                                     mon("         STD   $1A,Y                   ; DA53: ED A8 1A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x1a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA56; JUMP; // sstep
case 0xDA56:
                                                     mon("         STD   $22,Y                   ; DA56: ED A8 22      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x22); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA59; JUMP; // sstep
case 0xDA59:
                                                     mon("         STD   $2A,Y                   ; DA59: ED A8 2A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x2a); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA5C; JUMP; // sstep
case 0xDA5C:
                                                     mon("         LDD   $4AE8                   ; DA5C: FC 4A E8      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae8); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae9); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA5F; JUMP; // sstep
case 0xDA5F:
                                                     mon("         STD   $04,Y                   ; DA5F: ED 24         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0004); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA61; JUMP; // sstep
case 0xDA61:
                                                     mon("         STD   $0C,Y                   ; DA61: ED 2C         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x000c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA63; JUMP; // sstep
case 0xDA63:
                                                     mon("         STD   $14,Y                   ; DA63: ED A8 14      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x14); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA66; JUMP; // sstep
case 0xDA66:
                                                     mon("         STD   $1C,Y                   ; DA66: ED A8 1C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x1c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA69; JUMP; // sstep
case 0xDA69:
                                                     mon("         STD   $24,Y                   ; DA69: ED A8 24      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x24); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA6C; JUMP; // sstep
case 0xDA6C:
                                                     mon("         STD   $2C,Y                   ; DA6C: ED A8 2C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x2c); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA6F; JUMP; // sstep
case 0xDA6F:
                                                     mon("         LDD   #$B400                  ; DA6F: CC B4 00      \n");
    clockticks = clockticks + 3; 
    A = 0xb4; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA72; JUMP; // sstep
case 0xDA72:
                                                     mon("         STD   $06,Y                   ; DA72: ED 26         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0006); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA74; JUMP; // sstep
case 0xDA74:
                                                     mon("         LDD   #$B434                  ; DA74: CC B4 34      \n");
    clockticks = clockticks + 3; 
    A = 0xb4; 
    B = 0x34; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA77; JUMP; // sstep
case 0xDA77:
                                                     mon("         STD   $0E,Y                   ; DA77: ED 2E         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x000e); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA79; JUMP; // sstep
case 0xDA79:
                                                     mon("         LDD   #$B458                  ; DA79: CC B4 58      \n");
    clockticks = clockticks + 3; 
    A = 0xb4; 
    B = 0x58; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA7C; JUMP; // sstep
case 0xDA7C:
                                                     mon("         STD   $16,Y                   ; DA7C: ED A8 16      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x16); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA7F; JUMP; // sstep
case 0xDA7F:
                                                     mon("         LDD   #$B488                  ; DA7F: CC B4 88      \n");
    clockticks = clockticks + 3; 
    A = 0xb4; 
    B = 0x88; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA82; JUMP; // sstep
case 0xDA82:
                                                     mon("         STD   $1E,Y                   ; DA82: ED A8 1E      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x1e); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA85; JUMP; // sstep
case 0xDA85:
                                                     mon("         LDD   #$B4AE                  ; DA85: CC B4 AE      \n");
    clockticks = clockticks + 3; 
    A = 0xb4; 
    B = 0xae; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA88; JUMP; // sstep
case 0xDA88:
                                                     mon("         STD   $26,Y                   ; DA88: ED A8 26      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x26); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA8B; JUMP; // sstep
case 0xDA8B:
                                                     mon("         LDD   #$B4D2                  ; DA8B: CC B4 D2      \n");
    clockticks = clockticks + 3; 
    A = 0xb4; 
    B = 0xd2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA8E; JUMP; // sstep
case 0xDA8E:
                                                     mon("         STD   $2E,Y                   ; DA8E: ED A8 2E      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(Y + (SINT8)0x2e); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDA91; JUMP; // sstep
case 0xDA91:
                                                     mon("         LEAY  $30,Y                   ; DA91: 31 A8 30      \n");
    clockticks = clockticks + 5; 
    Y = (Y + (SINT8)0x30); 
/**/Z = Y; 
    PC = 0xDA94; JUMP; // sstep
case 0xDA94:
                                                     mon("LDA94    LDX   #$4A66                  ; DA94: 8E 4A 66      \n");
    clockticks = clockticks + 3; 
    X = 0x4a66; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xDA97; JUMP; // sstep
case 0xDA97:
                                                     mon("         CPX   $4ADD                   ; DA97: BC 4A DD      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDA9A; JUMP; // sstep
case 0xDA9A:
                                                     mon("         BCC   LDAF5                   ; DA9A: 24 59         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xdaf5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDA9C; JUMP; // sstep
case 0xDA9C:
                                                     mon("LDA9C    LDD   $4AE4                   ; DA9C: FC 4A E4      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae4); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae5); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDA9F; JUMP; // sstep
case 0xDA9F:
                                                     mon("         CMPD  #$E0                    ; DA9F: 10 83 00 E0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00e0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDAA3; JUMP; // sstep
case 0xDAA3:
                                                     mon("         BCC   LDAB3                   ; DAA3: 24 0E         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xdab3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAA5; JUMP; // sstep
case 0xDAA5:
                                                     mon("         CMPD  #$40                    ; DAA5: 10 83 00 40   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0040; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDAA9; JUMP; // sstep
case 0xDAA9:
                                                     mon("         BCS   LDAB1                   ; DAA9: 25 06         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xdab1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAAB; JUMP; // sstep
case 0xDAAB:
                                                     mon("         LDD   $01,X                   ; DAAB: EC 01         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0001); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDAAD; JUMP; // sstep
case 0xDAAD:
                                                     mon("         ADDD  $03,X                   ; DAAD: E3 03         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0003))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0003))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xDAAF; JUMP; // sstep
case 0xDAAF:
                                                     mon("         STD   $01,X                   ; DAAF: ED 01         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDAB1; JUMP; // sstep
case 0xDAB1:
                                                     mon("LDAB1    BRA   LDAEE                   ; DAB1: 20 3B         \n");
    PC = 0xdaee; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xDAB3:
                                                     mon("LDAB3    CMPD  #$0160                  ; DAB3: 10 83 01 60   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0160; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDAB7; JUMP; // sstep
case 0xDAB7:
                                                     mon("         BCC   LDAC1                   ; DAB7: 24 08         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xdac1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAB9; JUMP; // sstep
case 0xDAB9:
                                                     mon("         LDD   #$0400                  ; DAB9: CC 04 00      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDABC; JUMP; // sstep
case 0xDABC:
                                                     mon("         STD   $4A69                   ; DABC: FD 4A 69      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4a69, A); // Care needed with I/O space and word fetches
    wr_mem(0x4a6a, B); 
    PC = 0xDABF; JUMP; // sstep
case 0xDABF:
                                                     mon("         BRA   LDAEE                   ; DABF: 20 2D         \n");
    PC = 0xdaee; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xDAC1:
                                                     mon("LDAC1    LDD   $01,X                   ; DAC1: EC 01         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0001); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDAC3; JUMP; // sstep
case 0xDAC3:
                                                     mon("         ADDD  $03,X                   ; DAC3: E3 03         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0003))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0003))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xDAC5; JUMP; // sstep
case 0xDAC5:
                                                     mon("         STD   $01,X                   ; DAC5: ED 01         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDAC7; JUMP; // sstep
case 0xDAC7:
                                                     mon("         CMPD  #$F000                  ; DAC7: 10 83 F0 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xf000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDACB; JUMP; // sstep
case 0xDACB:
                                                     mon("         BCS   LDAEE                   ; DACB: 25 21         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xdaee; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDACD; JUMP; // sstep
case 0xDACD:
                                                     mon("         LDA   ,X                      ; DACD: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xDACF; JUMP; // sstep
case 0xDACF:
                                                     mon("         INCA                          ; DACF: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xDAD0; JUMP; // sstep
case 0xDAD0:
                                                     mon("         LDU   #$4A66                  ; DAD0: CE 4A 66      \n");
    clockticks = clockticks + 3; 
    U = 0x4a66; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xDAD3; JUMP; // sstep
case 0xDAD3:
                                                     mon("LDAD3    CMPA  ,U                      ; DAD3: A1 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(U); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xDAD5; JUMP; // sstep
case 0xDAD5:
                                                     mon("         BNE   LDADF                   ; DAD5: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xdadf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAD7; JUMP; // sstep
case 0xDAD7:
                                                     mon("         LDD   #$0400                  ; DAD7: CC 04 00      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDADA; JUMP; // sstep
case 0xDADA:
                                                     mon("         STD   $03,U                   ; DADA: ED 43         \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = (UINT16)(U + 0x0003); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xDADC; JUMP; // sstep
case 0xDADC:
                                                     mon("         LDU   $4ADD                   ; DADC: FE 4A DD      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xDADF; JUMP; // sstep
case 0xDADF:
                                                     mon("LDADF    LEAU  $05,U                   ; DADF: 33 45         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0005); 
    PC = 0xDAE1; JUMP; // sstep
case 0xDAE1:
                                                     mon("         CMPU  $4ADD                   ; DAE1: 11 B3 4A DD   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    val = U; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDAE5; JUMP; // sstep
case 0xDAE5:
                                                     mon("         BCS   LDAD3                   ; DAE5: 25 EC         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xdad3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAE7; JUMP; // sstep
case 0xDAE7:
                                                     mon("         LDA   ,X                      ; DAE7: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xDAE9; JUMP; // sstep
case 0xDAE9:
                                                     mon("         JSR   LD971                   ; DAE9: BD D9 71      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xec); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xda); 
    clockticks = clockticks + 1; 
    PC = 0xd971; 
    JUMP;
  case 0xDAEC:
                                                     mon("LDAEC    LEAX  -5,X                    ; DAEC: 30 1B         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xfffb); 
/**/Z = X; 
    PC = 0xDAEE; JUMP; // sstep
case 0xDAEE:
                                                     mon("LDAEE    LEAX  $05,X                   ; DAEE: 30 05         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0005); 
/**/Z = X; 
    PC = 0xDAF0; JUMP; // sstep
case 0xDAF0:
                                                     mon("         CPX   $4ADD                   ; DAF0: BC 4A DD      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4add)<<8; 
    ea = ea | rd_mem(0x4ade); 
    val = X; 
    arg = ea; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDAF3; JUMP; // sstep
case 0xDAF3:
                                                     mon("         BCS   LDA9C                   ; DAF3: 25 A7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xda9c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAF5; JUMP; // sstep
case 0xDAF5:
                                                     mon("LDAF5    LDD   $4AE4                   ; DAF5: FC 4A E4      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4ae4); // Care needed with I/O space and word fetches
    B = rd_mem(0x4ae5); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDAF8; JUMP; // sstep
case 0xDAF8:
                                                     mon("         CMPD  #$0200                  ; DAF8: 10 83 02 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0200; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xDAFC; JUMP; // sstep
case 0xDAFC:
                                                     mon("         BCS   LDB03                   ; DAFC: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xdb03; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDAFE; JUMP; // sstep
case 0xDAFE:
                                                     mon("         LDA   #$07                    ; DAFE: 86 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xDB00; JUMP; // sstep
case 0xDB00:
                                                     mon("         STA   $4841                   ; DB00: B7 48 41      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4841, val); 
    PC = 0xDB03; JUMP; // sstep
case 0xDB03:
                                                     mon("LDB03    CMPD  $4AE2                   ; DB03: 10 B3 4A E2   \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4ae2)<<8; 
    ea = ea | rd_mem(0x4ae3); 
    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; 
    clockticks = clockticks + 1; 
    PC = 0xDB07; JUMP; // sstep
case 0xDB07:
                                                     mon("         BCS   locret_DB2E             ; DB07: 25 25         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xdb2e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDB09; JUMP; // sstep
case 0xDB09:
                                                     mon("         LDA   $4ADF                   ; DB09: B6 4A DF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4adf); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xDB0C; JUMP; // sstep
case 0xDB0C:
                                                     mon("         JSR   LD95E                   ; DB0C: BD D9 5E      \n"); // Attract screen 2 text position control
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xdb); 
    clockticks = clockticks + 1; 
    PC = 0xd95e; 
    JUMP;
  case 0xDB0F:
                                                     mon("LDB0F    LDA   $4ADF                   ; DB0F: B6 4A DF      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4adf); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xDB12; JUMP; // sstep
case 0xDB12:
                                                     mon("         INCA                          ; DB12: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xDB13; JUMP; // sstep
case 0xDB13:
                                                     mon("         CMPA  #$59                    ; DB13: 81 59         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x59; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xDB15; JUMP; // sstep
case 0xDB15:
                                                     mon("         BCS   LDB1F                   ; DB15: 25 08         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xdb1f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xDB17; JUMP; // sstep
case 0xDB17:
                                                     mon("         LDD   #$FFFF                  ; DB17: CC FF FF      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDB1A; JUMP; // sstep
case 0xDB1A:
                                                     mon("         STD   $4AE2                   ; DB1A: FD 4A E2      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4ae2, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae3, B); 
    PC = 0xDB1D; JUMP; // sstep
case 0xDB1D:
                                                     mon("         BRA   locret_DB2E             ; DB1D: 20 0F         \n");
    PC = 0xdb2e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xDB1F:
                                                     mon("LDB1F    STA   $4ADF                   ; DB1F: B7 4A DF      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4adf, val); 
    PC = 0xDB22; JUMP; // sstep
case 0xDB22:
                                                     mon("         LDX   #$DA8D                  ; DB22: 8E DA 8D      \n");
    clockticks = clockticks + 3; 
    X = 0xda8d; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xDB25; JUMP; // sstep
case 0xDB25:
                                                     mon("         TFR   A,B                     ; DB25: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xDB27; JUMP; // sstep
case 0xDB27:
                                                     mon("         ABX                           ; DB27: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xDB28; JUMP; // sstep
case 0xDB28:
                                                     mon("         ABX                           ; DB28: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xDB29; JUMP; // sstep
case 0xDB29:
                                                     mon("         LDD   ,X                      ; DB29: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xDB2B; JUMP; // sstep
case 0xDB2B:
                                                     mon("         STD   $4AE2                   ; DB2B: FD 4A E2      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4ae2, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ae3, B); 
    // End of function sub_D9FA
    // ---------------------------------------------------------------------------
    PC = 0xDB2E; JUMP; // sstep
case 0xDB2E:
                                                     mon("locret_DB2E RTS                           ; DB2E: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
                   // FCB   $80                     ; DB38:  ' ' 80 00          SUBA  #$00 ; 
                   // FCB   $90                     ; DB3A:  ' ' 90 00          SUBA  <$00 ; 
                   // FCB   $A0                     ; DB3C:  ' ' A0 00          SUBA  0,X ; 
                   // FCB   $20                     ; DB49:  ' ' 20 31          BRA   $DB7C ; 
                   // FCB   $31                     ; DB4A:  '1' 31 39          LEAY  -7,Y ; 
                   // FCB   $39                     ; DB4B:  '9' 39             RTS   ; 
                   // FCB   $38                     ; DB4C:  '8' 38             Invalid ; 
                   // FCB   $33                     ; DB4D:  '3' 33 20          LEAU  0,Y ; 
                   // FCB   $20                     ; DB4E:  ' ' 20 4C          BRA   $DB9C ; 
                   // FCB   $4C                     ; DB4F:  'L' 4C             INCA  ; 
                   // FCB   $55                     ; DB50:  'U' 55             Invalid ; 
                   // FCB   $43                     ; DB51:  'C' 43             COMA  ; 
                   // FCB   $41                     ; DB52:  'A' 41             Invalid ; 
                   // FCB   $53                     ; DB53:  'S' 53             COMB  ; 
                   // FCB   $46                     ; DB54:  'F' 46             RORA  ; 
                   // FCB   $49                     ; DB55:  'I' 49             ROLA  ; 
                   // FCB   $4C                     ; DB56:  'L' 4C             INCA  ; 
                   // FCB   $4D                     ; DB57:  'M' 4D             TSTA  ; 
                   // FCB   $20                     ; DB58:  ' ' 20 4C          BRA   $DBA6 ; 
                   // FCB   $4C                     ; DB59:  'L' 4C             INCA  ; 
                   // FCB   $54                     ; DB5A:  'T' 54             LSRB  ; 
                   // FCB   $44                     ; DB5B:  'D' 44             LSRA  ; 
                   // FCB   $2E                     ; DB5C:  '.' 2E 20          BGT   $DB7E ; 
                   // FCB   $20                     ; DB5D:  ' ' 20 41          BRA   $DBA0 ; 
                   // FCB   $41                     ; DB5E:  'A' 41             Invalid ; 
                   // FCB   $4E                     ; DB5F:  'N' 4E             Invalid ; 
                   // FCB   $44                     ; DB60:  'D' 44             LSRA  ; 
                   // FCB   $20                     ; DB61:  ' ' 20 41          BRA   $DBA4 ; 
                   // FCB   $41                     ; DB62:  'A' 41             Invalid ; 
                   // FCB   $54                     ; DB63:  'T' 54             LSRB  ; 
                   // FCB   $41                     ; DB64:  'A' 41             Invalid ; 
                   // FCB   $52                     ; DB65:  'R' 52             Invalid ; 
                   // FCB   $49                     ; DB66:  'I' 49             ROLA  ; 
                   // FCB   $2C                     ; DB67:  ',' 2C 49          BGE   $DBB2 ; 
                   // FCB   $49                     ; DB68:  'I' 49             ROLA  ; 
                   // FCB   $4E                     ; DB69:  'N' 4E             Invalid ; 
                   // FCB   $43                     ; DB6A:  'C' 43             COMA  ; 
                   // FCB   $AE                     ; DB6B:  ' ' AE 41          LDX   1,U ; 
                   // FCB   $41                     ; DB6C:  'A' 41             Invalid ; 
                   // FCB   $4C                     ; DB6D:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; DB6E:  'L' 4C             INCA  ; 
                   // FCB   $20                     ; DB6F:  ' ' 20 52          BRA   $DBC3 ; 
                   // FCB   $52                     ; DB70:  'R' 52             Invalid ; 
                   // FCB   $49                     ; DB71:  'I' 49             ROLA  ; 
                   // FCB   $47                     ; DB72:  'G' 47             ASRA  ; 
                   // FCB   $48                     ; DB73:  'H' 48             ASLA  ; 
                   // FCB   $54                     ; DB74:  'T' 54             LSRB  ; 
                   // FCB   $53                     ; DB75:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DB76:  ' ' 20 52          BRA   $DBCA ; 
                   // FCB   $52                     ; DB77:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DB78:  'E' 45             Invalid ; 
                   // FCB   $53                     ; DB79:  'S' 53             COMB  ; 
                   // FCB   $45                     ; DB7A:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DB7B:  'R' 52             Invalid ; 
                   // FCB   $56                     ; DB7C:  'V' 56             RORB  ; 
                   // FCB   $45                     ; DB7D:  'E' 45             Invalid ; 
                   // FCB   $44                     ; DB7E:  'D' 44             LSRA  ; 
                   // FCB   $AE                     ; DB7F:  ' ' AE 4C          LDX   12,U ; 
                   // FCB   $4C                     ; DB80:  'L' 4C             INCA  ; 
                   // FCB   $55                     ; DB81:  'U' 55             Invalid ; 
                   // FCB   $43                     ; DB82:  'C' 43             COMA  ; 
                   // FCB   $41                     ; DB83:  'A' 41             Invalid ; 
                   // FCB   $53                     ; DB84:  'S' 53             COMB  ; 
                   // FCB   $46                     ; DB85:  'F' 46             RORA  ; 
                   // FCB   $49                     ; DB86:  'I' 49             ROLA  ; 
                   // FCB   $4C                     ; DB87:  'L' 4C             INCA  ; 
                   // FCB   $4D                     ; DB88:  'M' 4D             TSTA  ; 
                   // FCB   $20                     ; DB89:  ' ' 20 54          BRA   $DBDF ; 
                   // FCB   $54                     ; DB8A:  'T' 54             LSRB  ; 
                   // FCB   $52                     ; DB8B:  'R' 52             Invalid ; 
                   // FCB   $41                     ; DB8C:  'A' 41             Invalid ; 
                   // FCB   $44                     ; DB8D:  'D' 44             LSRA  ; 
                   // FCB   $45                     ; DB8E:  'E' 45             Invalid ; 
                   // FCB   $4D                     ; DB8F:  'M' 4D             TSTA  ; 
                   // FCB   $41                     ; DB90:  'A' 41             Invalid ; 
                   // FCB   $52                     ; DB91:  'R' 52             Invalid ; 
                   // FCB   $4B                     ; DB92:  'K' 4B             Invalid ; 
                   // FCB   $53                     ; DB93:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DB94:  ' ' 20 55          BRA   $DBEB ; 
                   // FCB   $55                     ; DB95:  'U' 55             Invalid ; 
                   // FCB   $53                     ; DB96:  'S' 53             COMB  ; 
                   // FCB   $45                     ; DB97:  'E' 45             Invalid ; 
                   // FCB   $44                     ; DB98:  'D' 44             LSRA  ; 
                   // FCB   $20                     ; DB99:  ' ' 20 55          BRA   $DBF0 ; 
                   // FCB   $55                     ; DB9A:  'U' 55             Invalid ; 
                   // FCB   $4E                     ; DB9B:  'N' 4E             Invalid ; 
                   // FCB   $44                     ; DB9C:  'D' 44             LSRA  ; 
                   // FCB   $45                     ; DB9D:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DB9E:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DB9F:  ' ' 20 4C          BRA   $DBED ; 
                   // FCB   $4C                     ; DBA0:  'L' 4C             INCA  ; 
                   // FCB   $49                     ; DBA1:  'I' 49             ROLA  ; 
                   // FCB   $43                     ; DBA2:  'C' 43             COMA  ; 
                   // FCB   $45                     ; DBA3:  'E' 45             Invalid ; 
                   // FCB   $4E                     ; DBA4:  'N' 4E             Invalid ; 
                   // FCB   $53                     ; DBA5:  'S' 53             COMB  ; 
                   // FCB   $45                     ; DBA6:  'E' 45             Invalid ; 
                   // FCB   $AE                     ; DBA7:  ' ' AE 47          LDX   7,U ; 
                   // FCB   $49                     ; DC7E:  'I' 49             ROLA  ; 
                   // FCB   $4C                     ; DC7F:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; DC80:  'L' 4C             INCA  ; 
                   // FCB   $20                     ; DC81:  ' ' 20 50          BRA   $DCD3 ; 
                   // FCB   $50                     ; DC82:  'P' 50             NEGB  ; 
                   // FCB   $52                     ; DC83:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; DC84:  'O' 4F             CLRA  ; 
                   // FCB   $54                     ; DC85:  'T' 54             LSRB  ; 
                   // FCB   $45                     ; DC86:  'E' 45             Invalid ; 
                   // FCB   $43                     ; DC87:  'C' 43             COMA  ; 
                   // FCB   $54                     ; DC88:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; DC89:  ' ' 20 59          BRA   $DCE4 ; 
                   // FCB   $59                     ; DC8A:  'Y' 59             ROLB  ; 
                   // FCB   $4F                     ; DC8B:  'O' 4F             CLRA  ; 
                   // FCB   $55                     ; DC8C:  'U' 55             Invalid ; 
                   // FCB   $20                     ; DC8D:  ' ' 20 46          BRA   $DCD5 ; 
                   // FCB   $46                     ; DC8E:  'F' 46             RORA  ; 
                   // FCB   $4F                     ; DC8F:  'O' 4F             CLRA  ; 
                   // FCB   $52                     ; DC90:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DC91:  ' ' 20 20          BRA   $DCB3 ; 
                   // FCB   $20                     ; DC92:  ' ' 20 20          BRA   $DCB4 ; 
                   // FCB   $20                     ; DC93:  ' ' 20 43          BRA   $DCD8 ; 
                   // FCB   $43                     ; DC94:  'C' 43             COMA  ; 
                   // FCB   $4F                     ; DC95:  'O' 4F             CLRA  ; 
                   // FCB   $4C                     ; DC96:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; DC97:  'L' 4C             INCA  ; 
                   // FCB   $49                     ; DC98:  'I' 49             ROLA  ; 
                   // FCB   $53                     ; DC99:  'S' 53             COMB  ; 
                   // FCB   $49                     ; DC9A:  'I' 49             ROLA  ; 
                   // FCB   $4F                     ; DC9B:  'O' 4F             CLRA  ; 
                   // FCB   $4E                     ; DC9C:  'N' 4E             Invalid ; 
                   // FCB   $53                     ; DC9D:  'S' 53             COMB  ; 
                   // FCB   $AE                     ; DC9E:  ' ' AE 32          LDX   -14,Y ; 
                   // FCB   $52                     ; DD04:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DD05:  'E' 45             Invalid ; 
                   // FCB   $4E                     ; DD06:  'N' 4E             Invalid ; 
                   // FCB   $43                     ; DD07:  'C' 43             COMA  ; 
                   // FCB   $48                     ; DD08:  'H' 48             ASLA  ; 
                   // FCB   $20                     ; DD09:  ' ' 20 43          BRA   $DD4E ; 
                   // FCB   $43                     ; DD0A:  'C' 43             COMA  ; 
                   // FCB   $41                     ; DD0B:  'A' 41             Invalid ; 
                   // FCB   $54                     ; DD0C:  'T' 54             LSRB  ; 
                   // FCB   $57                     ; DD0D:  'W' 57             ASRB  ; 
                   // FCB   $41                     ; DD0E:  'A' 41             Invalid ; 
                   // FCB   $4C                     ; DD0F:  'L' 4C             INCA  ; 
                   // FCB   $4B                     ; DD10:  'K' 4B             Invalid ; 
                   // FCB   $AE                     ; DD11:  ' ' AE 33          LDX   -13,Y ; 
                   // FCB   $4F                     ; DD57:  'O' 4F             CLRA  ; 
                   // FCB   $57                     ; DD58:  'W' 57             ASRB  ; 
                   // FCB   $45                     ; DD59:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DD5A:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DD5B:  ' ' 20 54          BRA   $DDB1 ; 
                   // FCB   $54                     ; DD5C:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; DD5D:  'O' 4F             CLRA  ; 
                   // FCB   $50                     ; DD5E:  'P' 50             NEGB  ; 
                   // FCB   $53                     ; DD5F:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DD60:  ' ' 20 41          BRA   $DDA3 ; 
                   // FCB   $41                     ; DD61:  'A' 41             Invalid ; 
                   // FCB   $4E                     ; DD62:  'N' 4E             Invalid ; 
                   // FCB   $44                     ; DD63:  'D' 44             LSRA  ; 
                   // FCB   $20                     ; DD64:  ' ' 20 54          BRA   $DDBA ; 
                   // FCB   $54                     ; DD65:  'T' 54             LSRB  ; 
                   // FCB   $52                     ; DD66:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DD67:  'E' 45             Invalid ; 
                   // FCB   $4E                     ; DD68:  'N' 4E             Invalid ; 
                   // FCB   $43                     ; DD69:  'C' 43             COMA  ; 
                   // FCB   $48                     ; DD6A:  'H' 48             ASLA  ; 
                   // FCB   $20                     ; DD6B:  ' ' 20 54          BRA   $DDC1 ; 
                   // FCB   $54                     ; DD6C:  'T' 54             LSRB  ; 
                   // FCB   $55                     ; DD6D:  'U' 55             Invalid ; 
                   // FCB   $52                     ; DD6E:  'R' 52             Invalid ; 
                   // FCB   $52                     ; DD6F:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DD70:  'E' 45             Invalid ; 
                   // FCB   $54                     ; DD71:  'T' 54             LSRB  ; 
                   // FCB   $53                     ; DD72:  'S' 53             COMB  ; 
                   // FCB   $AE                     ; DD73:  ' ' AE 34          LDX   -12,Y ; 
                   // FCB   $4D                     ; DD94:  'M' 4D             TSTA  ; 
                   // FCB   $50                     ; DD95:  'P' 50             NEGB  ; 
                   // FCB   $41                     ; DD96:  'A' 41             Invalid ; 
                   // FCB   $43                     ; DD97:  'C' 43             COMA  ; 
                   // FCB   $54                     ; DD98:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; DD99:  ' ' 20 59          BRA   $DDF4 ; 
                   // FCB   $59                     ; DD9A:  'Y' 59             ROLB  ; 
                   // FCB   $4F                     ; DD9B:  'O' 4F             CLRA  ; 
                   // FCB   $55                     ; DD9C:  'U' 55             Invalid ; 
                   // FCB   $52                     ; DD9D:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DD9E:  ' ' 20 53          BRA   $DDF3 ; 
                   // FCB   $53                     ; DD9F:  'S' 53             COMB  ; 
                   // FCB   $48                     ; DDA0:  'H' 48             ASLA  ; 
                   // FCB   $49                     ; DDA1:  'I' 49             ROLA  ; 
                   // FCB   $45                     ; DDA2:  'E' 45             Invalid ; 
                   // FCB   $4C                     ; DDA3:  'L' 4C             INCA  ; 
                   // FCB   $44                     ; DDA4:  'D' 44             LSRA  ; 
                   // FCB   $AE                     ; DDA5:  ' ' AE 35          LDX   -11,Y ; 
                   // FCB   $4F                     ; DDCA:  'O' 4F             CLRA  ; 
                   // FCB   $55                     ; DDCB:  'U' 55             Invalid ; 
                   // FCB   $20                     ; DDCC:  ' ' 20 54          BRA   $DE22 ; 
                   // FCB   $54                     ; DDCD:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; DDCE:  'O' 4F             CLRA  ; 
                   // FCB   $20                     ; DDCF:  ' ' 20 53          BRA   $DE24 ; 
                   // FCB   $53                     ; DDD0:  'S' 53             COMB  ; 
                   // FCB   $54                     ; DDD1:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; DDD2:  'O' 4F             CLRA  ; 
                   // FCB   $50                     ; DDD3:  'P' 50             NEGB  ; 
                   // FCB   $20                     ; DDD4:  ' ' 20 54          BRA   $DE2A ; 
                   // FCB   $54                     ; DDD5:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; DDD6:  'H' 48             ASLA  ; 
                   // FCB   $45                     ; DDD7:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DDD8:  ' ' 20 45          BRA   $DE1F ; 
                   // FCB   $45                     ; DDD9:  'E' 45             Invalid ; 
                   // FCB   $4D                     ; DDDA:  'M' 4D             TSTA  ; 
                   // FCB   $50                     ; DDDB:  'P' 50             NEGB  ; 
                   // FCB   $49                     ; DDDC:  'I' 49             ROLA  ; 
                   // FCB   $52                     ; DDDD:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DDDE:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DDDF:  ' ' 20 42          BRA   $DE23 ; 
                   // FCB   $42                     ; DDE0:  'B' 42             Invalid ; 
                   // FCB   $59                     ; DDE1:  'Y' 59             ROLB  ; 
                   // FCB   $20                     ; DDE2:  ' ' 20 42          BRA   $DE26 ; 
                   // FCB   $42                     ; DDE3:  'B' 42             Invalid ; 
                   // FCB   $4C                     ; DDE4:  'L' 4C             INCA  ; 
                   // FCB   $4F                     ; DDE5:  'O' 4F             CLRA  ; 
                   // FCB   $57                     ; DDE6:  'W' 57             ASRB  ; 
                   // FCB   $49                     ; DDE7:  'I' 49             ROLA  ; 
                   // FCB   $4E                     ; DDE8:  'N' 4E             Invalid ; 
                   // FCB   $C7                     ; DDE9:  ' ' C7             Invalid ; 
                   // FCB   $55                     ; DDEA:  'U' 55             Invalid ; 
                   // FCB   $50                     ; DDEB:  'P' 50             NEGB  ; 
                   // FCB   $20                     ; DDEC:  ' ' 20 54          BRA   $DE42 ; 
                   // FCB   $54                     ; DDED:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; DDEE:  'H' 48             ASLA  ; 
                   // FCB   $45                     ; DDEF:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DDF0:  ' ' 20 44          BRA   $DE36 ; 
                   // FCB   $44                     ; DDF1:  'D' 44             LSRA  ; 
                   // FCB   $45                     ; DDF2:  'E' 45             Invalid ; 
                   // FCB   $41                     ; DDF3:  'A' 41             Invalid ; 
                   // FCB   $54                     ; DDF4:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; DDF5:  'H' 48             ASLA  ; 
                   // FCB   $20                     ; DDF6:  ' ' 20 53          BRA   $DE4B ; 
                   // FCB   $53                     ; DDF7:  'S' 53             COMB  ; 
                   // FCB   $54                     ; DDF8:  'T' 54             LSRB  ; 
                   // FCB   $41                     ; DDF9:  'A' 41             Invalid ; 
                   // FCB   $52                     ; DDFA:  'R' 52             Invalid ; 
                   // FCB   $AE                     ; DDFB:  ' ' AE B6          LDX   [A,Y] ; 
                   // FCB   $B6                     ; DDFC:  ' ' B6 B7 B8       LDA   $B7B8 ; 
                   // FCB   $B9                     ; DDFF:  ' ' B9 53 43       ADCA  $5343 ; 
                   // FCB   $53                     ; DE00:  'S' 53             COMB  ; 
                   // FCB   $43                     ; DE01:  'C' 43             COMA  ; 
                   // FCB   $4F                     ; DE02:  'O' 4F             CLRA  ; 
                   // FCB   $52                     ; DE03:  'R' 52             Invalid ; 
                   // FCB   $49                     ; DE04:  'I' 49             ROLA  ; 
                   // FCB   $4E                     ; DE05:  'N' 4E             Invalid ; 
                   // FCB   $C7                     ; DE06:  ' ' C7             Invalid ; 
                   // FCB   $54                     ; DE07:  'T' 54             LSRB  ; 
                   // FCB   $49                     ; DE08:  'I' 49             ROLA  ; 
                   // FCB   $45                     ; DE09:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DE0A:  ' ' 20 46          BRA   $DE52 ; 
                   // FCB   $46                     ; DE0B:  'F' 46             RORA  ; 
                   // FCB   $49                     ; DE0C:  'I' 49             ROLA  ; 
                   // FCB   $47                     ; DE0D:  'G' 47             ASRA  ; 
                   // FCB   $48                     ; DE0E:  'H' 48             ASLA  ; 
                   // FCB   $54                     ; DE0F:  'T' 54             LSRB  ; 
                   // FCB   $45                     ; DE10:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DE11:  'R' 52             Invalid ; 
                   // FCB   $53                     ; DE12:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DE13:  ' ' 20 20          BRA   $DE35 ; 
                   // FCB   $20                     ; DE14:  ' ' 20 20          BRA   $DE36 ; 
                   // FCB   $20                     ; DE15:  ' ' 20 20          BRA   $DE37 ; 
                   // FCB   $20                     ; DE16:  ' ' 20 20          BRA   $DE38 ; 
                   // FCB   $20                     ; DE17:  ' ' 20 20          BRA   $DE39 ; 
                   // FCB   $20                     ; DE18:  ' ' 20 20          BRA   $DE3A ; 
                   // FCB   $20                     ; DE19:  ' ' 20 20          BRA   $DE3B ; 
                   // FCB   $20                     ; DE1A:  ' ' 20 20          BRA   $DE3C ; 
                   // FCB   $20                     ; DE1B:  ' ' 20 20          BRA   $DE3D ; 
                   // FCB   $20                     ; DE1C:  ' ' 20 20          BRA   $DE3E ; 
                   // FCB   $20                     ; DE1D:  ' ' 20 20          BRA   $DE3F ; 
                   // FCB   $20                     ; DE1E:  ' ' 20 20          BRA   $DE40 ; 
                   // FCB   $20                     ; DE1F:  ' ' 20 20          BRA   $DE41 ; 
                   // FCB   $20                     ; DE20:  ' ' 20 20          BRA   $DE42 ; 
                   // FCB   $20                     ; DE21:  ' ' 20 20          BRA   $DE43 ; 
                   // FCB   $20                     ; DE22:  ' ' 20 20          BRA   $DE44 ; 
                   // FCB   $20                     ; DE23:  ' ' 20 31          BRA   $DE56 ; 
                   // FCB   $31                     ; DE24:  '1' 31 2C          LEAY  12,Y ; 
                   // FCB   $2C                     ; DE25:  ',' 2C 30          BGE   $DE57 ; 
                   // FCB   $30                     ; DE26:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DE27:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DE28:  ' ' B0 44 41       SUBA  $4441 ; 
                   // FCB   $20                     ; DE36:  ' ' 20 53          BRA   $DE8B ; 
                   // FCB   $53                     ; DE37:  'S' 53             COMB  ; 
                   // FCB   $48                     ; DE38:  'H' 48             ASLA  ; 
                   // FCB   $49                     ; DE39:  'I' 49             ROLA  ; 
                   // FCB   $50                     ; DE3A:  'P' 50             NEGB  ; 
                   // FCB   $20                     ; DE3B:  ' ' 20 20          BRA   $DE5D ; 
                   // FCB   $20                     ; DE3C:  ' ' 20 20          BRA   $DE5E ; 
                   // FCB   $20                     ; DE3D:  ' ' 20 20          BRA   $DE5F ; 
                   // FCB   $20                     ; DE3E:  ' ' 20 20          BRA   $DE60 ; 
                   // FCB   $20                     ; DE3F:  ' ' 20 20          BRA   $DE61 ; 
                   // FCB   $20                     ; DE40:  ' ' 20 20          BRA   $DE62 ; 
                   // FCB   $20                     ; DE41:  ' ' 20 20          BRA   $DE63 ; 
                   // FCB   $20                     ; DE42:  ' ' 20 20          BRA   $DE64 ; 
                   // FCB   $20                     ; DE43:  ' ' 20 20          BRA   $DE65 ; 
                   // FCB   $20                     ; DE44:  ' ' 20 20          BRA   $DE66 ; 
                   // FCB   $20                     ; DE45:  ' ' 20 32          BRA   $DE79 ; 
                   // FCB   $32                     ; DE46:  '2' 32 2C          LEAS  12,Y ; 
                   // FCB   $2C                     ; DE47:  ',' 2C 30          BGE   $DE79 ; 
                   // FCB   $30                     ; DE48:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DE49:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DE4A:  ' ' B0 4C 41       SUBA  $4C41 ; 
                   // FCB   $4C                     ; DE4B:  'L' 4C             INCA  ; 
                   // FCB   $41                     ; DE4C:  'A' 41             Invalid ; 
                   // FCB   $53                     ; DE4D:  'S' 53             COMB  ; 
                   // FCB   $45                     ; DE4E:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DE4F:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DE50:  ' ' 20 42          BRA   $DE94 ; 
                   // FCB   $42                     ; DE51:  'B' 42             Invalid ; 
                   // FCB   $55                     ; DE52:  'U' 55             Invalid ; 
                   // FCB   $4E                     ; DE53:  'N' 4E             Invalid ; 
                   // FCB   $4B                     ; DE54:  'K' 4B             Invalid ; 
                   // FCB   $45                     ; DE55:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DE56:  'R' 52             Invalid ; 
                   // FCB   $53                     ; DE57:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DE58:  ' ' 20 20          BRA   $DE7A ; 
                   // FCB   $20                     ; DE59:  ' ' 20 20          BRA   $DE7B ; 
                   // FCB   $20                     ; DE5A:  ' ' 20 20          BRA   $DE7C ; 
                   // FCB   $20                     ; DE5B:  ' ' 20 20          BRA   $DE7D ; 
                   // FCB   $20                     ; DE5C:  ' ' 20 20          BRA   $DE7E ; 
                   // FCB   $20                     ; DE5D:  ' ' 20 20          BRA   $DE7F ; 
                   // FCB   $20                     ; DE5E:  ' ' 20 20          BRA   $DE80 ; 
                   // FCB   $20                     ; DE5F:  ' ' 20 20          BRA   $DE81 ; 
                   // FCB   $20                     ; DE60:  ' ' 20 20          BRA   $DE82 ; 
                   // FCB   $20                     ; DE61:  ' ' 20 20          BRA   $DE83 ; 
                   // FCB   $20                     ; DE62:  ' ' 20 20          BRA   $DE84 ; 
                   // FCB   $20                     ; DE63:  ' ' 20 20          BRA   $DE85 ; 
                   // FCB   $20                     ; DE64:  ' ' 20 20          BRA   $DE86 ; 
                   // FCB   $20                     ; DE65:  ' ' 20 20          BRA   $DE87 ; 
                   // FCB   $20                     ; DE66:  ' ' 20 20          BRA   $DE88 ; 
                   // FCB   $20                     ; DE67:  ' ' 20 20          BRA   $DE89 ; 
                   // FCB   $20                     ; DE68:  ' ' 20 20          BRA   $DE8A ; 
                   // FCB   $20                     ; DE69:  ' ' 20 32          BRA   $DE9D ; 
                   // FCB   $32                     ; DE6A:  '2' 32 30          LEAS  -16,Y ; 
                   // FCB   $30                     ; DE6B:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DE6C:  ' ' B0 4C 41       SUBA  $4C41 ; 
                   // FCB   $4C                     ; DE6D:  'L' 4C             INCA  ; 
                   // FCB   $41                     ; DE6E:  'A' 41             Invalid ; 
                   // FCB   $53                     ; DE6F:  'S' 53             COMB  ; 
                   // FCB   $45                     ; DE70:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DE71:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DE72:  ' ' 20 54          BRA   $DEC8 ; 
                   // FCB   $54                     ; DE73:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; DE74:  'O' 4F             CLRA  ; 
                   // FCB   $57                     ; DE75:  'W' 57             ASRB  ; 
                   // FCB   $45                     ; DE76:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DE77:  'R' 52             Invalid ; 
                   // FCB   $53                     ; DE78:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DE79:  ' ' 20 20          BRA   $DE9B ; 
                   // FCB   $20                     ; DE7A:  ' ' 20 20          BRA   $DE9C ; 
                   // FCB   $20                     ; DE7B:  ' ' 20 20          BRA   $DE9D ; 
                   // FCB   $20                     ; DE7C:  ' ' 20 20          BRA   $DE9E ; 
                   // FCB   $20                     ; DE7D:  ' ' 20 20          BRA   $DE9F ; 
                   // FCB   $20                     ; DE7E:  ' ' 20 20          BRA   $DEA0 ; 
                   // FCB   $20                     ; DE7F:  ' ' 20 20          BRA   $DEA1 ; 
                   // FCB   $20                     ; DE80:  ' ' 20 20          BRA   $DEA2 ; 
                   // FCB   $20                     ; DE81:  ' ' 20 20          BRA   $DEA3 ; 
                   // FCB   $20                     ; DE82:  ' ' 20 20          BRA   $DEA4 ; 
                   // FCB   $20                     ; DE83:  ' ' 20 20          BRA   $DEA5 ; 
                   // FCB   $20                     ; DE84:  ' ' 20 20          BRA   $DEA6 ; 
                   // FCB   $20                     ; DE85:  ' ' 20 20          BRA   $DEA7 ; 
                   // FCB   $20                     ; DE86:  ' ' 20 20          BRA   $DEA8 ; 
                   // FCB   $20                     ; DE87:  ' ' 20 20          BRA   $DEA9 ; 
                   // FCB   $20                     ; DE88:  ' ' 20 20          BRA   $DEAA ; 
                   // FCB   $20                     ; DE89:  ' ' 20 20          BRA   $DEAB ; 
                   // FCB   $20                     ; DE8A:  ' ' 20 20          BRA   $DEAC ; 
                   // FCB   $20                     ; DE8B:  ' ' 20 32          BRA   $DEBF ; 
                   // FCB   $32                     ; DE8C:  '2' 32 30          LEAS  -16,Y ; 
                   // FCB   $30                     ; DE8D:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DE8E:  ' ' B0 54 52       SUBA  $5452 ; 
                   // FCB   $54                     ; DE8F:  'T' 54             LSRB  ; 
                   // FCB   $52                     ; DE90:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DE91:  'E' 45             Invalid ; 
                   // FCB   $4E                     ; DE92:  'N' 4E             Invalid ; 
                   // FCB   $43                     ; DE93:  'C' 43             COMA  ; 
                   // FCB   $48                     ; DE94:  'H' 48             ASLA  ; 
                   // FCB   $20                     ; DE95:  ' ' 20 54          BRA   $DEEB ; 
                   // FCB   $54                     ; DE96:  'T' 54             LSRB  ; 
                   // FCB   $55                     ; DE97:  'U' 55             Invalid ; 
                   // FCB   $52                     ; DE98:  'R' 52             Invalid ; 
                   // FCB   $52                     ; DE99:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DE9A:  'E' 45             Invalid ; 
                   // FCB   $54                     ; DE9B:  'T' 54             LSRB  ; 
                   // FCB   $53                     ; DE9C:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DE9D:  ' ' 20 20          BRA   $DEBF ; 
                   // FCB   $20                     ; DE9E:  ' ' 20 20          BRA   $DEC0 ; 
                   // FCB   $20                     ; DE9F:  ' ' 20 20          BRA   $DEC1 ; 
                   // FCB   $20                     ; DEA0:  ' ' 20 20          BRA   $DEC2 ; 
                   // FCB   $20                     ; DEA1:  ' ' 20 20          BRA   $DEC3 ; 
                   // FCB   $20                     ; DEA2:  ' ' 20 20          BRA   $DEC4 ; 
                   // FCB   $20                     ; DEA3:  ' ' 20 20          BRA   $DEC5 ; 
                   // FCB   $20                     ; DEA4:  ' ' 20 20          BRA   $DEC6 ; 
                   // FCB   $20                     ; DEA5:  ' ' 20 20          BRA   $DEC7 ; 
                   // FCB   $20                     ; DEA6:  ' ' 20 20          BRA   $DEC8 ; 
                   // FCB   $20                     ; DEA7:  ' ' 20 20          BRA   $DEC9 ; 
                   // FCB   $20                     ; DEA8:  ' ' 20 20          BRA   $DECA ; 
                   // FCB   $20                     ; DEA9:  ' ' 20 20          BRA   $DECB ; 
                   // FCB   $20                     ; DEAA:  ' ' 20 20          BRA   $DECC ; 
                   // FCB   $20                     ; DEAB:  ' ' 20 20          BRA   $DECD ; 
                   // FCB   $20                     ; DEAC:  ' ' 20 20          BRA   $DECE ; 
                   // FCB   $20                     ; DEAD:  ' ' 20 31          BRA   $DEE0 ; 
                   // FCB   $31                     ; DEAE:  '1' 31 30          LEAY  -16,Y ; 
                   // FCB   $30                     ; DEAF:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DEB0:  ' ' B0 46 49       SUBA  $4649 ; 
                   // FCB   $46                     ; DEB1:  'F' 46             RORA  ; 
                   // FCB   $49                     ; DEB2:  'I' 49             ROLA  ; 
                   // FCB   $52                     ; DEB3:  'R' 52             Invalid ; 
                   // FCB   $45                     ; DEB4:  'E' 45             Invalid ; 
                   // FCB   $42                     ; DEB5:  'B' 42             Invalid ; 
                   // FCB   $41                     ; DEB6:  'A' 41             Invalid ; 
                   // FCB   $4C                     ; DEB7:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; DEB8:  'L' 4C             INCA  ; 
                   // FCB   $53                     ; DEB9:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DEBA:  ' ' 20 20          BRA   $DEDC ; 
                   // FCB   $20                     ; DEBB:  ' ' 20 20          BRA   $DEDD ; 
                   // FCB   $20                     ; DEBC:  ' ' 20 20          BRA   $DEDE ; 
                   // FCB   $20                     ; DEBD:  ' ' 20 20          BRA   $DEDF ; 
                   // FCB   $20                     ; DEBE:  ' ' 20 20          BRA   $DEE0 ; 
                   // FCB   $20                     ; DEBF:  ' ' 20 20          BRA   $DEE1 ; 
                   // FCB   $20                     ; DEC0:  ' ' 20 20          BRA   $DEE2 ; 
                   // FCB   $20                     ; DEC1:  ' ' 20 20          BRA   $DEE3 ; 
                   // FCB   $20                     ; DEC2:  ' ' 20 20          BRA   $DEE4 ; 
                   // FCB   $20                     ; DEC3:  ' ' 20 20          BRA   $DEE5 ; 
                   // FCB   $20                     ; DEC4:  ' ' 20 20          BRA   $DEE6 ; 
                   // FCB   $20                     ; DEC5:  ' ' 20 20          BRA   $DEE7 ; 
                   // FCB   $20                     ; DEC6:  ' ' 20 20          BRA   $DEE8 ; 
                   // FCB   $20                     ; DEC7:  ' ' 20 20          BRA   $DEE9 ; 
                   // FCB   $20                     ; DEC8:  ' ' 20 20          BRA   $DEEA ; 
                   // FCB   $20                     ; DEC9:  ' ' 20 20          BRA   $DEEB ; 
                   // FCB   $20                     ; DECA:  ' ' 20 20          BRA   $DEEC ; 
                   // FCB   $20                     ; DECB:  ' ' 20 20          BRA   $DEED ; 
                   // FCB   $20                     ; DECC:  ' ' 20 20          BRA   $DEEE ; 
                   // FCB   $20                     ; DECD:  ' ' 20 20          BRA   $DEEF ; 
                   // FCB   $20                     ; DECE:  ' ' 20 20          BRA   $DEF0 ; 
                   // FCB   $20                     ; DECF:  ' ' 20 20          BRA   $DEF1 ; 
                   // FCB   $20                     ; DED0:  ' ' 20 33          BRA   $DF05 ; 
                   // FCB   $33                     ; DED1:  '3' 33 B3          LEAU  [,--Y] ; 
                   // FCB   $B3                     ; DED2:  ' ' B3 45 58       SUBD  $4558 ; 
                   // FCB   $45                     ; DED3:  'E' 45             Invalid ; 
                   // FCB   $58                     ; DED4:  'X' 58             ASLB  ; 
                   // FCB   $48                     ; DED5:  'H' 48             ASLA  ; 
                   // FCB   $41                     ; DED6:  'A' 41             Invalid ; 
                   // FCB   $55                     ; DED7:  'U' 55             Invalid ; 
                   // FCB   $53                     ; DED8:  'S' 53             COMB  ; 
                   // FCB   $54                     ; DED9:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; DEDA:  ' ' 20 50          BRA   $DF2C ; 
                   // FCB   $50                     ; DEDB:  'P' 50             NEGB  ; 
                   // FCB   $4F                     ; DEDC:  'O' 4F             CLRA  ; 
                   // FCB   $52                     ; DEDD:  'R' 52             Invalid ; 
                   // FCB   $54                     ; DEDE:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; DEDF:  ' ' 20 20          BRA   $DF01 ; 
                   // FCB   $20                     ; DEE0:  ' ' 20 20          BRA   $DF02 ; 
                   // FCB   $20                     ; DEE1:  ' ' 20 20          BRA   $DF03 ; 
                   // FCB   $20                     ; DEE2:  ' ' 20 20          BRA   $DF04 ; 
                   // FCB   $20                     ; DEE3:  ' ' 20 20          BRA   $DF05 ; 
                   // FCB   $20                     ; DEE4:  ' ' 20 20          BRA   $DF06 ; 
                   // FCB   $20                     ; DEE5:  ' ' 20 20          BRA   $DF07 ; 
                   // FCB   $20                     ; DEE6:  ' ' 20 20          BRA   $DF08 ; 
                   // FCB   $20                     ; DEE7:  ' ' 20 20          BRA   $DF09 ; 
                   // FCB   $20                     ; DEE8:  ' ' 20 20          BRA   $DF0A ; 
                   // FCB   $20                     ; DEE9:  ' ' 20 20          BRA   $DF0B ; 
                   // FCB   $20                     ; DEEA:  ' ' 20 20          BRA   $DF0C ; 
                   // FCB   $20                     ; DEEB:  ' ' 20 20          BRA   $DF0D ; 
                   // FCB   $20                     ; DEEC:  ' ' 20 20          BRA   $DF0E ; 
                   // FCB   $20                     ; DEED:  ' ' 20 20          BRA   $DF0F ; 
                   // FCB   $20                     ; DEEE:  ' ' 20 32          BRA   $DF22 ; 
                   // FCB   $32                     ; DEEF:  '2' 32 35          LEAS  -11,Y ; 
                   // FCB   $35                     ; DEF0:  '5' 35 2C          PULS  Y,DP,B ; 
                   // FCB   $2C                     ; DEF1:  ',' 2C 30          BGE   $DF23 ; 
                   // FCB   $30                     ; DEF2:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DEF3:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DEF4:  ' ' B0 44 45       SUBA  $4445 ; 
                   // FCB   $44                     ; DEF5:  'D' 44             LSRA  ; 
                   // FCB   $45                     ; DEF6:  'E' 45             Invalid ; 
                   // FCB   $53                     ; DEF7:  'S' 53             COMB  ; 
                   // FCB   $54                     ; DEF8:  'T' 54             LSRB  ; 
                   // FCB   $52                     ; DEF9:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; DEFA:  'O' 4F             CLRA  ; 
                   // FCB   $59                     ; DEFB:  'Y' 59             ROLB  ; 
                   // FCB   $49                     ; DEFC:  'I' 49             ROLA  ; 
                   // FCB   $4E                     ; DEFD:  'N' 4E             Invalid ; 
                   // FCB   $47                     ; DEFE:  'G' 47             ASRA  ; 
                   // FCB   $20                     ; DEFF:  ' ' 20 41          BRA   $DF42 ; 
                   // FCB   $41                     ; DF00:  'A' 41             Invalid ; 
                   // FCB   $4C                     ; DF01:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; DF02:  'L' 4C             INCA  ; 
                   // FCB   $20                     ; DF03:  ' ' 20 54          BRA   $DF59 ; 
                   // FCB   $54                     ; DF04:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; DF05:  'O' 4F             CLRA  ; 
                   // FCB   $57                     ; DF06:  'W' 57             ASRB  ; 
                   // FCB   $45                     ; DF07:  'E' 45             Invalid ; 
                   // FCB   $52                     ; DF08:  'R' 52             Invalid ; 
                   // FCB   $20                     ; DF09:  ' ' 20 54          BRA   $DF5F ; 
                   // FCB   $54                     ; DF0A:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; DF0B:  'O' 4F             CLRA  ; 
                   // FCB   $50                     ; DF0C:  'P' 50             NEGB  ; 
                   // FCB   $53                     ; DF0D:  'S' 53             COMB  ; 
                   // FCB   $20                     ; DF0E:  ' ' 20 20          BRA   $DF30 ; 
                   // FCB   $20                     ; DF0F:  ' ' 20 20          BRA   $DF31 ; 
                   // FCB   $20                     ; DF10:  ' ' 20 35          BRA   $DF47 ; 
                   // FCB   $35                     ; DF11:  '5' 35 30          PULS  Y,X ; 
                   // FCB   $30                     ; DF12:  '0' 30 2C          LEAX  12,Y ; 
                   // FCB   $2C                     ; DF13:  ',' 2C 30          BGE   $DF45 ; 
                   // FCB   $30                     ; DF14:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DF15:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DF16:  ' ' B0 53 45       SUBA  $5345 ; 
                   // FCB   $41                     ; DF62:  'A' 41             Invalid ; 
                   // FCB   $56                     ; DF63:  'V' 56             RORB  ; 
                   // FCB   $45                     ; DF64:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DF65:  ' ' 20 B1          BRA   $DF18 ; 
                   // FCB   $B1                     ; DF66:  ' ' B1 57 41       CMPA  $5741 ; 
                   // FCB   $57                     ; DF67:  'W' 57             ASRB  ; 
                   // FCB   $41                     ; DF68:  'A' 41             Invalid ; 
                   // FCB   $56                     ; DF69:  'V' 56             RORB  ; 
                   // FCB   $45                     ; DF6A:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DF6B:  ' ' 20 B3          BRA   $DF20 ; 
                   // FCB   $B3                     ; DF6C:  ' ' B3 57 41       SUBD  $5741 ; 
                   // FCB   $57                     ; DF6D:  'W' 57             ASRB  ; 
                   // FCB   $41                     ; DF6E:  'A' 41             Invalid ; 
                   // FCB   $56                     ; DF6F:  'V' 56             RORB  ; 
                   // FCB   $45                     ; DF70:  'E' 45             Invalid ; 
                   // FCB   $20                     ; DF71:  ' ' 20 B5          BRA   $DF28 ; 
                   // FCB   $B5                     ; DF72:  ' ' B5 42 4F       BITA  $424F ; 
                   // FCB   $30                     ; DF81:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DF82:  '0' 30 2C          LEAX  12,Y ; 
                   // FCB   $2C                     ; DF83:  ',' 2C 30          BGE   $DFB5 ; 
                   // FCB   $30                     ; DF84:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DF85:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DF86:  ' ' B0 38 30       SUBA  $3830 ; 
                   // FCB   $38                     ; DF87:  '8' 38             Invalid ; 
                   // FCB   $30                     ; DF88:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DF89:  '0' 30 2C          LEAX  12,Y ; 
                   // FCB   $2C                     ; DF8A:  ',' 2C 30          BGE   $DFBC ; 
                   // FCB   $30                     ; DF8B:  '0' 30 30          LEAX  -16,Y ; 
                   // FCB   $30                     ; DF8C:  '0' 30 B0          LEAX  ??? ; 
                   // FCB   $B0                     ; DF8D:  ' ' B0 4D 45       SUBA  $4D45 ; 
                   // FCB   $52                     ; E164:  'R' 52             Invalid ; 
                   // FCB   $45                     ; E165:  'E' 45             Invalid ; 
                   // FCB   $53                     ; E166:  'S' 53             COMB  ; 
                   // FCB   $45                     ; E167:  'E' 45             Invalid ; 
                   // FCB   $4E                     ; E168:  'N' 4E             Invalid ; 
                   // FCB   $43                     ; E169:  'C' 43             COMA  ; 
                   // FCB   $45                     ; E16A:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E16B:  ' ' 20 49          BRA   $E1B6 ; 
                   // FCB   $49                     ; E16C:  'I' 49             ROLA  ; 
                   // FCB   $53                     ; E16D:  'S' 53             COMB  ; 
                   // FCB   $20                     ; E16E:  ' ' 20 46          BRA   $E1B6 ; 
                   // FCB   $46                     ; E16F:  'F' 46             RORA  ; 
                   // FCB   $45                     ; E170:  'E' 45             Invalid ; 
                   // FCB   $4C                     ; E171:  'L' 4C             INCA  ; 
                   // FCB   $54                     ; E172:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E173:  ' ' 20 57          BRA   $E1CC ; 
                   // FCB   $57                     ; E174:  'W' 57             ASRB  ; 
                   // FCB   $49                     ; E175:  'I' 49             ROLA  ; 
                   // FCB   $54                     ; E176:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; E177:  'H' 48             ASLA  ; 
                   // FCB   $49                     ; E178:  'I' 49             ROLA  ; 
                   // FCB   $4E                     ; E179:  'N' 4E             Invalid ; 
                   // FCB   $20                     ; E17A:  ' ' 20 54          BRA   $E1D0 ; 
                   // FCB   $54                     ; E17B:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; E17C:  'H' 48             ASLA  ; 
                   // FCB   $45                     ; E17D:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E17E:  ' ' 20 46          BRA   $E1C6 ; 
                   // FCB   $46                     ; E17F:  'F' 46             RORA  ; 
                   // FCB   $4F                     ; E180:  'O' 4F             CLRA  ; 
                   // FCB   $52                     ; E181:  'R' 52             Invalid ; 
                   // FCB   $43                     ; E182:  'C' 43             COMA  ; 
                   // FCB   $45                     ; E183:  'E' 45             Invalid ; 
                   // FCB   $AE                     ; E184:  ' ' AE 54          LDX   -12,U ; 
                   // FCB   $45                     ; E1E9:  'E' 45             Invalid ; 
                   // FCB   $42                     ; E1EA:  'B' 42             Invalid ; 
                   // FCB   $45                     ; E1EB:  'E' 45             Invalid ; 
                   // FCB   $4C                     ; E1EC:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; E1ED:  'L' 4C             INCA  ; 
                   // FCB   $49                     ; E1EE:  'I' 49             ROLA  ; 
                   // FCB   $4F                     ; E1EF:  'O' 4F             CLRA  ; 
                   // FCB   $4E                     ; E1F0:  'N' 4E             Invalid ; 
                   // FCB   $20                     ; E1F1:  ' ' 20 54          BRA   $E247 ; 
                   // FCB   $54                     ; E1F2:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; E1F3:  'O' 4F             CLRA  ; 
                   // FCB   $20                     ; E1F4:  ' ' 20 53          BRA   $E249 ; 
                   // FCB   $53                     ; E1F5:  'S' 53             COMB  ; 
                   // FCB   $54                     ; E1F6:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; E1F7:  'O' 4F             CLRA  ; 
                   // FCB   $50                     ; E1F8:  'P' 50             NEGB  ; 
                   // FCB   $20                     ; E1F9:  ' ' 20 54          BRA   $E24F ; 
                   // FCB   $54                     ; E1FA:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; E1FB:  'H' 48             ASLA  ; 
                   // FCB   $45                     ; E1FC:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E1FD:  ' ' 20 45          BRA   $E244 ; 
                   // FCB   $45                     ; E1FE:  'E' 45             Invalid ; 
                   // FCB   $4D                     ; E1FF:  'M' 4D             TSTA  ; 
                   // FCB   $50                     ; E200:  'P' 50             NEGB  ; 
                   // FCB   $49                     ; E201:  'I' 49             ROLA  ; 
                   // FCB   $52                     ; E202:  'R' 52             Invalid ; 
                   // FCB   $45                     ; E203:  'E' 45             Invalid ; 
                   // FCB   $AE                     ; E204:  ' ' AE 54          LDX   -12,U ; 
                   // FCB   $54                     ; E205:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; E206:  'H' 48             ASLA  ; 
                   // FCB   $45                     ; E207:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E208:  ' ' 20 46          BRA   $E250 ; 
                   // FCB   $46                     ; E209:  'F' 46             RORA  ; 
                   // FCB   $4F                     ; E20A:  'O' 4F             CLRA  ; 
                   // FCB   $52                     ; E20B:  'R' 52             Invalid ; 
                   // FCB   $43                     ; E20C:  'C' 43             COMA  ; 
                   // FCB   $45                     ; E20D:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E20E:  ' ' 20 57          BRA   $E267 ; 
                   // FCB   $57                     ; E20F:  'W' 57             ASRB  ; 
                   // FCB   $49                     ; E210:  'I' 49             ROLA  ; 
                   // FCB   $4C                     ; E211:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; E212:  'L' 4C             INCA  ; 
                   // FCB   $20                     ; E213:  ' ' 20 42          BRA   $E257 ; 
                   // FCB   $42                     ; E214:  'B' 42             Invalid ; 
                   // FCB   $45                     ; E215:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E216:  ' ' 20 57          BRA   $E26F ; 
                   // FCB   $57                     ; E217:  'W' 57             ASRB  ; 
                   // FCB   $49                     ; E218:  'I' 49             ROLA  ; 
                   // FCB   $54                     ; E219:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; E21A:  'H' 48             ASLA  ; 
                   // FCB   $20                     ; E21B:  ' ' 20 59          BRA   $E276 ; 
                   // FCB   $59                     ; E21C:  'Y' 59             ROLB  ; 
                   // FCB   $4F                     ; E21D:  'O' 4F             CLRA  ; 
                   // FCB   $55                     ; E21E:  'U' 55             Invalid ; 
                   // FCB   $AE                     ; E21F:  ' ' AE 41          LDX   1,U ; 
                   // FCB   $55                     ; E3DD:  'U' 55             Invalid ; 
                   // FCB   $4C                     ; E3DE:  'L' 4C             INCA  ; 
                   // FCB   $4C                     ; E3DF:  'L' 4C             INCA  ; 
                   // FCB   $20                     ; E3E0:  ' ' 20 4C          BRA   $E42E ; 
                   // FCB   $4C                     ; E3E1:  'L' 4C             INCA  ; 
                   // FCB   $45                     ; E3E2:  'E' 45             Invalid ; 
                   // FCB   $46                     ; E3E3:  'F' 46             RORA  ; 
                   // FCB   $54                     ; E3E4:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E3E5:  ' ' 20 46          BRA   $E42D ; 
                   // FCB   $46                     ; E3E6:  'F' 46             RORA  ; 
                   // FCB   $49                     ; E3E7:  'I' 49             ROLA  ; 
                   // FCB   $52                     ; E3E8:  'R' 52             Invalid ; 
                   // FCB   $45                     ; E3E9:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E3EA:  ' ' 20 54          BRA   $E440 ; 
                   // FCB   $54                     ; E3EB:  'T' 54             LSRB  ; 
                   // FCB   $4F                     ; E3EC:  'O' 4F             CLRA  ; 
                   // FCB   $20                     ; E3ED:  ' ' 20 43          BRA   $E432 ; 
                   // FCB   $43                     ; E3EE:  'C' 43             COMA  ; 
                   // FCB   $48                     ; E3EF:  'H' 48             ASLA  ; 
                   // FCB   $41                     ; E3F0:  'A' 41             Invalid ; 
                   // FCB   $4E                     ; E3F1:  'N' 4E             Invalid ; 
                   // FCB   $47                     ; E3F2:  'G' 47             ASRA  ; 
                   // FCB   $45                     ; E3F3:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E3F4:  ' ' 20 53          BRA   $E449 ; 
                   // FCB   $53                     ; E3F5:  'S' 53             COMB  ; 
                   // FCB   $45                     ; E3F6:  'E' 45             Invalid ; 
                   // FCB   $54                     ; E3F7:  'T' 54             LSRB  ; 
                   // FCB   $54                     ; E3F8:  'T' 54             LSRB  ; 
                   // FCB   $49                     ; E3F9:  'I' 49             ROLA  ; 
                   // FCB   $4E                     ; E3FA:  'N' 4E             Invalid ; 
                   // FCB   $C7                     ; E3FB:  ' ' C7             Invalid ; 
                   // FCB   $B2                     ; E41F:  ' ' B2 B1 B4       SBCA  $B1B4 ; 
                   // FCB   $B1                     ; E420:  ' ' B1 B4 B5       CMPA  $B4B5 ; 
                   // FCB   $B4                     ; E421:  ' ' B4 B5 B6       ANDA  $B5B6 ; 
                   // FCB   $B5                     ; E422:  ' ' B5 B6 4E       BITA  $B64E ; 
                   // FCB   $B6                     ; E423:  ' ' B6 4E 4F       LDA   $4E4F ; 
                   // FCB   $20                     ; E429:  ' ' 20 47          BRA   $E472 ; 
                   // FCB   $47                     ; E42A:  'G' 47             ASRA  ; 
                   // FCB   $49                     ; E42B:  'I' 49             ROLA  ; 
                   // FCB   $56                     ; E42C:  'V' 56             RORB  ; 
                   // FCB   $45                     ; E42D:  'E' 45             Invalid ; 
                   // FCB   $53                     ; E42E:  'S' 53             COMB  ; 
                   // FCB   $20                     ; E42F:  ' ' 20 B1          BRA   $E3E2 ; 
                   // FCB   $B1                     ; E430:  ' ' B1 34 20       CMPA  $3420 ; 
                   // FCB   $34                     ; E431:  '4' 34 20          PSHS  Y ; 
                   // FCB   $20                     ; E432:  ' ' 20 47          BRA   $E47B ; 
                   // FCB   $47                     ; E433:  'G' 47             ASRA  ; 
                   // FCB   $49                     ; E434:  'I' 49             ROLA  ; 
                   // FCB   $56                     ; E435:  'V' 56             RORB  ; 
                   // FCB   $45                     ; E436:  'E' 45             Invalid ; 
                   // FCB   $53                     ; E437:  'S' 53             COMB  ; 
                   // FCB   $20                     ; E438:  ' ' 20 B1          BRA   $E3EB ; 
                   // FCB   $B1                     ; E439:  ' ' B1 34 20       CMPA  $3420 ; 
                   // FCB   $34                     ; E43A:  '4' 34 20          PSHS  Y ; 
                   // FCB   $20                     ; E43B:  ' ' 20 47          BRA   $E484 ; 
                   // FCB   $47                     ; E43C:  'G' 47             ASRA  ; 
                   // FCB   $49                     ; E43D:  'I' 49             ROLA  ; 
                   // FCB   $56                     ; E43E:  'V' 56             RORB  ; 
                   // FCB   $45                     ; E43F:  'E' 45             Invalid ; 
                   // FCB   $53                     ; E440:  'S' 53             COMB  ; 
                   // FCB   $20                     ; E441:  ' ' 20 B2          BRA   $E3F5 ; 
                   // FCB   $B2                     ; E442:  ' ' B2 35 20       SBCA  $3520 ; 
                   // FCB   $35                     ; E443:  '5' 35 20          PULS  Y ; 
                   // FCB   $20                     ; E444:  ' ' 20 47          BRA   $E48D ; 
                   // FCB   $47                     ; E445:  'G' 47             ASRA  ; 
                   // FCB   $49                     ; E446:  'I' 49             ROLA  ; 
                   // FCB   $56                     ; E447:  'V' 56             RORB  ; 
                   // FCB   $45                     ; E448:  'E' 45             Invalid ; 
                   // FCB   $53                     ; E449:  'S' 53             COMB  ; 
                   // FCB   $20                     ; E44A:  ' ' 20 B1          BRA   $E3FD ; 
                   // FCB   $B1                     ; E44B:  ' ' B1 33 20       CMPA  $3320 ; 
                   // FCB   $33                     ; E44C:  '3' 33 20          LEAU  0,Y ; 
                   // FCB   $20                     ; E44D:  ' ' 20 47          BRA   $E496 ; 
                   // FCB   $47                     ; E44E:  'G' 47             ASRA  ; 
                   // FCB   $49                     ; E44F:  'I' 49             ROLA  ; 
                   // FCB   $56                     ; E450:  'V' 56             RORB  ; 
                   // FCB   $45                     ; E451:  'E' 45             Invalid ; 
                   // FCB   $53                     ; E452:  'S' 53             COMB  ; 
                   // FCB   $20                     ; E453:  ' ' 20 B1          BRA   $E406 ; 
                   // FCB   $B1                     ; E454:  ' ' B1 4E 4F       CMPA  $4E4F ; 
                   // FCB   $B9                     ; E45C:  ' ' B9 45 41       ADCA  $4541 ; 
                   // FCB   $B1                     ; E475:  ' ' B1 B2 B3       CMPA  $B2B3 ; 
                   // FCB   $B2                     ; E476:  ' ' B2 B3 59       SBCA  $B359 ; 
                   // FCB   $B3                     ; E477:  ' ' B3 59 45       SUBD  $5945 ; 
                   // FCB   $50                     ; E4C1:  'P' 50             NEGB  ; 
                   // FCB   $41                     ; E4C2:  'A' 41             Invalid ; 
                   // FCB   $52                     ; E4C3:  'R' 52             Invalid ; 
                   // FCB   $45                     ; E4C4:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E4C5:  ' ' 20 B1          BRA   $E478 ; 
                   // FCB   $B1                     ; E4C6:  ' ' B1 53 45       CMPA  $5345 ; 
                   // FCB   $49                     ; E4E6:  'I' 49             ROLA  ; 
                   // FCB   $47                     ; E4E7:  'G' 47             ASRA  ; 
                   // FCB   $48                     ; E4E8:  'H' 48             ASLA  ; 
                   // FCB   $54                     ; E4E9:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E4EA:  ' ' 20 43          BRA   $E52F ; 
                   // FCB   $43                     ; E4EB:  'C' 43             COMA  ; 
                   // FCB   $4F                     ; E4EC:  'O' 4F             CLRA  ; 
                   // FCB   $49                     ; E4ED:  'I' 49             ROLA  ; 
                   // FCB   $CE                     ; E4EE:  ' ' CE A0 4C       LDU   #$A04C ; 
                   // FCB   $A0                     ; E4EF:  ' ' A0 4C          SUBA  12,U ; 
                   // FCB   $50                     ; E506:  'P' 50             NEGB  ; 
                   // FCB   $41                     ; E507:  'A' 41             Invalid ; 
                   // FCB   $52                     ; E508:  'R' 52             Invalid ; 
                   // FCB   $45                     ; E509:  'E' 45             Invalid ; 
                   // FCB   $20                     ; E50A:  ' ' 20 B2          BRA   $E4BE ; 
                   // FCB   $B2                     ; E50B:  ' ' B2 A0 50       SBCA  $A050 ; 
                   // FCB   $A0                     ; E50C:  ' ' A0 50          SUBA  -16,U ; 
                   // FCB   $41                     ; E549:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E54A:  'T' 54             LSRB  ; 
                   // FCB   $48                     ; E54B:  'H' 48             ASLA  ; 
                   // FCB   $20                     ; E54C:  ' ' 20 52          BRA   $E5A0 ; 
                   // FCB   $52                     ; E54D:  'R' 52             Invalid ; 
                   // FCB   $41                     ; E54E:  'A' 41             Invalid ; 
                   // FCB   $4D                     ; E54F:  'M' 4D             TSTA  ; 
                   // FCB   $20                     ; E550:  ' ' 20 41          BRA   $E593 ; 
                   // FCB   $41                     ; E551:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E552:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E553:  ' ' 20 35          BRA   $E58A ; 
                   // FCB   $35                     ; E554:  '5' 35 C6          PULS  PC,U,B,A ; 
                   // FCB   $C6                     ; E555:  ' ' C6 4D          LDB   #$4D ; 
                   // FCB   $47                     ; E565:  'G' 47             ASRA  ; 
                   // FCB   $20                     ; E566:  ' ' 20 52          BRA   $E5BA ; 
                   // FCB   $52                     ; E567:  'R' 52             Invalid ; 
                   // FCB   $41                     ; E568:  'A' 41             Invalid ; 
                   // FCB   $4D                     ; E569:  'M' 4D             TSTA  ; 
                   // FCB   $30                     ; E56A:  '0' 30 20          LEAX  0,Y ; 
                   // FCB   $20                     ; E56B:  ' ' 20 41          BRA   $E5AE ; 
                   // FCB   $41                     ; E56C:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E56D:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E56E:  ' ' 20 33          BRA   $E5A3 ; 
                   // FCB   $33                     ; E56F:  '3' 33 CC 56       LEAU  $56,PC ; 
                   // FCB   $CC                     ; E570:  ' ' CC 56 47       LDD   #$5647 ; 
                   // FCB   $47                     ; E58C:  'G' 47             ASRA  ; 
                   // FCB   $20                     ; E58D:  ' ' 20 52          BRA   $E5E1 ; 
                   // FCB   $52                     ; E58E:  'R' 52             Invalid ; 
                   // FCB   $41                     ; E58F:  'A' 41             Invalid ; 
                   // FCB   $4D                     ; E590:  'M' 4D             TSTA  ; 
                   // FCB   $33                     ; E591:  '3' 33 20          LEAU  0,Y ; 
                   // FCB   $20                     ; E592:  ' ' 20 41          BRA   $E5D5 ; 
                   // FCB   $41                     ; E593:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E594:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E595:  ' ' 20 34          BRA   $E5CB ; 
                   // FCB   $34                     ; E596:  '4' 34 CC          PSHS  PC,U,DP,B ; 
                   // FCB   $CC                     ; E597:  ' ' CC 56 47       LDD   #$5647 ; 
                   // FCB   $52                     ; E5C9:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; E5CA:  'O' 4F             CLRA  ; 
                   // FCB   $47                     ; E5CB:  'G' 47             ASRA  ; 
                   // FCB   $52                     ; E5CC:  'R' 52             Invalid ; 
                   // FCB   $41                     ; E5CD:  'A' 41             Invalid ; 
                   // FCB   $4D                     ; E5CE:  'M' 4D             TSTA  ; 
                   // FCB   $20                     ; E5CF:  ' ' 20 52          BRA   $E623 ; 
                   // FCB   $52                     ; E5D0:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; E5D1:  'O' 4F             CLRA  ; 
                   // FCB   $4D                     ; E5D2:  'M' 4D             TSTA  ; 
                   // FCB   $30                     ; E5D3:  '0' 30 20          LEAX  0,Y ; 
                   // FCB   $20                     ; E5D4:  ' ' 20 41          BRA   $E617 ; 
                   // FCB   $41                     ; E5D5:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E5D6:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E5D7:  ' ' 20 31          BRA   $E60A ; 
                   // FCB   $31                     ; E5D8:  '1' 31 C6          LEAY  A,U ; 
                   // FCB   $C6                     ; E5D9:  ' ' C6 50          LDB   #$50 ; 
                   // FCB   $52                     ; E601:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; E602:  'O' 4F             CLRA  ; 
                   // FCB   $47                     ; E603:  'G' 47             ASRA  ; 
                   // FCB   $52                     ; E604:  'R' 52             Invalid ; 
                   // FCB   $41                     ; E605:  'A' 41             Invalid ; 
                   // FCB   $4D                     ; E606:  'M' 4D             TSTA  ; 
                   // FCB   $20                     ; E607:  ' ' 20 52          BRA   $E65B ; 
                   // FCB   $52                     ; E608:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; E609:  'O' 4F             CLRA  ; 
                   // FCB   $4D                     ; E60A:  'M' 4D             TSTA  ; 
                   // FCB   $33                     ; E60B:  '3' 33 20          LEAU  0,Y ; 
                   // FCB   $20                     ; E60C:  ' ' 20 41          BRA   $E64F ; 
                   // FCB   $41                     ; E60D:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E60E:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E60F:  ' ' 20 31          BRA   $E642 ; 
                   // FCB   $31                     ; E610:  '1' 31 4B          LEAY  11,U ; 
                   // FCB   $4B                     ; E611:  'K' 4B             Invalid ; 
                   // FCB   $CC                     ; E612:  ' ' CC 50 52       LDD   #$5052 ; 
                   // FCB   $47                     ; E626:  'G' 47             ASRA  ; 
                   // FCB   $20                     ; E627:  ' ' 20 52          BRA   $E67B ; 
                   // FCB   $52                     ; E628:  'R' 52             Invalid ; 
                   // FCB   $4F                     ; E629:  'O' 4F             CLRA  ; 
                   // FCB   $4D                     ; E62A:  'M' 4D             TSTA  ; 
                   // FCB   $20                     ; E62B:  ' ' 20 41          BRA   $E66E ; 
                   // FCB   $41                     ; E62C:  'A' 41             Invalid ; 
                   // FCB   $54                     ; E62D:  'T' 54             LSRB  ; 
                   // FCB   $20                     ; E62E:  ' ' 20 31          BRA   $E661 ; 
                   // FCB   $31                     ; E62F:  '1' 31 CC 4D       LEAY  $4D,PC ; 
                   // FCB   $CC                     ; E630:  ' ' CC 4D 41       LDD   #$4D41 ; 
                   // FCB   $4F                     ; E6E9:  'O' 4F             CLRA  ; 
                   // FCB   $46                     ; E6EA:  'F' 46             RORA  ; 
                   // FCB   $C6                     ; E6EB:  ' ' C6 31          LDB   #$31 ; 
    // =============== S U B R O U T I N E =======================================
  case 0xE764:
                                                     mon("LE764    LDA   ,X                      ; E764: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xE766; JUMP; // sstep
case 0xE766:
                                                     mon("         JSR   Display_Vect_BCD        ; E766: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xE769:
                                                     mon("LE769    LDA   <$AD                    ; E769: 96 AD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xad); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xE76B; JUMP; // sstep
case 0xE76B:
                                                     mon("         BGT   LE772                   ; E76B: 2E 05         \n"); // Display BCD number text
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xe772; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE76D; JUMP; // sstep
case 0xE76D:
                                                     mon("         LDD   #$B913                  ; E76D: CC B9 13      \n");
    clockticks = clockticks + 3; 
    A = 0xb9; 
    B = 0x13; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    // End of function sub_E764
    PC = 0xE770; JUMP; // sstep
case 0xE770:
                                                     mon("         STD   ,Y++                    ; E770: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // =============== S U B R O U T I N E =======================================
    // Display BCD number text
    PC = 0xE772; JUMP; // sstep
case 0xE772:
                                                     mon("LE772    LDA   $01,X                   ; E772: A6 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0001)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xE774; JUMP; // sstep
case 0xE774:
                                                     mon("         JSR   Display_Vect_BCD        ; E774: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xE777:
                                                     mon("LE777    LDA   $02,X                   ; E777: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0xE779; JUMP; // sstep
case 0xE779:
                                                     mon("         LSRA                          ; E779: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE77A; JUMP; // sstep
case 0xE77A:
                                                     mon("         LSRA                          ; E77A: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE77B; JUMP; // sstep
case 0xE77B:
                                                     mon("         LSRA                          ; E77B: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE77C; JUMP; // sstep
case 0xE77C:
                                                     mon("         LSRA                          ; E77C: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE77D; JUMP; // sstep
case 0xE77D:
                                                     mon("         JSR   LE7AD                   ; E77D: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x80); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0xE780:
                                                     mon("LE780    LDA   <$AD                    ; E780: 96 AD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xad); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xE782; JUMP; // sstep
case 0xE782:
                                                     mon("         BGT   LE789                   ; E782: 2E 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xe789; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE784; JUMP; // sstep
case 0xE784:
                                                     mon("         LDD   #$B913                  ; E784: CC B9 13      \n");
    clockticks = clockticks + 3; 
    A = 0xb9; 
    B = 0x13; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE787; JUMP; // sstep
case 0xE787:
                                                     mon("         STD   ,Y++                    ; E787: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xE789; JUMP; // sstep
case 0xE789:
                                                     mon("LE789    LDA   $02,X                   ; E789: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xE78B; JUMP; // sstep
case 0xE78B:
                                                     mon("         JSR   LE7AD                   ; E78B: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
    // End of function sub_E772
  case 0xE78E:
                                                     mon("LE78E    LDA   $03,X                   ; E78E: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    // =============== S U B R O U T I N E =======================================
    // Display BCD numbers
    PC = 0xE790; JUMP; // sstep
case 0xE790:
                                                     mon("Display_Vect_BCD TFR   A,B                     ; E790: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xE792; JUMP; // sstep
case 0xE792:
                                                     mon("         LSRB                          ; E792: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE793; JUMP; // sstep
case 0xE793:
                                                     mon("         LSRB                          ; E793: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE794; JUMP; // sstep
case 0xE794:
                                                     mon("         LSRB                          ; E794: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xE795; JUMP; // sstep
case 0xE795:
                                                     mon("         ANDB  #$1E                    ; E795: C4 1E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x1e; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xE797; JUMP; // sstep
case 0xE797:
                                                     mon("         BNE   LE7A2                   ; E797: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe7a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE799; JUMP; // sstep
case 0xE799:
                                                     mon("         TST   <$AD                    ; E799: 0D AD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xad); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xE79B; JUMP; // sstep
case 0xE79B:
                                                     mon("         BLE   LE7A2                   ; E79B: 2F 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xe7a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE79D; JUMP; // sstep
case 0xE79D:
                                                     mon("         LDU   $3002                   ; E79D: FE 30 02      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x3002)<<8; 
    ea = ea | rd_mem(0x3003); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xE7A0; JUMP; // sstep
case 0xE7A0:
                                                     mon("         BRA   LE7A9                   ; E7A0: 20 07         \n");
    PC = 0xe7a9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE7A2:
                                                     mon("LE7A2    CLR   <$AD                    ; E7A2: 0F AD         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xad, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xE7A4; JUMP; // sstep
case 0xE7A4:
                                                     mon("         LDU   #$3004                  ; E7A4: CE 30 04      \n");
    clockticks = clockticks + 3; 
    U = 0x3004; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xE7A7; JUMP; // sstep
case 0xE7A7:
                                                     mon("         LDU   B,U                     ; E7A7: EE C5         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + (SINT8)B))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + (SINT8)B))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xE7A9; JUMP; // sstep
case 0xE7A9:
                                                     mon("LE7A9    DEC   <$AD                    ; E7A9: 0A AD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xad); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0xad, res); 
    clockticks = clockticks + 2; 
    PC = 0xE7AB; JUMP; // sstep
case 0xE7AB:
                                                     mon("         STU   ,Y++                    ; E7AB: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xE7AD; JUMP; // sstep
case 0xE7AD:
                                                     mon("LE7AD    ASLA                          ; E7AD: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xE7AE; JUMP; // sstep
case 0xE7AE:
                                                     mon("         ANDA  #$1E                    ; E7AE: 84 1E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1e; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xE7B0; JUMP; // sstep
case 0xE7B0:
                                                     mon("         BNE   LE7BB                   ; E7B0: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe7bb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE7B2; JUMP; // sstep
case 0xE7B2:
                                                     mon("         TST   <$AD                    ; E7B2: 0D AD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xad); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xE7B4; JUMP; // sstep
case 0xE7B4:
                                                     mon("         BLE   LE7BB                   ; E7B4: 2F 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xe7bb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE7B6; JUMP; // sstep
case 0xE7B6:
                                                     mon("         LDU   $3002                   ; E7B6: FE 30 02      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x3002)<<8; 
    ea = ea | rd_mem(0x3003); 
    U = ea; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0xE7B9; JUMP; // sstep
case 0xE7B9:
                                                     mon("         BRA   LE7C2                   ; E7B9: 20 07         \n");
    PC = 0xe7c2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE7BB:
                                                     mon("LE7BB    CLR   <$AD                    ; E7BB: 0F AD         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xad, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xE7BD; JUMP; // sstep
case 0xE7BD:
                                                     mon("         LDU   #$3004                  ; E7BD: CE 30 04      \n");
    clockticks = clockticks + 3; 
    U = 0x3004; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xE7C0; JUMP; // sstep
case 0xE7C0:
                                                     mon("         LDU   A,U                     ; E7C0: EE C6         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + (SINT8)A))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + (SINT8)A))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xE7C2; JUMP; // sstep
case 0xE7C2:
                                                     mon("LE7C2    DEC   <$AD                    ; E7C2: 0A AD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xad); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0xad, res); 
    clockticks = clockticks + 2; 
    PC = 0xE7C4; JUMP; // sstep
case 0xE7C4:
                                                     mon("         STU   ,Y++                    ; E7C4: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    // End of function Display_Vect_BCD
    PC = 0xE7C6; JUMP; // sstep
case 0xE7C6:
                                                     mon("         RTS                           ; E7C6: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Print text string from pointer table
  case 0xE7C7:
                                                     mon("LE7C7    CMPB  #$D6                    ; E7C7: C1 D6         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xd6; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE7C9; JUMP; // sstep
case 0xE7C9:
                                                     mon("         BCC   locret_E7D2             ; E7C9: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xe7d2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE7CB; JUMP; // sstep
case 0xE7CB:
                                                     mon("         STB   $48AE                   ; E7CB: F7 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x48ae, val); 
    PC = 0xE7CE; JUMP; // sstep
case 0xE7CE:
                                                     mon("         BSR   LE7DD                   ; E7CE: 8D 0D         \n"); // Insert text colour vector instruction
    S = S - 1; 
    wr_mem(S, 0xd0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 7; 
    PC = 0xe7dd; 
    JUMP;
  case 0xE7D0:
                                                     mon("LE7D0    BSR   LE7EA                   ; E7D0: 8D 18         \n"); // Insert text position vector instruction
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 7; 
    PC = 0xe7ea; 
    JUMP;
    // End of function sub_E7C7
  case 0xE7D2:
                                                     mon("locret_E7D2 RTS                           ; E7D2: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xE7D3:
                                                     mon("LE7D3    CMPB  #$D6                    ; E7D3: C1 D6         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xd6; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE7D5; JUMP; // sstep
case 0xE7D5:
                                                     mon("         BCC   locret_E7DC             ; E7D5: 24 05         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xe7dc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE7D7; JUMP; // sstep
case 0xE7D7:
                                                     mon("         STB   $48AE                   ; E7D7: F7 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x48ae, val); 
    PC = 0xE7DA; JUMP; // sstep
case 0xE7DA:
                                                     mon("         BSR   LE7EA                   ; E7DA: 8D 0E         \n"); // Insert text position vector instruction
    S = S - 1; 
    wr_mem(S, 0xdc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    clockticks = clockticks + 7; 
    PC = 0xe7ea; 
    JUMP;
    // End of function sub_E7D3
  case 0xE7DC:
                                                     mon("locret_E7DC RTS                           ; E7DC: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert text colour vector instruction
  case 0xE7DD:
                                                     mon("LE7DD    LDB   $48AE                   ; E7DD: F6 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48ae); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xE7E0; JUMP; // sstep
case 0xE7E0:
                                                     mon("         LDX   #word_EDA8              ; E7E0: 8E ED A8      \n"); // Text string colour
    clockticks = clockticks + 3; 
    X = 0xeda8; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE7E3; JUMP; // sstep
case 0xE7E3:
                                                     mon("         ABX                           ; E7E3: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE7E4; JUMP; // sstep
case 0xE7E4:
                                                     mon("         ABX                           ; E7E4: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE7E5; JUMP; // sstep
case 0xE7E5:
                                                     mon("         LDD   ,X                      ; E7E5: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE7E7; JUMP; // sstep
case 0xE7E7:
                                                     mon("         STD   ,Y++                    ; E7E7: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_E7DD
    PC = 0xE7E9; JUMP; // sstep
case 0xE7E9:
                                                     mon("         RTS                           ; E7E9: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Insert text position vector instruction
  case 0xE7EA:
                                                     mon("LE7EA    LDB   $48AE                   ; E7EA: F6 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48ae); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xE7ED; JUMP; // sstep
case 0xE7ED:
                                                     mon("         LDX   #word_EA50              ; E7ED: 8E EA 50      \n"); // Text string position
    clockticks = clockticks + 3; 
    X = 0xea50; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE7F0; JUMP; // sstep
case 0xE7F0:
                                                     mon("         ABX                           ; E7F0: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE7F1; JUMP; // sstep
case 0xE7F1:
                                                     mon("         ABX                           ; E7F1: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE7F2; JUMP; // sstep
case 0xE7F2:
                                                     mon("         ABX                           ; E7F2: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE7F3; JUMP; // sstep
case 0xE7F3:
                                                     mon("         ABX                           ; E7F3: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE7F4; JUMP; // sstep
case 0xE7F4:
                                                     mon("         LDD   $02,X                   ; E7F4: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE7F6; JUMP; // sstep
case 0xE7F6:
                                                     mon("         STD   ,Y++                    ; E7F6: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xE7F8; JUMP; // sstep
case 0xE7F8:
                                                     mon("         LDD   ,X                      ; E7F8: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xE7FA; JUMP; // sstep
case 0xE7FA:
                                                     mon("         BRA   LE811                   ; E7FA: 20 15         \n");
    PC = 0xe811; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE7FC:
                                                     mon("LE7FC    LDB   $48AE                   ; E7FC: F6 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48ae); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xE7FF; JUMP; // sstep
case 0xE7FF:
                                                     mon("         LDX   #word_EA50              ; E7FF: 8E EA 50      \n"); // Text string position
    clockticks = clockticks + 3; 
    X = 0xea50; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE802; JUMP; // sstep
case 0xE802:
                                                     mon("         ABX                           ; E802: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE803; JUMP; // sstep
case 0xE803:
                                                     mon("         ABX                           ; E803: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE804; JUMP; // sstep
case 0xE804:
                                                     mon("         ABX                           ; E804: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE805; JUMP; // sstep
case 0xE805:
                                                     mon("         ABX                           ; E805: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE806; JUMP; // sstep
case 0xE806:
                                                     mon("         LDD   $02,X                   ; E806: EC 02         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + 0x0002); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE808; JUMP; // sstep
case 0xE808:
                                                     mon("         SUBD  $48AF                   ; E808: B3 48 AF      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x48af)<<8; 
    ea = ea | rd_mem(0x48b0); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xE80B; JUMP; // sstep
case 0xE80B:
                                                     mon("         ANDA  #$1F                    ; E80B: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xE80D; JUMP; // sstep
case 0xE80D:
                                                     mon("         STD   ,Y++                    ; E80D: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xE80F; JUMP; // sstep
case 0xE80F:
                                                     mon("         LDD   ,X                      ; E80F: EC 84         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE811; JUMP; // sstep
case 0xE811:
                                                     mon("LE811    STD   ,Y++                    ; E811: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xE813; JUMP; // sstep
case 0xE813:
                                                     mon("         JSR   LE821                   ; E813: BD E8 21      \n"); // Text handling
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xe8); 
    clockticks = clockticks + 1; 
    PC = 0xe821; 
    JUMP;
  case 0xE816:
                                                     mon("LE816    LDD   #$7200                  ; E816: CC 72 00      \n"); // Vector SCAL 2,0 instruction
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE819; JUMP; // sstep
case 0xE819:
                                                     mon("         STD   ,Y++                    ; E819: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xE81B; JUMP; // sstep
case 0xE81B:
                                                     mon("         LDD   #$8040                  ; E81B: CC 80 40      \n"); // Vector CNTR instruction
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE81E; JUMP; // sstep
case 0xE81E:
                                                     mon("         STD   ,Y++                    ; E81E: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // End of function sub_E7EA
    PC = 0xE820; JUMP; // sstep
case 0xE820:
                                                     mon("         RTS                           ; E820: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Text handling
  case 0xE821:
                                                     mon("LE821    LDX   #ptrText                ; E821: 8E E8 94      \n");
    clockticks = clockticks + 3; 
    X = 0xe894; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE824; JUMP; // sstep
case 0xE824:
                                                     mon("         LDB   $48AE                   ; E824: F6 48 AE      \n"); // Text string index
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48ae); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xE827; JUMP; // sstep
case 0xE827:
                                                     mon("         ABX                           ; E827: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE828; JUMP; // sstep
case 0xE828:
                                                     mon("         ABX                           ; E828: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xE829; JUMP; // sstep
case 0xE829:
                                                     mon("         LDX   ,X                      ; E829: AE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE82B; JUMP; // sstep
case 0xE82B:
                                                     mon("LE82B    LDB   ,X+                     ; E82B: E6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xE82D; JUMP; // sstep
case 0xE82D:
                                                     mon("         STX   $48B1                   ; E82D: BF 48 B1      \n");
    clockticks = clockticks + 5; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x48b1, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x48b2, (UINT8)val); 
    PC = 0xE830; JUMP; // sstep
case 0xE830:
                                                     mon("         ASLB                          ; E830: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xE831; JUMP; // sstep
case 0xE831:
                                                     mon("         CMPB  #$82                    ; E831: C1 82         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x82; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE833; JUMP; // sstep
case 0xE833:
                                                     mon("         BCS   LE83C                   ; E833: 25 07         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xe83c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE835; JUMP; // sstep
case 0xE835:
                                                     mon("         LDX   #$3016                  ; E835: 8E 30 16      \n");
    clockticks = clockticks + 3; 
    X = 0x3016; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE838; JUMP; // sstep
case 0xE838:
                                                     mon("         ANDB  #$7F                    ; E838: C4 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x7f; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xE83A; JUMP; // sstep
case 0xE83A:
                                                     mon("         BRA   LE888                   ; E83A: 20 4C         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE83C:
                                                     mon("LE83C    CMPB  #$74                    ; E83C: C1 74         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x74; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE83E; JUMP; // sstep
case 0xE83E:
                                                     mon("         BNE   LE845                   ; E83E: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe845; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE840; JUMP; // sstep
case 0xE840:
                                                     mon("         LDX   #$2FDE                  ; E840: 8E 2F DE      \n");
    clockticks = clockticks + 3; 
    X = 0x2fde; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE843; JUMP; // sstep
case 0xE843:
                                                     mon("         BRA   LE888                   ; E843: 20 43         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE845:
                                                     mon("LE845    CMPB  #$80                    ; E845: C1 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x80; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE847; JUMP; // sstep
case 0xE847:
                                                     mon("         BNE   LE84F                   ; E847: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe84f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE849; JUMP; // sstep
case 0xE849:
                                                     mon("         LDX   #$3058                  ; E849: 8E 30 58      \n");
    clockticks = clockticks + 3; 
    X = 0x3058; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE84C; JUMP; // sstep
case 0xE84C:
                                                     mon("         CLRB                          ; E84C: 5F            \n");
    B = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xE84D; JUMP; // sstep
case 0xE84D:
                                                     mon("         BRA   LE888                   ; E84D: 20 39         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE84F:
                                                     mon("LE84F    CMPB  #$60                    ; E84F: C1 60         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x60; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE851; JUMP; // sstep
case 0xE851:
                                                     mon("         BCS   LE858                   ; E851: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xe858; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE853; JUMP; // sstep
case 0xE853:
                                                     mon("         LDX   #$2FA4                  ; E853: 8E 2F A4      \n");
    clockticks = clockticks + 3; 
    X = 0x2fa4; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE856; JUMP; // sstep
case 0xE856:
                                                     mon("         BRA   LE888                   ; E856: 20 30         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE858:
                                                     mon("LE858    CMPB  #$40                    ; E858: C1 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x40; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE85A; JUMP; // sstep
case 0xE85A:
                                                     mon("         BNE   LE861                   ; E85A: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe861; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE85C; JUMP; // sstep
case 0xE85C:
                                                     mon("         LDX   #$2FC2                  ; E85C: 8E 2F C2      \n");
    clockticks = clockticks + 3; 
    X = 0x2fc2; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE85F; JUMP; // sstep
case 0xE85F:
                                                     mon("         BRA   LE888                   ; E85F: 20 27         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE861:
                                                     mon("LE861    CMPB  #$4E                    ; E861: C1 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x4e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE863; JUMP; // sstep
case 0xE863:
                                                     mon("         BNE   LE86A                   ; E863: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe86a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE865; JUMP; // sstep
case 0xE865:
                                                     mon("         LDX   #$2FFE                  ; E865: 8E 2F FE      \n");
    clockticks = clockticks + 3; 
    X = 0x2ffe; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE868; JUMP; // sstep
case 0xE868:
                                                     mon("         BRA   LE888                   ; E868: 20 1E         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE86A:
                                                     mon("LE86A    CMPB  #$58                    ; E86A: C1 58         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x58; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE86C; JUMP; // sstep
case 0xE86C:
                                                     mon("         BNE   LE873                   ; E86C: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe873; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE86E; JUMP; // sstep
case 0xE86E:
                                                     mon("         LDX   #$2FF6                  ; E86E: 8E 2F F6      \n");
    clockticks = clockticks + 3; 
    X = 0x2ff6; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE871; JUMP; // sstep
case 0xE871:
                                                     mon("         BRA   LE888                   ; E871: 20 15         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE873:
                                                     mon("LE873    CMPB  #$5A                    ; E873: C1 5A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x5a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE875; JUMP; // sstep
case 0xE875:
                                                     mon("         BNE   LE87C                   ; E875: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe87c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE877; JUMP; // sstep
case 0xE877:
                                                     mon("         LDX   #$3000                  ; E877: 8E 30 00      \n");
    clockticks = clockticks + 3; 
    X = 0x3000; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE87A; JUMP; // sstep
case 0xE87A:
                                                     mon("         BRA   LE888                   ; E87A: 20 0C         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE87C:
                                                     mon("LE87C    CMPB  #$4A                    ; E87C: C1 4A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x4a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xE87E; JUMP; // sstep
case 0xE87E:
                                                     mon("         BNE   LE885                   ; E87E: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xe885; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xE880; JUMP; // sstep
case 0xE880:
                                                     mon("         LDX   #$300C                  ; E880: 8E 30 0C      \n");
    clockticks = clockticks + 3; 
    X = 0x300c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xE883; JUMP; // sstep
case 0xE883:
                                                     mon("         BRA   LE888                   ; E883: 20 03         \n");
    PC = 0xe888; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xE885:
                                                     mon("LE885    LDX   #$2FF4                  ; E885: 8E 2F F4      \n");
    clockticks = clockticks + 3; 
    X = 0x2ff4; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE888; JUMP; // sstep
case 0xE888:
                                                     mon("LE888    LDD   B,X                     ; E888: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xE88A; JUMP; // sstep
case 0xE88A:
                                                     mon("         STD   ,Y++                    ; E88A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xE88C; JUMP; // sstep
case 0xE88C:
                                                     mon("         LDX   $48B1                   ; E88C: BE 48 B1      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x48b1)<<8; 
    ea = ea | rd_mem(0x48b2); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xE88F; JUMP; // sstep
case 0xE88F:
                                                     mon("         TST   -1,X                    ; E88F: 6D 1F         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0xffff)); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xE891; JUMP; // sstep
case 0xE891:
                                                     mon("         BPL   LE82B                   ; E891: 2A 98         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xe82b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_E821
    // ---------------------------------------------------------------------------
    PC = 0xE893; JUMP; // sstep
case 0xE893:
                                                     mon("         RTS                           ; E893: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Attributes: noreturn
    // End of function BADIRQ
  case 0xEF54:
                                                     mon("BADIRQ   BRA   BADIRQ                  ; EF54: 20 FE         \n"); // public BADIRQ
    PC = 0xef54; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0xEF56:
                                                     mon("IRQ      LDX   $0A,S                   ; EF56: AE 6A         \n"); // public IRQ
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(S + 0x000a))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(S + 0x000a))+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xEF58; JUMP; // sstep
case 0xEF58:
                                                     mon("         CMPX  #$6000                  ; EF58: 8C 60 00      \n"); // Bounds check for return address in ROM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x6000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xEF5B; JUMP; // sstep
case 0xEF5B:
                                                     mon("         BCC   LEF5E                   ; EF5B: 24 01         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xef5e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEF5D; JUMP; // sstep
case 0xEF5D:
                                                     mon("         SWI                           ; EF5D: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x5e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xEF5E:
                                                     mon("LEF5E    CMPX  #BADIRQ                 ; EF5E: 8C EF 54      \n"); // Only allow IRQ calls from lower in ROM than BADIRQ function
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0xef54; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xEF61; JUMP; // sstep
case 0xEF61:
                                                     mon("         BCS   LEF64                   ; EF61: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xef64; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEF63; JUMP; // sstep
case 0xEF63:
                                                     mon("         SWI                           ; EF63: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xEF64:
                                                     mon("LEF64    LDA   #$48                    ; EF64: 86 48         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x48; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEF66; JUMP; // sstep
case 0xEF66:
                                                     mon("         TFR   A,DP                    ; EF66: 1F 8B         \n");
    DP = (A) << 8; checkDP(); 
    // memory_DP = &memory[DP];
    clockticks = clockticks + 6; 
    PC = 0xEF68; JUMP; // sstep
case 0xEF68:
                                                     mon("         STA   $4640                   ; EF68: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xEF6B; JUMP; // sstep
case 0xEF6B:
                                                     mon("         LDA   <$00                    ; EF6B: 96 00         \n"); // Check sanity byte is $3F
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x00); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEF6D; JUMP; // sstep
case 0xEF6D:
                                                     mon("         CMPA  #$3F                    ; EF6D: 81 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x3f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xEF6F; JUMP; // sstep
case 0xEF6F:
                                                     mon("         BEQ   LEF72                   ; EF6F: 27 01         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xef72; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEF71; JUMP; // sstep
case 0xEF71:
                                                     mon("         SWI                           ; EF71: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xEF72:
                                                     mon("LEF72    DEC   <$3E                    ; EF72: 0A 3E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3e); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x3e, res); 
    clockticks = clockticks + 2; 
    PC = 0xEF74; JUMP; // sstep
case 0xEF74:
                                                     mon("         BPL   LEF7F                   ; EF74: 2A 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xef7f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEF76; JUMP; // sstep
case 0xEF76:
                                                     mon("         LDA   #$0B                    ; EF76: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEF78; JUMP; // sstep
case 0xEF78:
                                                     mon("         STA   <$3E                    ; EF78: 97 3E         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x3e; 
    wr_mem(ea, val); 
    PC = 0xEF7A; JUMP; // sstep
case 0xEF7A:
                                                     mon("         INC   <$3D                    ; EF7A: 0C 3D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3d); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x3d, res); 
    clockticks = clockticks + 2; 
    PC = 0xEF7C; JUMP; // sstep
case 0xEF7C:
                                                     mon("         BVC   LEF7F                   ; EF7C: 28 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0xef7f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEF7E; JUMP; // sstep
case 0xEF7E:
                                                     mon("         SWI                           ; EF7E: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x7f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xEF7F:
                                                     mon("LEF7F    INC   <$0A                    ; EF7F: 0C 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x0a, res); 
    clockticks = clockticks + 2; 
    PC = 0xEF81; JUMP; // sstep
case 0xEF81:
                                                     mon("         JSR   LD776                   ; EF81: BD D7 76      \n"); // Check coin inputs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    PC = 0xd776; 
    JUMP;
  case 0xEF84:
                                                     mon("LEF84    LDA   <$14                    ; EF84: 96 14         \n"); // Credits
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEF86; JUMP; // sstep
case 0xEF86:
                                                     mon("         CMPA  #$24                    ; EF86: 81 24         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x24; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xEF88; JUMP; // sstep
case 0xEF88:
                                                     mon("         BCS   LEF8B                   ; EF88: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xef8b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEF8A; JUMP; // sstep
case 0xEF8A:
                                                     mon("         SWI                           ; EF8A: 3F            \n");
    clockticks = clockticks + 19; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, U); 
    S = S - 1; 
    wr_mem(S, U >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, Y); 
    S = S - 1; 
    wr_mem(S, Y >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, X); 
    S = S - 1; 
    wr_mem(S, X >> 8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, (DP >> 8)); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, B); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    simplify_flags();
    CC = (((((((((((((E<<1) | F)<<1) | H)<<1) |I)<<1) | N)<<1) | Z)<<1) | V)<<1) | C; // Placeholder for now
    restore_flags();
    S = S - 1; 
    wr_mem(S, CC); 
    clockticks = clockticks + 1; 
    PC = (rd_mem(0xfffa)<<8)|rd_mem(0xfffb); 
    JUMP;
  case 0xEF8B:
                                                     mon("LEF8B    LDX   #$481C                  ; EF8B: 8E 48 1C      \n");
    clockticks = clockticks + 3; 
    X = 0x481c; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xEF8E; JUMP; // sstep
case 0xEF8E:
                                                     mon("         LDA   $4300                   ; EF8E: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xEF91; JUMP; // sstep
case 0xEF91:
                                                     mon("         JSR   LF133                   ; EF91: BD F1 33      \n"); // Inputs debounce
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    PC = 0xf133; 
    JUMP;
  case 0xEF94:
                                                     mon("LEF94    LDA   $4320                   ; EF94: B6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xEF97; JUMP; // sstep
case 0xEF97:
                                                     mon("         JSR   LF133                   ; EF97: BD F1 33      \n"); // Inputs debounce
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    PC = 0xf133; 
    JUMP;
  case 0xEF9A:
                                                     mon("LEF9A    LDA   $4340                   ; EF9A: B6 43 40      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4340); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xEF9D; JUMP; // sstep
case 0xEF9D:
                                                     mon("         JSR   LF133                   ; EF9D: BD F1 33      \n"); // Inputs debounce
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    PC = 0xf133; 
    JUMP;
  case 0xEFA0:
                                                     mon("LEFA0    LDA   $4360                   ; EFA0: B6 43 60      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4360); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xEFA3; JUMP; // sstep
case 0xEFA3:
                                                     mon("         JSR   LF133                   ; EFA3: BD F1 33      \n"); // Inputs debounce
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    PC = 0xf133; 
    JUMP;
  case 0xEFA6:
                                                     mon("LEFA6    LDA   <$33                    ; EFA6: 96 33         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x33); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFA8; JUMP; // sstep
case 0xEFA8:
                                                     mon("         STA   <$34                    ; EFA8: 97 34         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x34; 
    wr_mem(ea, val); 
    PC = 0xEFAA; JUMP; // sstep
case 0xEFAA:
                                                     mon("         LDA   $4821                   ; EFAA: B6 48 21      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4821); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFAD; JUMP; // sstep
case 0xEFAD:
                                                     mon("         ANDA  #$30                    ; EFAD: 84 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x30; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xEFAF; JUMP; // sstep
case 0xEFAF:
                                                     mon("         STA   -1,S                    ; EFAF: A7 7F         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(S + 0xffff); 
    wr_mem(ea, val); 
    PC = 0xEFB1; JUMP; // sstep
case 0xEFB1:
                                                     mon("         LDA   $481E                   ; EFB1: B6 48 1E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFB4; JUMP; // sstep
case 0xEFB4:
                                                     mon("         ANDA  #$CF                    ; EFB4: 84 CF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xcf; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xEFB6; JUMP; // sstep
case 0xEFB6:
                                                     mon("         ORA   -1,S                    ; EFB6: AA 7F         \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(S + 0xffff)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xEFB8; JUMP; // sstep
case 0xEFB8:
                                                     mon("         STA   <$33                    ; EFB8: 97 33         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x33; 
    wr_mem(ea, val); 
    PC = 0xEFBA; JUMP; // sstep
case 0xEFBA:
                                                     mon("         EORA  <$34                    ; EFBA: 98 34         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(DP|0x34); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xEFBC; JUMP; // sstep
case 0xEFBC:
                                                     mon("         ANDA  <$34                    ; EFBC: 94 34         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(DP|0x34); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xEFBE; JUMP; // sstep
case 0xEFBE:
                                                     mon("         STA   <$32                    ; EFBE: 97 32         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x32; 
    wr_mem(ea, val); 
    PC = 0xEFC0; JUMP; // sstep
case 0xEFC0:
                                                     mon("         LDA   <$32                    ; EFC0: 96 32         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x32); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFC2; JUMP; // sstep
case 0xEFC2:
                                                     mon("         ANDA  #$F0                    ; EFC2: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xEFC4; JUMP; // sstep
case 0xEFC4:
                                                     mon("         BEQ   LEFCA                   ; EFC4: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xefca; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFC6; JUMP; // sstep
case 0xEFC6:
                                                     mon("         ORA   <$31                    ; EFC6: 9A 31         \n");
    clockticks = clockticks + 4; 
    res = A | (UINT8)rd_mem(DP|0x31); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xEFC8; JUMP; // sstep
case 0xEFC8:
                                                     mon("         STA   <$31                    ; EFC8: 97 31         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x31; 
    wr_mem(ea, val); 
    PC = 0xEFCA; JUMP; // sstep
case 0xEFCA:
                                                     mon("LEFCA    JSR   LF146                   ; EFCA: BD F1 46      \n"); // Joystick processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    PC = 0xf146; 
    JUMP;
  case 0xEFCD:
                                                     mon("LEFCD    LDA   <$0A                    ; EFCD: 96 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xEFCF; JUMP; // sstep
case 0xEFCF:
                                                     mon("         BNE   LEFE6                   ; EFCF: 26 15         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xefe6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFD1; JUMP; // sstep
case 0xEFD1:
                                                     mon("         LDA   $4401                   ; EFD1: B6 44 01      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4401); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFD4; JUMP; // sstep
case 0xEFD4:
                                                     mon("         ASLA                          ; EFD4: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xEFD5; JUMP; // sstep
case 0xEFD5:
                                                     mon("         BPL   LEFDE                   ; EFD5: 2A 07         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xefde; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFD7; JUMP; // sstep
case 0xEFD7:
                                                     mon("         LDA   $4400                   ; EFD7: B6 44 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4400); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFDA; JUMP; // sstep
case 0xEFDA:
                                                     mon("         CMPA  #$5A                    ; EFDA: 81 5A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x5a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xEFDC; JUMP; // sstep
case 0xEFDC:
                                                     mon("         BEQ   LEFE6                   ; EFDC: 27 08         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xefe6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFDE; JUMP; // sstep
case 0xEFDE:
                                                     mon("LEFDE    STA   $46E0                   ; EFDE: B7 46 E0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46e0, val); 
    PC = 0xEFE1; JUMP; // sstep
case 0xEFE1:
                                                     mon("         LDA   #$00                    ; EFE1: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFE3; JUMP; // sstep
case 0xEFE3:
                                                     mon("         STA   $4400                   ; EFE3: B7 44 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4400, val); 
    PC = 0xEFE6; JUMP; // sstep
case 0xEFE6:
                                                     mon("LEFE6    LDA   <$0A                    ; EFE6: 96 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFE8; JUMP; // sstep
case 0xEFE8:
                                                     mon("         ANDA  #$03                    ; EFE8: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xEFEA; JUMP; // sstep
case 0xEFEA:
                                                     mon("         BNE   LF034                   ; EFEA: 26 48         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf034; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFEC; JUMP; // sstep
case 0xEFEC:
                                                     mon("         LDA   $481B                   ; EFEC: B6 48 1B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481b); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFEF; JUMP; // sstep
case 0xEFEF:
                                                     mon("         ADDA  #$01                    ; EFEF: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xEFF1; JUMP; // sstep
case 0xEFF1:
                                                     mon("         CMPA  #$FA                    ; EFF1: 81 FA         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xfa; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xEFF3; JUMP; // sstep
case 0xEFF3:
                                                     mon("         BCS   LEFF7                   ; EFF3: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xeff7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFF5; JUMP; // sstep
case 0xEFF5:
                                                     mon("         LDA   #$00                    ; EFF5: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFF7; JUMP; // sstep
case 0xEFF7:
                                                     mon("LEFF7    STA   $481B                   ; EFF7: B7 48 1B      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x481b, val); 
    PC = 0xEFFA; JUMP; // sstep
case 0xEFFA:
                                                     mon("         BNE   LF034                   ; EFFA: 26 38         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf034; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xEFFC; JUMP; // sstep
case 0xEFFC:
                                                     mon("         LDA   $481A                   ; EFFC: B6 48 1A      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xEFFF; JUMP; // sstep
case 0xEFFF:
                                                     mon("         ADDA  #$01                    ; EFFF: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xF001; JUMP; // sstep
case 0xF001:
                                                     mon("         DAA                           ; F001: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF002; JUMP; // sstep
case 0xF002:
                                                     mon("         STA   $481A                   ; F002: B7 48 1A      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x481a, val); 
    PC = 0xF005; JUMP; // sstep
case 0xF005:
                                                     mon("         LDA   $4819                   ; F005: B6 48 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4819); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF008; JUMP; // sstep
case 0xF008:
                                                     mon("         ADCA  #$00                    ; F008: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xF00A; JUMP; // sstep
case 0xF00A:
                                                     mon("         DAA                           ; F00A: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
    N = res; 
    Z = res; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF00B; JUMP; // sstep
case 0xF00B:
                                                     mon("         BCS   LF010                   ; F00B: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf010; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF00D; JUMP; // sstep
case 0xF00D:
                                                     mon("         STA   $4819                   ; F00D: B7 48 19      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4819, val); 
    PC = 0xF010; JUMP; // sstep
case 0xF010:
                                                     mon("LF010    LDA   $4B07                   ; F010: B6 4B 07      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b07); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF013; JUMP; // sstep
case 0xF013:
                                                     mon("         ADDA  #$01                    ; F013: 8B 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x01; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xF015; JUMP; // sstep
case 0xF015:
                                                     mon("         DAA                           ; F015: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF016; JUMP; // sstep
case 0xF016:
                                                     mon("         STA   $4B07                   ; F016: B7 4B 07      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b07, val); 
    PC = 0xF019; JUMP; // sstep
case 0xF019:
                                                     mon("         LDA   $4B06                   ; F019: B6 4B 06      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b06); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF01C; JUMP; // sstep
case 0xF01C:
                                                     mon("         ADCA  #$00                    ; F01C: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xF01E; JUMP; // sstep
case 0xF01E:
                                                     mon("         DAA                           ; F01E: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF01F; JUMP; // sstep
case 0xF01F:
                                                     mon("         STA   $4B06                   ; F01F: B7 4B 06      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b06, val); 
    PC = 0xF022; JUMP; // sstep
case 0xF022:
                                                     mon("         LDA   $4B05                   ; F022: B6 4B 05      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b05); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF025; JUMP; // sstep
case 0xF025:
                                                     mon("         ADCA  #$00                    ; F025: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xF027; JUMP; // sstep
case 0xF027:
                                                     mon("         DAA                           ; F027: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF028; JUMP; // sstep
case 0xF028:
                                                     mon("         STA   $4B05                   ; F028: B7 4B 05      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b05, val); 
    PC = 0xF02B; JUMP; // sstep
case 0xF02B:
                                                     mon("         LDA   $4B04                   ; F02B: B6 4B 04      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b04); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF02E; JUMP; // sstep
case 0xF02E:
                                                     mon("         ADCA  #$00                    ; F02E: 89 00         \n");
    clockticks = clockticks + 2; 
    arg = A; 
    val = (SINT8)0x00; 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    PC = 0xF030; JUMP; // sstep
case 0xF030:
                                                     mon("         DAA                           ; F030: 19            \n");
    res = A; 
    msn = res & 0xf0; 
    lsn = res & 0x0f; 
    res = res + (((lsn > 0x09) || (H & 0x10)) ? 0x06 : 0); 
    res = res + ((((UINT8)msn > 0x80U) && ((UINT8)lsn > 0x09U)) || (((UINT8)msn > 0x90U) || (C != 0)) ? 0x60 : 0); 
    C = C | (res & 0x100); 
    res = (UINT8)res; 
    A = res; 
/**/N = res; 
/**/Z = res; 
/**/V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF031; JUMP; // sstep
case 0xF031:
                                                     mon("         STA   $4B04                   ; F031: B7 4B 04      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b04, val); 
    PC = 0xF034; JUMP; // sstep
case 0xF034:
                                                     mon("LF034    DEC   <$40                    ; F034: 0A 40         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x40); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x40, res); 
    clockticks = clockticks + 2; 
    PC = 0xF036; JUMP; // sstep
case 0xF036:
                                                     mon("         BVC   LF041                   ; F036: 28 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0xf041; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF038; JUMP; // sstep
case 0xF038:
                                                     mon("         STA   $4620                   ; F038: B7 46 20      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4620, val); 
    PC = 0xF03B; JUMP; // sstep
case 0xF03B:
                                                     mon("         JSR   $611E                   ; F03B: BD 61 1E      \n"); // Copies Star Wars logo vector data to vector RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    PC = 0x611e; 
    JUMP;
  case 0xF03E:
                                                     mon("LF03E    JMP   LF12F                   ; F03E: 7E F1 2F      \n");
    clockticks = clockticks + 4; 
    PC = 0xf12f; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xF041:
                                                     mon("LF041    LBPL  LF12F                   ; F041: 10 2A 00 EA   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N >= 0) {
    clockticks = clockticks + 1; 
    PC = 0xf12f; 
    JUMP;
    }
    PC = 0xF045; JUMP; // sstep
case 0xF045:
                                                     mon("         LDA   $4320                   ; F045: B6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF048; JUMP; // sstep
case 0xF048:
                                                     mon("         ASLA                          ; F048: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
    Z = res; 
    N = res; 
    V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF049; JUMP; // sstep
case 0xF049:
                                                     mon("         LBPL  LF12F                   ; F049: 10 2A 00 E2   \n"); // If VGHALT is high, VG is ready
    clockticks = clockticks + 5; 
    if ((SINT8)N >= 0) {
    clockticks = clockticks + 1; 
    PC = 0xf12f; 
    JUMP;
    }
    PC = 0xF04D; JUMP; // sstep
case 0xF04D:
                                                     mon("         LDA   <$3F                    ; F04D: 96 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3f); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF04F; JUMP; // sstep
case 0xF04F:
                                                     mon("         BPL   LF06A                   ; F04F: 2A 19         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xf06a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF051; JUMP; // sstep
case 0xF051:
                                                     mon("         LDA   $00                     ; F051: B6 00 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x0000); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF054; JUMP; // sstep
case 0xF054:
                                                     mon("         ANDA  #$0A                    ; F054: 84 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0a; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF056; JUMP; // sstep
case 0xF056:
                                                     mon("         BEQ   LF05A                   ; F056: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf05a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF058; JUMP; // sstep
case 0xF058:
                                                     mon("         LDA   #$14                    ; F058: 86 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x14; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF05A; JUMP; // sstep
case 0xF05A:
                                                     mon("LF05A    ORA   #$00                    ; F05A: 8A 00         \n"); // What the heck is going on here???
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x00; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF05C; JUMP; // sstep
case 0xF05C:
                                                     mon("         STA   <$3F                    ; F05C: 97 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x3f; 
    wr_mem(ea, val); 
    PC = 0xF05E; JUMP; // sstep
case 0xF05E:
                                                     mon("         LDB   #$38                    ; F05E: C6 38         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x38; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF060; JUMP; // sstep
case 0xF060:
                                                     mon("         LSRA                          ; F060: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xF061; JUMP; // sstep
case 0xF061:
                                                     mon("         ANDA  #$0A                    ; F061: 84 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0a; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF063; JUMP; // sstep
case 0xF063:
                                                     mon("         EORA  #$0A                    ; F063: 88 0A         \n");
    clockticks = clockticks + 2; 
    res = A ^ (SINT8)0x0a; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF065; JUMP; // sstep
case 0xF065:
                                                     mon("         ORA   #$E0                    ; F065: 8A E0         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0xe0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF067; JUMP; // sstep
case 0xF067:
                                                     mon("         STD   $00                     ; F067: FD 00 00      \n"); // Seems to toggle vector address $0000 from $E038 and $EA38 JMPL $038 and $A38
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0000, A); // Care needed with I/O space and word fetches
    wr_mem(0x0001, B); 
    PC = 0xF06A; JUMP; // sstep
case 0xF06A:
                                                     mon("LF06A    DEC   <$28                    ; F06A: 0A 28         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x28); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x28, res); 
    clockticks = clockticks + 2; 
    PC = 0xF06C; JUMP; // sstep
case 0xF06C:
                                                     mon("         BPL   LF073                   ; F06C: 2A 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xf073; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF06E; JUMP; // sstep
case 0xF06E:
                                                     mon("         CLR   <$28                    ; F06E: 0F 28         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0x28, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF070; JUMP; // sstep
case 0xF070:
                                                     mon("         JSR   LF18D                   ; F070: BD F1 8D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    PC = 0xf18d; 
    JUMP;
  case 0xF073:
                                                     mon("LF073    JSR   LF22B                   ; F073: BD F2 2B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    PC = 0xf22b; 
    JUMP;
  case 0xF076:
                                                     mon("LF076    LDB   <$3A                    ; F076: D6 3A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3a); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF078; JUMP; // sstep
case 0xF078:
                                                     mon("         ADDB  #$02                    ; F078: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF07A; JUMP; // sstep
case 0xF07A:
                                                     mon("         CMPB  #$20                    ; F07A: C1 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x20; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF07C; JUMP; // sstep
case 0xF07C:
                                                     mon("         BCS   LF07F                   ; F07C: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf07f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF07E; JUMP; // sstep
case 0xF07E:
                                                     mon("         CLRB                          ; F07E: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF07F; JUMP; // sstep
case 0xF07F:
                                                     mon("LF07F    STB   <$3A                    ; F07F: D7 3A         \n"); // Colour cycle blue/cyan for lasers
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x3a; 
    wr_mem(ea, val); 
    PC = 0xF081; JUMP; // sstep
case 0xF081:
                                                     mon("         LDX   #$04                    ; F081: 8E 00 04      \n");
    clockticks = clockticks + 3; 
    X = 0x0004; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF084; JUMP; // sstep
case 0xF084:
                                                     mon("         ABX                           ; F084: 3A            \n"); // Points to jump table that jump into vector ROM for laser colour cycle
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xF085; JUMP; // sstep
case 0xF085:
                                                     mon("         LDU   #word_D620              ; F085: CE D6 20      \n"); // Copies vector JMPL instructions into vector RAM
    clockticks = clockticks + 3; 
    U = 0xd620; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF088; JUMP; // sstep
case 0xF088:
                                                     mon("LF088    LDD   ,U++                    ; F088: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF08A; JUMP; // sstep
case 0xF08A:
                                                     mon("         STD   ,--X                    ; F08A: ED 83         \n");
    clockticks = clockticks + 7; 
    X = X - 2; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF08C; JUMP; // sstep
case 0xF08C:
                                                     mon("         CMPX  #$02                    ; F08C: 8C 00 02      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x0002; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF08F; JUMP; // sstep
case 0xF08F:
                                                     mon("         BGT   LF088                   ; F08F: 2E F7         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xf088; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF091; JUMP; // sstep
case 0xF091:
                                                     mon("         LDX   #$22                    ; F091: 8E 00 22      \n");
    clockticks = clockticks + 3; 
    X = 0x0022; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF094; JUMP; // sstep
case 0xF094:
                                                     mon("LF094    CMPU  #word_D640              ; F094: 11 83 D6 40   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xd640; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF098; JUMP; // sstep
case 0xF098:
                                                     mon("         BCC   LF0A0                   ; F098: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf0a0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF09A; JUMP; // sstep
case 0xF09A:
                                                     mon("         LDD   ,U++                    ; F09A: EC C1         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(U); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(U+1)); 
    U = U + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF09C; JUMP; // sstep
case 0xF09C:
                                                     mon("         STD   ,--X                    ; F09C: ED 83         \n");
    clockticks = clockticks + 7; 
    X = X - 2; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF09E; JUMP; // sstep
case 0xF09E:
                                                     mon("         BRA   LF094                   ; F09E: 20 F4         \n");
    PC = 0xf094; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF0A0:
                                                     mon("LF0A0    LDB   <$3B                    ; F0A0: D6 3B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3b); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0A2; JUMP; // sstep
case 0xF0A2:
                                                     mon("         ADDB  #$02                    ; F0A2: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF0A4; JUMP; // sstep
case 0xF0A4:
                                                     mon("         CMPB  #$08                    ; F0A4: C1 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF0A6; JUMP; // sstep
case 0xF0A6:
                                                     mon("         BCS   LF0A9                   ; F0A6: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf0a9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF0A8; JUMP; // sstep
case 0xF0A8:
                                                     mon("         CLRB                          ; F0A8: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF0A9; JUMP; // sstep
case 0xF0A9:
                                                     mon("LF0A9    STB   <$3B                    ; F0A9: D7 3B         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x3b; 
    wr_mem(ea, val); 
    PC = 0xF0AB; JUMP; // sstep
case 0xF0AB:
                                                     mon("         LDU   #word_D640              ; F0AB: CE D6 40      \n");
    clockticks = clockticks + 3; 
    U = 0xd640; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF0AE; JUMP; // sstep
case 0xF0AE:
                                                     mon("         LDD   B,U                     ; F0AE: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF0B0; JUMP; // sstep
case 0xF0B0:
                                                     mon("         STD   $22                     ; F0B0: FD 00 22      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0022, A); // Care needed with I/O space and word fetches
    wr_mem(0x0023, B); 
    PC = 0xF0B3; JUMP; // sstep
case 0xF0B3:
                                                     mon("         DEC   <$36                    ; F0B3: 0A 36         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x36); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x36, res); 
    clockticks = clockticks + 2; 
    PC = 0xF0B5; JUMP; // sstep
case 0xF0B5:
                                                     mon("         BGT   LF0D8                   ; F0B5: 2E 21         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xf0d8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF0B7; JUMP; // sstep
case 0xF0B7:
                                                     mon("         LDB   #$04                    ; F0B7: C6 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0B9; JUMP; // sstep
case 0xF0B9:
                                                     mon("         STB   <$36                    ; F0B9: D7 36         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x36; 
    wr_mem(ea, val); 
    PC = 0xF0BB; JUMP; // sstep
case 0xF0BB:
                                                     mon("         LDB   <$37                    ; F0BB: D6 37         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x37); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0BD; JUMP; // sstep
case 0xF0BD:
                                                     mon("         ADDB  #$02                    ; F0BD: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF0BF; JUMP; // sstep
case 0xF0BF:
                                                     mon("         CMPB  #$08                    ; F0BF: C1 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF0C1; JUMP; // sstep
case 0xF0C1:
                                                     mon("         BCS   LF0C4                   ; F0C1: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf0c4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF0C3; JUMP; // sstep
case 0xF0C3:
                                                     mon("         CLRB                          ; F0C3: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF0C4; JUMP; // sstep
case 0xF0C4:
                                                     mon("LF0C4    STB   <$37                    ; F0C4: D7 37         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x37; 
    wr_mem(ea, val); 
    PC = 0xF0C6; JUMP; // sstep
case 0xF0C6:
                                                     mon("         LDU   #word_D648              ; F0C6: CE D6 48      \n");
    clockticks = clockticks + 3; 
    U = 0xd648; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF0C9; JUMP; // sstep
case 0xF0C9:
                                                     mon("         LDD   B,U                     ; F0C9: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF0CB; JUMP; // sstep
case 0xF0CB:
                                                     mon("         STD   $2A                     ; F0CB: FD 00 2A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x002a, A); // Care needed with I/O space and word fetches
    wr_mem(0x002b, B); 
    PC = 0xF0CE; JUMP; // sstep
case 0xF0CE:
                                                     mon("         LDB   <$37                    ; F0CE: D6 37         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x37); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0D0; JUMP; // sstep
case 0xF0D0:
                                                     mon("         LDU   #word_D650              ; F0D0: CE D6 50      \n");
    clockticks = clockticks + 3; 
    U = 0xd650; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF0D3; JUMP; // sstep
case 0xF0D3:
                                                     mon("         LDD   B,U                     ; F0D3: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF0D5; JUMP; // sstep
case 0xF0D5:
                                                     mon("         STD   $2E                     ; F0D5: FD 00 2E      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x002e, A); // Care needed with I/O space and word fetches
    wr_mem(0x002f, B); 
    PC = 0xF0D8; JUMP; // sstep
case 0xF0D8:
                                                     mon("LF0D8    DEC   <$38                    ; F0D8: 0A 38         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x38); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x38, res); 
    clockticks = clockticks + 2; 
    PC = 0xF0DA; JUMP; // sstep
case 0xF0DA:
                                                     mon("         BGT   LF0F3                   ; F0DA: 2E 17         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0xf0f3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF0DC; JUMP; // sstep
case 0xF0DC:
                                                     mon("         LDB   #$01                    ; F0DC: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0DE; JUMP; // sstep
case 0xF0DE:
                                                     mon("         STB   <$38                    ; F0DE: D7 38         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x38; 
    wr_mem(ea, val); 
    PC = 0xF0E0; JUMP; // sstep
case 0xF0E0:
                                                     mon("         LDB   <$39                    ; F0E0: D6 39         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x39); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0E2; JUMP; // sstep
case 0xF0E2:
                                                     mon("         ADDB  #$02                    ; F0E2: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF0E4; JUMP; // sstep
case 0xF0E4:
                                                     mon("         CMPB  #$08                    ; F0E4: C1 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x08; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF0E6; JUMP; // sstep
case 0xF0E6:
                                                     mon("         BCS   LF0E9                   ; F0E6: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf0e9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF0E8; JUMP; // sstep
case 0xF0E8:
                                                     mon("         CLRB                          ; F0E8: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF0E9; JUMP; // sstep
case 0xF0E9:
                                                     mon("LF0E9    STB   <$39                    ; F0E9: D7 39         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x39; 
    wr_mem(ea, val); 
    PC = 0xF0EB; JUMP; // sstep
case 0xF0EB:
                                                     mon("         LDU   #word_D658              ; F0EB: CE D6 58      \n");
    clockticks = clockticks + 3; 
    U = 0xd658; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF0EE; JUMP; // sstep
case 0xF0EE:
                                                     mon("         LDD   B,U                     ; F0EE: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF0F0; JUMP; // sstep
case 0xF0F0:
                                                     mon("         STD   $2C                     ; F0F0: FD 00 2C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x002c, A); // Care needed with I/O space and word fetches
    wr_mem(0x002d, B); 
    PC = 0xF0F3; JUMP; // sstep
case 0xF0F3:
                                                     mon("LF0F3    LDB   <$35                    ; F0F3: D6 35         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x35); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF0F5; JUMP; // sstep
case 0xF0F5:
                                                     mon("         ADDB  #$02                    ; F0F5: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF0F7; JUMP; // sstep
case 0xF0F7:
                                                     mon("         CMPB  #$0E                    ; F0F7: C1 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x0e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF0F9; JUMP; // sstep
case 0xF0F9:
                                                     mon("         BCS   LF0FC                   ; F0F9: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf0fc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF0FB; JUMP; // sstep
case 0xF0FB:
                                                     mon("         CLRB                          ; F0FB: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF0FC; JUMP; // sstep
case 0xF0FC:
                                                     mon("LF0FC    STB   <$35                    ; F0FC: D7 35         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x35; 
    wr_mem(ea, val); 
    PC = 0xF0FE; JUMP; // sstep
case 0xF0FE:
                                                     mon("         LDU   #word_D604              ; F0FE: CE D6 04      \n");
    clockticks = clockticks + 3; 
    U = 0xd604; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF101; JUMP; // sstep
case 0xF101:
                                                     mon("         LDD   B,U                     ; F101: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF103; JUMP; // sstep
case 0xF103:
                                                     mon("         STD   $30                     ; F103: FD 00 30      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0030, A); // Care needed with I/O space and word fetches
    wr_mem(0x0031, B); 
    PC = 0xF106; JUMP; // sstep
case 0xF106:
                                                     mon("         LDD   #$C000                  ; F106: CC C0 00      \n"); // Vector RTSL
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF109; JUMP; // sstep
case 0xF109:
                                                     mon("         STD   $32                     ; F109: FD 00 32      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0032, A); // Care needed with I/O space and word fetches
    wr_mem(0x0033, B); 
    PC = 0xF10C; JUMP; // sstep
case 0xF10C:
                                                     mon("         LDB   <$3C                    ; F10C: D6 3C         \n"); // Cycle through 7 colours
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3c); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF10E; JUMP; // sstep
case 0xF10E:
                                                     mon("         ADDB  #$02                    ; F10E: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF110; JUMP; // sstep
case 0xF110:
                                                     mon("         CMPB  #$0E                    ; F110: C1 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x0e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF112; JUMP; // sstep
case 0xF112:
                                                     mon("         BCS   LF115                   ; F112: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf115; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF114; JUMP; // sstep
case 0xF114:
                                                     mon("         CLRB                          ; F114: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF115; JUMP; // sstep
case 0xF115:
                                                     mon("LF115    STB   <$3C                    ; F115: D7 3C         \n"); // Vector colour cycle count
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x3c; 
    wr_mem(ea, val); 
    PC = 0xF117; JUMP; // sstep
case 0xF117:
                                                     mon("         LDU   #word_D612              ; F117: CE D6 12      \n");
    clockticks = clockticks + 3; 
    U = 0xd612; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF11A; JUMP; // sstep
case 0xF11A:
                                                     mon("         LDD   B,U                     ; F11A: EC C5         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(U + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF11C; JUMP; // sstep
case 0xF11C:
                                                     mon("         STD   $34                     ; F11C: FD 00 34      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0034, A); // Care needed with I/O space and word fetches
    wr_mem(0x0035, B); 
    PC = 0xF11F; JUMP; // sstep
case 0xF11F:
                                                     mon("         LDD   #$C000                  ; F11F: CC C0 00      \n"); // Vector RTSL
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF122; JUMP; // sstep
case 0xF122:
                                                     mon("         STD   $36                     ; F122: FD 00 36      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x0036, A); // Care needed with I/O space and word fetches
    wr_mem(0x0037, B); 
    PC = 0xF125; JUMP; // sstep
case 0xF125:
                                                     mon("         JSR   LD660                   ; F125: BD D6 60      \n"); // Update laser target hit vector animations
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    PC = 0xd660; 
    JUMP;
  case 0xF128:
                                                     mon("LF128    STA   $4600                   ; F128: B7 46 00      \n"); // Start vector generator run
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4600, val); 
    PC = 0xF12B; JUMP; // sstep
case 0xF12B:
                                                     mon("         LDA   #$05                    ; F12B: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF12D; JUMP; // sstep
case 0xF12D:
                                                     mon("         STA   <$40                    ; F12D: 97 40         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x40; 
    wr_mem(ea, val); 
    PC = 0xF12F; JUMP; // sstep
case 0xF12F:
                                                     mon("LF12F    STA   $4660                   ; F12F: B7 46 60      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4660, val); 
    // End of function IRQ
    PC = 0xF132; JUMP; // sstep
case 0xF132:
                                                     mon("         RTI                           ; F132: 3B            \n");
    clockticks = clockticks + 6; 
    res = E; 
    clockticks = clockticks + 1; 
    CC = rd_mem(S); 
    S = S + 1; 
    C = CC; V = C>>1; Z = V>>1; N = Z>>1; I = N>>1; H = I>>1; F = H>>1; E = (F>>1)&1; F = F&1; H = H&1; I = I&1; N = N&1; Z = Z&1; V = V&1; C = C&1; 
    restore_flags();
    if (res) {
    clockticks = clockticks + 9; 
    clockticks = clockticks + 1; 
    A = rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 1; 
    B = rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 1; 
    DP = rd_mem(S); 
    S = S + 1; 
    DP = DP << 8; checkDP(); 
    // memory_DP = &memory[DP];
    clockticks = clockticks + 1; 
    X = rd_mem(S)<<8; 
    S = S + 1; 
    X = X | rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 1; 
    Y = rd_mem(S)<<8; 
    S = S + 1; 
    Y = Y | rd_mem(S); 
    S = S + 1; 
    clockticks = clockticks + 1; 
    U = rd_mem(S)<<8; 
    S = S + 1; 
    U = U | rd_mem(S); 
    S = S + 1; 
    }
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Inputs debounce
  case 0xF133:
                                                     mon("LF133    LDB   ,X                      ; F133: E6 84         \n"); // Inputs debounce
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF135; JUMP; // sstep
case 0xF135:
                                                     mon("         STB   $01,X                   ; F135: E7 01         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xF137; JUMP; // sstep
case 0xF137:
                                                     mon("         STA   ,X                      ; F137: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xF139; JUMP; // sstep
case 0xF139:
                                                     mon("         ANDA  $01,X                   ; F139: A4 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    res = val & rd_mem((UINT16)(X + 0x0001)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF13B; JUMP; // sstep
case 0xF13B:
                                                     mon("         ORA   $02,X                   ; F13B: AA 02         \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF13D; JUMP; // sstep
case 0xF13D:
                                                     mon("         STA   $02,X                   ; F13D: A7 02         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, val); 
    PC = 0xF13F; JUMP; // sstep
case 0xF13F:
                                                     mon("         ORB   ,X++                    ; F13F: EA 81         \n");
    clockticks = clockticks + 7; 
    res = B | (UINT8)rd_mem(X); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    X = X + 2; 
    PC = 0xF141; JUMP; // sstep
case 0xF141:
                                                     mon("         ANDB  ,X                      ; F141: E4 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    res = val & rd_mem(X); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF143; JUMP; // sstep
case 0xF143:
                                                     mon("         STB   ,X+                     ; F143: E7 80         \n");
    clockticks = clockticks + 6; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    // End of function sub_F133
    PC = 0xF145; JUMP; // sstep
case 0xF145:
                                                     mon("         RTS                           ; F145: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Joystick processing
  case 0xF146:
                                                     mon("LF146    LDA   <$0A                    ; F146: 96 0A         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x0a); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF148; JUMP; // sstep
case 0xF148:
                                                     mon("         LSRA                          ; F148: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xF149; JUMP; // sstep
case 0xF149:
                                                     mon("         LDY   #$4829                  ; F149: 10 8E 48 29   \n");
    clockticks = clockticks + 4; 
    Y = 0x4829; 
    Z = Y; 
    N = (Y) >> 8; 
    V = 0; 
    PC = 0xF14D; JUMP; // sstep
case 0xF14D:
                                                     mon("         BCS   LF153                   ; F14D: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf153; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF14F; JUMP; // sstep
case 0xF14F:
                                                     mon("         LDY   #$482B                  ; F14F: 10 8E 48 2B   \n");
    clockticks = clockticks + 4; 
    Y = 0x482b; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF153; JUMP; // sstep
case 0xF153:
                                                     mon("LF153    LDB   $01,Y                   ; F153: E6 21         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(Y + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF155; JUMP; // sstep
case 0xF155:
                                                     mon("         LDA   $4380                   ; F155: B6 43 80      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4380); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF158; JUMP; // sstep
case 0xF158:
                                                     mon("         STA   $01,Y                   ; F158: A7 21         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(Y + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xF15A; JUMP; // sstep
case 0xF15A:
                                                     mon("         CMPA  ,Y                      ; F15A: A1 A4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(Y); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF15C; JUMP; // sstep
case 0xF15C:
                                                     mon("         BCS   LF16C                   ; F15C: 25 0E         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf16c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF15E; JUMP; // sstep
case 0xF15E:
                                                     mon("         CMPB  ,Y                      ; F15E: E1 A4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(Y); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF160; JUMP; // sstep
case 0xF160:
                                                     mon("         BLS   LF16A                   ; F160: 23 08         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xf16a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF162; JUMP; // sstep
case 0xF162:
                                                     mon("         CMPB  $01,Y                   ; F162: E1 21         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem((UINT16)(Y + 0x0001)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF164; JUMP; // sstep
case 0xF164:
                                                     mon("         BLS   LF168                   ; F164: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xf168; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF166; JUMP; // sstep
case 0xF166:
                                                     mon("         LDB   $01,Y                   ; F166: E6 21         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(Y + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF168; JUMP; // sstep
case 0xF168:
                                                     mon("LF168    STB   ,Y                      ; F168: E7 A4         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, val); 
    PC = 0xF16A; JUMP; // sstep
case 0xF16A:
                                                     mon("LF16A    BRA   LF178                   ; F16A: 20 0C         \n");
    PC = 0xf178; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF16C:
                                                     mon("LF16C    CMPB  ,Y                      ; F16C: E1 A4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(Y); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF16E; JUMP; // sstep
case 0xF16E:
                                                     mon("         BCC   LF178                   ; F16E: 24 08         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf178; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF170; JUMP; // sstep
case 0xF170:
                                                     mon("         CMPB  $01,Y                   ; F170: E1 21         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem((UINT16)(Y + 0x0001)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF172; JUMP; // sstep
case 0xF172:
                                                     mon("         BCC   LF176                   ; F172: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf176; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF174; JUMP; // sstep
case 0xF174:
                                                     mon("         LDB   $01,Y                   ; F174: E6 21         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(Y + 0x0001)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF176; JUMP; // sstep
case 0xF176:
                                                     mon("LF176    STB   ,Y                      ; F176: E7 A4         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, val); 
    PC = 0xF178; JUMP; // sstep
case 0xF178:
                                                     mon("LF178    CMPY  #$4829                  ; F178: 10 8C 48 29   \n");
    clockticks = clockticks + 5; 
    val = Y; 
    arg = 0x4829; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF17C; JUMP; // sstep
case 0xF17C:
                                                     mon("         BNE   LF186                   ; F17C: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf186; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF17E; JUMP; // sstep
case 0xF17E:
                                                     mon("         STA   $46C0                   ; F17E: B7 46 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46c0, val); 
    PC = 0xF181; JUMP; // sstep
case 0xF181:
                                                     mon("         STA   $46C0                   ; F181: B7 46 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x46c0, val); 
    PC = 0xF184; JUMP; // sstep
case 0xF184:
                                                     mon("         BRA   locret_F18C             ; F184: 20 06         \n");
    PC = 0xf18c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF186:
                                                     mon("LF186    STA   $46C1                   ; F186: B7 46 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46c1, val); 
    PC = 0xF189; JUMP; // sstep
case 0xF189:
                                                     mon("         STA   $46C1                   ; F189: B7 46 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x46c1, val); 
    // End of function sub_F146
    PC = 0xF18C; JUMP; // sstep
case 0xF18C:
                                                     mon("locret_F18C RTS                           ; F18C: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF18D:
                                                     mon("LF18D    LDX   #$4866                  ; F18D: 8E 48 66      \n"); // Joystick pitch data structure
    clockticks = clockticks + 3; 
    X = 0x4866; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF190; JUMP; // sstep
case 0xF190:
                                                     mon("         LDA   <$2B                    ; F190: 96 2B         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x2b); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF192; JUMP; // sstep
case 0xF192:
                                                     mon("         NOP                           ; F192: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0xF193; JUMP; // sstep
case 0xF193:
                                                     mon("         JSR   LF1C6                   ; F193: BD F1 C6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    PC = 0xf1c6; 
    JUMP;
  case 0xF196:
                                                     mon("LF196    LDA   $04,X                   ; F196: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF198; JUMP; // sstep
case 0xF198:
                                                     mon("         CMPA  #$78                    ; F198: 81 78         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x78; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF19A; JUMP; // sstep
case 0xF19A:
                                                     mon("         BLE   LF19E                   ; F19A: 2F 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xf19e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF19C; JUMP; // sstep
case 0xF19C:
                                                     mon("         LDA   #$78                    ; F19C: 86 78         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x78; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF19E; JUMP; // sstep
case 0xF19E:
                                                     mon("LF19E    CMPA  #$98                    ; F19E: 81 98         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x98; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1A0; JUMP; // sstep
case 0xF1A0:
                                                     mon("         BGE   LF1A4                   ; F1A0: 2C 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xf1a4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1A2; JUMP; // sstep
case 0xF1A2:
                                                     mon("         LDA   #$98                    ; F1A2: 86 98         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x98; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1A4; JUMP; // sstep
case 0xF1A4:
                                                     mon("LF1A4    STA   $04,X                   ; F1A4: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xF1A6; JUMP; // sstep
case 0xF1A6:
                                                     mon("         JSR   LF1FD                   ; F1A6: BD F1 FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    PC = 0xf1fd; 
    JUMP;
  case 0xF1A9:
                                                     mon("LF1A9    LDX   #$486F                  ; F1A9: 8E 48 6F      \n"); // Joystick roll data structure
    clockticks = clockticks + 3; 
    X = 0x486f; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF1AC; JUMP; // sstep
case 0xF1AC:
                                                     mon("         LDA   <$29                    ; F1AC: 96 29         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x29); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF1AE; JUMP; // sstep
case 0xF1AE:
                                                     mon("         NOP                           ; F1AE: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0xF1AF; JUMP; // sstep
case 0xF1AF:
                                                     mon("         JSR   LF1C6                   ; F1AF: BD F1 C6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    PC = 0xf1c6; 
    JUMP;
  case 0xF1B2:
                                                     mon("LF1B2    LDA   $04,X                   ; F1B2: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1B4; JUMP; // sstep
case 0xF1B4:
                                                     mon("         CMPA  #$70                    ; F1B4: 81 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x70; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1B6; JUMP; // sstep
case 0xF1B6:
                                                     mon("         BLE   LF1BA                   ; F1B6: 2F 02         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xf1ba; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1B8; JUMP; // sstep
case 0xF1B8:
                                                     mon("         LDA   #$70                    ; F1B8: 86 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x70; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1BA; JUMP; // sstep
case 0xF1BA:
                                                     mon("LF1BA    CMPA  #$90                    ; F1BA: 81 90         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x90; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1BC; JUMP; // sstep
case 0xF1BC:
                                                     mon("         BGE   LF1C0                   ; F1BC: 2C 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xf1c0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1BE; JUMP; // sstep
case 0xF1BE:
                                                     mon("         LDA   #$90                    ; F1BE: 86 90         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x90; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1C0; JUMP; // sstep
case 0xF1C0:
                                                     mon("LF1C0    STA   $04,X                   ; F1C0: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    PC = 0xF1C2; JUMP; // sstep
case 0xF1C2:
                                                     mon("         JSR   LF1FD                   ; F1C2: BD F1 FD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    PC = 0xf1fd; 
    JUMP;
    // End of function sub_F18D
  case 0xF1C5:
                                                     mon("LF1C5    RTS                           ; F1C5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF1C6:
                                                     mon("LF1C6    CMPA  ,X                      ; F1C6: A1 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1C8; JUMP; // sstep
case 0xF1C8:
                                                     mon("         BCC   LF1D0                   ; F1C8: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf1d0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1CA; JUMP; // sstep
case 0xF1CA:
                                                     mon("         CMPA  $01,X                   ; F1CA: A1 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0001)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1CC; JUMP; // sstep
case 0xF1CC:
                                                     mon("         BCS   LF1D0                   ; F1CC: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf1d0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1CE; JUMP; // sstep
case 0xF1CE:
                                                     mon("         DEC   ,X                      ; F1CE: 6A 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(X, res); 
    clockticks = clockticks + 2; 
    PC = 0xF1D0; JUMP; // sstep
case 0xF1D0:
                                                     mon("LF1D0    STA   $01,X                   ; F1D0: A7 01         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0001); 
    wr_mem(ea, val); 
    PC = 0xF1D2; JUMP; // sstep
case 0xF1D2:
                                                     mon("         CMPA  ,X                      ; F1D2: A1 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1D4; JUMP; // sstep
case 0xF1D4:
                                                     mon("         BCC   LF1D8                   ; F1D4: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf1d8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1D6; JUMP; // sstep
case 0xF1D6:
                                                     mon("         LDA   ,X                      ; F1D6: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1D8; JUMP; // sstep
case 0xF1D8:
                                                     mon("LF1D8    SUBA  ,X                      ; F1D8: A0 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(X); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xF1DA; JUMP; // sstep
case 0xF1DA:
                                                     mon("         STA   <$51                    ; F1DA: 97 51         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x51; 
    wr_mem(ea, val); 
    PC = 0xF1DC; JUMP; // sstep
case 0xF1DC:
                                                     mon("         LDB   $02,X                   ; F1DC: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1DE; JUMP; // sstep
case 0xF1DE:
                                                     mon("         MUL                           ; F1DE: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xF1DF; JUMP; // sstep
case 0xF1DF:
                                                     mon("         ADDA  <$51                    ; F1DF: 9B 51         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x51); 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xF1E1; JUMP; // sstep
case 0xF1E1:
                                                     mon("         BNE   LF1E5                   ; F1E1: 26 02         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf1e5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1E3; JUMP; // sstep
case 0xF1E3:
                                                     mon("         LDA   #$01                    ; F1E3: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF1E5; JUMP; // sstep
case 0xF1E5:
                                                     mon("LF1E5    BCS   LF1EB                   ; F1E5: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf1eb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1E7; JUMP; // sstep
case 0xF1E7:
                                                     mon("         CLR   $03,X                   ; F1E7: 6F 03         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0003), 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF1E9; JUMP; // sstep
case 0xF1E9:
                                                     mon("         BRA   LF1F7                   ; F1E9: 20 0C         \n");
    PC = 0xf1f7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF1EB:
                                                     mon("LF1EB    LDA   #$FF                    ; F1EB: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1ED; JUMP; // sstep
case 0xF1ED:
                                                     mon("         INC   $03,X                   ; F1ED: 6C 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem((UINT16)(X + 0x0003), res); 
    clockticks = clockticks + 2; 
    PC = 0xF1EF; JUMP; // sstep
case 0xF1EF:
                                                     mon("         LDB   $03,X                   ; F1EF: E6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF1F1; JUMP; // sstep
case 0xF1F1:
                                                     mon("         CMPB  #$02                    ; F1F1: C1 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF1F3; JUMP; // sstep
case 0xF1F3:
                                                     mon("         BCS   LF1F7                   ; F1F3: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf1f7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF1F5; JUMP; // sstep
case 0xF1F5:
                                                     mon("         DEC   $02,X                   ; F1F5: 6A 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem((UINT16)(X + 0x0002), res); 
    clockticks = clockticks + 2; 
    PC = 0xF1F7; JUMP; // sstep
case 0xF1F7:
                                                     mon("LF1F7    CLRB                          ; F1F7: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF1F8; JUMP; // sstep
case 0xF1F8:
                                                     mon("         SUBA  #$80                    ; F1F8: 80 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x80; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0xF1FA; JUMP; // sstep
case 0xF1FA:
                                                     mon("         STA   $04,X                   ; F1FA: A7 04         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0004); 
    wr_mem(ea, val); 
    // End of function sub_F1C6
    PC = 0xF1FC; JUMP; // sstep
case 0xF1FC:
                                                     mon("         RTS                           ; F1FC: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF1FD:
                                                     mon("LF1FD    CLR   <$51                    ; F1FD: 0F 51         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0x51, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF1FF; JUMP; // sstep
case 0xF1FF:
                                                     mon("         LDA   $04,X                   ; F1FF: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF201; JUMP; // sstep
case 0xF201:
                                                     mon("         LDB   #$80                    ; F201: C6 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF203; JUMP; // sstep
case 0xF203:
                                                     mon("         SUBD  $05,X                   ; F203: A3 05         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0005))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0005))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0xF205; JUMP; // sstep
case 0xF205:
                                                     mon("         BGE   LF20A                   ; F205: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0xf20a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF207; JUMP; // sstep
case 0xF207:
                                                     mon("         NEGA                          ; F207: 40            \n");
    val = (UINT8)A; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xF208; JUMP; // sstep
case 0xF208:
                                                     mon("         DEC   <$51                    ; F208: 0A 51         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x51); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0x51, res); 
    clockticks = clockticks + 2; 
    PC = 0xF20A; JUMP; // sstep
case 0xF20A:
                                                     mon("LF20A    BLE   LF20F                   ; F20A: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0xf20f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF20C; JUMP; // sstep
case 0xF20C:
                                                     mon("         ADDD  #$FF                    ; F20C: C3 00 FF      \n");
    clockticks = clockticks + 4; 
    val = 0x00ff; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xF20F; JUMP; // sstep
case 0xF20F:
                                                     mon("LF20F    CMPA  #$F8                    ; F20F: 81 F8         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xf8; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF211; JUMP; // sstep
case 0xF211:
                                                     mon("         BLS   LF215                   ; F211: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0xf215; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF213; JUMP; // sstep
case 0xF213:
                                                     mon("         LDA   #$F8                    ; F213: 86 F8         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xf8; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF215; JUMP; // sstep
case 0xF215:
                                                     mon("LF215    LDB   #$60                    ; F215: C6 60         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x60; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF217; JUMP; // sstep
case 0xF217:
                                                     mon("         CMPA  #$40                    ; F217: 81 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x40; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF219; JUMP; // sstep
case 0xF219:
                                                     mon("         BCC   LF21D                   ; F219: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf21d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF21B; JUMP; // sstep
case 0xF21B:
                                                     mon("         LDB   #$30                    ; F21B: C6 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x30; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF21D; JUMP; // sstep
case 0xF21D:
                                                     mon("LF21D    MUL                           ; F21D: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0xF21E; JUMP; // sstep
case 0xF21E:
                                                     mon("         TST   <$51                    ; F21E: 0D 51         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x51); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF220; JUMP; // sstep
case 0xF220:
                                                     mon("         BPL   LF226                   ; F220: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xf226; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF222; JUMP; // sstep
case 0xF222:
                                                     mon("         COMA                          ; F222: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xF223; JUMP; // sstep
case 0xF223:
                                                     mon("         NEGB                          ; F223: 50            \n");
    val = (UINT8)B; 
    res = -val; 
/**/V = val & (UINT8)res; 
    C = res & 0x100; 
    val = (UINT8)res; 
    B = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xF224; JUMP; // sstep
case 0xF224:
                                                     mon("         SBCA  #$FF                    ; F224: 82 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = (val - (UINT8)arg) - (C != 0 ? 1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)res; 
    PC = 0xF226; JUMP; // sstep
case 0xF226:
                                                     mon("LF226    ADDD  $05,X                   ; F226: E3 05         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(X + 0x0005))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(X + 0x0005))+1)); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xF228; JUMP; // sstep
case 0xF228:
                                                     mon("         STD   $05,X                   ; F228: ED 05         \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(X + 0x0005); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_F1FD
    PC = 0xF22A; JUMP; // sstep
case 0xF22A:
                                                     mon("         RTS                           ; F22A: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF22B:
                                                     mon("LF22B    LDB   <$6B                    ; F22B: D6 6B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x6b); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF22D; JUMP; // sstep
case 0xF22D:
                                                     mon("         LDA   <$6C                    ; F22D: 96 6C         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x6c); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF22F; JUMP; // sstep
case 0xF22F:
                                                     mon("         ANDA  #$C0                    ; F22F: 84 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xc0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF231; JUMP; // sstep
case 0xF231:
                                                     mon("         ASLA                          ; F231: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF232; JUMP; // sstep
case 0xF232:
                                                     mon("         ROLB                          ; F232: 59            \n");
    val = (UINT8)B; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    B = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF233; JUMP; // sstep
case 0xF233:
                                                     mon("         BCC   LF237                   ; F233: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf237; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF235; JUMP; // sstep
case 0xF235:
                                                     mon("         ORA   #$3F                    ; F235: 8A 3F         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x3f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF237; JUMP; // sstep
case 0xF237:
                                                     mon("LF237    ROLA                          ; F237: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF238; JUMP; // sstep
case 0xF238:
                                                     mon("         ROLB                          ; F238: 59            \n");
    val = (UINT8)B; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    B = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF239; JUMP; // sstep
case 0xF239:
                                                     mon("         ROLA                          ; F239: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF23A; JUMP; // sstep
case 0xF23A:
                                                     mon("         STD   <$2F                    ; F23A: DD 2F         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x2f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF23C; JUMP; // sstep
case 0xF23C:
                                                     mon("         ADDD  #$FF98                  ; F23C: C3 FF 98      \n");
    clockticks = clockticks + 4; 
    val = 0xff98; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0xF23F; JUMP; // sstep
case 0xF23F:
                                                     mon("         ANDA  #$1F                    ; F23F: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF241; JUMP; // sstep
case 0xF241:
                                                     mon("         STD   $24                     ; F241: FD 00 24      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0024, A); // Care needed with I/O space and word fetches
    wr_mem(0x0025, B); 
    PC = 0xF244; JUMP; // sstep
case 0xF244:
                                                     mon("         LDB   <$74                    ; F244: D6 74         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x74); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF246; JUMP; // sstep
case 0xF246:
                                                     mon("         LDA   <$75                    ; F246: 96 75         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x75); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF248; JUMP; // sstep
case 0xF248:
                                                     mon("         ANDA  #$C0                    ; F248: 84 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xc0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF24A; JUMP; // sstep
case 0xF24A:
                                                     mon("         ASLA                          ; F24A: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF24B; JUMP; // sstep
case 0xF24B:
                                                     mon("         ROLB                          ; F24B: 59            \n");
    val = (UINT8)B; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    B = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF24C; JUMP; // sstep
case 0xF24C:
                                                     mon("         BCC   LF250                   ; F24C: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf250; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF24E; JUMP; // sstep
case 0xF24E:
                                                     mon("         ORA   #$3F                    ; F24E: 8A 3F         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x3f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF250; JUMP; // sstep
case 0xF250:
                                                     mon("LF250    ROLA                          ; F250: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF251; JUMP; // sstep
case 0xF251:
                                                     mon("         ROLB                          ; F251: 59            \n");
    val = (UINT8)B; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    B = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF252; JUMP; // sstep
case 0xF252:
                                                     mon("         ROLA                          ; F252: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF253; JUMP; // sstep
case 0xF253:
                                                     mon("         STD   <$2D                    ; F253: DD 2D         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x2d; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF255; JUMP; // sstep
case 0xF255:
                                                     mon("         ANDA  #$1F                    ; F255: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF257; JUMP; // sstep
case 0xF257:
                                                     mon("         STD   $26                     ; F257: FD 00 26      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0026, A); // Care needed with I/O space and word fetches
    wr_mem(0x0027, B); 
    PC = 0xF25A; JUMP; // sstep
case 0xF25A:
                                                     mon("         LDD   #$C000                  ; F25A: CC C0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xc0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF25D; JUMP; // sstep
case 0xF25D:
                                                     mon("         STD   $28                     ; F25D: FD 00 28      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x0028, A); // Care needed with I/O space and word fetches
    wr_mem(0x0029, B); 
    // End of function sub_F22B
    PC = 0xF260; JUMP; // sstep
case 0xF260:
                                                     mon("         RTS                           ; F260: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_6532
  case 0xF261:
                                                     mon("LF261    ORCC  #$10                    ; F261: 1A 10         \n"); // public Reset
    I = 1; 
    clockticks = clockticks + 3; 
    PC = 0xF263; JUMP; // sstep
case 0xF263:
                                                     mon("         CLR   $4684                   ; F263: 7F 46 84      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4684, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF266; JUMP; // sstep
case 0xF266:
                                                     mon("         LDA   #$00                    ; F266: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF268; JUMP; // sstep
case 0xF268:
                                                     mon("         STA   $4686                   ; F268: B7 46 86      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4686, val); 
    PC = 0xF26B; JUMP; // sstep
case 0xF26B:
                                                     mon("         STA   $4683                   ; F26B: B7 46 83      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4683, val); 
    PC = 0xF26E; JUMP; // sstep
case 0xF26E:
                                                     mon("         STA   $4682                   ; F26E: B7 46 82      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4682, val); 
    PC = 0xF271; JUMP; // sstep
case 0xF271:
                                                     mon("         LDA   #$00                    ; F271: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF273; JUMP; // sstep
case 0xF273:
                                                     mon("         STA   $4685                   ; F273: B7 46 85      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4685, val); 
    PC = 0xF276; JUMP; // sstep
case 0xF276:
                                                     mon("         LDA   #$80                    ; F276: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF278; JUMP; // sstep
case 0xF278:
                                                     mon("         STA   $4685                   ; F278: B7 46 85      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4685, val); 
    PC = 0xF27B; JUMP; // sstep
case 0xF27B:
                                                     mon("         STA   $4620                   ; F27B: B7 46 20      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4620, val); 
    PC = 0xF27E; JUMP; // sstep
case 0xF27E:
                                                     mon("         LDU   #$00                    ; F27E: CE 00 00      \n");
    clockticks = clockticks + 3; 
    U = 0x0000; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF281; JUMP; // sstep
case 0xF281:
                                                     mon("LF281    STA   $4640                   ; F281: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF284; JUMP; // sstep
case 0xF284:
                                                     mon("         LEAU  -1,U                    ; F284: 33 5F         \n");
    clockticks = clockticks + 5; 
    U = (U + 0xffff); 
    PC = 0xF286; JUMP; // sstep
case 0xF286:
                                                     mon("         CMPU  #$00                    ; F286: 11 83 00 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x0000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF28A; JUMP; // sstep
case 0xF28A:
                                                     mon("         BNE   LF281                   ; F28A: 26 F5         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf281; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF28C; JUMP; // sstep
case 0xF28C:
                                                     mon("         LDS   #$4FFF                  ; F28C: 10 CE 4F FF   \n"); // Stack top at $4FFF
    clockticks = clockticks + 4; 
    S = 0x4fff; 
/**/Z = S; 
/**/N = (S) >> 8; 
/**/V = 0; 
    PC = 0xF290; JUMP; // sstep
case 0xF290:
                                                     mon("         LDA   #$48                    ; F290: 86 48         \n"); // H      ; Direct Page at $4800
    clockticks = clockticks + 2; 
    val = (UINT8)0x48; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF292; JUMP; // sstep
case 0xF292:
                                                     mon("         TFR   A,DP                    ; F292: 1F 8B         \n");
    DP = (A) << 8; checkDP(); 
    // memory_DP = &memory[DP];
    clockticks = clockticks + 6; 
    PC = 0xF294; JUMP; // sstep
case 0xF294:
                                                     mon("         STA   $46E0                   ; F294: B7 46 E0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46e0, val); 
    PC = 0xF297; JUMP; // sstep
case 0xF297:
                                                     mon("         LDA   #$00                    ; F297: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF299; JUMP; // sstep
case 0xF299:
                                                     mon("         STA   $4400                   ; F299: B7 44 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4400, val); 
    PC = 0xF29C; JUMP; // sstep
case 0xF29C:
                                                     mon("         LDX   #$4800                  ; F29C: 8E 48 00      \n");
    clockticks = clockticks + 3; 
    X = 0x4800; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF29F; JUMP; // sstep
case 0xF29F:
                                                     mon("         LDD   #$00                    ; F29F: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF2A2; JUMP; // sstep
case 0xF2A2:
                                                     mon("LF2A2    STD   ,X++                    ; F2A2: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xF2A4; JUMP; // sstep
case 0xF2A4:
                                                     mon("         CMPX  #$5000                  ; F2A4: 8C 50 00      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x5000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF2A7; JUMP; // sstep
case 0xF2A7:
                                                     mon("         BCS   LF2A2                   ; F2A7: 25 F9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf2a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2A9; JUMP; // sstep
case 0xF2A9:
                                                     mon("         STA   $4640                   ; F2A9: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF2AC; JUMP; // sstep
case 0xF2AC:
                                                     mon("         LDX   #$5000                  ; F2AC: 8E 50 00      \n");
    clockticks = clockticks + 3; 
    X = 0x5000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF2AF; JUMP; // sstep
case 0xF2AF:
                                                     mon("         LDD   #$00                    ; F2AF: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF2B2; JUMP; // sstep
case 0xF2B2:
                                                     mon("LF2B2    STD   ,X++                    ; F2B2: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xF2B4; JUMP; // sstep
case 0xF2B4:
                                                     mon("         STA   $4640                   ; F2B4: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF2B7; JUMP; // sstep
case 0xF2B7:
                                                     mon("         CMPX  #$6000                  ; F2B7: 8C 60 00      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x6000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF2BA; JUMP; // sstep
case 0xF2BA:
                                                     mon("         BCS   LF2B2                   ; F2BA: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf2b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2BC; JUMP; // sstep
case 0xF2BC:
                                                     mon("         LDX   #$00                    ; F2BC: 8E 00 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF2BF; JUMP; // sstep
case 0xF2BF:
                                                     mon("         LDD   #$00                    ; F2BF: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF2C2; JUMP; // sstep
case 0xF2C2:
                                                     mon("LF2C2    STD   ,X++                    ; F2C2: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xF2C4; JUMP; // sstep
case 0xF2C4:
                                                     mon("         STA   $4640                   ; F2C4: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF2C7; JUMP; // sstep
case 0xF2C7:
                                                     mon("         CMPX  #$3000                  ; F2C7: 8C 30 00      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x3000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF2CA; JUMP; // sstep
case 0xF2CA:
                                                     mon("         BCS   LF2C2                   ; F2CA: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf2c2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2CC; JUMP; // sstep
case 0xF2CC:
                                                     mon("         LDA   $4300                   ; F2CC: B6 43 00      \n"); // Check self test switch
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF2CF; JUMP; // sstep
case 0xF2CF:
                                                     mon("         ANDA  #$10                    ; F2CF: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF2D1; JUMP; // sstep
case 0xF2D1:
                                                     mon("         BNE   LF2D6                   ; F2D1: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf2d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2D3; JUMP; // sstep
case 0xF2D3:
                                                     mon("         JMP   LF36E                   ; F2D3: 7E F3 6E      \n");
    clockticks = clockticks + 4; 
    PC = 0xf36e; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xF2D6:
                                                     mon("LF2D6    LDA   $4340                   ; F2D6: B6 43 40      \n"); // Read option switches
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4340); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF2D9; JUMP; // sstep
case 0xF2D9:
                                                     mon("         LDB   $4360                   ; F2D9: F6 43 60      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4360); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF2DC; JUMP; // sstep
case 0xF2DC:
                                                     mon("LF2DC    STA   <$24                    ; F2DC: 97 24         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x24; 
    wr_mem(ea, val); 
    PC = 0xF2DE; JUMP; // sstep
case 0xF2DE:
                                                     mon("         STB   <$27                    ; F2DE: D7 27         \n"); // Store in shadow RAM
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x27; 
    wr_mem(ea, val); 
    PC = 0xF2E0; JUMP; // sstep
case 0xF2E0:
                                                     mon("         LDX   #$0800                  ; F2E0: 8E 08 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0800; 
/**/Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0xF2E3; JUMP; // sstep
case 0xF2E3:
                                                     mon("LF2E3    LEAX  -1,X                    ; F2E3: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xF2E5; JUMP; // sstep
case 0xF2E5:
                                                     mon("         BNE   LF2E3                   ; F2E5: 26 FC         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf2e3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2E7; JUMP; // sstep
case 0xF2E7:
                                                     mon("         LDA   $4340                   ; F2E7: B6 43 40      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4340); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF2EA; JUMP; // sstep
case 0xF2EA:
                                                     mon("         LDB   $4360                   ; F2EA: F6 43 60      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4360); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF2ED; JUMP; // sstep
case 0xF2ED:
                                                     mon("         CMPA  <$24                    ; F2ED: 91 24         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x24); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF2EF; JUMP; // sstep
case 0xF2EF:
                                                     mon("         BNE   LF2DC                   ; F2EF: 26 EB         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf2dc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2F1; JUMP; // sstep
case 0xF2F1:
                                                     mon("         CMPB  <$27                    ; F2F1: D1 27         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    arg = rd_mem(DP|0x27); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF2F3; JUMP; // sstep
case 0xF2F3:
                                                     mon("         BNE   LF2DC                   ; F2F3: 26 E7         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf2dc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF2F5; JUMP; // sstep
case 0xF2F5:
                                                     mon("         LDD   #$2020                  ; F2F5: CC 20 20      \n");
    clockticks = clockticks + 3; 
    A = 0x20; 
    B = 0x20; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF2F8; JUMP; // sstep
case 0xF2F8:
                                                     mon("         LDX   #$00                    ; F2F8: 8E 00 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF2FB; JUMP; // sstep
case 0xF2FB:
                                                     mon("LF2FB    STD   ,X++                    ; F2FB: ED 81         \n"); // Clear vector RAM to HALT instructions
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xF2FD; JUMP; // sstep
case 0xF2FD:
                                                     mon("         STA   $4640                   ; F2FD: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF300; JUMP; // sstep
case 0xF300:
                                                     mon("         CMPX  #$2800                  ; F300: 8C 28 00      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x2800; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF303; JUMP; // sstep
case 0xF303:
                                                     mon("         BCS   LF2FB                   ; F303: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf2fb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF305; JUMP; // sstep
case 0xF305:
                                                     mon("         LDD   #$E038                  ; F305: CC E0 38      \n"); // Set up first vector instruction to JSRL 38
    clockticks = clockticks + 3; 
    A = 0xe0; 
    B = 0x38; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF308; JUMP; // sstep
case 0xF308:
                                                     mon("         STD   $00                     ; F308: FD 00 00      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x0000, A); // Care needed with I/O space and word fetches
    wr_mem(0x0001, B); 
    PC = 0xF30B; JUMP; // sstep
case 0xF30B:
                                                     mon("         LDA   #$FF                    ; F30B: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF30D; JUMP; // sstep
case 0xF30D:
                                                     mon("         STA   <$3F                    ; F30D: 97 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x3f; 
    wr_mem(ea, val); 
    PC = 0xF30F; JUMP; // sstep
case 0xF30F:
                                                     mon("         LDA   #$3F                    ; F30F: 86 3F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF311; JUMP; // sstep
case 0xF311:
                                                     mon("         STA   <$00                    ; F311: 97 00         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x00; 
    wr_mem(ea, val); 
    PC = 0xF313; JUMP; // sstep
case 0xF313:
                                                     mon("         LDA   #$40                    ; F313: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF315; JUMP; // sstep
case 0xF315:
                                                     mon("         STA   <$28                    ; F315: 97 28         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x28; 
    wr_mem(ea, val); 
    PC = 0xF317; JUMP; // sstep
case 0xF317:
                                                     mon("         JSR   LC306                   ; F317: BD C3 06      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf3); 
    clockticks = clockticks + 1; 
    PC = 0xc306; 
    JUMP;
  case 0xF31A:
                                                     mon("LF31A    STA   $4640                   ; F31A: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF31D; JUMP; // sstep
case 0xF31D:
                                                     mon("         LDA   #$FF                    ; F31D: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF31F; JUMP; // sstep
case 0xF31F:
                                                     mon("         STA   $4686                   ; F31F: B7 46 86      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4686, val); 
    PC = 0xF322; JUMP; // sstep
case 0xF322:
                                                     mon("         STA   $4683                   ; F322: B7 46 83      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4683, val); 
    PC = 0xF325; JUMP; // sstep
case 0xF325:
                                                     mon("         STA   $4682                   ; F325: B7 46 82      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4682, val); 
    PC = 0xF328; JUMP; // sstep
case 0xF328:
                                                     mon("         STA   $4660                   ; F328: B7 46 60      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4660, val); 
    // END OF FUNCTION CHUNK FOR sub_6532
    // ---------------------------------------------------------------------------
    PC = 0xF32B; JUMP; // sstep
case 0xF32B:
                                                     mon("         JMP   $6036                   ; F32B: 7E 60 36      \n"); // Jump to main game loop
    clockticks = clockticks + 4; 
    PC = 0x6036; 
    JUMP;
    
    // ---------------------------------------------------------------------------
    // START OF FUNCTION CHUNK FOR sub_6532
  case 0xF36E:
                                                     mon("LF36E    LDA   $4320                   ; F36E: B6 43 20      \n"); // Self test
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF371; JUMP; // sstep
case 0xF371:
                                                     mon("         ANDA  #$04                    ; F371: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF373; JUMP; // sstep
case 0xF373:
                                                     mon("         BNE   LF380                   ; F373: 26 0B         \n"); // Check Aux coin
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf380; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF375; JUMP; // sstep
case 0xF375:
                                                     mon("         LDA   $4340                   ; F375: B6 43 40      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4340); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF378; JUMP; // sstep
case 0xF378:
                                                     mon("         COMA                          ; F378: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xF379; JUMP; // sstep
case 0xF379:
                                                     mon("         ANDA  #$7F                    ; F379: 84 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x7f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF37B; JUMP; // sstep
case 0xF37B:
                                                     mon("         BEQ   LF380                   ; F37B: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf380; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF37D; JUMP; // sstep
case 0xF37D:
                                                     mon("         JMP   Check_Test_Diag         ; F37D: 7E FD 07      \n");
    clockticks = clockticks + 4; 
    PC = 0xfd07; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xF380:
                                                     mon("LF380    LDS   #$00                    ; F380: 10 CE 00 00   \n");
    clockticks = clockticks + 4; 
    S = 0x0000; 
/**/Z = S; 
/**/N = (S) >> 8; 
/**/V = 0; 
    PC = 0xF384; JUMP; // sstep
case 0xF384:
                                                     mon("         LDU   #word_F32E              ; F384: CE F3 2E      \n");
    clockticks = clockticks + 3; 
    U = 0xf32e; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF387; JUMP; // sstep
case 0xF387:
                                                     mon("LF387    LDX   ,U++                    ; F387: AE C1         \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    U = U + 2; 
    PC = 0xF389; JUMP; // sstep
case 0xF389:
                                                     mon("         LDY   #$0800                  ; F389: 10 8E 08 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x0800; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF38D; JUMP; // sstep
case 0xF38D:
                                                     mon("LF38D    LDA   ,X                      ; F38D: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF38F; JUMP; // sstep
case 0xF38F:
                                                     mon("         BEQ   LF39D                   ; F38F: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf39d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF391; JUMP; // sstep
case 0xF391:
                                                     mon("         TFR   S,D                     ; F391: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF393; JUMP; // sstep
case 0xF393:
                                                     mon("         ORA   $1E,U                   ; F393: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF396; JUMP; // sstep
case 0xF396:
                                                     mon("         ORB   $1F,U                   ; F396: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF399; JUMP; // sstep
case 0xF399:
                                                     mon("         TFR   D,S                     ; F399: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF39B; JUMP; // sstep
case 0xF39B:
                                                     mon("         BRA   LF3DC                   ; F39B: 20 3F         \n");
    PC = 0xf3dc; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF39D:
                                                     mon("LF39D    LDA   #$80                    ; F39D: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF39F; JUMP; // sstep
case 0xF39F:
                                                     mon("         ASLA                          ; F39F: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF3A0; JUMP; // sstep
case 0xF3A0:
                                                     mon("LF3A0    ROLA                          ; F3A0: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF3A1; JUMP; // sstep
case 0xF3A1:
                                                     mon("         STA   ,X                      ; F3A1: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xF3A3; JUMP; // sstep
case 0xF3A3:
                                                     mon("         TFR   A,B                     ; F3A3: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xF3A5; JUMP; // sstep
case 0xF3A5:
                                                     mon("         EORB  ,X                      ; F3A5: E8 84         \n");
    clockticks = clockticks + 4; 
    res = B ^ rd_mem(X); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF3A7; JUMP; // sstep
case 0xF3A7:
                                                     mon("         BEQ   LF3B5                   ; F3A7: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf3b5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3A9; JUMP; // sstep
case 0xF3A9:
                                                     mon("         TFR   S,D                     ; F3A9: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF3AB; JUMP; // sstep
case 0xF3AB:
                                                     mon("         ORA   $1E,U                   ; F3AB: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF3AE; JUMP; // sstep
case 0xF3AE:
                                                     mon("         ORB   $1F,U                   ; F3AE: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF3B1; JUMP; // sstep
case 0xF3B1:
                                                     mon("         TFR   D,S                     ; F3B1: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF3B3; JUMP; // sstep
case 0xF3B3:
                                                     mon("         BRA   LF3DC                   ; F3B3: 20 27         \n");
    PC = 0xf3dc; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF3B5:
                                                     mon("LF3B5    BCC   LF3BE                   ; F3B5: 24 07         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf3be; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3B7; JUMP; // sstep
case 0xF3B7:
                                                     mon("         TSTA                          ; F3B7: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF3B8; JUMP; // sstep
case 0xF3B8:
                                                     mon("         BNE   LF3A0                   ; F3B8: 26 E6         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf3a0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3BA; JUMP; // sstep
case 0xF3BA:
                                                     mon("         ADDA  #$FF                    ; F3BA: 8B FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
    V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0xF3BC; JUMP; // sstep
case 0xF3BC:
                                                     mon("         BRA   LF3A0                   ; F3BC: 20 E2         \n");
    PC = 0xf3a0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF3BE:
                                                     mon("LF3BE    TFR   A,B                     ; F3BE: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xF3C0; JUMP; // sstep
case 0xF3C0:
                                                     mon("         INCB                          ; F3C0: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xF3C1; JUMP; // sstep
case 0xF3C1:
                                                     mon("         BNE   LF3A0                   ; F3C1: 26 DD         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf3a0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3C3; JUMP; // sstep
case 0xF3C3:
                                                     mon("         STA   $4640                   ; F3C3: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF3C6; JUMP; // sstep
case 0xF3C6:
                                                     mon("         CMPU  #word_F332              ; F3C6: 11 83 F3 32   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf332; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF3CA; JUMP; // sstep
case 0xF3CA:
                                                     mon("         BEQ   LF3D2                   ; F3CA: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf3d2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3CC; JUMP; // sstep
case 0xF3CC:
                                                     mon("         CMPU  #word_F334              ; F3CC: 11 83 F3 34   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf334; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF3D0; JUMP; // sstep
case 0xF3D0:
                                                     mon("         BNE   LF3D6                   ; F3D0: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf3d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3D2; JUMP; // sstep
case 0xF3D2:
                                                     mon("LF3D2    LEAX  $02,X                   ; F3D2: 30 02         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0002); 
    Z = X; 
    PC = 0xF3D4; JUMP; // sstep
case 0xF3D4:
                                                     mon("         BRA   LF3D8                   ; F3D4: 20 02         \n");
    PC = 0xf3d8; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF3D6:
                                                     mon("LF3D6    LEAX  $01,X                   ; F3D6: 30 01         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0001); 
/**/Z = X; 
    PC = 0xF3D8; JUMP; // sstep
case 0xF3D8:
                                                     mon("LF3D8    LEAY  -1,Y                    ; F3D8: 31 3F         \n");
    clockticks = clockticks + 5; 
    Y = (Y + 0xffff); 
    Z = Y; 
    PC = 0xF3DA; JUMP; // sstep
case 0xF3DA:
                                                     mon("         BNE   LF38D                   ; F3DA: 26 B1         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf38d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3DC; JUMP; // sstep
case 0xF3DC:
                                                     mon("LF3DC    CMPU  #off_F340               ; F3DC: 11 83 F3 40   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf340; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF3E0; JUMP; // sstep
case 0xF3E0:
                                                     mon("         BCS   LF387                   ; F3E0: 25 A5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf387; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3E2; JUMP; // sstep
case 0xF3E2:
                                                     mon("         LDU   #word_F32E              ; F3E2: CE F3 2E      \n");
    clockticks = clockticks + 3; 
    U = 0xf32e; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF3E5; JUMP; // sstep
case 0xF3E5:
                                                     mon("LF3E5    LDX   ,U++                    ; F3E5: AE C1         \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    U = U + 2; 
    PC = 0xF3E7; JUMP; // sstep
case 0xF3E7:
                                                     mon("         LDY   #$0800                  ; F3E7: 10 8E 08 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x0800; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF3EB; JUMP; // sstep
case 0xF3EB:
                                                     mon("LF3EB    INC   ,X                      ; F3EB: 6C 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(X, res); 
    clockticks = clockticks + 2; 
    PC = 0xF3ED; JUMP; // sstep
case 0xF3ED:
                                                     mon("         BEQ   LF3FB                   ; F3ED: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf3fb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3EF; JUMP; // sstep
case 0xF3EF:
                                                     mon("         TFR   S,D                     ; F3EF: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF3F1; JUMP; // sstep
case 0xF3F1:
                                                     mon("         ORA   $1E,U                   ; F3F1: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF3F4; JUMP; // sstep
case 0xF3F4:
                                                     mon("         ORB   $1F,U                   ; F3F4: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF3F7; JUMP; // sstep
case 0xF3F7:
                                                     mon("         TFR   D,S                     ; F3F7: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF3F9; JUMP; // sstep
case 0xF3F9:
                                                     mon("         BRA   LF424                   ; F3F9: 20 29         \n");
    PC = 0xf424; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF3FB:
                                                     mon("LF3FB    LDA   ,X                      ; F3FB: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF3FD; JUMP; // sstep
case 0xF3FD:
                                                     mon("         BEQ   LF40B                   ; F3FD: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf40b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF3FF; JUMP; // sstep
case 0xF3FF:
                                                     mon("         TFR   S,D                     ; F3FF: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF401; JUMP; // sstep
case 0xF401:
                                                     mon("         ORA   $1E,U                   ; F401: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF404; JUMP; // sstep
case 0xF404:
                                                     mon("         ORB   $1F,U                   ; F404: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF407; JUMP; // sstep
case 0xF407:
                                                     mon("         TFR   D,S                     ; F407: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF409; JUMP; // sstep
case 0xF409:
                                                     mon("         BRA   LF424                   ; F409: 20 19         \n");
    PC = 0xf424; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF40B:
                                                     mon("LF40B    STA   $4640                   ; F40B: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF40E; JUMP; // sstep
case 0xF40E:
                                                     mon("         CMPU  #word_F332              ; F40E: 11 83 F3 32   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf332; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF412; JUMP; // sstep
case 0xF412:
                                                     mon("         BEQ   LF41A                   ; F412: 27 06         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf41a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF414; JUMP; // sstep
case 0xF414:
                                                     mon("         CMPU  #word_F334              ; F414: 11 83 F3 34   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf334; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF418; JUMP; // sstep
case 0xF418:
                                                     mon("         BNE   LF41E                   ; F418: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf41e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF41A; JUMP; // sstep
case 0xF41A:
                                                     mon("LF41A    LEAX  $02,X                   ; F41A: 30 02         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0002); 
    Z = X; 
    PC = 0xF41C; JUMP; // sstep
case 0xF41C:
                                                     mon("         BRA   LF420                   ; F41C: 20 02         \n");
    PC = 0xf420; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF41E:
                                                     mon("LF41E    LEAX  $01,X                   ; F41E: 30 01         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0001); 
/**/Z = X; 
    PC = 0xF420; JUMP; // sstep
case 0xF420:
                                                     mon("LF420    LEAY  -1,Y                    ; F420: 31 3F         \n");
    clockticks = clockticks + 5; 
    Y = (Y + 0xffff); 
    Z = Y; 
    PC = 0xF422; JUMP; // sstep
case 0xF422:
                                                     mon("         BNE   LF3EB                   ; F422: 26 C7         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf3eb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF424; JUMP; // sstep
case 0xF424:
                                                     mon("LF424    CMPU  #off_F340               ; F424: 11 83 F3 40   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf340; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF428; JUMP; // sstep
case 0xF428:
                                                     mon("         BCS   LF3E5                   ; F428: 25 BB         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf3e5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF42A; JUMP; // sstep
case 0xF42A:
                                                     mon("         TFR   S,D                     ; F42A: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF42C; JUMP; // sstep
case 0xF42C:
                                                     mon("         ANDB  #$01                    ; F42C: C4 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x01; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF42E; JUMP; // sstep
case 0xF42E:
                                                     mon("         BNE   LF43F                   ; F42E: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf43f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF430; JUMP; // sstep
case 0xF430:
                                                     mon("         LDX   #$4500                  ; F430: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF433; JUMP; // sstep
case 0xF433:
                                                     mon("         LDU   #$4C00                  ; F433: CE 4C 00      \n");
    clockticks = clockticks + 3; 
    U = 0x4c00; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF436; JUMP; // sstep
case 0xF436:
                                                     mon("LF436    LDD   ,X++                    ; F436: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF438; JUMP; // sstep
case 0xF438:
                                                     mon("         STD   ,U++                    ; F438: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xF43A; JUMP; // sstep
case 0xF43A:
                                                     mon("         CMPX  #$4600                  ; F43A: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF43D; JUMP; // sstep
case 0xF43D:
                                                     mon("         BCS   LF436                   ; F43D: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf436; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF43F; JUMP; // sstep
case 0xF43F:
                                                     mon("LF43F    LDU   #word_F342              ; F43F: CE F3 42      \n");
    clockticks = clockticks + 3; 
    U = 0xf342; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF442; JUMP; // sstep
case 0xF442:
                                                     mon("         LDX   #$4500                  ; F442: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF445; JUMP; // sstep
case 0xF445:
                                                     mon("         LDD   #$00                    ; F445: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF448; JUMP; // sstep
case 0xF448:
                                                     mon("LF448    STD   ,X++                    ; F448: ED 81         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    X = X + 2; 
    PC = 0xF44A; JUMP; // sstep
case 0xF44A:
                                                     mon("         CMPX  #$4600                  ; F44A: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF44D; JUMP; // sstep
case 0xF44D:
                                                     mon("         BCS   LF448                   ; F44D: 25 F9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf448; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF44F; JUMP; // sstep
case 0xF44F:
                                                     mon("         LDX   #$4500                  ; F44F: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF452; JUMP; // sstep
case 0xF452:
                                                     mon("LF452    LDA   ,X                      ; F452: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF454; JUMP; // sstep
case 0xF454:
                                                     mon("         ANDA  #$0F                    ; F454: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF456; JUMP; // sstep
case 0xF456:
                                                     mon("         BEQ   LF464                   ; F456: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf464; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF458; JUMP; // sstep
case 0xF458:
                                                     mon("         TFR   S,D                     ; F458: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF45A; JUMP; // sstep
case 0xF45A:
                                                     mon("         ORA   $1E,U                   ; F45A: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF45D; JUMP; // sstep
case 0xF45D:
                                                     mon("         ORB   $1F,U                   ; F45D: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF460; JUMP; // sstep
case 0xF460:
                                                     mon("         TFR   D,S                     ; F460: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF462; JUMP; // sstep
case 0xF462:
                                                     mon("         BRA   LF4B7                   ; F462: 20 53         \n");
    PC = 0xf4b7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF464:
                                                     mon("LF464    LDA   #$80                    ; F464: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF466; JUMP; // sstep
case 0xF466:
                                                     mon("         ASLA                          ; F466: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF467; JUMP; // sstep
case 0xF467:
                                                     mon("         LDY   #$04                    ; F467: 10 8E 00 04   \n");
    clockticks = clockticks + 4; 
    Y = 0x0004; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF46B; JUMP; // sstep
case 0xF46B:
                                                     mon("LF46B    ROLA                          ; F46B: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF46C; JUMP; // sstep
case 0xF46C:
                                                     mon("         STA   ,X                      ; F46C: A7 84         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    PC = 0xF46E; JUMP; // sstep
case 0xF46E:
                                                     mon("         TFR   A,B                     ; F46E: 1F 89         \n");
    B = (UINT8)A; 
    clockticks = clockticks + 6; 
    PC = 0xF470; JUMP; // sstep
case 0xF470:
                                                     mon("         EORB  ,X                      ; F470: E8 84         \n");
    clockticks = clockticks + 4; 
    res = B ^ rd_mem(X); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF472; JUMP; // sstep
case 0xF472:
                                                     mon("         ANDB  #$0F                    ; F472: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF474; JUMP; // sstep
case 0xF474:
                                                     mon("         BEQ   LF482                   ; F474: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf482; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF476; JUMP; // sstep
case 0xF476:
                                                     mon("         TFR   S,D                     ; F476: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF478; JUMP; // sstep
case 0xF478:
                                                     mon("         ORA   $1E,U                   ; F478: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF47B; JUMP; // sstep
case 0xF47B:
                                                     mon("         ORB   $1F,U                   ; F47B: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF47E; JUMP; // sstep
case 0xF47E:
                                                     mon("         TFR   D,S                     ; F47E: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF480; JUMP; // sstep
case 0xF480:
                                                     mon("         BRA   LF4B7                   ; F480: 20 35         \n");
    PC = 0xf4b7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF482:
                                                     mon("LF482    LEAY  -1,Y                    ; F482: 31 3F         \n");
    clockticks = clockticks + 5; 
    Y = (Y + 0xffff); 
    Z = Y; 
    PC = 0xF484; JUMP; // sstep
case 0xF484:
                                                     mon("         BNE   LF46B                   ; F484: 26 E5         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf46b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF486; JUMP; // sstep
case 0xF486:
                                                     mon("         TSTA                          ; F486: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF487; JUMP; // sstep
case 0xF487:
                                                     mon("         BMI   LF491                   ; F487: 2B 08         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0xf491; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF489; JUMP; // sstep
case 0xF489:
                                                     mon("         LDA   #$FF                    ; F489: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF48B; JUMP; // sstep
case 0xF48B:
                                                     mon("         LDY   #$05                    ; F48B: 10 8E 00 05   \n");
    clockticks = clockticks + 4; 
    Y = 0x0005; 
    Z = Y; 
    N = (Y) >> 8; 
    V = 0; 
    PC = 0xF48F; JUMP; // sstep
case 0xF48F:
                                                     mon("         BRA   LF46B                   ; F48F: 20 DA         \n");
    PC = 0xf46b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF491:
                                                     mon("LF491    STA   $4640                   ; F491: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF494; JUMP; // sstep
case 0xF494:
                                                     mon("         LEAX  $01,X                   ; F494: 30 01         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0001); 
/**/Z = X; 
    PC = 0xF496; JUMP; // sstep
case 0xF496:
                                                     mon("         CMPX  #$4600                  ; F496: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF499; JUMP; // sstep
case 0xF499:
                                                     mon("         BCS   LF452                   ; F499: 25 B7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf452; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF49B; JUMP; // sstep
case 0xF49B:
                                                     mon("         LDX   #$4500                  ; F49B: 8E 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    X = 0x4500; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF49E; JUMP; // sstep
case 0xF49E:
                                                     mon("LF49E    INC   ,X                      ; F49E: 6C 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(X, res); 
    clockticks = clockticks + 2; 
    PC = 0xF4A0; JUMP; // sstep
case 0xF4A0:
                                                     mon("         LDA   ,X+                     ; F4A0: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xF4A2; JUMP; // sstep
case 0xF4A2:
                                                     mon("         ANDA  #$0F                    ; F4A2: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF4A4; JUMP; // sstep
case 0xF4A4:
                                                     mon("         BEQ   LF4B2                   ; F4A4: 27 0C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf4b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF4A6; JUMP; // sstep
case 0xF4A6:
                                                     mon("         TFR   S,D                     ; F4A6: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF4A8; JUMP; // sstep
case 0xF4A8:
                                                     mon("         ORA   $1E,U                   ; F4A8: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF4AB; JUMP; // sstep
case 0xF4AB:
                                                     mon("         ORB   $1F,U                   ; F4AB: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF4AE; JUMP; // sstep
case 0xF4AE:
                                                     mon("         TFR   D,S                     ; F4AE: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF4B0; JUMP; // sstep
case 0xF4B0:
                                                     mon("         BRA   LF4B7                   ; F4B0: 20 05         \n");
    PC = 0xf4b7; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF4B2:
                                                     mon("LF4B2    CMPX  #$4600                  ; F4B2: 8C 46 00      \n"); // NOVRAM
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4600; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF4B5; JUMP; // sstep
case 0xF4B5:
                                                     mon("         BCS   LF49E                   ; F4B5: 25 E7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf49e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF4B7; JUMP; // sstep
case 0xF4B7:
                                                     mon("LF4B7    TFR   S,D                     ; F4B7: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF4B9; JUMP; // sstep
case 0xF4B9:
                                                     mon("         ANDB  #$01                    ; F4B9: C4 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x01; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF4BB; JUMP; // sstep
case 0xF4BB:
                                                     mon("         BNE   LF4CE                   ; F4BB: 26 11         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf4ce; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF4BD; JUMP; // sstep
case 0xF4BD:
                                                     mon("         LDX   #$4C00                  ; F4BD: 8E 4C 00      \n");
    clockticks = clockticks + 3; 
    X = 0x4c00; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF4C0; JUMP; // sstep
case 0xF4C0:
                                                     mon("         LDU   #$4500                  ; F4C0: CE 45 00      \n"); // NOVRAM
    clockticks = clockticks + 3; 
    U = 0x4500; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF4C3; JUMP; // sstep
case 0xF4C3:
                                                     mon("LF4C3    LDD   ,X++                    ; F4C3: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF4C5; JUMP; // sstep
case 0xF4C5:
                                                     mon("         STD   ,U++                    ; F4C5: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0xF4C7; JUMP; // sstep
case 0xF4C7:
                                                     mon("         CMPX  #$4D00                  ; F4C7: 8C 4D 00      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x4d00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF4CA; JUMP; // sstep
case 0xF4CA:
                                                     mon("         BCS   LF4C3                   ; F4CA: 25 F7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf4c3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF4CC; JUMP; // sstep
case 0xF4CC:
                                                     mon("         BRA   LF4EC                   ; F4CC: 20 1E         \n");
    PC = 0xf4ec; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF4CE:
                                                     mon("LF4CE    LDA   #$FF                    ; F4CE: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF4D0; JUMP; // sstep
case 0xF4D0:
                                                     mon("         STA   $4687                   ; F4D0: B7 46 87      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4687, val); 
    PC = 0xF4D3; JUMP; // sstep
case 0xF4D3:
                                                     mon("         LDX   #$0100                  ; F4D3: 8E 01 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0100; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF4D6; JUMP; // sstep
case 0xF4D6:
                                                     mon("LF4D6    STA   $4640                   ; F4D6: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF4D9; JUMP; // sstep
case 0xF4D9:
                                                     mon("         LEAX  -1,X                    ; F4D9: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xF4DB; JUMP; // sstep
case 0xF4DB:
                                                     mon("         BNE   LF4D6                   ; F4DB: 26 F9         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf4d6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF4DD; JUMP; // sstep
case 0xF4DD:
                                                     mon("         LDA   #$00                    ; F4DD: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF4DF; JUMP; // sstep
case 0xF4DF:
                                                     mon("         STA   $4687                   ; F4DF: B7 46 87      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4687, val); 
    PC = 0xF4E2; JUMP; // sstep
case 0xF4E2:
                                                     mon("         LDX   #$A000                  ; F4E2: 8E A0 00      \n");
    clockticks = clockticks + 3; 
    X = 0xa000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF4E5; JUMP; // sstep
case 0xF4E5:
                                                     mon("LF4E5    STA   $4640                   ; F4E5: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF4E8; JUMP; // sstep
case 0xF4E8:
                                                     mon("         LEAX  -1,X                    ; F4E8: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xF4EA; JUMP; // sstep
case 0xF4EA:
                                                     mon("         BNE   LF4E5                   ; F4EA: 26 F9         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf4e5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF4EC; JUMP; // sstep
case 0xF4EC:
                                                     mon("LF4EC    STA   $4640                   ; F4EC: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF4EF; JUMP; // sstep
case 0xF4EF:
                                                     mon("         LDA   #$00                    ; F4EF: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF4F1; JUMP; // sstep
case 0xF4F1:
                                                     mon("         STA   $4684                   ; F4F1: B7 46 84      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4684, val); 
    PC = 0xF4F4; JUMP; // sstep
case 0xF4F4:
                                                     mon("         LDX   word_F342               ; F4F4: BE F3 42      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0xf342)<<8; 
    ea = ea | rd_mem(0xf343); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF4F7; JUMP; // sstep
case 0xF4F7:
                                                     mon("         LDY   #$2000                  ; F4F7: 10 8E 20 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x2000; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF4FB; JUMP; // sstep
case 0xF4FB:
                                                     mon("         TFR   X,D                     ; F4FB: 1F 10         \n");
    val = X; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF4FD; JUMP; // sstep
case 0xF4FD:
                                                     mon("LF4FD    ADCB  $01,X                   ; F4FD: E9 01         \n");
    clockticks = clockticks + 5; 
    arg = B; 
    val = rd_mem((UINT16)(X + 0x0001)); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    B = (UINT8)res; 
    PC = 0xF4FF; JUMP; // sstep
case 0xF4FF:
                                                     mon("         ADCA  ,X++                    ; F4FF: A9 81         \n");
    clockticks = clockticks + 7; 
    arg = A; 
    val = rd_mem(X); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    X = X + 2; 
    PC = 0xF501; JUMP; // sstep
case 0xF501:
                                                     mon("         STA   $4640                   ; F501: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF504; JUMP; // sstep
case 0xF504:
                                                     mon("         LEAY  -2,Y                    ; F504: 31 3E         \n");
    clockticks = clockticks + 5; 
    Y = (Y + 0xfffe); 
    Z = Y; 
    PC = 0xF506; JUMP; // sstep
case 0xF506:
                                                     mon("         BNE   LF4FD                   ; F506: 26 F5         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf4fd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF508; JUMP; // sstep
case 0xF508:
                                                     mon("         TFR   D,X                     ; F508: 1F 01         \n");
    X = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF50A; JUMP; // sstep
case 0xF50A:
                                                     mon("         LDA   #$FF                    ; F50A: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF50C; JUMP; // sstep
case 0xF50C:
                                                     mon("         STA   $4684                   ; F50C: B7 46 84      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4684, val); 
    PC = 0xF50F; JUMP; // sstep
case 0xF50F:
                                                     mon("         LDU   #word_F344              ; F50F: CE F3 44      \n"); // Point to ROM start address table
    clockticks = clockticks + 3; 
    U = 0xf344; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF512; JUMP; // sstep
case 0xF512:
                                                     mon("         TFR   X,D                     ; F512: 1F 10         \n");
    val = X; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF514; JUMP; // sstep
case 0xF514:
                                                     mon("         LDY   #$2000                  ; F514: 10 8E 20 00   \n"); // Size of each ROM
    clockticks = clockticks + 4; 
    Y = 0x2000; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF518; JUMP; // sstep
case 0xF518:
                                                     mon("         LDX   word_F342               ; F518: BE F3 42      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0xf342)<<8; 
    ea = ea | rd_mem(0xf343); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    // END OF FUNCTION CHUNK FOR sub_6532
    PC = 0xF51B; JUMP; // sstep
case 0xF51B:
                                                     mon("         BRA   LF528                   ; F51B: 20 0B         \n");
    PC = 0xf528; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // End of function sub_F51D
  case 0xF51D:
                                                     mon("LF51D    LDU   #word_F344              ; F51D: CE F3 44      \n"); // Point to ROM start address table
    clockticks = clockticks + 3; 
    U = 0xf344; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    // START OF FUNCTION CHUNK FOR sub_6532
    PC = 0xF520; JUMP; // sstep
case 0xF520:
                                                     mon("LF520    LDX   ,U++                    ; F520: AE C1         \n"); // Next ROM address start
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    U = U + 2; 
    PC = 0xF522; JUMP; // sstep
case 0xF522:
                                                     mon("         LDY   #$2000                  ; F522: 10 8E 20 00   \n"); // Size of ROM
    clockticks = clockticks + 4; 
    Y = 0x2000; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF526; JUMP; // sstep
case 0xF526:
                                                     mon("LF526    TFR   X,D                     ; F526: 1F 10         \n");
    val = X; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF528; JUMP; // sstep
case 0xF528:
                                                     mon("LF528    ADCB  $01,X                   ; F528: E9 01         \n");
    clockticks = clockticks + 5; 
    arg = B; 
    val = rd_mem((UINT16)(X + 0x0001)); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    B = (UINT8)res; 
    PC = 0xF52A; JUMP; // sstep
case 0xF52A:
                                                     mon("         ADCA  ,X++                    ; F52A: A9 81         \n");
    clockticks = clockticks + 7; 
    arg = A; 
    val = rd_mem(X); 
    res = (arg + val) + (C != 0 ? 1:0); 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (arg ^ val) ^ ((UINT8)res ^ C); 
/**/V = (arg ^ val) ^ ((UINT8)res ^ C); 
    A = (UINT8)res; 
    X = X + 2; 
    PC = 0xF52C; JUMP; // sstep
case 0xF52C:
                                                     mon("         STA   $4640                   ; F52C: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF52F; JUMP; // sstep
case 0xF52F:
                                                     mon("         LEAY  -2,Y                    ; F52F: 31 3E         \n");
    clockticks = clockticks + 5; 
    Y = (Y + 0xfffe); 
    Z = Y; 
    PC = 0xF531; JUMP; // sstep
case 0xF531:
                                                     mon("         BNE   LF528                   ; F531: 26 F5         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf528; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF533; JUMP; // sstep
case 0xF533:
                                                     mon("         STD   $5593,U                 ; F533: ED C9 55 93   \n");
    clockticks = clockticks + 8; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = (UINT16)(U + 0x5593); 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF537; JUMP; // sstep
case 0xF537:
                                                     mon("         BEQ   LF543                   ; F537: 27 0A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf543; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF539; JUMP; // sstep
case 0xF539:
                                                     mon("         TFR   S,D                     ; F539: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF53B; JUMP; // sstep
case 0xF53B:
                                                     mon("         ORA   $1E,U                   ; F53B: AA C8 1E      \n");
    clockticks = clockticks + 5; 
    res = A | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1e)); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF53E; JUMP; // sstep
case 0xF53E:
                                                     mon("         ORB   $1F,U                   ; F53E: EA C8 1F      \n");
    clockticks = clockticks + 5; 
    res = B | (UINT8)rd_mem((UINT16)(U + (SINT8)0x1f)); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF541; JUMP; // sstep
case 0xF541:
                                                     mon("         TFR   D,S                     ; F541: 1F 04         \n");
    S = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF543; JUMP; // sstep
case 0xF543:
                                                     mon("LF543    CMPU  #word_F34C              ; F543: 11 83 F3 4C   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf34c; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF547; JUMP; // sstep
case 0xF547:
                                                     mon("         BCS   LF520                   ; F547: 25 D7         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf520; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF549; JUMP; // sstep
case 0xF549:
                                                     mon("         CMPU  #word_F34E              ; F549: 11 83 F3 4E   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf34e; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF54D; JUMP; // sstep
case 0xF54D:
                                                     mon("         BCC   LF557                   ; F54D: 24 08         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf557; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF54F; JUMP; // sstep
case 0xF54F:
                                                     mon("         LDX   ,U++                    ; F54F: AE C1         \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    U = U + 2; 
    PC = 0xF551; JUMP; // sstep
case 0xF551:
                                                     mon("         LDY   #$1000                  ; F551: 10 8E 10 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x1000; 
    Z = Y; 
    N = (Y) >> 8; 
    V = 0; 
    PC = 0xF555; JUMP; // sstep
case 0xF555:
                                                     mon("         BRA   LF526                   ; F555: 20 CF         \n");
    PC = 0xf526; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF557:
                                                     mon("LF557    LDA   #$FF                    ; F557: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF559; JUMP; // sstep
case 0xF559:
                                                     mon("         STA   $4686                   ; F559: B7 46 86      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4686, val); 
    PC = 0xF55C; JUMP; // sstep
case 0xF55C:
                                                     mon("         STA   $4683                   ; F55C: B7 46 83      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4683, val); 
    PC = 0xF55F; JUMP; // sstep
case 0xF55F:
                                                     mon("         STA   $4682                   ; F55F: B7 46 82      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4682, val); 
    PC = 0xF562; JUMP; // sstep
case 0xF562:
                                                     mon("         CLR   <$D1                    ; F562: 0F D1         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xd1, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF564; JUMP; // sstep
case 0xF564:
                                                     mon("         LDA   $4320                   ; F564: B6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF567; JUMP; // sstep
case 0xF567:
                                                     mon("         ANDA  #$04                    ; F567: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF569; JUMP; // sstep
case 0xF569:
                                                     mon("         BNE   LF56E                   ; F569: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf56e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF56B; JUMP; // sstep
case 0xF56B:
                                                     mon("         JMP   Check_Test_Diag         ; F56B: 7E FD 07      \n");
    clockticks = clockticks + 4; 
    PC = 0xfd07; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xF56E:
                                                     mon("LF56E    STA   $4640                   ; F56E: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF571; JUMP; // sstep
case 0xF571:
                                                     mon("         STS   <$D2                    ; F571: 10 DF D2      \n");
    clockticks = clockticks + 5; 
    val = S; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xd2; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xF574; JUMP; // sstep
case 0xF574:
                                                     mon("         TFR   S,D                     ; F574: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF576; JUMP; // sstep
case 0xF576:
                                                     mon("         ANDB  #$01                    ; F576: C4 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x01; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF578; JUMP; // sstep
case 0xF578:
                                                     mon("         BNE   LF5ED                   ; F578: 26 73         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf5ed; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF57A; JUMP; // sstep
case 0xF57A:
                                                     mon("         LDY   #$00                    ; F57A: 10 8E 00 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x0000; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF57E; JUMP; // sstep
case 0xF57E:
                                                     mon("         LDD   #$6000                  ; F57E: CC 60 00      \n");
    clockticks = clockticks + 3; 
    A = 0x60; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF581; JUMP; // sstep
case 0xF581:
                                                     mon("         STD   ,Y++                    ; F581: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF583; JUMP; // sstep
case 0xF583:
                                                     mon("         LDD   #$BFAE                  ; F583: CC BF AE      \n");
    clockticks = clockticks + 3; 
    A = 0xbf; 
    B = 0xae; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF586; JUMP; // sstep
case 0xF586:
                                                     mon("         STD   ,Y++                    ; F586: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF588; JUMP; // sstep
case 0xF588:
                                                     mon("         LDD   #$8040                  ; F588: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF58B; JUMP; // sstep
case 0xF58B:
                                                     mon("         STD   ,Y++                    ; F58B: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF58D; JUMP; // sstep
case 0xF58D:
                                                     mon("         LDA   #$48                    ; F58D: 86 48         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x48; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF58F; JUMP; // sstep
case 0xF58F:
                                                     mon("         TFR   A,DP                    ; F58F: 1F 8B         \n");
    DP = (A) << 8; checkDP(); 
    // memory_DP = &memory[DP];
    clockticks = clockticks + 6; 
    PC = 0xF591; JUMP; // sstep
case 0xF591:
                                                     mon("         STS   <$CC                    ; F591: 10 DF CC      \n");
    clockticks = clockticks + 5; 
    val = S; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xcc; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xF594; JUMP; // sstep
case 0xF594:
                                                     mon("         LDS   #$4FFF                  ; F594: 10 CE 4F FF   \n");
    clockticks = clockticks + 4; 
    S = 0x4fff; 
/**/Z = S; 
/**/N = (S) >> 8; 
/**/V = 0; 
    PC = 0xF598; JUMP; // sstep
case 0xF598:
                                                     mon("         LDB   #$D3                    ; F598: C6 D3         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xd3; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF59A; JUMP; // sstep
case 0xF59A:
                                                     mon("         JSR   LE7C7                   ; F59A: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF59D:
                                                     mon("LF59D    LDB   #$B0                    ; F59D: C6 B0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xb0; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF59F; JUMP; // sstep
case 0xF59F:
                                                     mon("         JSR   LE7C7                   ; F59F: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF5A2:
                                                     mon("LF5A2    LDB   #$B2                    ; F5A2: C6 B2         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xb2; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF5A4; JUMP; // sstep
case 0xF5A4:
                                                     mon("         STB   <$CE                    ; F5A4: D7 CE         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xce; 
    wr_mem(ea, val); 
    PC = 0xF5A6; JUMP; // sstep
case 0xF5A6:
                                                     mon("         LDD   <$CC                    ; F5A6: DC CC         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xcc); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xcd); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xF5A8; JUMP; // sstep
case 0xF5A8:
                                                     mon("         BNE   LF5B1                   ; F5A8: 26 07         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf5b1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF5AA; JUMP; // sstep
case 0xF5AA:
                                                     mon("         LDB   #$B1                    ; F5AA: C6 B1         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xb1; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF5AC; JUMP; // sstep
case 0xF5AC:
                                                     mon("         JSR   LE7C7                   ; F5AC: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF5AF:
                                                     mon("LF5AF    BRA   LF5EB                   ; F5AF: 20 3A         \n");
    PC = 0xf5eb; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF5B1:
                                                     mon("LF5B1    LSRA                          ; F5B1: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xF5B2; JUMP; // sstep
case 0xF5B2:
                                                     mon("         RORB                          ; F5B2: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xF5B3; JUMP; // sstep
case 0xF5B3:
                                                     mon("         STD   <$CC                    ; F5B3: DD CC         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0xcc; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF5B5; JUMP; // sstep
case 0xF5B5:
                                                     mon("         BCC   LF5E5                   ; F5B5: 24 2E         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf5e5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF5B7; JUMP; // sstep
case 0xF5B7:
                                                     mon("         LDB   <$CE                    ; F5B7: D6 CE         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xce); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF5B9; JUMP; // sstep
case 0xF5B9:
                                                     mon("         JSR   LE7C7                   ; F5B9: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF5BC:
                                                     mon("LF5BC    LDB   <$CE                    ; F5BC: D6 CE         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xce); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF5BE; JUMP; // sstep
case 0xF5BE:
                                                     mon("         SUBB  #$BC                    ; F5BE: C0 BC         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xbc; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xF5C0; JUMP; // sstep
case 0xF5C0:
                                                     mon("         BCS   LF5E5                   ; F5C0: 25 23         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf5e5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF5C2; JUMP; // sstep
case 0xF5C2:
                                                     mon("         ASLB                          ; F5C2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xF5C3; JUMP; // sstep
case 0xF5C3:
                                                     mon("         LDX   #$F743                  ; F5C3: 8E F7 43      \n");
    clockticks = clockticks + 3; 
    X = 0xf743; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF5C6; JUMP; // sstep
case 0xF5C6:
                                                     mon("         ABX                           ; F5C6: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xF5C7; JUMP; // sstep
case 0xF5C7:
                                                     mon("         LDU   ,X                      ; F5C7: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF5C9; JUMP; // sstep
case 0xF5C9:
                                                     mon("         STU   ,Y++                    ; F5C9: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xF5CB; JUMP; // sstep
case 0xF5CB:
                                                     mon("         LDU   #$0120                  ; F5CB: CE 01 20      \n");
    clockticks = clockticks + 3; 
    U = 0x0120; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF5CE; JUMP; // sstep
case 0xF5CE:
                                                     mon("         STU   ,Y++                    ; F5CE: EF A1         \n");
    clockticks = clockticks + 7; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    Y = Y + 2; 
    PC = 0xF5D0; JUMP; // sstep
case 0xF5D0:
                                                     mon("         LDX   #$48D7                  ; F5D0: 8E 48 D7      \n");
    clockticks = clockticks + 3; 
    X = 0x48d7; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF5D3; JUMP; // sstep
case 0xF5D3:
                                                     mon("         ABX                           ; F5D3: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0xF5D4; JUMP; // sstep
case 0xF5D4:
                                                     mon("         LDA   ,X+                     ; F5D4: A6 80         \n");
    clockticks = clockticks + 6; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    X = X + 1; 
    PC = 0xF5D6; JUMP; // sstep
case 0xF5D6:
                                                     mon("         COMA                          ; F5D6: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
    Z = val; 
    N = val; 
    V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xF5D7; JUMP; // sstep
case 0xF5D7:
                                                     mon("         JSR   Display_Vect_BCD        ; F5D7: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xda); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xF5DA:
                                                     mon("LF5DA    LDA   ,X                      ; F5DA: A6 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(X); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF5DC; JUMP; // sstep
case 0xF5DC:
                                                     mon("         COMA                          ; F5DC: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
    Z = val; 
    N = val; 
    V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xF5DD; JUMP; // sstep
case 0xF5DD:
                                                     mon("         JSR   Display_Vect_BCD        ; F5DD: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xF5E0:
                                                     mon("LF5E0    LDD   #$8040                  ; F5E0: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF5E3; JUMP; // sstep
case 0xF5E3:
                                                     mon("         STD   ,Y++                    ; F5E3: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF5E5; JUMP; // sstep
case 0xF5E5:
                                                     mon("LF5E5    INC   <$CE                    ; F5E5: 0C CE         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xce); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0xce, res); 
    clockticks = clockticks + 2; 
    PC = 0xF5E7; JUMP; // sstep
case 0xF5E7:
                                                     mon("         LDD   <$CC                    ; F5E7: DC CC         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xcc); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xcd); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xF5E9; JUMP; // sstep
case 0xF5E9:
                                                     mon("         BNE   LF5B1                   ; F5E9: 26 C6         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf5b1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF5EB; JUMP; // sstep
case 0xF5EB:
                                                     mon("LF5EB    BRA   LF643                   ; F5EB: 20 56         \n");
    PC = 0xf643; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF5ED:
                                                     mon("LF5ED    LDX   #$08                    ; F5ED: 8E 00 08      \n");
    clockticks = clockticks + 3; 
    X = 0x0008; 
/**/Z = X; 
/**/N = (X) >> 8; 
    V = 0; 
    PC = 0xF5F0; JUMP; // sstep
case 0xF5F0:
                                                     mon("         TFR   S,D                     ; F5F0: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF5F2; JUMP; // sstep
case 0xF5F2:
                                                     mon("LF5F2    LSRB                          ; F5F2: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xF5F3; JUMP; // sstep
case 0xF5F3:
                                                     mon("         BCC   LF5F9                   ; F5F3: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf5f9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF5F5; JUMP; // sstep
case 0xF5F5:
                                                     mon("         LDA   #$29                    ; F5F5: 86 29         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x29; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF5F7; JUMP; // sstep
case 0xF5F7:
                                                     mon("         BRA   LF5FB                   ; F5F7: 20 02         \n");
    PC = 0xf5fb; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF5F9:
                                                     mon("LF5F9    LDA   #$3B                    ; F5F9: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF5FB; JUMP; // sstep
case 0xF5FB:
                                                     mon("LF5FB    STA   $4400                   ; F5FB: B7 44 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4400, val); 
    PC = 0xF5FE; JUMP; // sstep
case 0xF5FE:
                                                     mon("         LDU   #$00                    ; F5FE: CE 00 00      \n");
    clockticks = clockticks + 3; 
    U = 0x0000; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF601; JUMP; // sstep
case 0xF601:
                                                     mon("LF601    STB   $4640                   ; F601: F7 46 40      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF604; JUMP; // sstep
case 0xF604:
                                                     mon("         LEAU  $01,U                   ; F604: 33 41         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0001); 
    PC = 0xF606; JUMP; // sstep
case 0xF606:
                                                     mon("         CMPU  #$A000                  ; F606: 11 83 A0 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xa000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF60A; JUMP; // sstep
case 0xF60A:
                                                     mon("         BCS   LF601                   ; F60A: 25 F5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf601; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF60C; JUMP; // sstep
case 0xF60C:
                                                     mon("         LEAX  -1,X                    ; F60C: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xF60E; JUMP; // sstep
case 0xF60E:
                                                     mon("         BNE   LF5F2                   ; F60E: 26 E2         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf5f2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF610; JUMP; // sstep
case 0xF610:
                                                     mon("         LDX   #$08                    ; F610: 8E 00 08      \n");
    clockticks = clockticks + 3; 
    X = 0x0008; 
/**/Z = X; 
/**/N = (X) >> 8; 
    V = 0; 
    PC = 0xF613; JUMP; // sstep
case 0xF613:
                                                     mon("         TFR   S,D                     ; F613: 1F 40         \n");
    val = S; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF615; JUMP; // sstep
case 0xF615:
                                                     mon("LF615    LSRA                          ; F615: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0xF616; JUMP; // sstep
case 0xF616:
                                                     mon("         BCC   LF61C                   ; F616: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0xf61c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF618; JUMP; // sstep
case 0xF618:
                                                     mon("         LDB   #$29                    ; F618: C6 29         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x29; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF61A; JUMP; // sstep
case 0xF61A:
                                                     mon("         BRA   LF61E                   ; F61A: 20 02         \n");
    PC = 0xf61e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF61C:
                                                     mon("LF61C    LDB   #$3B                    ; F61C: C6 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF61E; JUMP; // sstep
case 0xF61E:
                                                     mon("LF61E    STB   $4400                   ; F61E: F7 44 00      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4400, val); 
    PC = 0xF621; JUMP; // sstep
case 0xF621:
                                                     mon("         LDU   #$00                    ; F621: CE 00 00      \n");
    clockticks = clockticks + 3; 
    U = 0x0000; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF624; JUMP; // sstep
case 0xF624:
                                                     mon("LF624    STA   $4640                   ; F624: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF627; JUMP; // sstep
case 0xF627:
                                                     mon("         LEAU  $01,U                   ; F627: 33 41         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0001); 
    PC = 0xF629; JUMP; // sstep
case 0xF629:
                                                     mon("         CMPU  #$A000                  ; F629: 11 83 A0 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xa000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF62D; JUMP; // sstep
case 0xF62D:
                                                     mon("         BCS   LF624                   ; F62D: 25 F5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf624; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF62F; JUMP; // sstep
case 0xF62F:
                                                     mon("         LEAX  -1,X                    ; F62F: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0xF631; JUMP; // sstep
case 0xF631:
                                                     mon("         BNE   LF615                   ; F631: 26 E2         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf615; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF633; JUMP; // sstep
case 0xF633:
                                                     mon("         LDU   #$00                    ; F633: CE 00 00      \n");
    clockticks = clockticks + 3; 
    U = 0x0000; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF636; JUMP; // sstep
case 0xF636:
                                                     mon("LF636    STA   $4640                   ; F636: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF639; JUMP; // sstep
case 0xF639:
                                                     mon("         LEAU  $01,U                   ; F639: 33 41         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0001); 
    PC = 0xF63B; JUMP; // sstep
case 0xF63B:
                                                     mon("         CMPU  #$FF00                  ; F63B: 11 83 FF 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xff00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF63F; JUMP; // sstep
case 0xF63F:
                                                     mon("         BCS   LF636                   ; F63F: 25 F5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf636; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF641; JUMP; // sstep
case 0xF641:
                                                     mon("         BRA   LF5ED                   ; F641: 20 AA         \n");
    PC = 0xf5ed; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF643:
                                                     mon("LF643    LDD   #$2020                  ; F643: CC 20 20      \n");
    clockticks = clockticks + 3; 
    A = 0x20; 
    B = 0x20; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF646; JUMP; // sstep
case 0xF646:
                                                     mon("         STD   ,Y++                    ; F646: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF648; JUMP; // sstep
case 0xF648:
                                                     mon("         LDU   #off_F723               ; F648: CE F7 23      \n");
    clockticks = clockticks + 3; 
    U = 0xf723; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF64B; JUMP; // sstep
case 0xF64B:
                                                     mon("         CLR   <$C0                    ; F64B: 0F C0         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xc0, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF64D; JUMP; // sstep
case 0xF64D:
                                                     mon("         LDA   #$03                    ; F64D: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF64F; JUMP; // sstep
case 0xF64F:
                                                     mon("         STA   <$C5                    ; F64F: 97 C5         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc5; 
    wr_mem(ea, val); 
    PC = 0xF651; JUMP; // sstep
case 0xF651:
                                                     mon("         STA   <$C6                    ; F651: 97 C6         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc6; 
    wr_mem(ea, val); 
    PC = 0xF653; JUMP; // sstep
case 0xF653:
                                                     mon("         STA   <$C7                    ; F653: 97 C7         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc7; 
    wr_mem(ea, val); 
    PC = 0xF655; JUMP; // sstep
case 0xF655:
                                                     mon("         STA   <$D6                    ; F655: 97 D6         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xd6; 
    wr_mem(ea, val); 
    PC = 0xF657; JUMP; // sstep
case 0xF657:
                                                     mon("         LDX   #word_F34E              ; F657: 8E F3 4E      \n");
    clockticks = clockticks + 3; 
    X = 0xf34e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF65A; JUMP; // sstep
case 0xF65A:
                                                     mon("         STX   <$D4                    ; F65A: 9F D4         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xd4; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0xF65C; JUMP; // sstep
case 0xF65C:
                                                     mon("LF65C    LDD   #$01                    ; F65C: CC 00 01      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF65F; JUMP; // sstep
case 0xF65F:
                                                     mon("         LDX   #$00                    ; F65F: 8E 00 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF662; JUMP; // sstep
case 0xF662:
                                                     mon("LF662    STA   $4640                   ; F662: B7 46 40      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4640, val); 
    PC = 0xF665; JUMP; // sstep
case 0xF665:
                                                     mon("         LEAX  D,X                     ; F665: 30 8B         \n");
    clockticks = clockticks + 8; 
    X = (X + (((UINT8)A<<8)|(UINT8)B)); 
/**/Z = X; 
    PC = 0xF667; JUMP; // sstep
case 0xF667:
                                                     mon("         CMPX  #$0708                  ; F667: 8C 07 08      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x0708; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF66A; JUMP; // sstep
case 0xF66A:
                                                     mon("         BCS   LF662                   ; F66A: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf662; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF66C; JUMP; // sstep
case 0xF66C:
                                                     mon("         STA   $4620                   ; F66C: B7 46 20      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4620, val); 
    PC = 0xF66F; JUMP; // sstep
case 0xF66F:
                                                     mon("         LDA   $4320                   ; F66F: B6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF672; JUMP; // sstep
case 0xF672:
                                                     mon("         ANDA  #$04                    ; F672: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF674; JUMP; // sstep
case 0xF674:
                                                     mon("         BNE   LF679                   ; F674: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf679; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF676; JUMP; // sstep
case 0xF676:
                                                     mon("         JMP   LF720                   ; F676: 7E F7 20      \n");
    clockticks = clockticks + 4; 
    PC = 0xf720; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0xF679:
                                                     mon("LF679    LDA   $4300                   ; F679: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF67C; JUMP; // sstep
case 0xF67C:
                                                     mon("         ANDA  #$04                    ; F67C: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF67E; JUMP; // sstep
case 0xF67E:
                                                     mon("         BNE   LF69F                   ; F67E: 26 1F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf69f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF680; JUMP; // sstep
case 0xF680:
                                                     mon("         LDA   <$C5                    ; F680: 96 C5         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc5); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF682; JUMP; // sstep
case 0xF682:
                                                     mon("         BEQ   LF69D                   ; F682: 27 19         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf69d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF684; JUMP; // sstep
case 0xF684:
                                                     mon("         DECA                          ; F684: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF685; JUMP; // sstep
case 0xF685:
                                                     mon("         BNE   LF69D                   ; F685: 26 16         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf69d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF687; JUMP; // sstep
case 0xF687:
                                                     mon("         LEAU  $02,U                   ; F687: 33 42         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0002); 
    PC = 0xF689; JUMP; // sstep
case 0xF689:
                                                     mon("         CMPU  #word_F735              ; F689: 11 83 F7 35   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf735; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF68D; JUMP; // sstep
case 0xF68D:
                                                     mon("         BCS   LF692                   ; F68D: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf692; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF68F; JUMP; // sstep
case 0xF68F:
                                                     mon("         LDU   #off_F725               ; F68F: CE F7 25      \n");
    clockticks = clockticks + 3; 
    U = 0xf725; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0xF692; JUMP; // sstep
case 0xF692:
                                                     mon("LF692    LDD   #$00                    ; F692: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF695; JUMP; // sstep
case 0xF695:
                                                     mon("         STD   <$C2                    ; F695: DD C2         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc2; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF697; JUMP; // sstep
case 0xF697:
                                                     mon("         STA   <$C4                    ; F697: 97 C4         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc4; 
    wr_mem(ea, val); 
    PC = 0xF699; JUMP; // sstep
case 0xF699:
                                                     mon("         STA   <$C0                    ; F699: 97 C0         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc0; 
    wr_mem(ea, val); 
    PC = 0xF69B; JUMP; // sstep
case 0xF69B:
                                                     mon("         LDA   #$80                    ; F69B: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF69D; JUMP; // sstep
case 0xF69D:
                                                     mon("LF69D    BRA   LF6A1                   ; F69D: 20 02         \n");
    PC = 0xf6a1; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF69F:
                                                     mon("LF69F    LDA   #$03                    ; F69F: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6A1; JUMP; // sstep
case 0xF6A1:
                                                     mon("LF6A1    STA   <$C5                    ; F6A1: 97 C5         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc5; 
    wr_mem(ea, val); 
    PC = 0xF6A3; JUMP; // sstep
case 0xF6A3:
                                                     mon("         LDA   $4300                   ; F6A3: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6A6; JUMP; // sstep
case 0xF6A6:
                                                     mon("         COMA                          ; F6A6: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xF6A7; JUMP; // sstep
case 0xF6A7:
                                                     mon("         ANDA  #$C0                    ; F6A7: 84 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xc0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF6A9; JUMP; // sstep
case 0xF6A9:
                                                     mon("         BEQ   LF6C7                   ; F6A9: 27 1C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf6c7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6AB; JUMP; // sstep
case 0xF6AB:
                                                     mon("         LDA   <$C6                    ; F6AB: 96 C6         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc6); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF6AD; JUMP; // sstep
case 0xF6AD:
                                                     mon("         BEQ   LF6C5                   ; F6AD: 27 16         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf6c5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6AF; JUMP; // sstep
case 0xF6AF:
                                                     mon("         DECA                          ; F6AF: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF6B0; JUMP; // sstep
case 0xF6B0:
                                                     mon("         BNE   LF6C5                   ; F6B0: 26 13         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf6c5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6B2; JUMP; // sstep
case 0xF6B2:
                                                     mon("         LDB   <$C0                    ; F6B2: D6 C0         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc0); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6B4; JUMP; // sstep
case 0xF6B4:
                                                     mon("         ADDB  #$02                    ; F6B4: CB 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x02; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    B = (UINT8)res; 
    PC = 0xF6B6; JUMP; // sstep
case 0xF6B6:
                                                     mon("         CMPB  #$0E                    ; F6B6: C1 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x0e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF6B8; JUMP; // sstep
case 0xF6B8:
                                                     mon("         BCS   LF6BB                   ; F6B8: 25 01         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf6bb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6BA; JUMP; // sstep
case 0xF6BA:
                                                     mon("         CLRB                          ; F6BA: 5F            \n");
    B = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF6BB; JUMP; // sstep
case 0xF6BB:
                                                     mon("LF6BB    STB   <$C0                    ; F6BB: D7 C0         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc0; 
    wr_mem(ea, val); 
    PC = 0xF6BD; JUMP; // sstep
case 0xF6BD:
                                                     mon("         CMPB  #$04                    ; F6BD: C1 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0xF6BF; JUMP; // sstep
case 0xF6BF:
                                                     mon("         BNE   LF6C3                   ; F6BF: 26 02         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf6c3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6C1; JUMP; // sstep
case 0xF6C1:
                                                     mon("         CLR   <$C1                    ; F6C1: 0F C1         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xc1, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF6C3; JUMP; // sstep
case 0xF6C3:
                                                     mon("LF6C3    LDA   #$80                    ; F6C3: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF6C5; JUMP; // sstep
case 0xF6C5:
                                                     mon("LF6C5    BRA   LF6C9                   ; F6C5: 20 02         \n");
    PC = 0xf6c9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF6C7:
                                                     mon("LF6C7    LDA   #$03                    ; F6C7: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6C9; JUMP; // sstep
case 0xF6C9:
                                                     mon("LF6C9    STA   <$C6                    ; F6C9: 97 C6         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc6; 
    wr_mem(ea, val); 
    PC = 0xF6CB; JUMP; // sstep
case 0xF6CB:
                                                     mon("         CMPU  #off_F733               ; F6CB: 11 83 F7 33   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0xf733; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF6CF; JUMP; // sstep
case 0xF6CF:
                                                     mon("         BNE   LF6F0                   ; F6CF: 26 1F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf6f0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6D1; JUMP; // sstep
case 0xF6D1:
                                                     mon("         LDA   $4320                   ; F6D1: B6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6D4; JUMP; // sstep
case 0xF6D4:
                                                     mon("         COMA                          ; F6D4: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0xF6D5; JUMP; // sstep
case 0xF6D5:
                                                     mon("         ANDA  #$30                    ; F6D5: 84 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x30; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF6D7; JUMP; // sstep
case 0xF6D7:
                                                     mon("         BEQ   LF6EA                   ; F6D7: 27 11         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf6ea; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6D9; JUMP; // sstep
case 0xF6D9:
                                                     mon("         LDA   <$C7                    ; F6D9: 96 C7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc7); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF6DB; JUMP; // sstep
case 0xF6DB:
                                                     mon("         BEQ   LF6E8                   ; F6DB: 27 0B         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf6e8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6DD; JUMP; // sstep
case 0xF6DD:
                                                     mon("         DECA                          ; F6DD: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0xF6DE; JUMP; // sstep
case 0xF6DE:
                                                     mon("         BNE   LF6E8                   ; F6DE: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf6e8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF6E0; JUMP; // sstep
case 0xF6E0:
                                                     mon("         LDB   <$C1                    ; F6E0: D6 C1         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc1); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6E2; JUMP; // sstep
case 0xF6E2:
                                                     mon("         EORB  #$01                    ; F6E2: C8 01         \n");
    clockticks = clockticks + 2; 
    res = B ^ (SINT8)0x01; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF6E4; JUMP; // sstep
case 0xF6E4:
                                                     mon("         STB   <$C1                    ; F6E4: D7 C1         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xc1; 
    wr_mem(ea, val); 
    PC = 0xF6E6; JUMP; // sstep
case 0xF6E6:
                                                     mon("         LDA   #$80                    ; F6E6: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF6E8; JUMP; // sstep
case 0xF6E8:
                                                     mon("LF6E8    BRA   LF6EC                   ; F6E8: 20 02         \n");
    PC = 0xf6ec; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF6EA:
                                                     mon("LF6EA    LDA   #$03                    ; F6EA: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6EC; JUMP; // sstep
case 0xF6EC:
                                                     mon("LF6EC    STA   <$C7                    ; F6EC: 97 C7         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xc7; 
    wr_mem(ea, val); 
    PC = 0xF6EE; JUMP; // sstep
case 0xF6EE:
                                                     mon("         BRA   LF6F2                   ; F6EE: 20 02         \n");
    PC = 0xf6f2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF6F0:
                                                     mon("LF6F0    CLR   <$C1                    ; F6F0: 0F C1         \n");
    clockticks = clockticks + 4; 
    wr_mem(DP|0xc1, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF6F2; JUMP; // sstep
case 0xF6F2:
                                                     mon("LF6F2    LDY   #$00                    ; F6F2: 10 8E 00 00   \n");
    clockticks = clockticks + 4; 
    Y = 0x0000; 
/**/Z = Y; 
/**/N = (Y) >> 8; 
/**/V = 0; 
    PC = 0xF6F6; JUMP; // sstep
case 0xF6F6:
                                                     mon("         LDB   <$C0                    ; F6F6: D6 C0         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc0); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF6F8; JUMP; // sstep
case 0xF6F8:
                                                     mon("         LDX   #word_F735              ; F6F8: 8E F7 35      \n");
    clockticks = clockticks + 3; 
    X = 0xf735; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF6FB; JUMP; // sstep
case 0xF6FB:
                                                     mon("         LDD   B,X                     ; F6FB: EC 85         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)B); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF6FD; JUMP; // sstep
case 0xF6FD:
                                                     mon("         CMPD  #$6780                  ; F6FD: 10 83 67 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x6780; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF701; JUMP; // sstep
case 0xF701:
                                                     mon("         BNE   LF709                   ; F701: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf709; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF703; JUMP; // sstep
case 0xF703:
                                                     mon("         TST   <$C1                    ; F703: 0D C1         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xc1); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0xF705; JUMP; // sstep
case 0xF705:
                                                     mon("         BEQ   LF709                   ; F705: 27 02         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf709; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF707; JUMP; // sstep
case 0xF707:
                                                     mon("         LDB   #$20                    ; F707: C6 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF709; JUMP; // sstep
case 0xF709:
                                                     mon("LF709    STD   ,Y++                    ; F709: ED A1         \n");
    clockticks = clockticks + 7; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    // END OF FUNCTION CHUNK FOR sub_6532
    PC = 0xF70B; JUMP; // sstep
case 0xF70B:
                                                     mon("         JMP   [,U]                    ; F70B: 6E D4         \n");
    clockticks = clockticks + 1; 
    clockticks = clockticks + 4; 
    clockticks = clockticks + 2; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    PC = ea; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF70D:
                                                     mon("LF70D    LDD   #$2020                  ; F70D: CC 20 20      \n");
    clockticks = clockticks + 3; 
    A = 0x20; 
    B = 0x20; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF710; JUMP; // sstep
case 0xF710:
                                                     mon("         STD   ,Y++                    ; F710: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF712; JUMP; // sstep
case 0xF712:
                                                     mon("         STD   ,Y++                    ; F712: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF714; JUMP; // sstep
case 0xF714:
                                                     mon("LF714    STA   $4600                   ; F714: B7 46 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4600, val); 
    PC = 0xF717; JUMP; // sstep
case 0xF717:
                                                     mon("         LDA   $4300                   ; F717: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF71A; JUMP; // sstep
case 0xF71A:
                                                     mon("         ANDA  #$10                    ; F71A: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    // End of function sub_F70D
    PC = 0xF71C; JUMP; // sstep
case 0xF71C:
                                                     mon("         LBEQ  LF65C                   ; F71C: 10 27 FF 3C   \n");
    clockticks = clockticks + 5; 
    if (!Z) {
    clockticks = clockticks + 1; 
    PC = 0xf65c; 
    JUMP;
    }
    // START OF FUNCTION CHUNK FOR sub_6532
    // END OF FUNCTION CHUNK FOR sub_6532
    // ---------------------------------------------------------------------------
    PC = 0xF720; JUMP; // sstep
case 0xF720:
                                                     mon("LF720    JMP   LF720                   ; F720: 7E F7 20      \n");
    clockticks = clockticks + 4; 
    PC = 0xf720; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF74F:
                                                     mon("LF74F    DEC   <$D6                    ; F74F: 0A D6         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xd6); 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    wr_mem(DP|0xd6, res); 
    clockticks = clockticks + 2; 
    PC = 0xF751; JUMP; // sstep
case 0xF751:
                                                     mon("         BPL   LF77C                   ; F751: 2A 29         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0xf77c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF753; JUMP; // sstep
case 0xF753:
                                                     mon("         LDA   #$10                    ; F753: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF755; JUMP; // sstep
case 0xF755:
                                                     mon("         STA   <$D6                    ; F755: 97 D6         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xd6; 
    wr_mem(ea, val); 
    PC = 0xF757; JUMP; // sstep
case 0xF757:
                                                     mon("         LDX   <$D4                    ; F757: 9E D4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xd4)<<8; 
    ea = ea | rd_mem(DP|0xd5); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF759; JUMP; // sstep
case 0xF759:
                                                     mon("         LDD   <$D2                    ; F759: DC D2         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xd2); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xd3); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF75B; JUMP; // sstep
case 0xF75B:
                                                     mon("         ANDA  ,X                      ; F75B: A4 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(X); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF75D; JUMP; // sstep
case 0xF75D:
                                                     mon("         BNE   LF767                   ; F75D: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf767; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF75F; JUMP; // sstep
case 0xF75F:
                                                     mon("         ANDB  $01,X                   ; F75F: E4 01         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    res = val & rd_mem((UINT16)(X + 0x0001)); 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0xF761; JUMP; // sstep
case 0xF761:
                                                     mon("         BNE   LF767                   ; F761: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf767; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF763; JUMP; // sstep
case 0xF763:
                                                     mon("         LDA   #$3B                    ; F763: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF765; JUMP; // sstep
case 0xF765:
                                                     mon("         BRA   LF769                   ; F765: 20 02         \n");
    PC = 0xf769; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0xF767:
                                                     mon("LF767    LDA   #$29                    ; F767: 86 29         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x29; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF769; JUMP; // sstep
case 0xF769:
                                                     mon("LF769    STA   $4400                   ; F769: B7 44 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4400, val); 
    PC = 0xF76C; JUMP; // sstep
case 0xF76C:
                                                     mon("         LEAX  $02,X                   ; F76C: 30 02         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0002); 
/**/Z = X; 
    PC = 0xF76E; JUMP; // sstep
case 0xF76E:
                                                     mon("         CMPX  #LF36E                  ; F76E: 8C F3 6E      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0xf36e; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF771; JUMP; // sstep
case 0xF771:
                                                     mon("         BCS   LF77A                   ; F771: 25 07         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf77a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF773; JUMP; // sstep
case 0xF773:
                                                     mon("         LDA   #$20                    ; F773: 86 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF775; JUMP; // sstep
case 0xF775:
                                                     mon("         STA   <$D6                    ; F775: 97 D6         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xd6; 
    wr_mem(ea, val); 
    PC = 0xF777; JUMP; // sstep
case 0xF777:
                                                     mon("         LDX   #word_F34E              ; F777: 8E F3 4E      \n");
    clockticks = clockticks + 3; 
    X = 0xf34e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0xF77A; JUMP; // sstep
case 0xF77A:
                                                     mon("LF77A    STX   <$D4                    ; F77A: 9F D4         \n");
    clockticks = clockticks + 4; 
    val = X; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    ea = DP|0xd4; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    // End of function sub_F74F
    PC = 0xF77C; JUMP; // sstep
case 0xF77C:
                                                     mon("LF77C    JMP   LF714                   ; F77C: 7E F7 14      \n");
    clockticks = clockticks + 4; 
    PC = 0xf714; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0xF77F:
                                                     mon("LF77F    STA   $46C0                   ; F77F: B7 46 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46c0, val); 
    PC = 0xF782; JUMP; // sstep
case 0xF782:
                                                     mon("         STA   $46C0                   ; F782: B7 46 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46c0, val); 
    PC = 0xF785; JUMP; // sstep
case 0xF785:
                                                     mon("         LDD   #$BFAE                  ; F785: CC BF AE      \n");
    clockticks = clockticks + 3; 
    A = 0xbf; 
    B = 0xae; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF788; JUMP; // sstep
case 0xF788:
                                                     mon("         STD   ,Y++                    ; F788: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF78A; JUMP; // sstep
case 0xF78A:
                                                     mon("         LDD   #$8040                  ; F78A: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF78D; JUMP; // sstep
case 0xF78D:
                                                     mon("         STD   ,Y++                    ; F78D: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF78F; JUMP; // sstep
case 0xF78F:
                                                     mon("         LDS   #$4FFF                  ; F78F: 10 CE 4F FF   \n");
    clockticks = clockticks + 4; 
    S = 0x4fff; 
/**/Z = S; 
/**/N = (S) >> 8; 
/**/V = 0; 
    PC = 0xF793; JUMP; // sstep
case 0xF793:
                                                     mon("         LDB   #$9E                    ; F793: C6 9E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x9e; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF795; JUMP; // sstep
case 0xF795:
                                                     mon("         JSR   LE7C7                   ; F795: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x98); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF798:
                                                     mon("LF798    LDB   #$D3                    ; F798: C6 D3         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xd3; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF79A; JUMP; // sstep
case 0xF79A:
                                                     mon("         JSR   LE7C7                   ; F79A: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF79D:
                                                     mon("LF79D    LDB   #$9F                    ; F79D: C6 9F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x9f; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF79F; JUMP; // sstep
case 0xF79F:
                                                     mon("         STB   <$CE                    ; F79F: D7 CE         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xce; 
    wr_mem(ea, val); 
    PC = 0xF7A1; JUMP; // sstep
case 0xF7A1:
                                                     mon("         LDA   $4300                   ; F7A1: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF7A4; JUMP; // sstep
case 0xF7A4:
                                                     mon("         LDB   $4320                   ; F7A4: F6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF7A7; JUMP; // sstep
case 0xF7A7:
                                                     mon("         ORB   #$C7                    ; F7A7: CA C7         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0xc7; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7A9; JUMP; // sstep
case 0xF7A9:
                                                     mon("         STD   <$CC                    ; F7A9: DD CC         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xcc; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF7AB; JUMP; // sstep
case 0xF7AB:
                                                     mon("LF7AB    ASLB                          ; F7AB: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xF7AC; JUMP; // sstep
case 0xF7AC:
                                                     mon("         ROLA                          ; F7AC: 49            \n");
    val = (UINT8)A; 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    A = (UINT8)res; 
    clockticks = clockticks + 2; 
    PC = 0xF7AD; JUMP; // sstep
case 0xF7AD:
                                                     mon("         STD   <$CC                    ; F7AD: DD CC         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0xcc; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF7AF; JUMP; // sstep
case 0xF7AF:
                                                     mon("         BCS   LF7B6                   ; F7AF: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0xf7b6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF7B1; JUMP; // sstep
case 0xF7B1:
                                                     mon("         LDB   <$CE                    ; F7B1: D6 CE         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xce); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF7B3; JUMP; // sstep
case 0xF7B3:
                                                     mon("         JSR   LE7C7                   ; F7B3: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF7B6:
                                                     mon("LF7B6    INC   <$CE                    ; F7B6: 0C CE         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xce); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0xce, res); 
    clockticks = clockticks + 2; 
    PC = 0xF7B8; JUMP; // sstep
case 0xF7B8:
                                                     mon("         LDD   <$CC                    ; F7B8: DC CC         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xcc); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xcd); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0xF7BA; JUMP; // sstep
case 0xF7BA:
                                                     mon("         BNE   LF7AB                   ; F7BA: 26 EF         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0xf7ab; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF7BC; JUMP; // sstep
case 0xF7BC:
                                                     mon("         LDD   <$C8                    ; F7BC: DC C8         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0xc8); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0xc9); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF7BE; JUMP; // sstep
case 0xF7BE:
                                                     mon("         STD   <$CA                    ; F7BE: DD CA         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xca; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF7C0; JUMP; // sstep
case 0xF7C0:
                                                     mon("         LDA   $4300                   ; F7C0: B6 43 00      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4300); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF7C3; JUMP; // sstep
case 0xF7C3:
                                                     mon("         ANDA  #$CF                    ; F7C3: 84 CF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xcf; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7C5; JUMP; // sstep
case 0xF7C5:
                                                     mon("         LDB   $4320                   ; F7C5: F6 43 20      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4320); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF7C8; JUMP; // sstep
case 0xF7C8:
                                                     mon("         ANDB  #$3A                    ; F7C8: C4 3A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x3a; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7CA; JUMP; // sstep
case 0xF7CA:
                                                     mon("         STD   <$C8                    ; F7CA: DD C8         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc8; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0xF7CC; JUMP; // sstep
case 0xF7CC:
                                                     mon("         EORA  <$CA                    ; F7CC: 98 CA         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(DP|0xca); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7CE; JUMP; // sstep
case 0xF7CE:
                                                     mon("         ANDA  <$CA                    ; F7CE: 94 CA         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(DP|0xca); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7D0; JUMP; // sstep
case 0xF7D0:
                                                     mon("         EORB  <$CB                    ; F7D0: D8 CB         \n");
    clockticks = clockticks + 4; 
    res = B ^ rd_mem(DP|0xcb); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7D2; JUMP; // sstep
case 0xF7D2:
                                                     mon("         ANDB  <$CB                    ; F7D2: D4 CB         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    res = val & rd_mem(DP|0xcb); 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF7D4; JUMP; // sstep
case 0xF7D4:
                                                     mon("         CMPD  #$00                    ; F7D4: 10 83 00 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0xF7D8; JUMP; // sstep
case 0xF7D8:
                                                     mon("         BEQ   LF7DF                   ; F7D8: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0xf7df; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0xF7DA; JUMP; // sstep
case 0xF7DA:
                                                     mon("         LDA   #$3B                    ; F7DA: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF7DC; JUMP; // sstep
case 0xF7DC:
                                                     mon("         STA   $4400                   ; F7DC: B7 44 00      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4400, val); 
    PC = 0xF7DF; JUMP; // sstep
case 0xF7DF:
                                                     mon("LF7DF    LDD   #$1EA2                  ; F7DF: CC 1E A2      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0xa2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF7E2; JUMP; // sstep
case 0xF7E2:
                                                     mon("         STD   ,Y++                    ; F7E2: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF7E4; JUMP; // sstep
case 0xF7E4:
                                                     mon("         LDD   #$1F74                  ; F7E4: CC 1F 74      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x74; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF7E7; JUMP; // sstep
case 0xF7E7:
                                                     mon("         STD   ,Y++                    ; F7E7: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF7E9; JUMP; // sstep
case 0xF7E9:
                                                     mon("         LDA   #$10                    ; F7E9: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF7EB; JUMP; // sstep
case 0xF7EB:
                                                     mon("         JSR   Display_Vect_BCD        ; F7EB: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xee); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xF7EE:
                                                     mon("LF7EE    LDD   $301E                   ; F7EE: FC 30 1E      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x301e); // Care needed with I/O space and word fetches
    B = rd_mem(0x301f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF7F1; JUMP; // sstep
case 0xF7F1:
                                                     mon("         STD   ,Y++                    ; F7F1: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF7F3; JUMP; // sstep
case 0xF7F3:
                                                     mon("         LDD   $3002                   ; F7F3: FC 30 02      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3002); // Care needed with I/O space and word fetches
    B = rd_mem(0x3003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF7F6; JUMP; // sstep
case 0xF7F6:
                                                     mon("         STD   ,Y++                    ; F7F6: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF7F8; JUMP; // sstep
case 0xF7F8:
                                                     mon("         LDA   $4340                   ; F7F8: B6 43 40      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4340); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF7FB; JUMP; // sstep
case 0xF7FB:
                                                     mon("         JSR   LF86C                   ; F7FB: BD F8 6C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    PC = 0xf86c; 
    JUMP;
  case 0xF7FE:
                                                     mon("LF7FE    LDD   #$1E70                  ; F7FE: CC 1E 70      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0x70; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF801; JUMP; // sstep
case 0xF801:
                                                     mon("         STD   ,Y++                    ; F801: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF803; JUMP; // sstep
case 0xF803:
                                                     mon("         LDD   #$1F5C                  ; F803: CC 1F 5C      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x5c; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF806; JUMP; // sstep
case 0xF806:
                                                     mon("         STD   ,Y++                    ; F806: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF808; JUMP; // sstep
case 0xF808:
                                                     mon("         LDA   #$10                    ; F808: 86 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF80A; JUMP; // sstep
case 0xF80A:
                                                     mon("         JSR   Display_Vect_BCD        ; F80A: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0xF80D:
                                                     mon("LF80D    LDD   $3020                   ; F80D: FC 30 20      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3020); // Care needed with I/O space and word fetches
    B = rd_mem(0x3021); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF810; JUMP; // sstep
case 0xF810:
                                                     mon("         STD   ,Y++                    ; F810: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF812; JUMP; // sstep
case 0xF812:
                                                     mon("         LDD   $3022                   ; F812: FC 30 22      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3022); // Care needed with I/O space and word fetches
    B = rd_mem(0x3023); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF815; JUMP; // sstep
case 0xF815:
                                                     mon("         STD   ,Y++                    ; F815: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF817; JUMP; // sstep
case 0xF817:
                                                     mon("         LDD   $3002                   ; F817: FC 30 02      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x3002); // Care needed with I/O space and word fetches
    B = rd_mem(0x3003); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF81A; JUMP; // sstep
case 0xF81A:
                                                     mon("         STD   ,Y++                    ; F81A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF81C; JUMP; // sstep
case 0xF81C:
                                                     mon("         LDA   $4360                   ; F81C: B6 43 60      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4360); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF81F; JUMP; // sstep
case 0xF81F:
                                                     mon("         JSR   LF86C                   ; F81F: BD F8 6C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x22); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    PC = 0xf86c; 
    JUMP;
  case 0xF822:
                                                     mon("LF822    LDB   #$AF                    ; F822: C6 AF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xaf; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0xF824; JUMP; // sstep
case 0xF824:
                                                     mon("         JSR   LE7C7                   ; F824: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x27); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0xF827:
                                                     mon("LF827    LDD   #$BFD5                  ; F827: CC BF D5      \n");
    clockticks = clockticks + 3; 
    A = 0xbf; 
    B = 0xd5; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF82A; JUMP; // sstep
case 0xF82A:
                                                     mon("         STD   ,Y++                    ; F82A: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF82C; JUMP; // sstep
case 0xF82C:
                                                     mon("         LDD   #$00                    ; F82C: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF82F; JUMP; // sstep
case 0xF82F:
                                                     mon("         STD   ,Y++                    ; F82F: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF831; JUMP; // sstep
case 0xF831:
                                                     mon("         LDD   #$0140                  ; F831: CC 01 40      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0xF834; JUMP; // sstep
case 0xF834:
                                                     mon("         STD   ,Y++                    ; F834: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF836; JUMP; // sstep
case 0xF836:
                                                     mon("         LDB   $4380                   ; F836: F6 43 80      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4380); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0xF839; JUMP; // sstep
case 0xF839:
                                                     mon("         SUBB  #$80                    ; F839: C0 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x80; 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0xF83B; JUMP; // sstep
case 0xF83B:
                                                     mon("         SEX                           ; F83B: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0xF83C; JUMP; // sstep
case 0xF83C:
                                                     mon("         TFR   D,U                     ; F83C: 1F 03         \n");
    U = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0xF83E; JUMP; // sstep
case 0xF83E:
                                                     mon("         ASRA                          ; F83E: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0xF83F; JUMP; // sstep
case 0xF83F:
                                                     mon("         RORB                          ; F83F: 56            \n");
    res = ((UINT8)B) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0xF840; JUMP; // sstep
case 0xF840:
                                                     mon("         LEAU  D,U                     ; F840: 33 CB         \n");
    clockticks = clockticks + 8; 
    U = (U + (((UINT8)A<<8)|(UINT8)B)); 
    PC = 0xF842; JUMP; // sstep
case 0xF842:
                                                     mon("         TFR   U,D                     ; F842: 1F 30         \n");
    val = U; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0xF844; JUMP; // sstep
case 0xF844:
                                                     mon("         ANDA  #$1F                    ; F844: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0xF846; JUMP; // sstep
case 0xF846:
                                                     mon("         STD   ,Y++                    ; F846: ED A1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = Y; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    Y = Y + 2; 
    PC = 0xF848; JUMP; // sstep
case 0xF848:
                                                     mon("         STA   $46C1                   ; F848: B7 46 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46c1, val); 
    PC = 0xF84B; JUMP; // sstep
case 0xF84B:
                                                     mon("         STA   $46C1                   ; F84B: B7 46 C1      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x46c1, val); 
    PC = 0xF84E; JUMP; // sstep
case 0xF84E:
                                                     mon("         LDX   #$14                    ; F84E: 8E 00 14      \n");
    clockticks = clockticks + 3; 
