                   // ORG   $6000
    // ===========================================================================
    // Segment type: Pure code
    // =============== S U B R O U T I N E =======================================
  case 0x6005:
                                                     mon("L6005    LDX   #$00                    ; 6005: 8E 00 00      \n");
    clockticks = clockticks + 3; 
    X = 0x0000; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x6008; JUMP; // sstep
case 0x6008:
                                                     mon("         LDD   #$F800                  ; 6008: CC F8 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf8; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x600B; JUMP; // sstep
case 0x600B:
                                                     mon("         LDA   #$48                    ; 600B: 86 48         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x48; 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x600D; JUMP; // sstep
case 0x600D:
                                                     mon("         TFR   A,DP                    ; 600D: 1F 8B         \n");
    DP = (A) << 8; checkDP(); 
    // memory_DP = &memory[DP];
    clockticks = clockticks + 6; 
    PC = 0x600F; JUMP; // sstep
case 0x600F:
                                                     mon("         LSR   <$3D                    ; 600F: 04 3D         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3d); 
    C = val & 1; 
    val = val >> 1; 
    wr_mem(DP|0x3d, val); 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x6011; JUMP; // sstep
case 0x6011:
                                                     mon("         BCC   L6005                   ; 6011: 24 F2         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x6005; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6013; JUMP; // sstep
case 0x6013:
                                                     mon("         CMPS  #$4FFF                  ; 6013: 11 8C 4F FF   \n");
    clockticks = clockticks + 5; 
    val = S; 
    arg = 0x4fff; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6017; JUMP; // sstep
case 0x6017:
                                                     mon("         BEQ   L601A                   ; 6017: 27 01         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x601a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6019; JUMP; // sstep
case 0x6019:
                                                     mon("         RTS                           ; 6019: 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 0x601A:
                                                     mon("L601A    LDA   <$28                    ; 601A: 96 28         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x28); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x601C; JUMP; // sstep
case 0x601C:
                                                     mon("         BNE   L602F                   ; 601C: 26 11         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x602f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x601E; JUMP; // sstep
case 0x601E:
                                                     mon("         LDA   $4824                   ; 601E: B6 48 24      \n"); // Opt0_Shadow
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4824); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6021; JUMP; // sstep
case 0x6021:
                                                     mon("         ANDA  #$80                    ; 6021: 84 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x80; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6023; JUMP; // sstep
case 0x6023:
                                                     mon("         BNE   L602F                   ; 6023: 26 0A         \n"); // Check DIP switch for freeze mode
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x602f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6025; JUMP; // sstep
case 0x6025:
                                                     mon("         LDA   <$31                    ; 6025: 96 31         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x31); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6027; JUMP; // sstep
case 0x6027:
                                                     mon("         BITA  #$80                    ; 6027: 85 80         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x80; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6029; JUMP; // sstep
case 0x6029:
                                                     mon("         BEQ   L6005                   ; 6029: 27 DA         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6005; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x602B; JUMP; // sstep
case 0x602B:
                                                     mon("         ANDA  #$7F                    ; 602B: 84 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x7f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x602D; JUMP; // sstep
case 0x602D:
                                                     mon("         STA   <$31                    ; 602D: 97 31         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x31; 
    wr_mem(ea, val); 
    PC = 0x602F; JUMP; // sstep
case 0x602F:
                                                     mon("L602F    JSR   L60BE                   ; 602F: BD 60 BE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x32); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    PC = 0x60be; 
    JUMP;
  case 0x6032:
                                                     mon("L6032    LDA   <$3F                    ; 6032: 96 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3f); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6034; JUMP; // sstep
case 0x6034:
                                                     mon("         BMI   L6032                   ; 6034: 2B FC         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x6032; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6036; JUMP; // sstep
case 0x6036:
                                                     mon("L6036    LDA   <$41                    ; 6036: 96 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6038; JUMP; // sstep
case 0x6038:
                                                     mon("         CMPA  #$3D                    ; 6038: 81 3D         \n"); // Check game state for out of bounds
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x3d; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x603A; JUMP; // sstep
case 0x603A:
                                                     mon("L603A    BCC   L603A                   ; 603A: 24 FE         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x603a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x603C; JUMP; // sstep
case 0x603C:
                                                     mon("         ASLA                          ; 603C: 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 = 0x603D; JUMP; // sstep
case 0x603D:
                                                     mon("         LDX   #$6044                  ; 603D: 8E 60 44      \n");
    clockticks = clockticks + 3; 
    X = 0x6044; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x6040; JUMP; // sstep
case 0x6040:
                                                     mon("         JSR   [A,X]                   ; 6040: 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, 0x42); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    PC = ea; 
    JUMP;
    // End of function sub_6005
    // ---------------------------------------------------------------------------
  case 0x6042:
                                                     mon("L6042    BRA   L6005                   ; 6042: 20 C1         \n");
    PC = 0x6005; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0x60BE:
                                                     mon("L60BE    INC   <$43                    ; 60BE: 0C 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x43, res); 
    clockticks = clockticks + 2; 
    PC = 0x60C0; JUMP; // sstep
case 0x60C0:
                                                     mon("         BNE   L60CA                   ; 60C0: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x60ca; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x60C2; JUMP; // sstep
case 0x60C2:
                                                     mon("         INC   <$42                    ; 60C2: 0C 42         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x42); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x42, res); 
    clockticks = clockticks + 2; 
    PC = 0x60C4; JUMP; // sstep
case 0x60C4:
                                                     mon("         BNE   L60CA                   ; 60C4: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x60ca; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x60C6; JUMP; // sstep
case 0x60C6:
                                                     mon("         LDA   #$80                    ; 60C6: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x60C8; JUMP; // sstep
case 0x60C8:
                                                     mon("         STA   <$42                    ; 60C8: 97 42         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x42; 
    wr_mem(ea, val); 
    PC = 0x60CA; JUMP; // sstep
case 0x60CA:
                                                     mon("L60CA    LDA   $4814                   ; 60CA: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x60CD; JUMP; // sstep
case 0x60CD:
                                                     mon("         BNE   L60D4                   ; 60CD: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x60d4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x60CF; JUMP; // sstep
case 0x60CF:
                                                     mon("         STA   $4B31                   ; 60CF: B7 4B 31      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b31, val); 
    PC = 0x60D2; JUMP; // sstep
case 0x60D2:
                                                     mon("         BRA   L60F4                   ; 60D2: 20 20         \n");
    PC = 0x60f4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x60D4:
                                                     mon("L60D4    LDA   $4B31                   ; 60D4: B6 4B 31      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b31); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x60D7; JUMP; // sstep
case 0x60D7:
                                                     mon("         BNE   L60E4                   ; 60D7: 26 0B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x60e4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x60D9; JUMP; // sstep
case 0x60D9:
                                                     mon("         JSR   $BD12                   ; 60D9: BD BD 12      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    PC = 0xbd12; 
    JUMP;
  case 0x60DC:
                                                     mon("L60DC    LDA   $4814                   ; 60DC: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x60DF; JUMP; // sstep
case 0x60DF:
                                                     mon("         STA   $4B31                   ; 60DF: B7 4B 31      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b31, val); 
    PC = 0x60E2; JUMP; // sstep
case 0x60E2:
                                                     mon("         BRA   L60F4                   ; 60E2: 20 10         \n");
    PC = 0x60f4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x60E4:
                                                     mon("L60E4    LDA   $4B31                   ; 60E4: B6 4B 31      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b31); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x60E7; JUMP; // sstep
case 0x60E7:
                                                     mon("         CMPA  $4814                   ; 60E7: B1 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4814); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x60EA; JUMP; // sstep
case 0x60EA:
                                                     mon("         BCC   L60F4                   ; 60EA: 24 08         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x60f4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x60EC; JUMP; // sstep
case 0x60EC:
                                                     mon("         JSR   $BD03                   ; 60EC: BD BD 03      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    PC = 0xbd03; 
    JUMP;
    // ---------------------------------------------------------------------------
  case 0x60EF:
                                                     mon("L60EF    LDA   #$FF                    ; 60EF: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x60F1; JUMP; // sstep
case 0x60F1:
                                                     mon("         STA   $4B31                   ; 60F1: B7 4B 31      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b31, val); 
    PC = 0x60F4; JUMP; // sstep
case 0x60F4:
                                                     mon("L60F4    JSR   L70DB                   ; 60F4: BD 70 DB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    PC = 0x70db; 
    JUMP;
  case 0x60F7:
                                                     mon("L60F7    LDA   <$AB                    ; 60F7: 96 AB         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xab); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x60F9; JUMP; // sstep
case 0x60F9:
                                                     mon("         STA   <$AA                    ; 60F9: 97 AA         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xaa; 
    wr_mem(ea, val); 
    PC = 0x60FB; JUMP; // sstep
case 0x60FB:
                                                     mon("         LDA   <$21                    ; 60FB: 96 21         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x21); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x60FD; JUMP; // sstep
case 0x60FD:
                                                     mon("         ANDA  #$30                    ; 60FD: 84 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x30; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x60FF; JUMP; // sstep
case 0x60FF:
                                                     mon("         PSHS  A                       ; 60FF: 34 02         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, A); 
    clockticks = clockticks + 1; 
    PC = 0x6101; JUMP; // sstep
case 0x6101:
                                                     mon("         LDA   <$1E                    ; 6101: 96 1E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x1e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6103; JUMP; // sstep
case 0x6103:
                                                     mon("         ANDA  #$CF                    ; 6103: 84 CF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xcf; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6105; JUMP; // sstep
case 0x6105:
                                                     mon("         ORA   ,S+                     ; 6105: AA E0         \n");
    clockticks = clockticks + 6; 
    res = A | (UINT8)rd_mem(S); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    S = S + 1; 
    PC = 0x6107; JUMP; // sstep
case 0x6107:
                                                     mon("         ANDA  #$F4                    ; 6107: 84 F4         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf4; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6109; JUMP; // sstep
case 0x6109:
                                                     mon("         STA   <$AB                    ; 6109: 97 AB         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xab; 
    wr_mem(ea, val); 
    PC = 0x610B; JUMP; // sstep
case 0x610B:
                                                     mon("         EORA  <$AA                    ; 610B: 98 AA         \n");
    clockticks = clockticks + 4; 
    res = A ^ rd_mem(DP|0xaa); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x610D; JUMP; // sstep
case 0x610D:
                                                     mon("         ANDA  <$AA                    ; 610D: 94 AA         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(DP|0xaa); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x610F; JUMP; // sstep
case 0x610F:
                                                     mon("         STA   <$AC                    ; 610F: 97 AC         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xac; 
    wr_mem(ea, val); 
    // End of function sub_60BE
    PC = 0x6111; JUMP; // sstep
case 0x6111:
                                                     mon("         RTS                           ; 6111: 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 data for four blue dots in screen corners
  case 0x6112:
                                                     mon("L6112    LDA   <$3F                    ; 6112: 96 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x3f); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6114; JUMP; // sstep
case 0x6114:
                                                     mon("         LDB   #$70                    ; 6114: C6 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x70; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6116; JUMP; // sstep
case 0x6116:
                                                     mon("         TFR   D,Y                     ; 6116: 1F 02         \n"); // Set new vector pointer value
    Y = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0x6118; JUMP; // sstep
case 0x6118:
                                                     mon("         LDD   #$B99E                  ; 6118: CC B9 9E      \n"); // Vector JRSL to draw four blue dots in screen corners
    clockticks = clockticks + 3; 
    A = 0xb9; 
    B = 0x9e; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x611B; JUMP; // sstep
case 0x611B:
                                                     mon("         STD   ,Y++                    ; 611B: 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_6112
    PC = 0x611D; JUMP; // sstep
case 0x611D:
                                                     mon("         RTS                           ; 611D: 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 =======================================
    // Copies Star Wars logo vector data to vector RAM
  case 0x611E:
                                                     mon("L611E    LDX   #$CEDE                  ; 611E: 8E CE DE      \n"); // Copies vector data. Called at start of attract screen 2
    clockticks = clockticks + 3; 
    X = 0xcede; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x6121; JUMP; // sstep
case 0x6121:
                                                     mon("         LDU   #$2800                  ; 6121: CE 28 00      \n");
    clockticks = clockticks + 3; 
    U = 0x2800; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x6124; JUMP; // sstep
case 0x6124:
                                                     mon("L6124    LDD   ,X++                    ; 6124: 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 = 0x6126; JUMP; // sstep
case 0x6126:
                                                     mon("         STD   ,U++                    ; 6126: 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 = 0x6128; JUMP; // sstep
case 0x6128:
                                                     mon("         CMPU  #$3000                  ; 6128: 11 83 30 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x3000; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x612C; JUMP; // sstep
case 0x612C:
                                                     mon("         BCS   L6124                   ; 612C: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6124; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_611E
    PC = 0x612E; JUMP; // sstep
case 0x612E:
                                                     mon("         RTS                           ; 612E: 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 =======================================
    // Vector instructions end
  case 0x612F:
                                                     mon("L612F    LDD   #$8040                  ; 612F: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6132; JUMP; // sstep
case 0x6132:
                                                     mon("         STD   ,Y++                    ; 6132: 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 = 0x6134; JUMP; // sstep
case 0x6134:
                                                     mon("         LDD   #$2020                  ; 6134: CC 20 20      \n"); // Vector HALT
    clockticks = clockticks + 3; 
    A = 0x20; 
    B = 0x20; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6137; JUMP; // sstep
case 0x6137:
                                                     mon("         STD   ,Y++                    ; 6137: 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 = 0x6139; JUMP; // sstep
case 0x6139:
                                                     mon("         STD   ,Y+                     ; 6139: ED A0         \n");
    clockticks = clockticks + 6; 
/**/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 + 1; 
    PC = 0x613B; JUMP; // sstep
case 0x613B:
                                                     mon("         TFR   Y,D                     ; 613B: 1F 20         \n");
    val = Y; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0x613D; JUMP; // sstep
case 0x613D:
                                                     mon("         SUBA  <$3F                    ; 613D: 90 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x3f); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0x613F; JUMP; // sstep
case 0x613F:
                                                     mon("         SUBA  #$14                    ; 613F: 80 14         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x14; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0x6141; JUMP; // sstep
case 0x6141:
                                                     mon("         BCS   L6155                   ; 6141: 25 12         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6155; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6143; JUMP; // sstep
case 0x6143:
                                                     mon("         JSR   L611E                   ; 6143: BD 61 1E      \n"); // Copies Star Wars logo vector data to vector RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x46); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    PC = 0x611e; 
    JUMP;
  case 0x6146:
                                                     mon("L6146    LDD   #$2020                  ; 6146: CC 20 20      \n");
    clockticks = clockticks + 3; 
    A = 0x20; 
    B = 0x20; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6149; JUMP; // sstep
case 0x6149:
                                                     mon("         STD   $13FE                   ; 6149: FD 13 FE      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x13fe, A); // Care needed with I/O space and word fetches
    wr_mem(0x13ff, B); 
    PC = 0x614C; JUMP; // sstep
case 0x614C:
                                                     mon("         STD   $13FC                   ; 614C: FD 13 FC      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x13fc, A); // Care needed with I/O space and word fetches
    wr_mem(0x13fd, B); 
    PC = 0x614F; JUMP; // sstep
case 0x614F:
                                                     mon("         STD   $27FE                   ; 614F: FD 27 FE      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x27fe, A); // Care needed with I/O space and word fetches
    wr_mem(0x27ff, B); 
    PC = 0x6152; JUMP; // sstep
case 0x6152:
                                                     mon("         STD   $27FC                   ; 6152: FD 27 FC      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x27fc, A); // Care needed with I/O space and word fetches
    wr_mem(0x27fd, B); 
    PC = 0x6155; JUMP; // sstep
case 0x6155:
                                                     mon("L6155    LDA   #$FF                    ; 6155: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6157; JUMP; // sstep
case 0x6157:
                                                     mon("         STA   <$3F                    ; 6157: 97 3F         \n"); // Vector pointer state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x3f; 
    wr_mem(ea, val); 
    // End of function sub_612F
    PC = 0x6159; JUMP; // sstep
case 0x6159:
                                                     mon("         RTS                           ; 6159: 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 =======================================
    // More stars/ties init stuff
  case 0x615A:
                                                     mon("L615A    JSR   L6161                   ; 615A: BD 61 61      \n"); // Initialise tie fighters and fireballs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    PC = 0x6161; 
    JUMP;
  case 0x615D:
                                                     mon("L615D    JSR   L7A48                   ; 615D: BD 7A 48      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x60); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    PC = 0x7a48; 
    JUMP;
    // End of function sub_615A
  case 0x6160:
                                                     mon("L6160    RTS                           ; 6160: 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 tie fighters and fireballs
  case 0x6161:
                                                     mon("L6161    LDA   $4703                   ; 6161: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6164; JUMP; // sstep
case 0x6164:
                                                     mon("         SUBA  $4703                   ; 6164: B0 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)); 
    A = (UINT8)(res); 
    PC = 0x6167; JUMP; // sstep
case 0x6167:
                                                     mon("         BNE   L6171                   ; 6167: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6171; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6169; JUMP; // sstep
case 0x6169:
                                                     mon("         STA   $4685                   ; 6169: B7 46 85      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4685, val); 
    PC = 0x616C; JUMP; // sstep
case 0x616C:
                                                     mon("         LDA   #$80                    ; 616C: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x616E; JUMP; // sstep
case 0x616E:
                                                     mon("         STA   $4685                   ; 616E: B7 46 85      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4685, val); 
    PC = 0x6171; JUMP; // sstep
case 0x6171:
                                                     mon("L6171    LDA   #$80                    ; 6171: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6173; JUMP; // sstep
case 0x6173:
                                                     mon("         STA   <$83                    ; 6173: 97 83         \n"); // Star intensity
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x83; 
    wr_mem(ea, val); 
    PC = 0x6175; JUMP; // sstep
case 0x6175:
                                                     mon("         LDX   #$4900                  ; 6175: 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 = 0x6178; JUMP; // sstep
case 0x6178:
                                                     mon("         LDU   #$50F0                  ; 6178: CE 50 F0      \n"); // 3x Tie fighter math data structure ($20 bytes per Tie)
    clockticks = clockticks + 3; 
    U = 0x50f0; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x617B; JUMP; // sstep
case 0x617B:
                                                     mon("         LDB   #$1C                    ; 617B: C6 1C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1c; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x617D; JUMP; // sstep
case 0x617D:
                                                     mon("L617D    STU   ,X                      ; 617D: EF 84         \n");
    clockticks = clockticks + 4; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x617F; JUMP; // sstep
case 0x617F:
                                                     mon("         STB   $02,X                   ; 617F: E7 02         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, val); 
    PC = 0x6181; JUMP; // sstep
case 0x6181:
                                                     mon("         LEAU  $20,U                   ; 6181: 33 C8 20      \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)0x20); 
    PC = 0x6184; JUMP; // sstep
case 0x6184:
                                                     mon("         ADDB  #$04                    ; 6184: CB 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    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)); 
    B = (UINT8)res; 
    PC = 0x6186; JUMP; // sstep
case 0x6186:
                                                     mon("         LEAX  $19,X                   ; 6186: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x6189; JUMP; // sstep
case 0x6189:
                                                     mon("         CMPX  #$494B                  ; 6189: 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 = 0x618C; JUMP; // sstep
case 0x618C:
                                                     mon("         BCS   L617D                   ; 618C: 25 EF         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x617d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x618E; JUMP; // sstep
case 0x618E:
                                                     mon("         LDX   #$494B                  ; 618E: 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 = 0x6191; JUMP; // sstep
case 0x6191:
                                                     mon("         LDU   #$5160                  ; 6191: CE 51 60      \n"); // 6x Fireball math data structure 2 ($8 bytes per Tie)
    clockticks = clockticks + 3; 
    U = 0x5160; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x6194; JUMP; // sstep
case 0x6194:
                                                     mon("         LDB   #$2C                    ; 6194: C6 2C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2c; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6196; JUMP; // sstep
case 0x6196:
                                                     mon("L6196    STU   ,X                      ; 6196: EF 84         \n");
    clockticks = clockticks + 4; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x6198; JUMP; // sstep
case 0x6198:
                                                     mon("         STB   $02,X                   ; 6198: E7 02         \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0002); 
    wr_mem(ea, val); 
    PC = 0x619A; JUMP; // sstep
case 0x619A:
                                                     mon("         CLR   $03,X                   ; 619A: 6F 03         \n");
    clockticks = clockticks + 5; 
    wr_mem((UINT16)(X + 0x0003), 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x619C; JUMP; // sstep
case 0x619C:
                                                     mon("         LEAU  $08,U                   ; 619C: 33 48         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0008); 
    PC = 0x619E; JUMP; // sstep
case 0x619E:
                                                     mon("         ADDB  #$01                    ; 619E: 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 = 0x61A0; JUMP; // sstep
case 0x61A0:
                                                     mon("         LEAX  $06,X                   ; 61A0: 30 06         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0006); 
/**/Z = X; 
    PC = 0x61A2; JUMP; // sstep
case 0x61A2:
                                                     mon("         CMPX  #$496F                  ; 61A2: 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 = 0x61A5; JUMP; // sstep
case 0x61A5:
                                                     mon("         BCS   L6196                   ; 61A5: 25 EF         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6196; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x61A7; JUMP; // sstep
case 0x61A7:
                                                     mon("         JSR   $8ED6                   ; 61A7: BD 8E D6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    PC = 0x8ed6; 
    JUMP;
  case 0x61AA:
                                                     mon("L61AA    LDB   #$04                    ; 61AA: C6 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x61AC; JUMP; // sstep
case 0x61AC:
                                                     mon("         JSR   $CCCC                   ; 61AC: BD CC CC      \n"); // Copy XYZ data to math RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    PC = 0xcccc; 
    JUMP;
  case 0x61AF:
                                                     mon("L61AF    LDB   #$07                    ; 61AF: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x61B1; JUMP; // sstep
case 0x61B1:
                                                     mon("         JSR   $CCCC                   ; 61B1: BD CC CC      \n"); // Copy XYZ data to math RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x61); 
    clockticks = clockticks + 1; 
    PC = 0xcccc; 
    JUMP;
    // End of function sub_6161
  case 0x61B4:
                                                     mon("L61B4    RTS                           ; 61B4: 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 =======================================
    // Set up math constants
  case 0x61B5:
                                                     mon("L61B5    LDD   #$00                    ; 61B5: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61B8; JUMP; // sstep
case 0x61B8:
                                                     mon("         STD   $501E                   ; 61B8: FD 50 1E      \n"); // Math zero constant
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x501e, A); // Care needed with I/O space and word fetches
    wr_mem(0x501f, B); 
    PC = 0x61BB; JUMP; // sstep
case 0x61BB:
                                                     mon("         LDD   #$4000                  ; 61BB: CC 40 00      \n");
    clockticks = clockticks + 3; 
    A = 0x40; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61BE; JUMP; // sstep
case 0x61BE:
                                                     mon("         STD   $5020                   ; 61BE: FD 50 20      \n"); // Math 1.000 constant
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5020, A); // Care needed with I/O space and word fetches
    wr_mem(0x5021, B); 
    PC = 0x61C1; JUMP; // sstep
case 0x61C1:
                                                     mon("         LDD   #$E000                  ; 61C1: CC E0 00      \n");
    clockticks = clockticks + 3; 
    A = 0xe0; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61C4; JUMP; // sstep
case 0x61C4:
                                                     mon("         STD   $5026                   ; 61C4: FD 50 26      \n"); // Constant -0.5 ?
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5026, A); // Care needed with I/O space and word fetches
    wr_mem(0x5027, B); 
    PC = 0x61C7; JUMP; // sstep
case 0x61C7:
                                                     mon("         LDD   #$80                    ; 61C7: CC 00 80      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61CA; JUMP; // sstep
case 0x61CA:
                                                     mon("         STD   $506A                   ; 61CA: FD 50 6A      \n"); // Math Constant $0080
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x506a, A); // Care needed with I/O space and word fetches
    wr_mem(0x506b, B); 
    PC = 0x61CD; JUMP; // sstep
case 0x61CD:
                                                     mon("         LDD   #$40                    ; 61CD: CC 00 40      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61D0; JUMP; // sstep
case 0x61D0:
                                                     mon("         STD   $5068                   ; 61D0: FD 50 68      \n"); // Math Constant $0040
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5068, A); // Care needed with I/O space and word fetches
    wr_mem(0x5069, B); 
    PC = 0x61D3; JUMP; // sstep
case 0x61D3:
                                                     mon("         LDD   #$021F                  ; 61D3: CC 02 1F      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x1f; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61D6; JUMP; // sstep
case 0x61D6:
                                                     mon("         STD   $5022                   ; 61D6: 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 = 0x61D9; JUMP; // sstep
case 0x61D9:
                                                     mon("         LDD   #$3FF7                  ; 61D9: CC 3F F7      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xf7; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61DC; JUMP; // sstep
case 0x61DC:
                                                     mon("         STD   $5024                   ; 61DC: 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 = 0x61DF; JUMP; // sstep
case 0x61DF:
                                                     mon("         LDD   #$4000                  ; 61DF: CC 40 00      \n");
    clockticks = clockticks + 3; 
    A = 0x40; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61E2; JUMP; // sstep
case 0x61E2:
                                                     mon("         STD   $506C                   ; 61E2: FD 50 6C      \n"); // Math 1.000 constant
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x506c, A); // Care needed with I/O space and word fetches
    wr_mem(0x506d, B); 
    PC = 0x61E5; JUMP; // sstep
case 0x61E5:
                                                     mon("         LDD   #$0200                  ; 61E5: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x61E8; JUMP; // sstep
case 0x61E8:
                                                     mon("         STD   $4706                   ; 61E8: 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); 
    // End of function sub_61B5
    PC = 0x61EB; JUMP; // sstep
case 0x61EB:
                                                     mon("         RTS                           ; 61EB: 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 =======================================
    // Init stars math data
  case 0x61EC:
                                                     mon("L61EC    LDA   #$80                    ; 61EC: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x61EE; JUMP; // sstep
case 0x61EE:
                                                     mon("         STA   <$83                    ; 61EE: 97 83         \n"); // Star intensity
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x83; 
    wr_mem(ea, val); 
    PC = 0x61F0; JUMP; // sstep
case 0x61F0:
                                                     mon("         LDX   #$5C60                  ; 61F0: 8E 5C 60      \n");
    clockticks = clockticks + 3; 
    X = 0x5c60; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x61F3; JUMP; // sstep
case 0x61F3:
                                                     mon("L61F3    LDA   $4703                   ; 61F3: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x61F6; JUMP; // sstep
case 0x61F6:
                                                     mon("         LDB   $4703                   ; 61F6: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x61F9; JUMP; // sstep
case 0x61F9:
                                                     mon("         STD   ,X                      ; 61F9: 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 = 0x61FB; JUMP; // sstep
case 0x61FB:
                                                     mon("         MUL                           ; 61FB: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x61FC; JUMP; // sstep
case 0x61FC:
                                                     mon("         LDA   $4703                   ; 61FC: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x61FF; JUMP; // sstep
case 0x61FF:
                                                     mon("         STD   $02,X                   ; 61FF: 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 = 0x6201; JUMP; // sstep
case 0x6201:
                                                     mon("         MUL                           ; 6201: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x6202; JUMP; // sstep
case 0x6202:
                                                     mon("         LDA   $4703                   ; 6202: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6205; JUMP; // sstep
case 0x6205:
                                                     mon("         STD   $04,X                   ; 6205: 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 = 0x6207; JUMP; // sstep
case 0x6207:
                                                     mon("         LEAX  $08,X                   ; 6207: 30 08         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0008); 
/**/Z = X; 
    PC = 0x6209; JUMP; // sstep
case 0x6209:
                                                     mon("         CMPX  #$5DF0                  ; 6209: 8C 5D F0      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x5df0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x620C; JUMP; // sstep
case 0x620C:
                                                     mon("         BCS   L61F3                   ; 620C: 25 E5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x61f3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_61EC
    PC = 0x620E; JUMP; // sstep
case 0x620E:
                                                     mon("         RTS                           ; 620E: 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 =======================================
    // Init towers surface dots
  case 0x620F:
                                                     mon("L620F    LDX   #$5C60                  ; 620F: 8E 5C 60      \n");
    clockticks = clockticks + 3; 
    X = 0x5c60; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x6212; JUMP; // sstep
case 0x6212:
                                                     mon("L6212    LDA   $4703                   ; 6212: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6215; JUMP; // sstep
case 0x6215:
                                                     mon("         LDB   $4703                   ; 6215: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6218; JUMP; // sstep
case 0x6218:
                                                     mon("         STD   ,X                      ; 6218: 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 = 0x621A; JUMP; // sstep
case 0x621A:
                                                     mon("         MUL                           ; 621A: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x621B; JUMP; // sstep
case 0x621B:
                                                     mon("         LDA   $4703                   ; 621B: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x621E; JUMP; // sstep
case 0x621E:
                                                     mon("         STD   $02,X                   ; 621E: 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 = 0x6220; JUMP; // sstep
case 0x6220:
                                                     mon("         LDD   #$00                    ; 6220: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6223; JUMP; // sstep
case 0x6223:
                                                     mon("         STD   $04,X                   ; 6223: 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 = 0x6225; JUMP; // sstep
case 0x6225:
                                                     mon("         LEAX  $08,X                   ; 6225: 30 08         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0008); 
/**/Z = X; 
    PC = 0x6227; JUMP; // sstep
case 0x6227:
                                                     mon("         CMPX  #$5DF0                  ; 6227: 8C 5D F0      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x5df0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x622A; JUMP; // sstep
case 0x622A:
                                                     mon("         BCS   L6212                   ; 622A: 25 E6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6212; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_620F
    PC = 0x622C; JUMP; // sstep
case 0x622C:
                                                     mon("         RTS                           ; 622C: 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 joystick X to show high scores if moved
  case 0x622D:
                                                     mon("L622D    LDB   <$7D                    ; 622D: D6 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x622F; JUMP; // sstep
case 0x622F:
                                                     mon("         CMPB  #$A0                    ; 622F: C1 A0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xa0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6231; JUMP; // sstep
case 0x6231:
                                                     mon("         BGT   L623E                   ; 6231: 2E 0B         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x623e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6233; JUMP; // sstep
case 0x6233:
                                                     mon("         LDA   #$08                    ; 6233: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6235; JUMP; // sstep
case 0x6235:
                                                     mon("         CMPA  <$41                    ; 6235: 91 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x41); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6237; JUMP; // sstep
case 0x6237:
                                                     mon("         BEQ   L623C                   ; 6237: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x623c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6239; JUMP; // sstep
case 0x6239:
                                                     mon("         DECA                          ; 6239: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x623A; JUMP; // sstep
case 0x623A:
                                                     mon("         STA   <$41                    ; 623A: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x623C; JUMP; // sstep
case 0x623C:
                                                     mon("L623C    BRA   L624B                   ; 623C: 20 0D         \n");
    PC = 0x624b; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x623E:
                                                     mon("L623E    CMPB  #$60                    ; 623E: 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 = 0x6240; JUMP; // sstep
case 0x6240:
                                                     mon("         BLT   L624B                   ; 6240: 2D 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x624b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6242; JUMP; // sstep
case 0x6242:
                                                     mon("         LDA   #$0C                    ; 6242: 86 0C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0c; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6244; JUMP; // sstep
case 0x6244:
                                                     mon("         CMPA  <$41                    ; 6244: 91 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x41); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6246; JUMP; // sstep
case 0x6246:
                                                     mon("         BEQ   L624B                   ; 6246: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x624b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6248; JUMP; // sstep
case 0x6248:
                                                     mon("         DECA                          ; 6248: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x6249; JUMP; // sstep
case 0x6249:
                                                     mon("         STA   <$41                    ; 6249: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x624B; JUMP; // sstep
case 0x624B:
                                                     mon("L624B    LDA   $4591                   ; 624B: B6 45 91      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4591); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x624E; JUMP; // sstep
case 0x624E:
                                                     mon("         ANDA  #$03                    ; 624E: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6250; JUMP; // sstep
case 0x6250:
                                                     mon("         BNE   L6257                   ; 6250: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6257; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6252; JUMP; // sstep
case 0x6252:
                                                     mon("         LDA   #$01                    ; 6252: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6254; JUMP; // sstep
case 0x6254:
                                                     mon("         STA   $4814                   ; 6254: B7 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4814, val); 
    PC = 0x6257; JUMP; // sstep
case 0x6257:
                                                     mon("L6257    LDA   $4814                   ; 6257: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x625A; JUMP; // sstep
case 0x625A:
                                                     mon("         BEQ   L6269                   ; 625A: 27 0D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6269; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x625C; JUMP; // sstep
case 0x625C:
                                                     mon("         LDA   <$AC                    ; 625C: 96 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x625E; JUMP; // sstep
case 0x625E:
                                                     mon("         ANDA  #$F0                    ; 625E: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6260; JUMP; // sstep
case 0x6260:
                                                     mon("         BEQ   L6269                   ; 6260: 27 07         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6269; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6262; JUMP; // sstep
case 0x6262:
                                                     mon("         LDA   #$19                    ; 6262: 86 19         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x19; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6264; JUMP; // sstep
case 0x6264:
                                                     mon("         STA   <$41                    ; 6264: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6266; JUMP; // sstep
case 0x6266:
                                                     mon("         DEC   $4814                   ; 6266: 7A 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(0x4814, res); 
    clockticks = clockticks + 2; 
    PC = 0x6269; JUMP; // sstep
case 0x6269:
                                                     mon("L6269    LDA   $481E                   ; 6269: B6 48 1E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x626C; JUMP; // sstep
case 0x626C:
                                                     mon("         ANDA  #$10                    ; 626C: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x626E; JUMP; // sstep
case 0x626E:
                                                     mon("         BNE   locret_6274             ; 626E: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6274; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6270; JUMP; // sstep
case 0x6270:
                                                     mon("         LDA   #$01                    ; 6270: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6272; JUMP; // sstep
case 0x6272:
                                                     mon("         STA   <$41                    ; 6272: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_622D
    PC = 0x6274; JUMP; // sstep
case 0x6274:
                                                     mon("locret_6274 RTS                           ; 6274: 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 =======================================
    // Game initialisation
  case 0x6275:
                                                     mon("L6275    ORCC  #$10                    ; 6275: 1A 10         \n"); // Disable interrupts
    I = 1; 
    clockticks = clockticks + 3; 
    PC = 0x6277; JUMP; // sstep
case 0x6277:
                                                     mon("         LDX   #$4534                  ; 6277: 8E 45 34      \n");
    clockticks = clockticks + 3; 
    X = 0x4534; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x627A; JUMP; // sstep
case 0x627A:
                                                     mon("         JSR   $C6D4                   ; 627A: BD C6 D4      \n"); // Read NOVRAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0xc6d4; 
    JUMP;
  case 0x627D:
                                                     mon("L627D    LDX   #$4AFA                  ; 627D: 8E 4A FA      \n");
    clockticks = clockticks + 3; 
    X = 0x4afa; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x6280; JUMP; // sstep
case 0x6280:
                                                     mon("         JSR   L62D5                   ; 6280: BD 62 D5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x62d5; 
    JUMP;
  case 0x6283:
                                                     mon("L6283    STA   $4866                   ; 6283: B7 48 66      \n"); // Joystick pitch data structure
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4866, val); 
    PC = 0x6286; JUMP; // sstep
case 0x6286:
                                                     mon("         LDX   #$4AFB                  ; 6286: 8E 4A FB      \n");
    clockticks = clockticks + 3; 
    X = 0x4afb; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x6289; JUMP; // sstep
case 0x6289:
                                                     mon("         JSR   L62D5                   ; 6289: BD 62 D5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x62d5; 
    JUMP;
  case 0x628C:
                                                     mon("L628C    STA   $4868                   ; 628C: B7 48 68      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4868, val); 
    PC = 0x628F; JUMP; // sstep
case 0x628F:
                                                     mon("         LDX   #$4AFC                  ; 628F: 8E 4A FC      \n");
    clockticks = clockticks + 3; 
    X = 0x4afc; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x6292; JUMP; // sstep
case 0x6292:
                                                     mon("         JSR   L62D5                   ; 6292: BD 62 D5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x62d5; 
    JUMP;
  case 0x6295:
                                                     mon("L6295    STA   $486F                   ; 6295: B7 48 6F      \n"); // Joystick roll data structure
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x486f, val); 
    PC = 0x6298; JUMP; // sstep
case 0x6298:
                                                     mon("         LDX   #$4AFD                  ; 6298: 8E 4A FD      \n");
    clockticks = clockticks + 3; 
    X = 0x4afd; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x629B; JUMP; // sstep
case 0x629B:
                                                     mon("         JSR   L62D5                   ; 629B: BD 62 D5      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x62d5; 
    JUMP;
  case 0x629E:
                                                     mon("L629E    STA   $4871                   ; 629E: B7 48 71      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4871, val); 
    PC = 0x62A1; JUMP; // sstep
case 0x62A1:
                                                     mon("         ANDCC #$EF                    ; 62A1: 1C EF         \n"); // Enable interrupts
    I = 0; 
    clockticks = clockticks + 3; 
    PC = 0x62A3; JUMP; // sstep
case 0x62A3:
                                                     mon("         LDA   #$0B                    ; 62A3: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62A5; JUMP; // sstep
case 0x62A5:
                                                     mon("         STA   <$41                    ; 62A5: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x62A7; JUMP; // sstep
case 0x62A7:
                                                     mon("         LDA   #$FF                    ; 62A7: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62A9; JUMP; // sstep
case 0x62A9:
                                                     mon("         STA   $4B34                   ; 62A9: B7 4B 34      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b34, val); 
    PC = 0x62AC; JUMP; // sstep
case 0x62AC:
                                                     mon("         JSR   L61B5                   ; 62AC: BD 61 B5      \n"); // Set up math constants
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x61b5; 
    JUMP;
  case 0x62AF:
                                                     mon("L62AF    JSR   L615A                   ; 62AF: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x62B2:
                                                     mon("L62B2    JSR   L611E                   ; 62B2: BD 61 1E      \n"); // Copies Star Wars logo vector data to vector RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x611e; 
    JUMP;
  case 0x62B5:
                                                     mon("L62B5    JSR   L61EC                   ; 62B5: BD 61 EC      \n"); // Init stars math data
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0x61ec; 
    JUMP;
  case 0x62B8:
                                                     mon("L62B8    JSR   $D91A                   ; 62B8: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x62BB:
                                                     mon("L62BB    LDA   #$00                    ; 62BB: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62BD; JUMP; // sstep
case 0x62BD:
                                                     mon("         STA   <$5C                    ; 62BD: 97 5C         \n"); // Score millions
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5c; 
    wr_mem(ea, val); 
    PC = 0x62BF; JUMP; // sstep
case 0x62BF:
                                                     mon("         STA   <$5D                    ; 62BF: 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 = 0x62C1; JUMP; // sstep
case 0x62C1:
                                                     mon("         STA   <$5E                    ; 62C1: 97 5E         \n"); // Score thousands
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5e; 
    wr_mem(ea, val); 
    PC = 0x62C3; JUMP; // sstep
case 0x62C3:
                                                     mon("         STA   <$5F                    ; 62C3: 97 5F         \n"); // Score
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5f; 
    wr_mem(ea, val); 
    PC = 0x62C5; JUMP; // sstep
case 0x62C5:
                                                     mon("         STA   <$8B                    ; 62C5: 97 8B         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8b; 
    wr_mem(ea, val); 
    PC = 0x62C7; JUMP; // sstep
case 0x62C7:
                                                     mon("         STA   <$8C                    ; 62C7: 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 = 0x62C9; JUMP; // sstep
case 0x62C9:
                                                     mon("         JSR   $CC18                   ; 62C9: BD CC 18      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    PC = 0xcc18; 
    JUMP;
  case 0x62CC:
                                                     mon("L62CC    LDA   #$FF                    ; 62CC: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62CE; JUMP; // sstep
case 0x62CE:
                                                     mon("         STA   $4AEC                   ; 62CE: B7 4A EC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4aec, val); 
    PC = 0x62D1; JUMP; // sstep
case 0x62D1:
                                                     mon("         STA   $4818                   ; 62D1: B7 48 18      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4818, val); 
    // End of function sub_6275
    PC = 0x62D4; JUMP; // sstep
case 0x62D4:
                                                     mon("         RTS                           ; 62D4: 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 0x62D5:
                                                     mon("L62D5    LDA   #$40                    ; 62D5: 86 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62D7; JUMP; // sstep
case 0x62D7:
                                                     mon("         CMPA  ,X                      ; 62D7: 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 = 0x62D9; JUMP; // sstep
case 0x62D9:
                                                     mon("         BLS   locret_62E3             ; 62D9: 23 08         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x62e3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x62DB; JUMP; // sstep
case 0x62DB:
                                                     mon("         SUBA  ,X                      ; 62DB: 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 = 0x62DD; JUMP; // sstep
case 0x62DD:
                                                     mon("         LSRA                          ; 62DD: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x62DE; JUMP; // sstep
case 0x62DE:
                                                     mon("         LSRA                          ; 62DE: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x62DF; JUMP; // sstep
case 0x62DF:
                                                     mon("         LSRA                          ; 62DF: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x62E0; JUMP; // sstep
case 0x62E0:
                                                     mon("         INCA                          ; 62E0: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x62E1; JUMP; // sstep
case 0x62E1:
                                                     mon("         ADDA  ,X                      ; 62E1: AB 84         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    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)); 
    A = (UINT8)res; 
    // End of function sub_62D5
    PC = 0x62E3; JUMP; // sstep
case 0x62E3:
                                                     mon("locret_62E3 RTS                           ; 62E3: 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 once before attract screen 3
  case 0x62E4:
                                                     mon("L62E4    LDD   #$00                    ; 62E4: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x62E7; JUMP; // sstep
case 0x62E7:
                                                     mon("         STD   $4B0C                   ; 62E7: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x62EA; JUMP; // sstep
case 0x62EA:
                                                     mon("         LDD   #$0200                  ; 62EA: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x62ED; JUMP; // sstep
case 0x62ED:
                                                     mon("         STD   $4B0E                   ; 62ED: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x62F0; JUMP; // sstep
case 0x62F0:
                                                     mon("         LDA   #$0F                    ; 62F0: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62F2; JUMP; // sstep
case 0x62F2:
                                                     mon("         STA   $4ADB                   ; 62F2: B7 4A DB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4adb, val); 
    PC = 0x62F5; JUMP; // sstep
case 0x62F5:
                                                     mon("         LDA   #$1F                    ; 62F5: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x62F7; JUMP; // sstep
case 0x62F7:
                                                     mon("         STA   $4ADC                   ; 62F7: B7 4A DC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4adc, val); 
    PC = 0x62FA; JUMP; // sstep
case 0x62FA:
                                                     mon("         LDD   #$6480                  ; 62FA: CC 64 80      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x62FD; JUMP; // sstep
case 0x62FD:
                                                     mon("         STD   $4B10                   ; 62FD: FD 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b10, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b11, B); 
    PC = 0x6300; JUMP; // sstep
case 0x6300:
                                                     mon("         JSR   $D91A                   ; 6300: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x03); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6303:
                                                     mon("L6303    INC   <$41                    ; 6303: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_62E4
    PC = 0x6305; JUMP; // sstep
case 0x6305:
                                                     mon("         RTS                           ; 6305: 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 3
  case 0x6306:
                                                     mon("L6306    JSR   L6112                   ; 6306: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x6309:
                                                     mon("L6309    JSR   L761D                   ; 6309: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x630C:
                                                     mon("L630C    JSR   L63D5                   ; 630C: BD 63 D5      \n"); // Check credits status
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x63d5; 
    JUMP;
  case 0x630F:
                                                     mon("L630F    JSR   L6368                   ; 630F: BD 63 68      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x6368; 
    JUMP;
  case 0x6312:
                                                     mon("L6312    JSR   $CD80                   ; 6312: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x15); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x6315:
                                                     mon("L6315    JSR   L612F                   ; 6315: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x18); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x6318:
                                                     mon("L6318    JSR   L6DB6                   ; 6318: BD 6D B6      \n"); // Attract screen 3 stars YT move
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x6db6; 
    JUMP;
  case 0x631B:
                                                     mon("L631B    LDD   $4B0E                   ; 631B: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x631E; JUMP; // sstep
case 0x631E:
                                                     mon("         BPL   L6322                   ; 631E: 2A 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6322; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6320; JUMP; // sstep
case 0x6320:
                                                     mon("         INC   <$41                    ; 6320: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x6322; JUMP; // sstep
case 0x6322:
                                                     mon("L6322    JSR   L622D                   ; 6322: BD 62 2D      \n"); // Check joystick X to show high scores if moved
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x25); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x622d; 
    JUMP;
    // End of function sub_6306
  case 0x6325:
                                                     mon("L6325    RTS                           ; 6325: 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 0x6326:
                                                     mon("L6326    LDD   #$03C0                  ; 6326: CC 03 C0      \n"); // Called once before attract screen 4
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0xc0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6329; JUMP; // sstep
case 0x6329:
                                                     mon("         STD   $4B0C                   ; 6329: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x632C; JUMP; // sstep
case 0x632C:
                                                     mon("         LDD   #$0200                  ; 632C: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x632F; JUMP; // sstep
case 0x632F:
                                                     mon("         STD   $4B0E                   ; 632F: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6332; JUMP; // sstep
case 0x6332:
                                                     mon("         LDA   #$23                    ; 6332: 86 23         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x23; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6334; JUMP; // sstep
case 0x6334:
                                                     mon("         STA   $4ADB                   ; 6334: B7 4A DB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4adb, val); 
    PC = 0x6337; JUMP; // sstep
case 0x6337:
                                                     mon("         LDA   #$2C                    ; 6337: 86 2C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2c; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6339; JUMP; // sstep
case 0x6339:
                                                     mon("         STA   $4ADC                   ; 6339: B7 4A DC      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4adc, val); 
    PC = 0x633C; JUMP; // sstep
case 0x633C:
                                                     mon("         LDD   #$6580                  ; 633C: CC 65 80      \n");
    clockticks = clockticks + 3; 
    A = 0x65; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x633F; JUMP; // sstep
case 0x633F:
                                                     mon("         STD   $4B10                   ; 633F: FD 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b10, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b11, B); 
    PC = 0x6342; JUMP; // sstep
case 0x6342:
                                                     mon("         JSR   $D91A                   ; 6342: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x45); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6345:
                                                     mon("L6345    INC   <$41                    ; 6345: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6326
    PC = 0x6347; JUMP; // sstep
case 0x6347:
                                                     mon("         RTS                           ; 6347: 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 4
  case 0x6348:
                                                     mon("L6348    JSR   L6112                   ; 6348: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x634B:
                                                     mon("L634B    JSR   L761D                   ; 634B: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x634E:
                                                     mon("L634E    JSR   L63D5                   ; 634E: BD 63 D5      \n"); // Check credits status
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x51); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x63d5; 
    JUMP;
  case 0x6351:
                                                     mon("L6351    JSR   L6368                   ; 6351: BD 63 68      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x54); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x6368; 
    JUMP;
  case 0x6354:
                                                     mon("L6354    JSR   $CD80                   ; 6354: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x57); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x6357:
                                                     mon("L6357    JSR   L612F                   ; 6357: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x635A:
                                                     mon("L635A    JSR   L6DC0                   ; 635A: BD 6D C0      \n"); // Attract screen 4 stars ZT move
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x6dc0; 
    JUMP;
  case 0x635D:
                                                     mon("L635D    LDD   $4B0E                   ; 635D: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6360; JUMP; // sstep
case 0x6360:
                                                     mon("         BPL   L6364                   ; 6360: 2A 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6364; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6362; JUMP; // sstep
case 0x6362:
                                                     mon("         INC   <$41                    ; 6362: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x6364; JUMP; // sstep
case 0x6364:
                                                     mon("L6364    JSR   L622D                   ; 6364: BD 62 2D      \n"); // Check joystick X to show high scores if moved
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0x622d; 
    JUMP;
    // End of function sub_6348
  case 0x6367:
                                                     mon("L6367    RTS                           ; 6367: 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 0x6368:
                                                     mon("L6368    LDD   $4B0E                   ; 6368: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x636B; JUMP; // sstep
case 0x636B:
                                                     mon("         SUBD  #$01                    ; 636B: 83 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 ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x636E; JUMP; // sstep
case 0x636E:
                                                     mon("         STD   $4B0E                   ; 636E: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6371; JUMP; // sstep
case 0x6371:
                                                     mon("         ANDB  #$07                    ; 6371: C4 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x07; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6373; JUMP; // sstep
case 0x6373:
                                                     mon("         BNE   L639D                   ; 6373: 26 28         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x639d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6375; JUMP; // sstep
case 0x6375:
                                                     mon("         LDA   $4ADB                   ; 6375: B6 4A DB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4adb); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6378; JUMP; // sstep
case 0x6378:
                                                     mon("         BMI   L637D                   ; 6378: 2B 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x637d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x637A; JUMP; // sstep
case 0x637A:
                                                     mon("         JSR   $D8DF                   ; 637A: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x637D:
                                                     mon("L637D    LDA   $4ADB                   ; 637D: B6 4A DB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4adb); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6380; JUMP; // sstep
case 0x6380:
                                                     mon("         CMPA  #$12                    ; 6380: 81 12         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x12; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6382; JUMP; // sstep
case 0x6382:
                                                     mon("         BNE   L638E                   ; 6382: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x638e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6384; JUMP; // sstep
case 0x6384:
                                                     mon("         LDA   $4593                   ; 6384: B6 45 93      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4593); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6387; JUMP; // sstep
case 0x6387:
                                                     mon("         ANDA  #$03                    ; 6387: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6389; JUMP; // sstep
case 0x6389:
                                                     mon("         ADDA  #$1F                    ; 6389: 8B 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1f; 
    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 = 0x638B; JUMP; // sstep
case 0x638B:
                                                     mon("         JSR   $D8DF                   ; 638B: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x638E:
                                                     mon("L638E    LDA   $4ADB                   ; 638E: B6 4A DB      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4adb); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6391; JUMP; // sstep
case 0x6391:
                                                     mon("         ADDA  #$01                    ; 6391: 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 = 0x6393; JUMP; // sstep
case 0x6393:
                                                     mon("         CMPA  $4ADC                   ; 6393: B1 4A DC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4adc); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6396; JUMP; // sstep
case 0x6396:
                                                     mon("         BCS   L639A                   ; 6396: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x639a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6398; JUMP; // sstep
case 0x6398:
                                                     mon("         LDA   #$80                    ; 6398: 86 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x639A; JUMP; // sstep
case 0x639A:
                                                     mon("L639A    STA   $4ADB                   ; 639A: B7 4A DB      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4adb, val); 
    PC = 0x639D; JUMP; // sstep
case 0x639D:
                                                     mon("L639D    LDD   $4B0C                   ; 639D: FC 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0c); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x63A0; JUMP; // sstep
case 0x63A0:
                                                     mon("         SUBD  #$08                    ; 63A0: 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 = 0x63A3; JUMP; // sstep
case 0x63A3:
                                                     mon("         BPL   L63A8                   ; 63A3: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x63a8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63A5; JUMP; // sstep
case 0x63A5:
                                                     mon("         LDD   #$00                    ; 63A5: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x63A8; JUMP; // sstep
case 0x63A8:
                                                     mon("L63A8    STD   $4B0C                   ; 63A8: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x63AB; JUMP; // sstep
case 0x63AB:
                                                     mon("         LDD   $4B0E                   ; 63AB: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x63AE; JUMP; // sstep
case 0x63AE:
                                                     mon("         CMPD  #$C0                    ; 63AE: 10 83 00 C0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00c0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x63B2; JUMP; // sstep
case 0x63B2:
                                                     mon("         BCC   L63C6                   ; 63B2: 24 12         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x63c6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63B4; JUMP; // sstep
case 0x63B4:
                                                     mon("         LDB   $4B11                   ; 63B4: F6 4B 11      \n"); // Attract text intensity
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b11); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x63B7; JUMP; // sstep
case 0x63B7:
                                                     mon("         SUBB  #$01                    ; 63B7: C0 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)); 
    B = (UINT8)(res); 
    PC = 0x63B9; JUMP; // sstep
case 0x63B9:
                                                     mon("         CMPB  #$10                    ; 63B9: C1 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x10; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x63BB; JUMP; // sstep
case 0x63BB:
                                                     mon("         BCC   L63C3                   ; 63BB: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x63c3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63BD; JUMP; // sstep
case 0x63BD:
                                                     mon("         LDD   #$00                    ; 63BD: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x63C0; JUMP; // sstep
case 0x63C0:
                                                     mon("         STD   $4B0E                   ; 63C0: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x63C3; JUMP; // sstep
case 0x63C3:
                                                     mon("L63C3    STB   $4B11                   ; 63C3: F7 4B 11      \n"); // Attract text intensity
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b11, val); 
    PC = 0x63C6; JUMP; // sstep
case 0x63C6:
                                                     mon("L63C6    LDD   $4B0C                   ; 63C6: FC 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0c); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x63C9; JUMP; // sstep
case 0x63C9:
                                                     mon("         STD   $48AF                   ; 63C9: FD 48 AF      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x48af, A); // Care needed with I/O space and word fetches
    wr_mem(0x48b0, B); 
    PC = 0x63CC; JUMP; // sstep
case 0x63CC:
                                                     mon("         LDD   $4B10                   ; 63CC: 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 = 0x63CF; JUMP; // sstep
case 0x63CF:
                                                     mon("         STD   ,Y++                    ; 63CF: 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 = 0x63D1; JUMP; // sstep
case 0x63D1:
                                                     mon("         JSR   $D942                   ; 63D1: BD D9 42      \n"); // Called from Attract screen 3 + 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xd942; 
    JUMP;
    // End of function sub_6368
  case 0x63D4:
                                                     mon("L63D4    RTS                           ; 63D4: 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 credits status
  case 0x63D5:
                                                     mon("L63D5    LDA   $4814                   ; 63D5: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x63D8; JUMP; // sstep
case 0x63D8:
                                                     mon("         BNE   L63EB                   ; 63D8: 26 11         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x63eb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63DA; JUMP; // sstep
case 0x63DA:
                                                     mon("         LDA   <$43                    ; 63DA: 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 = 0x63DC; JUMP; // sstep
case 0x63DC:
                                                     mon("         ANDA  #$10                    ; 63DC: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x63DE; JUMP; // sstep
case 0x63DE:
                                                     mon("         BNE   L63E4                   ; 63DE: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x63e4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63E0; JUMP; // sstep
case 0x63E0:
                                                     mon("         LDB   #$06                    ; 63E0: C6 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x63E2; JUMP; // sstep
case 0x63E2:
                                                     mon("         BRA   L63E6                   ; 63E2: 20 02         \n");
    PC = 0x63e6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x63E4:
                                                     mon("L63E4    LDB   #$05                    ; 63E4: C6 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x63E6; JUMP; // sstep
case 0x63E6:
                                                     mon("L63E6    JSR   $E7C7                   ; 63E6: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x63E9:
                                                     mon("L63E9    BRA   L63F0                   ; 63E9: 20 05         \n");
    PC = 0x63f0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x63EB:
                                                     mon("L63EB    LDB   #$0B                    ; 63EB: C6 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x63ED; JUMP; // sstep
case 0x63ED:
                                                     mon("         JSR   $E7C7                   ; 63ED: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x63); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x63F0:
                                                     mon("L63F0    LDA   $4814                   ; 63F0: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x63F3; JUMP; // sstep
case 0x63F3:
                                                     mon("         BNE   L6410                   ; 63F3: 26 1B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6410; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63F5; JUMP; // sstep
case 0x63F5:
                                                     mon("         LDA   $4812                   ; 63F5: B6 48 12      \n"); // Half credit
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4812); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x63F8; JUMP; // sstep
case 0x63F8:
                                                     mon("         BEQ   L6404                   ; 63F8: 27 0A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6404; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x63FA; JUMP; // sstep
case 0x63FA:
                                                     mon("         LDA   <$43                    ; 63FA: 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 = 0x63FC; JUMP; // sstep
case 0x63FC:
                                                     mon("         ANDA  #$10                    ; 63FC: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x63FE; JUMP; // sstep
case 0x63FE:
                                                     mon("         BEQ   L6404                   ; 63FE: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6404; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6400; JUMP; // sstep
case 0x6400:
                                                     mon("         BRA   L6410                   ; 6400: 20 0E         \n");
    PC = 0x6410; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6402:
                                                     mon("         BRA   L640E                   ; 6402: 20 0A         \n");
    PC = 0x640e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6404:
                                                     mon("L6404    LDB   $4591                   ; 6404: F6 45 91      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4591); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6407; JUMP; // sstep
case 0x6407:
                                                     mon("         ANDB  #$03                    ; 6407: C4 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x03; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6409; JUMP; // sstep
case 0x6409:
                                                     mon("         ADDB  #$07                    ; 6409: CB 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x07; 
    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 = 0x640B; JUMP; // sstep
case 0x640B:
                                                     mon("         JSR   $E7C7                   ; 640B: 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, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x640E:
                                                     mon("L640E    BRA   locret_6458             ; 640E: 20 48         \n");
    PC = 0x6458; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6410:
                                                     mon("L6410    LDA   $4814                   ; 6410: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6413; JUMP; // sstep
case 0x6413:
                                                     mon("         ADDA  $4812                   ; 6413: BB 48 12      \n"); // Half credit
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4812); 
    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 = 0x6416; JUMP; // sstep
case 0x6416:
                                                     mon("         CMPA  #$01                    ; 6416: 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 = 0x6418; JUMP; // sstep
case 0x6418:
                                                     mon("         BNE   L641E                   ; 6418: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x641e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x641A; JUMP; // sstep
case 0x641A:
                                                     mon("         LDB   #$0D                    ; 641A: C6 0D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0d; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x641C; JUMP; // sstep
case 0x641C:
                                                     mon("         BRA   L6420                   ; 641C: 20 02         \n");
    PC = 0x6420; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x641E:
                                                     mon("L641E    LDB   #$0C                    ; 641E: C6 0C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0c; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6420; JUMP; // sstep
case 0x6420:
                                                     mon("L6420    JSR   $E7C7                   ; 6420: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x23); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x6423:
                                                     mon("L6423    LDD   #$01B0                  ; 6423: CC 01 B0      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xb0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6426; JUMP; // sstep
case 0x6426:
                                                     mon("         ANDA  #$1F                    ; 6426: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6428; JUMP; // sstep
case 0x6428:
                                                     mon("         STD   ,Y++                    ; 6428: 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 = 0x642A; JUMP; // sstep
case 0x642A:
                                                     mon("         LDD   #$FF80                  ; 642A: CC FF 80      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x642D; JUMP; // sstep
case 0x642D:
                                                     mon("         TST   $4812                   ; 642D: 7D 48 12      \n"); // Half credit
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4812); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6430; JUMP; // sstep
case 0x6430:
                                                     mon("         BEQ   L6435                   ; 6430: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6435; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6432; JUMP; // sstep
case 0x6432:
                                                     mon("         SUBD  #$18                    ; 6432: 83 00 18      \n");
    clockticks = clockticks + 4; 
    val = 0x0018; 
    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 = 0x6435; JUMP; // sstep
case 0x6435:
                                                     mon("L6435    ANDA  #$1F                    ; 6435: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6437; JUMP; // sstep
case 0x6437:
                                                     mon("         STD   ,Y++                    ; 6437: 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 = 0x6439; JUMP; // sstep
case 0x6439:
                                                     mon("         LDA   $4814                   ; 6439: B6 48 14      \n"); // Credits
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4814); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x643C; JUMP; // sstep
case 0x643C:
                                                     mon("         CMPA  #$0A                    ; 643C: 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 = 0x643E; JUMP; // sstep
case 0x643E:
                                                     mon("         BCS   L6442                   ; 643E: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6442; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6440; JUMP; // sstep
case 0x6440:
                                                     mon("         ADDA  #$06                    ; 6440: 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 = 0x6442; JUMP; // sstep
case 0x6442:
                                                     mon("L6442    LDB   #$02                    ; 6442: C6 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6444; JUMP; // sstep
case 0x6444:
                                                     mon("         STB   <$AD                    ; 6444: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x6446; JUMP; // sstep
case 0x6446:
                                                     mon("         JSR   $E790                   ; 6446: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x49); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x6449:
                                                     mon("L6449    LDA   $4812                   ; 6449: B6 48 12      \n"); // Half credit
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4812); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x644C; JUMP; // sstep
case 0x644C:
                                                     mon("         BEQ   L6453                   ; 644C: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6453; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x644E; JUMP; // sstep
case 0x644E:
                                                     mon("         LDD   #$B8F3                  ; 644E: CC B8 F3      \n");
    clockticks = clockticks + 3; 
    A = 0xb8; 
    B = 0xf3; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6451; JUMP; // sstep
case 0x6451:
                                                     mon("         STD   ,Y++                    ; 6451: 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 = 0x6453; JUMP; // sstep
case 0x6453:
                                                     mon("L6453    LDD   #$8040                  ; 6453: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6456; JUMP; // sstep
case 0x6456:
                                                     mon("         STD   ,Y++                    ; 6456: 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_63D5
    PC = 0x6458; JUMP; // sstep
case 0x6458:
                                                     mon("locret_6458 RTS                           ; 6458: 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 0x6459:
                                                     mon("L6459    LDD   #$00                    ; 6459: CC 00 00      \n"); // Called once before attract screen 1
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x645C; JUMP; // sstep
case 0x645C:
                                                     mon("         STD   $4B0C                   ; 645C: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x645F; JUMP; // sstep
case 0x645F:
                                                     mon("         STD   $48AF                   ; 645F: FD 48 AF      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x48af, A); // Care needed with I/O space and word fetches
    wr_mem(0x48b0, B); 
    PC = 0x6462; JUMP; // sstep
case 0x6462:
                                                     mon("         LDD   #$0100                  ; 6462: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6465; JUMP; // sstep
case 0x6465:
                                                     mon("         STD   $4B0E                   ; 6465: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6468; JUMP; // sstep
case 0x6468:
                                                     mon("         LDD   #$6180                  ; 6468: CC 61 80      \n");
    clockticks = clockticks + 3; 
    A = 0x61; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x646B; JUMP; // sstep
case 0x646B:
                                                     mon("         STD   $4B10                   ; 646B: FD 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b10, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b11, B); 
    PC = 0x646E; JUMP; // sstep
case 0x646E:
                                                     mon("         JSR   $D91A                   ; 646E: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6471:
                                                     mon("L6471    JSR   L61B5                   ; 6471: BD 61 B5      \n"); // Set up math constants
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x61b5; 
    JUMP;
  case 0x6474:
                                                     mon("L6474    JSR   L615A                   ; 6474: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6477:
                                                     mon("L6477    LDU   #$5038                  ; 6477: CE 50 38      \n"); // Matrix 2
    clockticks = clockticks + 3; 
    U = 0x5038; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x647A; JUMP; // sstep
case 0x647A:
                                                     mon("         JSR   $CDC3                   ; 647A: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x647D:
                                                     mon("L647D    JSR   $CC38                   ; 647D: BD CC 38      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x80); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xcc38; 
    JUMP;
  case 0x6480:
                                                     mon("L6480    INC   <$41                    ; 6480: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6459
    PC = 0x6482; JUMP; // sstep
case 0x6482:
                                                     mon("         RTS                           ; 6482: 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 1
  case 0x6483:
                                                     mon("L6483    JSR   L6112                   ; 6483: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x6486:
                                                     mon("L6486    JSR   L64CD                   ; 6486: BD 64 CD      \n"); // Print Star Wars and copyright text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x64cd; 
    JUMP;
  case 0x6489:
                                                     mon("L6489    JSR   $CD80                   ; 6489: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x648C:
                                                     mon("L648C    JSR   L761D                   ; 648C: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x648F:
                                                     mon("L648F    JSR   L63D5                   ; 648F: BD 63 D5      \n"); // Check credits status
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x92); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x63d5; 
    JUMP;
  case 0x6492:
                                                     mon("L6492    LDD   $4B0E                   ; 6492: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6495; JUMP; // sstep
case 0x6495:
                                                     mon("         CMPD  #$50                    ; 6495: 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 = 0x6499; JUMP; // sstep
case 0x6499:
                                                     mon("         BCC   L64A9                   ; 6499: 24 0E         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x64a9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x649B; JUMP; // sstep
case 0x649B:
                                                     mon("         LDB   $4B11                   ; 649B: F6 4B 11      \n"); // Attract text intensity
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b11); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x649E; JUMP; // sstep
case 0x649E:
                                                     mon("         SUBB  #$01                    ; 649E: C0 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)); 
    B = (UINT8)(res); 
    PC = 0x64A0; JUMP; // sstep
case 0x64A0:
                                                     mon("         CMPB  #$F0                    ; 64A0: C1 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0xf0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x64A2; JUMP; // sstep
case 0x64A2:
                                                     mon("         BCS   L64A6                   ; 64A2: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x64a6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x64A4; JUMP; // sstep
case 0x64A4:
                                                     mon("         LDB   #$00                    ; 64A4: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x64A6; JUMP; // sstep
case 0x64A6:
                                                     mon("L64A6    STB   $4B11                   ; 64A6: F7 4B 11      \n"); // Attract text intensity
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b11, val); 
    PC = 0x64A9; JUMP; // sstep
case 0x64A9:
                                                     mon("L64A9    LDD   $4B10                   ; 64A9: 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 = 0x64AC; JUMP; // sstep
case 0x64AC:
                                                     mon("         STD   ,Y++                    ; 64AC: 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 = 0x64AE; JUMP; // sstep
case 0x64AE:
                                                     mon("         JSR   $C7FD                   ; 64AE: BD C7 FD      \n"); // Display high scores
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xc7fd; 
    JUMP;
  case 0x64B1:
                                                     mon("L64B1    JSR   $D923                   ; 64B1: BD D9 23      \n"); // Called from attract screen 1
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xd923; 
    JUMP;
  case 0x64B4:
                                                     mon("L64B4    JSR   L612F                   ; 64B4: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x64B7:
                                                     mon("L64B7    JSR   L6DCA                   ; 64B7: BD 6D CA      \n"); // Move stars XT translate position
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x6dca; 
    JUMP;
  case 0x64BA:
                                                     mon("L64BA    LDD   $4B0E                   ; 64BA: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x64BD; JUMP; // sstep
case 0x64BD:
                                                     mon("         SUBD  #$01                    ; 64BD: 83 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 ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x64C0; JUMP; // sstep
case 0x64C0:
                                                     mon("         STD   $4B0E                   ; 64C0: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x64C3; JUMP; // sstep
case 0x64C3:
                                                     mon("         BPL   L64C9                   ; 64C3: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x64c9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x64C5; JUMP; // sstep
case 0x64C5:
                                                     mon("         LDA   #$05                    ; 64C5: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x64C7; JUMP; // sstep
case 0x64C7:
                                                     mon("         STA   <$41                    ; 64C7: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x64C9; JUMP; // sstep
case 0x64C9:
                                                     mon("L64C9    JSR   L622D                   ; 64C9: BD 62 2D      \n"); // Check joystick X to show high scores if moved
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x622d; 
    JUMP;
    // End of function sub_6483
  case 0x64CC:
                                                     mon("L64CC    RTS                           ; 64CC: 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 Star Wars and copyright text
  case 0x64CD:
                                                     mon("L64CD    LDB   #$00                    ; 64CD: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x64CF; JUMP; // sstep
case 0x64CF:
                                                     mon("         JSR   $E7C7                   ; 64CF: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x64D2:
                                                     mon("L64D2    LDB   #$01                    ; 64D2: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x64D4; JUMP; // sstep
case 0x64D4:
                                                     mon("         JSR   $E7C7                   ; 64D4: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x64D7:
                                                     mon("L64D7    LDB   #$02                    ; 64D7: C6 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x64D9; JUMP; // sstep
case 0x64D9:
                                                     mon("         JSR   $E7C7                   ; 64D9: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x64DC:
                                                     mon("L64DC    LDB   #$03                    ; 64DC: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x64DE; JUMP; // sstep
case 0x64DE:
                                                     mon("         JSR   $E7C7                   ; 64DE: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // End of function sub_64CD
  case 0x64E1:
                                                     mon("L64E1    RTS                           ; 64E1: 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 0x64E2:
                                                     mon("L64E2    JSR   $D91A                   ; 64E2: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x64E5:
                                                     mon("L64E5    LDD   #$00                    ; 64E5: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x64E8; JUMP; // sstep
case 0x64E8:
                                                     mon("         STD   $4B0C                   ; 64E8: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x64EB; JUMP; // sstep
case 0x64EB:
                                                     mon("         STD   $48AF                   ; 64EB: FD 48 AF      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x48af, A); // Care needed with I/O space and word fetches
    wr_mem(0x48b0, B); 
    PC = 0x64EE; JUMP; // sstep
case 0x64EE:
                                                     mon("         INC   <$41                    ; 64EE: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_64E2
    PC = 0x64F0; JUMP; // sstep
case 0x64F0:
                                                     mon("         RTS                           ; 64F0: 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 0x64F1:
                                                     mon("L64F1    JSR   L6112                   ; 64F1: BD 61 12      \n"); // Accounting time stats
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x64F4:
                                                     mon("L64F4    JSR   $BE20                   ; 64F4: BD BE 20      \n"); // Display accounting screen
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xbe20; 
    JUMP;
  case 0x64F7:
                                                     mon("L64F7    JSR   $D923                   ; 64F7: BD D9 23      \n"); // Called from attract screen 1
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfa); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0xd923; 
    JUMP;
  case 0x64FA:
                                                     mon("L64FA    JSR   L612F                   ; 64FA: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x64FD:
                                                     mon("L64FD    LDA   <$AC                    ; 64FD: 96 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x64FF; JUMP; // sstep
case 0x64FF:
                                                     mon("         ANDA  #$04                    ; 64FF: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6501; JUMP; // sstep
case 0x6501:
                                                     mon("         BEQ   L6507                   ; 6501: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6507; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6503; JUMP; // sstep
case 0x6503:
                                                     mon("         LDA   #$03                    ; 6503: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6505; JUMP; // sstep
case 0x6505:
                                                     mon("         STA   <$41                    ; 6505: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6507; JUMP; // sstep
case 0x6507:
                                                     mon("L6507    LDA   $481E                   ; 6507: B6 48 1E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x650A; JUMP; // sstep
case 0x650A:
                                                     mon("         ANDA  #$10                    ; 650A: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x650C; JUMP; // sstep
case 0x650C:
                                                     mon("         BEQ   locret_6512             ; 650C: 27 04         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6512; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x650E; JUMP; // sstep
case 0x650E:
                                                     mon("         LDA   #$05                    ; 650E: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6510; JUMP; // sstep
case 0x6510:
                                                     mon("         STA   <$41                    ; 6510: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_64F1
    PC = 0x6512; JUMP; // sstep
case 0x6512:
                                                     mon("locret_6512 RTS                           ; 6512: 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 0x6513:
                                                     mon("L6513    JSR   $D91A                   ; 6513: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6516:
                                                     mon("L6516    LDA   #$0A                    ; 6516: 86 0A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0a; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6518; JUMP; // sstep
case 0x6518:
                                                     mon("         STA   $4AF6                   ; 6518: B7 4A F6      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af6, val); 
    PC = 0x651B; JUMP; // sstep
case 0x651B:
                                                     mon("         LDA   #$00                    ; 651B: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x651D; JUMP; // sstep
case 0x651D:
                                                     mon("         STA   $4598                   ; 651D: B7 45 98      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4598, val); 
    PC = 0x6520; JUMP; // sstep
case 0x6520:
                                                     mon("         STA   $4AF7                   ; 6520: B7 4A F7      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4af7, val); 
    PC = 0x6523; JUMP; // sstep
case 0x6523:
                                                     mon("         LDA   #$03                    ; 6523: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6525; JUMP; // sstep
case 0x6525:
                                                     mon("         JSR   $C2C3                   ; 6525: BD C2 C3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xc2c3; 
    JUMP;
  case 0x6528:
                                                     mon("L6528    BEQ   L652F                   ; 6528: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x652f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x652A; JUMP; // sstep
case 0x652A:
                                                     mon("         LDA   #$03                    ; 652A: 86 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x652C; JUMP; // sstep
case 0x652C:
                                                     mon("         JSR   $C369                   ; 652C: BD C3 69      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xc369; 
    JUMP;
  case 0x652F:
                                                     mon("L652F    INC   <$41                    ; 652F: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6513
    PC = 0x6531; JUMP; // sstep
case 0x6531:
                                                     mon("         RTS                           ; 6531: 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:F261 SIZE 000000CD BYTES
    // FUNCTION CHUNK AT ROM:F36E SIZE 000001AF BYTES
    // FUNCTION CHUNK AT ROM:F520 SIZE 000001ED BYTES
    // FUNCTION CHUNK AT ROM:F720 SIZE 00000003 BYTES
    // FUNCTION CHUNK AT ROM:FD07 SIZE 0000007E BYTES
    // FUNCTION CHUNK AT ROM:FF24 SIZE 00000033 BYTES
  case 0x6532:
                                                     mon("L6532    JSR   L6112                   ; 6532: BD 61 12      \n"); // Game options
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x6535:
                                                     mon("L6535    JSR   $C450                   ; 6535: BD C4 50      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xc450; 
    JUMP;
  case 0x6538:
                                                     mon("L6538    LDD   #L6780                  ; 6538: CC 67 80      \n");
    clockticks = clockticks + 3; 
    A = 0x67; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x653B; JUMP; // sstep
case 0x653B:
                                                     mon("         STD   ,Y++                    ; 653B: 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 = 0x653D; JUMP; // sstep
case 0x653D:
                                                     mon("         LDB   #$66                    ; 653D: C6 66         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x66; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x653F; JUMP; // sstep
case 0x653F:
                                                     mon("         ADDB  $4AF6                   ; 653F: FB 4A F6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x4af6); 
    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 = 0x6542; JUMP; // sstep
case 0x6542:
                                                     mon("         JSR   $E7D3                   ; 6542: BD E7 D3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x45); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xe7d3; 
    JUMP;
  case 0x6545:
                                                     mon("L6545    LDA   $4AF6                   ; 6545: B6 4A F6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4af6); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6548; JUMP; // sstep
case 0x6548:
                                                     mon("         JSR   $C5A4                   ; 6548: BD C5 A4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xc5a4; 
    JUMP;
  case 0x654B:
                                                     mon("L654B    JSR   $C4EB                   ; 654B: BD C4 EB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xc4eb; 
    JUMP;
  case 0x654E:
                                                     mon("L654E    JSR   $D923                   ; 654E: BD D9 23      \n"); // Called from attract screen 1
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x51); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xd923; 
    JUMP;
  case 0x6551:
                                                     mon("L6551    JSR   L612F                   ; 6551: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x54); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x6554:
                                                     mon("L6554    LDA   <$AC                    ; 6554: 96 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6556; JUMP; // sstep
case 0x6556:
                                                     mon("         ANDA  #$04                    ; 6556: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6558; JUMP; // sstep
case 0x6558:
                                                     mon("         BEQ   L655D                   ; 6558: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x655d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x655A; JUMP; // sstep
case 0x655A:
                                                     mon("         JMP   $F261                   ; 655A: 7E F2 61      \n");
    clockticks = clockticks + 4; 
    PC = 0xf261; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x655D:
                                                     mon("L655D    LDA   $481E                   ; 655D: B6 48 1E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6560; JUMP; // sstep
case 0x6560:
                                                     mon("         ANDA  #$10                    ; 6560: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6562; JUMP; // sstep
case 0x6562:
                                                     mon("         BEQ   locret_656B             ; 6562: 27 07         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x656b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6564; JUMP; // sstep
case 0x6564:
                                                     mon("         JSR   $D91A                   ; 6564: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6567:
                                                     mon("L6567    LDA   #$05                    ; 6567: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6569; JUMP; // sstep
case 0x6569:
                                                     mon("         STA   <$41                    ; 6569: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6532
    PC = 0x656B; JUMP; // sstep
case 0x656B:
                                                     mon("locret_656B RTS                           ; 656B: 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 =======================================
    // Start select screen
  case 0x656C:
                                                     mon("L656C    LDD   #$0100                  ; 656C: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x656F; JUMP; // sstep
case 0x656F:
                                                     mon("         STD   $4B0E                   ; 656F: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6572; JUMP; // sstep
case 0x6572:
                                                     mon("         LDD   #$00                    ; 6572: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6575; JUMP; // sstep
case 0x6575:
                                                     mon("         STD   $4B0C                   ; 6575: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x6578; JUMP; // sstep
case 0x6578:
                                                     mon("         STD   $48AF                   ; 6578: FD 48 AF      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x48af, A); // Care needed with I/O space and word fetches
    wr_mem(0x48b0, B); 
    PC = 0x657B; JUMP; // sstep
case 0x657B:
                                                     mon("         LDD   #$6480                  ; 657B: CC 64 80      \n");
    clockticks = clockticks + 3; 
    A = 0x64; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x657E; JUMP; // sstep
case 0x657E:
                                                     mon("         STD   $4B10                   ; 657E: FD 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b10, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b11, B); 
    PC = 0x6581; JUMP; // sstep
case 0x6581:
                                                     mon("         JSR   $D91A                   ; 6581: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6584:
                                                     mon("L6584    LDB   #$2C                    ; 6584: C6 2C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2c; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6586; JUMP; // sstep
case 0x6586:
                                                     mon("L6586    TFR   B,A                     ; 6586: 1F 98         \n");
    A = (UINT8)B; 
    clockticks = clockticks + 6; 
    PC = 0x6588; JUMP; // sstep
case 0x6588:
                                                     mon("         JSR   $D8DF                   ; 6588: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x658B:
                                                     mon("L658B    INCB                          ; 658B: 5C            \n");
    val = (UINT8)B; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x658C; JUMP; // sstep
case 0x658C:
                                                     mon("         CMPB  #$3A                    ; 658C: C1 3A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x3a; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x658E; JUMP; // sstep
case 0x658E:
                                                     mon("         BCS   L6586                   ; 658E: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6586; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6590; JUMP; // sstep
case 0x6590:
                                                     mon("         INC   <$41                    ; 6590: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_656C
    // ---------------------------------------------------------------------------
    PC = 0x6592; JUMP; // sstep
case 0x6592:
                                                     mon("         RTS                           ; 6592: 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 0x659F:
                                                     mon("L659F    LDD   $4B0E                   ; 659F: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65A2; JUMP; // sstep
case 0x65A2:
                                                     mon("         SUBD  #$01                    ; 65A2: 83 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 ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x65A5; JUMP; // sstep
case 0x65A5:
                                                     mon("         STD   $4B0E                   ; 65A5: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x65A8; JUMP; // sstep
case 0x65A8:
                                                     mon("         BPL   L65BD                   ; 65A8: 2A 13         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x65bd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x65AA; JUMP; // sstep
case 0x65AA:
                                                     mon("         LDA   #$00                    ; 65AA: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x65AC; JUMP; // sstep
case 0x65AC:
                                                     mon("         STA   $4B15                   ; 65AC: B7 4B 15      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b15, val); 
    PC = 0x65AF; JUMP; // sstep
case 0x65AF:
                                                     mon("         LDA   #$1B                    ; 65AF: 86 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x65B1; JUMP; // sstep
case 0x65B1:
                                                     mon("         STA   <$41                    ; 65B1: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x65B3; JUMP; // sstep
case 0x65B3:
                                                     mon("         CLR   $481B                   ; 65B3: 7F 48 1B      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x481b, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x65B6; JUMP; // sstep
case 0x65B6:
                                                     mon("         CLR   $481A                   ; 65B6: 7F 48 1A      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x481a, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x65B9; JUMP; // sstep
case 0x65B9:
                                                     mon("         CLR   $4819                   ; 65B9: 7F 48 19      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4819, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x65BC; JUMP; // sstep
case 0x65BC:
                                                     mon("         RTS                           ; 65BC: 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 0x65BD:
                                                     mon("L65BD    JSR   L6112                   ; 65BD: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x65C0:
                                                     mon("L65C0    LDX   #word_6593              ; 65C0: 8E 65 93      \n");
    clockticks = clockticks + 3; 
    X = 0x6593; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x65C3; JUMP; // sstep
case 0x65C3:
                                                     mon("L65C3    LDD   ,X++                    ; 65C3: 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 = 0x65C5; JUMP; // sstep
case 0x65C5:
                                                     mon("         ANDA  #$1F                    ; 65C5: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x65C7; JUMP; // sstep
case 0x65C7:
                                                     mon("         STD   ,Y++                    ; 65C7: 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 = 0x65C9; JUMP; // sstep
case 0x65C9:
                                                     mon("         LDD   ,X++                    ; 65C9: 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 = 0x65CB; JUMP; // sstep
case 0x65CB:
                                                     mon("         ANDA  #$1F                    ; 65CB: 84 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x1f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x65CD; JUMP; // sstep
case 0x65CD:
                                                     mon("         STD   ,Y++                    ; 65CD: 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 = 0x65CF; JUMP; // sstep
case 0x65CF:
                                                     mon("         LDD   #$7200                  ; 65CF: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65D2; JUMP; // sstep
case 0x65D2:
                                                     mon("         STD   ,Y++                    ; 65D2: 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 = 0x65D4; JUMP; // sstep
case 0x65D4:
                                                     mon("         LDD   #$BE50                  ; 65D4: CC BE 50      \n");
    clockticks = clockticks + 3; 
    A = 0xbe; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65D7; JUMP; // sstep
case 0x65D7:
                                                     mon("         STD   ,Y++                    ; 65D7: 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 = 0x65D9; JUMP; // sstep
case 0x65D9:
                                                     mon("         CMPX  #L659F                  ; 65D9: 8C 65 9F      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x659f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x65DC; JUMP; // sstep
case 0x65DC:
                                                     mon("         BCS   L65C3                   ; 65DC: 25 E5         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x65c3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x65DE; JUMP; // sstep
case 0x65DE:
                                                     mon("         LDA   <$DD                    ; 65DE: 96 DD         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xdd); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x65E0; JUMP; // sstep
case 0x65E0:
                                                     mon("         BPL   L65E7                   ; 65E0: 2A 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x65e7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x65E2; JUMP; // sstep
case 0x65E2:
                                                     mon("         LDD   #$6380                  ; 65E2: CC 63 80      \n");
    clockticks = clockticks + 3; 
    A = 0x63; 
    B = 0x80; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x65E5; JUMP; // sstep
case 0x65E5:
                                                     mon("         BRA   L65EA                   ; 65E5: 20 03         \n");
    PC = 0x65ea; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x65E7:
                                                     mon("L65E7    LDD   #$6680                  ; 65E7: CC 66 80      \n");
    clockticks = clockticks + 3; 
    A = 0x66; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65EA; JUMP; // sstep
case 0x65EA:
                                                     mon("L65EA    STD   ,Y++                    ; 65EA: 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 = 0x65EC; JUMP; // sstep
case 0x65EC:
                                                     mon("         JSR   $B6C0                   ; 65EC: BD B6 C0      \n"); // Insert vector instructions at joystick position for laser explosion 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xb6c0; 
    JUMP;
  case 0x65EF:
                                                     mon("L65EF    JSR   $D923                   ; 65EF: BD D9 23      \n"); // Called from attract screen 1
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    PC = 0xd923; 
    JUMP;
  case 0x65F2:
                                                     mon("L65F2    LDD   #$C8                    ; 65F2: CC 00 C8      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0xc8; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65F5; JUMP; // sstep
case 0x65F5:
                                                     mon("         STD   ,Y++                    ; 65F5: 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 = 0x65F7; JUMP; // sstep
case 0x65F7:
                                                     mon("         LDD   #$1FF0                  ; 65F7: CC 1F F0      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0xf0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65FA; JUMP; // sstep
case 0x65FA:
                                                     mon("         STD   ,Y++                    ; 65FA: 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 = 0x65FC; JUMP; // sstep
case 0x65FC:
                                                     mon("         LDD   $4B0E                   ; 65FC: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x65FF; JUMP; // sstep
case 0x65FF:
                                                     mon("         ASLB                          ; 65FF: 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 = 0x6600; JUMP; // sstep
case 0x6600:
                                                     mon("         ROLA                          ; 6600: 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 = 0x6601; JUMP; // sstep
case 0x6601:
                                                     mon("         ASLB                          ; 6601: 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 = 0x6602; JUMP; // sstep
case 0x6602:
                                                     mon("         ROLA                          ; 6602: 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 = 0x6603; JUMP; // sstep
case 0x6603:
                                                     mon("         ASLB                          ; 6603: 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 = 0x6604; JUMP; // sstep
case 0x6604:
                                                     mon("         ROLA                          ; 6604: 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 = 0x6605; JUMP; // sstep
case 0x6605:
                                                     mon("         CMPA  #$0A                    ; 6605: 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 = 0x6607; JUMP; // sstep
case 0x6607:
                                                     mon("         BCS   L660B                   ; 6607: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x660b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6609; JUMP; // sstep
case 0x6609:
                                                     mon("         ADDA  #$06                    ; 6609: 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 = 0x660B; JUMP; // sstep
case 0x660B:
                                                     mon("L660B    JSR   $E790                   ; 660B: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x660E:
                                                     mon("L660E    JSR   L612F                   ; 660E: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x11); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x6611:
                                                     mon("L6611    LDA   #$FF                    ; 6611: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6613; JUMP; // sstep
case 0x6613:
                                                     mon("         STA   <$DD                    ; 6613: 97 DD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdd; 
    wr_mem(ea, val); 
    PC = 0x6615; JUMP; // sstep
case 0x6615:
                                                     mon("         LDX   #word_6593              ; 6615: 8E 65 93      \n");
    clockticks = clockticks + 3; 
    X = 0x6593; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x6618; JUMP; // sstep
case 0x6618:
                                                     mon("L6618    LDD   <$7B                    ; 6618: DC 7B         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x7b); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x7c); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x661A; JUMP; // sstep
case 0x661A:
                                                     mon("         ADDD  #$FF98                  ; 661A: 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 = 0x661D; JUMP; // sstep
case 0x661D:
                                                     mon("         SUBD  ,X                      ; 661D: 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 = 0x661F; JUMP; // sstep
case 0x661F:
                                                     mon("         TSTA                          ; 661F: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6620; JUMP; // sstep
case 0x6620:
                                                     mon("         BPL   L6626                   ; 6620: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6626; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6622; JUMP; // sstep
case 0x6622:
                                                     mon("         COMA                          ; 6622: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6623; JUMP; // sstep
case 0x6623:
                                                     mon("         NEGB                          ; 6623: 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 = 0x6624; JUMP; // sstep
case 0x6624:
                                                     mon("         SBCA  #$FF                    ; 6624: 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 = 0x6626; JUMP; // sstep
case 0x6626:
                                                     mon("L6626    STD   $4AFA                   ; 6626: 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 = 0x6629; JUMP; // sstep
case 0x6629:
                                                     mon("         CMPD  #$48                    ; 6629: 10 83 00 48   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0048; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x662D; JUMP; // sstep
case 0x662D:
                                                     mon("         BCC   L6668                   ; 662D: 24 39         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x6668; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x662F; JUMP; // sstep
case 0x662F:
                                                     mon("         LDD   <$79                    ; 662F: DC 79         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x79); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x7a); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6631; JUMP; // sstep
case 0x6631:
                                                     mon("         SUBD  $02,X                   ; 6631: 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 = 0x6633; JUMP; // sstep
case 0x6633:
                                                     mon("         TSTA                          ; 6633: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6634; JUMP; // sstep
case 0x6634:
                                                     mon("         BPL   L663A                   ; 6634: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x663a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6636; JUMP; // sstep
case 0x6636:
                                                     mon("         COMA                          ; 6636: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6637; JUMP; // sstep
case 0x6637:
                                                     mon("         NEGB                          ; 6637: 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 = 0x6638; JUMP; // sstep
case 0x6638:
                                                     mon("         SBCA  #$FF                    ; 6638: 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 = 0x663A; JUMP; // sstep
case 0x663A:
                                                     mon("L663A    CMPD  #$34                    ; 663A: 10 83 00 34   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0034; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x663E; JUMP; // sstep
case 0x663E:
                                                     mon("         BCC   L6668                   ; 663E: 24 28         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x6668; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6640; JUMP; // sstep
case 0x6640:
                                                     mon("         ADDD  $4AFA                   ; 6640: F3 4A FA      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4afa)<<8; 
    ea = ea | rd_mem(0x4afb); 
    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 = 0x6643; JUMP; // sstep
case 0x6643:
                                                     mon("         CMPD  #$50                    ; 6643: 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 = 0x6647; JUMP; // sstep
case 0x6647:
                                                     mon("         BCC   L6668                   ; 6647: 24 1F         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x6668; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6649; JUMP; // sstep
case 0x6649:
                                                     mon("         TFR   X,D                     ; 6649: 1F 10         \n");
    val = X; 
    A = (UINT8)(val >> 8); 
    B = (UINT8)val; 
    clockticks = clockticks + 6; 
    PC = 0x664B; JUMP; // sstep
case 0x664B:
                                                     mon("         SUBD  #word_6593              ; 664B: 83 65 93      \n");
    clockticks = clockticks + 4; 
    val = 0x6593; 
    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 = 0x664E; JUMP; // sstep
case 0x664E:
                                                     mon("         LSRB                          ; 664E: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x664F; JUMP; // sstep
case 0x664F:
                                                     mon("         STB   <$DD                    ; 664F: D7 DD         \n");
    clockticks = clockticks + 4; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdd; 
    wr_mem(ea, val); 
    PC = 0x6651; JUMP; // sstep
case 0x6651:
                                                     mon("         STB   $4B15                   ; 6651: F7 4B 15      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b15, val); 
    PC = 0x6654; JUMP; // sstep
case 0x6654:
                                                     mon("         LDA   <$AC                    ; 6654: 96 AC         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xac); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6656; JUMP; // sstep
case 0x6656:
                                                     mon("         ANDA  #$F0                    ; 6656: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6658; JUMP; // sstep
case 0x6658:
                                                     mon("         BEQ   locret_6667             ; 6658: 27 0D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6667; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x665A; JUMP; // sstep
case 0x665A:
                                                     mon("         LDA   #$1B                    ; 665A: 86 1B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x665C; JUMP; // sstep
case 0x665C:
                                                     mon("         STA   <$41                    ; 665C: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x665E; JUMP; // sstep
case 0x665E:
                                                     mon("         CLR   $481B                   ; 665E: 7F 48 1B      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x481b, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6661; JUMP; // sstep
case 0x6661:
                                                     mon("         CLR   $481A                   ; 6661: 7F 48 1A      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x481a, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6664; JUMP; // sstep
case 0x6664:
                                                     mon("         CLR   $4819                   ; 6664: 7F 48 19      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4819, 0); 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6667; JUMP; // sstep
case 0x6667:
                                                     mon("locret_6667 RTS                           ; 6667: 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 0x6668:
                                                     mon("L6668    LEAX  $04,X                   ; 6668: 30 04         \n");
    clockticks = clockticks + 5; 
    X = (X + 0x0004); 
/**/Z = X; 
    PC = 0x666A; JUMP; // sstep
case 0x666A:
                                                     mon("         CMPX  #L659F                  ; 666A: 8C 65 9F      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x659f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x666D; JUMP; // sstep
case 0x666D:
                                                     mon("         BCS   L6618                   ; 666D: 25 A9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6618; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_659F
    PC = 0x666F; JUMP; // sstep
case 0x666F:
                                                     mon("         RTS                           ; 666F: 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 0x6670:
                                                     mon("L6670    LDD   #$00                    ; 6670: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6673; JUMP; // sstep
case 0x6673:
                                                     mon("         STD   $4B0E                   ; 6673: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6676; JUMP; // sstep
case 0x6676:
                                                     mon("         STD   $4B0C                   ; 6676: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x6679; JUMP; // sstep
case 0x6679:
                                                     mon("         STD   $48AF                   ; 6679: FD 48 AF      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x48af, A); // Care needed with I/O space and word fetches
    wr_mem(0x48b0, B); 
    PC = 0x667C; JUMP; // sstep
case 0x667C:
                                                     mon("         LDD   #$6180                  ; 667C: CC 61 80      \n");
    clockticks = clockticks + 3; 
    A = 0x61; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x667F; JUMP; // sstep
case 0x667F:
                                                     mon("         STD   $4B10                   ; 667F: FD 4B 10      \n"); // Attract text colour/intensity for fading
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b10, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b11, B); 
    PC = 0x6682; JUMP; // sstep
case 0x6682:
                                                     mon("         JSR   $D91A                   ; 6682: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6685:
                                                     mon("L6685    LDA   #$3A                    ; 6685: 86 3A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3a; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6687; JUMP; // sstep
case 0x6687:
                                                     mon("         JSR   $D8DF                   ; 6687: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x668A:
                                                     mon("L668A    LDA   #$3B                    ; 668A: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x668C; JUMP; // sstep
case 0x668C:
                                                     mon("         JSR   $D8DF                   ; 668C: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x668F:
                                                     mon("L668F    LDA   #$3C                    ; 668F: 86 3C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6691; JUMP; // sstep
case 0x6691:
                                                     mon("         JSR   $D8DF                   ; 6691: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x6694:
                                                     mon("L6694    LDA   #$3D                    ; 6694: 86 3D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3d; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6696; JUMP; // sstep
case 0x6696:
                                                     mon("         JSR   $D8DF                   ; 6696: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x99); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x6699:
                                                     mon("L6699    LDA   #$3E                    ; 6699: 86 3E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x669B; JUMP; // sstep
case 0x669B:
                                                     mon("         JSR   $D8DF                   ; 669B: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x669E:
                                                     mon("L669E    LDA   #$3D                    ; 669E: 86 3D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3d; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x66A0; JUMP; // sstep
case 0x66A0:
                                                     mon("         JSR   $D8DF                   ; 66A0: BD D8 DF      \n"); // Called from select screen, attract screen 1 + 3 when writing text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd8df; 
    JUMP;
  case 0x66A3:
                                                     mon("L66A3    JSR   $BD80                   ; 66A3: BD BD 80      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xbd80; 
    JUMP;
  case 0x66A6:
                                                     mon("L66A6    JSR   $CC38                   ; 66A6: BD CC 38      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xcc38; 
    JUMP;
  case 0x66A9:
                                                     mon("L66A9    INC   <$41                    ; 66A9: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6670
    PC = 0x66AB; JUMP; // sstep
case 0x66AB:
                                                     mon("         RTS                           ; 66AB: 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 0x66AC:
                                                     mon("L66AC    JSR   L6112                   ; 66AC: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x66AF:
                                                     mon("L66AF    JSR   L761D                   ; 66AF: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x66B2:
                                                     mon("L66B2    JSR   L63D5                   ; 66B2: BD 63 D5      \n"); // Check credits status
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0x63d5; 
    JUMP;
  case 0x66B5:
                                                     mon("L66B5    JSR   $C7FD                   ; 66B5: BD C7 FD      \n"); // Display high scores
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xc7fd; 
    JUMP;
  case 0x66B8:
                                                     mon("L66B8    JSR   $D923                   ; 66B8: BD D9 23      \n"); // Called from attract screen 1
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xd923; 
    JUMP;
  case 0x66BB:
                                                     mon("L66BB    JSR   L612F                   ; 66BB: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x66BE:
                                                     mon("L66BE    JSR   $CAF3                   ; 66BE: BD CA F3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xcaf3; 
    JUMP;
  case 0x66C1:
                                                     mon("L66C1    LDA   $481E                   ; 66C1: B6 48 1E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x481e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x66C4; JUMP; // sstep
case 0x66C4:
                                                     mon("         ANDA  #$10                    ; 66C4: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x66C6; JUMP; // sstep
case 0x66C6:
                                                     mon("         BNE   L66CE                   ; 66C6: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x66ce; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x66C8; JUMP; // sstep
case 0x66C8:
                                                     mon("         LDD   #$0300                  ; 66C8: CC 03 00      \n");
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x66CB; JUMP; // sstep
case 0x66CB:
                                                     mon("         STD   $4B0E                   ; 66CB: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x66CE; JUMP; // sstep
case 0x66CE:
                                                     mon("L66CE    LDD   $4B0E                   ; 66CE: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x66D1; JUMP; // sstep
case 0x66D1:
                                                     mon("         ADDD  #$01                    ; 66D1: 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 = 0x66D4; JUMP; // sstep
case 0x66D4:
                                                     mon("         STD   $4B0E                   ; 66D4: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x66D7; JUMP; // sstep
case 0x66D7:
                                                     mon("         CMPD  #$0280                  ; 66D7: 10 83 02 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0280; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x66DB; JUMP; // sstep
case 0x66DB:
                                                     mon("         BCS   L66E3                   ; 66DB: 25 06         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x66e3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x66DD; JUMP; // sstep
case 0x66DD:
                                                     mon("         LDD   #$FFFF                  ; 66DD: CC FF FF      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x66E0; JUMP; // sstep
case 0x66E0:
                                                     mon("         STD   $4AEC                   ; 66E0: 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 = 0x66E3; JUMP; // sstep
case 0x66E3:
                                                     mon("L66E3    LDD   $4AEC                   ; 66E3: 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 = 0x66E6; JUMP; // sstep
case 0x66E6:
                                                     mon("         BPL   locret_6707             ; 66E6: 2A 1F         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6707; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x66E8; JUMP; // sstep
case 0x66E8:
                                                     mon("         LDA   #$0B                    ; 66E8: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x66EA; JUMP; // sstep
case 0x66EA:
                                                     mon("         STA   <$41                    ; 66EA: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x66EC; JUMP; // sstep
case 0x66EC:
                                                     mon("         LDU   #$4AB6                  ; 66EC: CE 4A B6      \n");
    clockticks = clockticks + 3; 
    U = 0x4ab6; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x66EF; JUMP; // sstep
case 0x66EF:
                                                     mon("         LDX   #$4520                  ; 66EF: 8E 45 20      \n");
    clockticks = clockticks + 3; 
    X = 0x4520; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x66F2; JUMP; // sstep
case 0x66F2:
                                                     mon("         LDA   #$08                    ; 66F2: 86 08         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x08; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x66F4; JUMP; // sstep
case 0x66F4:
                                                     mon("         JSR   $C6F9                   ; 66F4: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x66); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
  case 0x66F7:
                                                     mon("L66F7    LDU   #$4A8E                  ; 66F7: CE 4A 8E      \n"); // High scores RAM
    clockticks = clockticks + 3; 
    U = 0x4a8e; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x66FA; JUMP; // sstep
case 0x66FA:
                                                     mon("         LDX   #$4508                  ; 66FA: 8E 45 08      \n");
    clockticks = clockticks + 3; 
    X = 0x4508; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x66FD; JUMP; // sstep
case 0x66FD:
                                                     mon("         LDA   #$0B                    ; 66FD: 86 0B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0b; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x66FF; JUMP; // sstep
case 0x66FF:
                                                     mon("         JSR   $C6F9                   ; 66FF: BD C6 F9      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x02); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xc6f9; 
    JUMP;
  case 0x6702:
                                                     mon("L6702    LDA   #$01                    ; 6702: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6704; JUMP; // sstep
case 0x6704:
                                                     mon("         JSR   $C2B3                   ; 6704: BD C2 B3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xc2b3; 
    JUMP;
    // End of function sub_66AC
  case 0x6707:
                                                     mon("locret_6707 RTS                           ; 6707: 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 once before attract screen 2
  case 0x6708:
                                                     mon("L6708    INC   <$41                    ; 6708: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x670A; JUMP; // sstep
case 0x670A:
                                                     mon("         JSR   L611E                   ; 670A: BD 61 1E      \n"); // Copies Star Wars logo vector data to vector RAM
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x611e; 
    JUMP;
  case 0x670D:
                                                     mon("L670D    JSR   $D91A                   ; 670D: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x10); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6710:
                                                     mon("L6710    LDD   #$00                    ; 6710: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6713; JUMP; // sstep
case 0x6713:
                                                     mon("         STD   $4B0C                   ; 6713: FD 4B 0C      \n"); // Attract text position for scrolling
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0c, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0d, B); 
    PC = 0x6716; JUMP; // sstep
case 0x6716:
                                                     mon("         STD   $48AF                   ; 6716: FD 48 AF      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x48af, A); // Care needed with I/O space and word fetches
    wr_mem(0x48b0, B); 
    PC = 0x6719; JUMP; // sstep
case 0x6719:
                                                     mon("         JSR   $D9DC                   ; 6719: BD D9 DC      \n"); // Initialise before game start
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xd9dc; 
    JUMP;
  case 0x671C:
                                                     mon("L671C    JSR   L61B5                   ; 671C: BD 61 B5      \n"); // Set up math constants
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x61b5; 
    JUMP;
  case 0x671F:
                                                     mon("L671F    JSR   L615A                   ; 671F: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x22); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6722:
                                                     mon("L6722    LDU   #$5038                  ; 6722: CE 50 38      \n"); // Matrix 2
    clockticks = clockticks + 3; 
    U = 0x5038; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x6725; JUMP; // sstep
case 0x6725:
                                                     mon("L6725    JSR   $CDC3                   ; 6725: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x28); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x6728:
                                                     mon("L6728    LDA   $4B34                   ; 6728: B6 4B 34      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b34); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x672B; JUMP; // sstep
case 0x672B:
                                                     mon("         CMPA  #$FF                    ; 672B: 81 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xff; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x672D; JUMP; // sstep
case 0x672D:
                                                     mon("         BNE   L6737                   ; 672D: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6737; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x672F; JUMP; // sstep
case 0x672F:
                                                     mon("         LDA   $4B06                   ; 672F: B6 4B 06      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b06); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6732; JUMP; // sstep
case 0x6732:
                                                     mon("         STA   $4B34                   ; 6732: B7 4B 34      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b34, val); 
    PC = 0x6735; JUMP; // sstep
case 0x6735:
                                                     mon("         BRA   locret_6758             ; 6735: 20 21         \n");
    PC = 0x6758; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6737:
                                                     mon("L6737    LDA   $4B06                   ; 6737: B6 4B 06      \n"); // Called once before attract screen 2
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b06); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x673A; JUMP; // sstep
case 0x673A:
                                                     mon("         CMPA  $4B34                   ; 673A: B1 4B 34      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b34); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x673D; JUMP; // sstep
case 0x673D:
                                                     mon("         BEQ   locret_6758             ; 673D: 27 19         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6758; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x673F; JUMP; // sstep
case 0x673F:
                                                     mon("         STA   $4B34                   ; 673F: B7 4B 34      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b34, val); 
    PC = 0x6742; JUMP; // sstep
case 0x6742:
                                                     mon("         JSR   $C20C                   ; 6742: BD C2 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x45); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xc20c; 
    JUMP;
  case 0x6745:
                                                     mon("L6745    LDA   $4592                   ; 6745: B6 45 92      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4592); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6748; JUMP; // sstep
case 0x6748:
                                                     mon("         ANDA  #$04                    ; 6748: 84 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x04; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x674A; JUMP; // sstep
case 0x674A:
                                                     mon("         BNE   locret_6758             ; 674A: 26 0C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6758; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x674C; JUMP; // sstep
case 0x674C:
                                                     mon("         LDX   #off_6759               ; 674C: 8E 67 59      \n");
    clockticks = clockticks + 3; 
    X = 0x6759; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x674F; JUMP; // sstep
case 0x674F:
                                                     mon("         LDA   $4703                   ; 674F: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6752; JUMP; // sstep
case 0x6752:
                                                     mon("         LDB   #$09                    ; 6752: C6 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6754; JUMP; // sstep
case 0x6754:
                                                     mon("         MUL                           ; 6754: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x6755; JUMP; // sstep
case 0x6755:
                                                     mon("         ASLA                          ; 6755: 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 = 0x6756; JUMP; // sstep
case 0x6756:
                                                     mon("         JSR   [A,X]                   ; 6756: AD 96         \n"); // Play random attract sound
    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, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = ea; 
    JUMP;
    // End of function sub_6708
    // ---------------------------------------------------------------------------
  case 0x6758:
                                                     mon("locret_6758 RTS                           ; 6758: 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 0x676B:
                                                     mon("L676B    JSR   L6112                   ; 676B: BD 61 12      \n"); // Attract screen 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x676E:
                                                     mon("L676E    JSR   $CD80                   ; 676E: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x6771:
                                                     mon("L6771    JSR   $D9FA                   ; 6771: BD D9 FA      \n"); // Attract screen 2 large Star Wars logo handling
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xd9fa; 
    JUMP;
  case 0x6774:
                                                     mon("L6774    JSR   $D985                   ; 6774: BD D9 85      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xd985; 
    JUMP;
  case 0x6777:
                                                     mon("L6777    JSR   L63D5                   ; 6777: BD 63 D5      \n"); // Check credits status
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x63d5; 
    JUMP;
  case 0x677A:
                                                     mon("L677A    JSR   L761D                   ; 677A: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x677D:
                                                     mon("L677D    JSR   L612F                   ; 677D: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x80); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
  case 0x6780:
                                                     mon("L6780    JSR   L6DA5                   ; 6780: BD 6D A5      \n"); // Attract screen 2 stars forward and down translate
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x6da5; 
    JUMP;
  case 0x6783:
                                                     mon("L6783    JSR   L622D                   ; 6783: BD 62 2D      \n"); // Check joystick X to show high scores if moved
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x622d; 
    JUMP;
    // End of function sub_676B
  case 0x6786:
                                                     mon("L6786    RTS                           ; 6786: 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 once before difficulty select screen
  case 0x6787:
                                                     mon("L6787    LDA   #$05                    ; 6787: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6789; JUMP; // sstep
case 0x6789:
                                                     mon("         STA   $4B0E                   ; 6789: B7 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b0e, val); 
    PC = 0x678C; JUMP; // sstep
case 0x678C:
                                                     mon("         LDA   #$FF                    ; 678C: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x678E; JUMP; // sstep
case 0x678E:
                                                     mon("         STA   $4B34                   ; 678E: B7 4B 34      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b34, val); 
    PC = 0x6791; JUMP; // sstep
case 0x6791:
                                                     mon("         JSR   $D91A                   ; 6791: BD D9 1A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xd91a; 
    JUMP;
  case 0x6794:
                                                     mon("L6794    JSR   $BD44                   ; 6794: BD BD 44      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0xbd44; 
    JUMP;
  case 0x6797:
                                                     mon("L6797    INC   <$41                    ; 6797: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6787
    PC = 0x6799; JUMP; // sstep
case 0x6799:
                                                     mon("         RTS                           ; 6799: 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 once before difficulty select screen
  case 0x679A:
                                                     mon("L679A    LDA   #$0D                    ; 679A: 86 0D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0d; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x679C; JUMP; // sstep
case 0x679C:
                                                     mon("         STA   <$41                    ; 679C: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x679E; JUMP; // sstep
case 0x679E:
                                                     mon("         LDD   #$00                    ; 679E: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x67A1; JUMP; // sstep
case 0x67A1:
                                                     mon("         STD   <$42                    ; 67A1: DD 42         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x42; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x67A3; JUMP; // sstep
case 0x67A3:
                                                     mon("         STA   <$DD                    ; 67A3: 97 DD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xdd; 
    wr_mem(ea, val); 
    PC = 0x67A5; JUMP; // sstep
case 0x67A5:
                                                     mon("         LDA   $4593                   ; 67A5: B6 45 93      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4593); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x67A8; JUMP; // sstep
case 0x67A8:
                                                     mon("         ANDA  #$03                    ; 67A8: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x67AA; JUMP; // sstep
case 0x67AA:
                                                     mon("L67AA    ADDA  #$06                    ; 67AA: 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 = 0x67AC; JUMP; // sstep
case 0x67AC:
                                                     mon("         STA   <$60                    ; 67AC: 97 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x60; 
    wr_mem(ea, val); 
    PC = 0x67AE; JUMP; // sstep
case 0x67AE:
                                                     mon("         STA   <$8E                    ; 67AE: 97 8E         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8e; 
    wr_mem(ea, val); 
    PC = 0x67B0; JUMP; // sstep
case 0x67B0:
                                                     mon("         LDA   $4593                   ; 67B0: B6 45 93      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4593); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x67B3; JUMP; // sstep
case 0x67B3:
                                                     mon("         LSRA                          ; 67B3: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x67B4; JUMP; // sstep
case 0x67B4:
                                                     mon("         LSRA                          ; 67B4: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x67B5; JUMP; // sstep
case 0x67B5:
                                                     mon("         ANDA  #$03                    ; 67B5: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x67B7; JUMP; // sstep
case 0x67B7:
                                                     mon("         STA   $4B18                   ; 67B7: B7 4B 18      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b18, val); 
    PC = 0x67BA; JUMP; // sstep
case 0x67BA:
                                                     mon("         LDA   #$00                    ; 67BA: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x67BC; JUMP; // sstep
case 0x67BC:
                                                     mon("         STA   $4B17                   ; 67BC: B7 4B 17      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b17, val); 
    PC = 0x67BF; JUMP; // sstep
case 0x67BF:
                                                     mon("         STA   <$8B                    ; 67BF: 97 8B         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x8b; 
    wr_mem(ea, val); 
    PC = 0x67C1; JUMP; // sstep
case 0x67C1:
                                                     mon("         STA   <$8C                    ; 67C1: 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 = 0x67C3; JUMP; // sstep
case 0x67C3:
                                                     mon("         STA   <$5C                    ; 67C3: 97 5C         \n"); // Score millions
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5c; 
    wr_mem(ea, val); 
    PC = 0x67C5; JUMP; // sstep
case 0x67C5:
                                                     mon("         STA   <$5D                    ; 67C5: 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 = 0x67C7; JUMP; // sstep
case 0x67C7:
                                                     mon("         STA   <$5E                    ; 67C7: 97 5E         \n"); // Score thousands
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5e; 
    wr_mem(ea, val); 
    PC = 0x67C9; JUMP; // sstep
case 0x67C9:
                                                     mon("         STA   <$5F                    ; 67C9: 97 5F         \n"); // Score
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x5f; 
    wr_mem(ea, val); 
    PC = 0x67CB; JUMP; // sstep
case 0x67CB:
                                                     mon("         STA   $4B2D                   ; 67CB: B7 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2d, val); 
    PC = 0x67CE; JUMP; // sstep
case 0x67CE:
                                                     mon("         STA   $4B37                   ; 67CE: B7 4B 37      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b37, val); 
    PC = 0x67D1; JUMP; // sstep
case 0x67D1:
                                                     mon("L67D1    STA   $4B35                   ; 67D1: B7 4B 35      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b35, val); 
    PC = 0x67D4; JUMP; // sstep
case 0x67D4:
                                                     mon("L67D4    ORCC  #$10                    ; 67D4: 1A 10         \n");
    I = 1; 
    clockticks = clockticks + 3; 
    PC = 0x67D6; JUMP; // sstep
case 0x67D6:
                                                     mon("L67D6    INC   $486F                   ; 67D6: 7C 48 6F      \n"); // Joystick roll data structure
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x486f); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x486f, res); 
    clockticks = clockticks + 2; 
    PC = 0x67D9; JUMP; // sstep
case 0x67D9:
                                                     mon("         INC   $4866                   ; 67D9: 7C 48 66      \n"); // Joystick pitch data structure
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4866); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4866, res); 
    clockticks = clockticks + 2; 
    PC = 0x67DC; JUMP; // sstep
case 0x67DC:
                                                     mon("         INC   $4871                   ; 67DC: 7C 48 71      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4871); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4871, res); 
    clockticks = clockticks + 2; 
    PC = 0x67DF; JUMP; // sstep
case 0x67DF:
                                                     mon("         INC   $4868                   ; 67DF: 7C 48 68      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4868); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x4868, res); 
    clockticks = clockticks + 2; 
    PC = 0x67E2; JUMP; // sstep
case 0x67E2:
                                                     mon("         ANDCC #$EF                    ; 67E2: 1C EF         \n");
    I = 0; 
    clockticks = clockticks + 3; 
    // End of function sub_679A
    PC = 0x67E4; JUMP; // sstep
case 0x67E4:
                                                     mon("         RTS                           ; 67E4: 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 0x67E5:
                                                     mon("L67E5    JSR   L61B5                   ; 67E5: BD 61 B5      \n"); // Set up math constants
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x61b5; 
    JUMP;
  case 0x67E8:
                                                     mon("L67E8    JSR   L615A                   ; 67E8: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xeb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x67EB:
                                                     mon("L67EB    JSR   L61EC                   ; 67EB: BD 61 EC      \n"); // Init stars math data
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xee); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    PC = 0x61ec; 
    JUMP;
  case 0x67EE:
                                                     mon("L67EE    LDA   #$C0                    ; 67EE: 86 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xc0; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x67F0; JUMP; // sstep
case 0x67F0:
                                                     mon("         STA   $5080                   ; 67F0: B7 50 80      \n"); // Matrix 4
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x5080, val); 
    PC = 0x67F3; JUMP; // sstep
case 0x67F3:
                                                     mon("         STA   $508A                   ; 67F3: B7 50 8A      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x508a, val); 
    PC = 0x67F6; JUMP; // sstep
case 0x67F6:
                                                     mon("         LDA   #$00                    ; 67F6: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x67F8; JUMP; // sstep
case 0x67F8:
                                                     mon("         STA   $4813                   ; 67F8: B7 48 13      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4813, val); 
    PC = 0x67FB; JUMP; // sstep
case 0x67FB:
                                                     mon("         INC   <$41                    ; 67FB: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x67FD; JUMP; // sstep
case 0x67FD:
                                                     mon("L67FD    LDA   #$1D                    ; 67FD: 86 1D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1d; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x67FF; JUMP; // sstep
case 0x67FF:
                                                     mon("         STA   <$41                    ; 67FF: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_67E5
    PC = 0x6801; JUMP; // sstep
case 0x6801:
                                                     mon("         RTS                           ; 6801: 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 =======================================
    // Next space wave after Death Star explosion
  case 0x6802:
                                                     mon("L6802    JSR   L7A5A                   ; 6802: BD 7A 5A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x05); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x7a5a; 
    JUMP;
  case 0x6805:
                                                     mon("L6805    LDX   #$08                    ; 6805: 8E 00 08      \n");
    clockticks = clockticks + 3; 
    X = 0x0008; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x6808; JUMP; // sstep
case 0x6808:
                                                     mon("         LDA   $4B15                   ; 6808: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x680B; JUMP; // sstep
case 0x680B:
                                                     mon("         INCA                          ; 680B: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x680C; JUMP; // sstep
case 0x680C:
                                                     mon("         JSR   L7720                   ; 680C: BD 77 20      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x7720; 
    JUMP;
  case 0x680F:
                                                     mon("L680F    LDA   $4AD6                   ; 680F: B6 4A D6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad6); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6812; JUMP; // sstep
case 0x6812:
                                                     mon("         STA   $4B16                   ; 6812: B7 4B 16      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b16, val); 
    PC = 0x6815; JUMP; // sstep
case 0x6815:
                                                     mon("         LDA   $4B15                   ; 6815: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6818; JUMP; // sstep
case 0x6818:
                                                     mon("L6818    CMPA  #$1F                    ; 6818: 81 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x681A; JUMP; // sstep
case 0x681A:
                                                     mon("         BLS   L681E                   ; 681A: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x681e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x681C; JUMP; // sstep
case 0x681C:
                                                     mon("         LDA   #$1F                    ; 681C: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x681E; JUMP; // sstep
case 0x681E:
                                                     mon("L681E    STA   $4B14                   ; 681E: B7 4B 14      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b14, val); 
    PC = 0x6821; JUMP; // sstep
case 0x6821:
                                                     mon("         ADDA  $4B18                   ; 6821: BB 4B 18      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b18); 
    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 = 0x6824; JUMP; // sstep
case 0x6824:
                                                     mon("         CMPA  #$0F                    ; 6824: 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 = 0x6826; JUMP; // sstep
case 0x6826:
                                                     mon("         BLS   L682A                   ; 6826: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x682a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6828; JUMP; // sstep
case 0x6828:
                                                     mon("         LDA   #$0F                    ; 6828: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x682A; JUMP; // sstep
case 0x682A:
                                                     mon("L682A    STA   $4B19                   ; 682A: B7 4B 19      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b19, val); 
    PC = 0x682D; JUMP; // sstep
case 0x682D:
                                                     mon("         INC   <$41                    ; 682D: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x682F; JUMP; // sstep
case 0x682F:
                                                     mon("L682F    LDA   #$1F                    ; 682F: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6831; JUMP; // sstep
case 0x6831:
                                                     mon("         STA   <$41                    ; 6831: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6833; JUMP; // sstep
case 0x6833:
                                                     mon("         LDA   #$00                    ; 6833: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6835; JUMP; // sstep
case 0x6835:
                                                     mon("         STA   <$DD                    ; 6835: 97 DD         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xdd; 
    wr_mem(ea, val); 
    // End of function sub_6802
    PC = 0x6837; JUMP; // sstep
case 0x6837:
                                                     mon("         RTS                           ; 6837: 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 =======================================
    // Next space wave after Death Star explosion
    // FUNCTION CHUNK AT ROM:6C76 SIZE 0000000E BYTES
  case 0x6838:
                                                     mon("L6838    JSR   L6161                   ; 6838: BD 61 61      \n"); // Initialise tie fighters and fireballs
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x6161; 
    JUMP;
  case 0x683B:
                                                     mon("L683B    JSR   $B939                   ; 683B: BD B9 39      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xb939; 
    JUMP;
  case 0x683E:
                                                     mon("L683E    LDD   #$00                    ; 683E: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6841; JUMP; // sstep
case 0x6841:
                                                     mon("         STD   $4B0E                   ; 6841: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6844; JUMP; // sstep
case 0x6844:
                                                     mon("         STA   $4B3B                   ; 6844: B7 4B 3B      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b3b, val); 
    PC = 0x6847; JUMP; // sstep
case 0x6847:
                                                     mon("         LDA   #$09                    ; 6847: 86 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6849; JUMP; // sstep
case 0x6849:
                                                     mon("         STA   $4B3C                   ; 6849: B7 4B 3C      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b3c, val); 
    PC = 0x684C; JUMP; // sstep
case 0x684C:
                                                     mon("         LDA   $4B2D                   ; 684C: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x684F; JUMP; // sstep
case 0x684F:
                                                     mon("         BNE   L6857                   ; 684F: 26 06         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6857; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6851; JUMP; // sstep
case 0x6851:
                                                     mon("         LDD   #$27                    ; 6851: CC 00 27      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x27; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6854; JUMP; // sstep
case 0x6854:
                                                     mon("         STD   $4B0E                   ; 6854: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6857; JUMP; // sstep
case 0x6857:
                                                     mon("L6857    INC   <$41                    ; 6857: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x6859; JUMP; // sstep
case 0x6859:
                                                     mon("L6859    JSR   L72C7                   ; 6859: BD 72 C7      \n"); // Space wave
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x72c7; 
    JUMP;
  case 0x685C:
                                                     mon("L685C    LDA   <$60                    ; 685C: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x685E; JUMP; // sstep
case 0x685E:
                                                     mon("         LBMI  L6C76                   ; 685E: 10 2B 04 14   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N <  0) {
    clockticks = clockticks + 1; 
    PC = 0x6c76; 
    JUMP;
    }
    PC = 0x6862; JUMP; // sstep
case 0x6862:
                                                     mon("L6862    JSR   $A849                   ; 6862: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x6865:
                                                     mon("L6865    JSR   $9898                   ; 6865: BD 98 98      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x9898; 
    JUMP;
  case 0x6868:
                                                     mon("L6868    JSR   $B98B                   ; 6868: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
  case 0x686B:
                                                     mon("L686B    JSR   $9890                   ; 686B: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x686E:
                                                     mon("L686E    JSR   $9558                   ; 686E: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6871:
                                                     mon("L6871    JSR   $8B6D                   ; 6871: BD 8B 6D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x8b6d; 
    JUMP;
  case 0x6874:
                                                     mon("L6874    JSR   L70DB                   ; 6874: BD 70 DB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x70db; 
    JUMP;
  case 0x6877:
                                                     mon("L6877    JSR   L6DD2                   ; 6877: BD 6D D2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x6dd2; 
    JUMP;
  case 0x687A:
                                                     mon("L687A    LDA   #$10                    ; 687A: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x687C; JUMP; // sstep
case 0x687C:
                                                     mon("         JSR   $CE0C                   ; 687C: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x687F:
                                                     mon("L687F    JSR   L6F5F                   ; 687F: BD 6F 5F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x82); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x6f5f; 
    JUMP;
  case 0x6882:
                                                     mon("L6882    LDD   $4B0E                   ; 6882: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6885; JUMP; // sstep
case 0x6885:
                                                     mon("         ADDD  #$01                    ; 6885: 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 = 0x6888; JUMP; // sstep
case 0x6888:
                                                     mon("         STD   $4B0E                   ; 6888: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x688B; JUMP; // sstep
case 0x688B:
                                                     mon("         CMPD  #$28                    ; 688B: 10 83 00 28   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0028; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x688F; JUMP; // sstep
case 0x688F:
                                                     mon("         BNE   L68A6                   ; 688F: 26 15         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x68a6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6891; JUMP; // sstep
case 0x6891:
                                                     mon("         LDA   $4B15                   ; 6891: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6894; JUMP; // sstep
case 0x6894:
                                                     mon("         CMPA  #$03                    ; 6894: 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 = 0x6896; JUMP; // sstep
case 0x6896:
                                                     mon("         BLT   L68A1                   ; 6896: 2D 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x68a1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6898; JUMP; // sstep
case 0x6898:
                                                     mon("         ANDA  #$01                    ; 6898: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x689A; JUMP; // sstep
case 0x689A:
                                                     mon("         BEQ   L68A1                   ; 689A: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x68a1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x689C; JUMP; // sstep
case 0x689C:
                                                     mon("         JSR   $BD85                   ; 689C: BD BD 85      \n"); // Imperial March
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xbd85; 
    JUMP;
  case 0x689F:
                                                     mon("L689F    BRA   L68A4                   ; 689F: 20 03         \n");
    PC = 0x68a4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x68A1:
                                                     mon("L68A1    JSR   $BDA8                   ; 68A1: BD BD A8      \n"); // Space wave 1 music
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xbda8; 
    JUMP;
  case 0x68A4:
                                                     mon("L68A4    BRA   L68C6                   ; 68A4: 20 20         \n");
    PC = 0x68c6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x68A6:
                                                     mon("L68A6    CMPD  #$C8                    ; 68A6: 10 83 00 C8   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00c8; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x68AA; JUMP; // sstep
case 0x68AA:
                                                     mon("         BNE   L68B1                   ; 68AA: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x68b1; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x68AC; JUMP; // sstep
case 0x68AC:
                                                     mon("         JSR   $BDAD                   ; 68AC: BD BD AD      \n"); // Space Wave 2 music
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xbdad; 
    JUMP;
  case 0x68AF:
                                                     mon("L68AF    BRA   L68C6                   ; 68AF: 20 15         \n");
    PC = 0x68c6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x68B1:
                                                     mon("L68B1    CMPD  #$0190                  ; 68B1: 10 83 01 90   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0190; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x68B5; JUMP; // sstep
case 0x68B5:
                                                     mon("         BNE   L68BC                   ; 68B5: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x68bc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x68B7; JUMP; // sstep
case 0x68B7:
                                                     mon("         JSR   $BD8A                   ; 68B7: BD BD 8A      \n"); // Enter Death Star
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xbd8a; 
    JUMP;
  case 0x68BA:
                                                     mon("L68BA    BRA   L68C6                   ; 68BA: 20 0A         \n");
    PC = 0x68c6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x68BC:
                                                     mon("L68BC    CMPD  #$01A4                  ; 68BC: 10 83 01 A4   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x01a4; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x68C0; JUMP; // sstep
case 0x68C0:
                                                     mon("         BCS   L68C6                   ; 68C0: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x68c6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x68C2; JUMP; // sstep
case 0x68C2:
                                                     mon("         LDA   #$21                    ; 68C2: 86 21         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x21; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x68C4; JUMP; // sstep
case 0x68C4:
                                                     mon("         STA   <$41                    ; 68C4: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x68C6; JUMP; // sstep
case 0x68C6:
                                                     mon("L68C6    LDA   <$E6                    ; 68C6: 96 E6         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xe6); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x68C8; JUMP; // sstep
case 0x68C8:
                                                     mon("         CMPA  #$03                    ; 68C8: 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 = 0x68CA; JUMP; // sstep
case 0x68CA:
                                                     mon("         BCC   locret_68CF             ; 68CA: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x68cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x68CC; JUMP; // sstep
case 0x68CC:
                                                     mon("         JSR   $8F7B                   ; 68CC: BD 8F 7B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x8f7b; 
    JUMP;
    // End of function sub_6838
  case 0x68CF:
                                                     mon("locret_68CF RTS                           ; 68CF: 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 0x68D0:
                                                     mon("L68D0    INC   $4B3B                   ; 68D0: 7C 4B 3B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3b); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4b3b, res); 
    clockticks = clockticks + 2; 
    PC = 0x68D3; JUMP; // sstep
case 0x68D3:
                                                     mon("         INC   <$41                    ; 68D3: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x68D5; JUMP; // sstep
case 0x68D5:
                                                     mon("L68D5    JSR   L72C7                   ; 68D5: BD 72 C7      \n"); // Entering Death Star
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x72c7; 
    JUMP;
  case 0x68D8:
                                                     mon("L68D8    LDA   <$60                    ; 68D8: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x68DA; JUMP; // sstep
case 0x68DA:
                                                     mon("         LBMI  L6C76                   ; 68DA: 10 2B 03 98   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N <  0) {
    clockticks = clockticks + 1; 
    PC = 0x6c76; 
    JUMP;
    }
    PC = 0x68DE; JUMP; // sstep
case 0x68DE:
                                                     mon("         JSR   $A849                   ; 68DE: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x68E1:
                                                     mon("L68E1    JSR   $9898                   ; 68E1: BD 98 98      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x9898; 
    JUMP;
  case 0x68E4:
                                                     mon("L68E4    JSR   $B98B                   ; 68E4: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
  case 0x68E7:
                                                     mon("L68E7    JSR   $9890                   ; 68E7: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xea); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x68EA:
                                                     mon("L68EA    JSR   $9558                   ; 68EA: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xed); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x68ED:
                                                     mon("L68ED    JSR   $8B86                   ; 68ED: BD 8B 86      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x8b86; 
    JUMP;
  case 0x68F0:
                                                     mon("L68F0    JSR   L70DB                   ; 68F0: BD 70 DB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x70db; 
    JUMP;
  case 0x68F3:
                                                     mon("L68F3    JSR   L6DFA                   ; 68F3: BD 6D FA      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x6dfa; 
    JUMP;
  case 0x68F6:
                                                     mon("L68F6    LDA   #$10                    ; 68F6: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x68F8; JUMP; // sstep
case 0x68F8:
                                                     mon("         JSR   $CE0C                   ; 68F8: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x68FB:
                                                     mon("L68FB    JSR   L6F5F                   ; 68FB: BD 6F 5F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfe); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    PC = 0x6f5f; 
    JUMP;
  case 0x68FE:
                                                     mon("L68FE    LDX   #$4900                  ; 68FE: 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 = 0x6901; JUMP; // sstep
case 0x6901:
                                                     mon("L6901    LDA   $03,X                   ; 6901: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6903; JUMP; // sstep
case 0x6903:
                                                     mon("         BNE   locret_6911             ; 6903: 26 0C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6911; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6905; JUMP; // sstep
case 0x6905:
                                                     mon("         LEAX  $19,X                   ; 6905: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x6908; JUMP; // sstep
case 0x6908:
                                                     mon("         CMPX  #$494B                  ; 6908: 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 = 0x690B; JUMP; // sstep
case 0x690B:
                                                     mon("         BCS   L6901                   ; 690B: 25 F4         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6901; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x690D; JUMP; // sstep
case 0x690D:
                                                     mon("         LDA   #$23                    ; 690D: 86 23         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x23; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x690F; JUMP; // sstep
case 0x690F:
                                                     mon("         STA   <$41                    ; 690F: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_68D0
    PC = 0x6911; JUMP; // sstep
case 0x6911:
                                                     mon("locret_6911 RTS                           ; 6911: 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 0x6912:
                                                     mon("L6912    LDD   #$7780                  ; 6912: CC 77 80      \n");
    clockticks = clockticks + 3; 
    A = 0x77; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6915; JUMP; // sstep
case 0x6915:
                                                     mon("         STD   <$56                    ; 6915: DD 56         \n"); // Zoom value
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x56; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6917; JUMP; // sstep
case 0x6917:
                                                     mon("         LDD   #$0100                  ; 6917: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x691A; JUMP; // sstep
case 0x691A:
                                                     mon("         STD   <$58                    ; 691A: DD 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x58; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x691C; JUMP; // sstep
case 0x691C:
                                                     mon("         LDA   $4B2D                   ; 691C: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x691F; JUMP; // sstep
case 0x691F:
                                                     mon("         BNE   L692A                   ; 691F: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x692a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6921; JUMP; // sstep
case 0x6921:
                                                     mon("         LDA   $4B14                   ; 6921: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6924; JUMP; // sstep
case 0x6924:
                                                     mon("         CMPA  #$04                    ; 6924: 81 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6926; JUMP; // sstep
case 0x6926:
                                                     mon("         BNE   L692A                   ; 6926: 26 02         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x692a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6928; JUMP; // sstep
case 0x6928:
                                                     mon("         BRA   L6930                   ; 6928: 20 06         \n");
    PC = 0x6930; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x692A:
                                                     mon("L692A    JSR   $BD67                   ; 692A: BD BD 67      \n"); // Red 5 Im going in
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xbd67; 
    JUMP;
  case 0x692D:
                                                     mon("L692D    JSR   $BDEE                   ; 692D: BD BD EE      \n"); // R2 beeps entering Death Star
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x30); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xbdee; 
    JUMP;
  case 0x6930:
                                                     mon("L6930    INC   <$41                    ; 6930: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6912
    PC = 0x6932; JUMP; // sstep
case 0x6932:
                                                     mon("         RTS                           ; 6932: 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 =======================================
    // Entering Death Star 2nd part
  case 0x6933:
                                                     mon("L6933    JSR   L733C                   ; 6933: BD 73 3C      \n"); // End of space wave? Also Trench catwalks
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x36); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x733c; 
    JUMP;
  case 0x6936:
                                                     mon("L6936    JSR   $B98B                   ; 6936: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x39); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
  case 0x6939:
                                                     mon("L6939    JSR   $9890                   ; 6939: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x693C:
                                                     mon("L693C    JSR   $9558                   ; 693C: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x693F:
                                                     mon("L693F    JSR   L6DD2                   ; 693F: BD 6D D2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x42); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x6dd2; 
    JUMP;
  case 0x6942:
                                                     mon("L6942    JSR   L6F67                   ; 6942: BD 6F 67      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x45); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x6f67; 
    JUMP;
  case 0x6945:
                                                     mon("L6945    LDD   $5080                   ; 6945: FC 50 80      \n"); // Matrix 4
    clockticks = clockticks + 5; 
    A = rd_mem(0x5080); // Care needed with I/O space and word fetches
    B = rd_mem(0x5081); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6948; JUMP; // sstep
case 0x6948:
                                                     mon("         CMPD  #$3F00                  ; 6948: 10 83 3F 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x3f00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x694C; JUMP; // sstep
case 0x694C:
                                                     mon("         BLT   locret_6952             ; 694C: 2D 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x6952; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x694E; JUMP; // sstep
case 0x694E:
                                                     mon("         LDA   #$25                    ; 694E: 86 25         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x25; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6950; JUMP; // sstep
case 0x6950:
                                                     mon("         STA   <$41                    ; 6950: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6933
    PC = 0x6952; JUMP; // sstep
case 0x6952:
                                                     mon("locret_6952 RTS                           ; 6952: 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 0x6953:
                                                     mon("L6953    LDA   $4B2D                   ; 6953: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6956; JUMP; // sstep
case 0x6956:
                                                     mon("         BNE   L6962                   ; 6956: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6962; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6958; JUMP; // sstep
case 0x6958:
                                                     mon("         LDA   $4B14                   ; 6958: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x695B; JUMP; // sstep
case 0x695B:
                                                     mon("         CMPA  #$04                    ; 695B: 81 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x695D; JUMP; // sstep
case 0x695D:
                                                     mon("         BNE   L6962                   ; 695D: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6962; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x695F; JUMP; // sstep
case 0x695F:
                                                     mon("         JSR   $BD53                   ; 695F: BD BD 53      \n"); // Look at the size of that thing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xbd53; 
    JUMP;
  case 0x6962:
                                                     mon("L6962    JSR   $BE0C                   ; 6962: BD BE 0C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xbe0c; 
    JUMP;
  case 0x6965:
                                                     mon("L6965    INC   <$41                    ; 6965: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6953
    PC = 0x6967; JUMP; // sstep
case 0x6967:
                                                     mon("         RTS                           ; 6967: 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 =======================================
    // Entering Death Star zoom in
  case 0x6968:
                                                     mon("L6968    JSR   L736F                   ; 6968: BD 73 6F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x736f; 
    JUMP;
  case 0x696B:
                                                     mon("L696B    JSR   $9898                   ; 696B: BD 98 98      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x9898; 
    JUMP;
  case 0x696E:
                                                     mon("L696E    JSR   $9890                   ; 696E: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x6971:
                                                     mon("L6971    JSR   $9558                   ; 6971: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6974:
                                                     mon("L6974    JSR   L6DD2                   ; 6974: BD 6D D2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x6dd2; 
    JUMP;
  case 0x6977:
                                                     mon("L6977    JSR   L6F67                   ; 6977: BD 6F 67      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x6f67; 
    JUMP;
  case 0x697A:
                                                     mon("L697A    LDB   <$58                    ; 697A: D6 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x58); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x697C; JUMP; // sstep
case 0x697C:
                                                     mon("         NEGB                          ; 697C: 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 = 0x697D; JUMP; // sstep
case 0x697D:
                                                     mon("         SEX                           ; 697D: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x697E; JUMP; // sstep
case 0x697E:
                                                     mon("         ADDD  <$56                    ; 697E: D3 56         \n"); // Zoom value
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x56)<<8; 
    ea = ea | rd_mem(DP|0x57); 
    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 = 0x6980; JUMP; // sstep
case 0x6980:
                                                     mon("         ANDB  #$7F                    ; 6980: C4 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x7f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6982; JUMP; // sstep
case 0x6982:
                                                     mon("         STD   <$56                    ; 6982: DD 56         \n"); // Zoom value
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x56; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6984; JUMP; // sstep
case 0x6984:
                                                     mon("         CMPD  #$7310                  ; 6984: 10 83 73 10   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x7310; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6988; JUMP; // sstep
case 0x6988:
                                                     mon("         BHI   L6997                   ; 6988: 22 0D         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x6997; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x698A; JUMP; // sstep
case 0x698A:
                                                     mon("         LDA   $4B14                   ; 698A: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x698D; JUMP; // sstep
case 0x698D:
                                                     mon("         BNE   L6993                   ; 698D: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6993; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x698F; JUMP; // sstep
case 0x698F:
                                                     mon("         LDA   #$27                    ; 698F: 86 27         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x27; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6991; JUMP; // sstep
case 0x6991:
                                                     mon("         BRA   L6995                   ; 6991: 20 02         \n");
    PC = 0x6995; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6993:
                                                     mon("L6993    LDA   #$29                    ; 6993: 86 29         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x29; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6995; JUMP; // sstep
case 0x6995:
                                                     mon("L6995    STA   <$41                    ; 6995: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6997; JUMP; // sstep
case 0x6997:
                                                     mon("L6997    LDD   <$58                    ; 6997: DC 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x58); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x59); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6999; JUMP; // sstep
case 0x6999:
                                                     mon("         ADDD  #$60                    ; 6999: C3 00 60      \n");
    clockticks = clockticks + 4; 
    val = 0x0060; 
    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 = 0x699C; JUMP; // sstep
case 0x699C:
                                                     mon("         STD   <$58                    ; 699C: DD 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x58; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x699E; JUMP; // sstep
case 0x699E:
                                                     mon("         LDA   <$83                    ; 699E: 96 83         \n"); // Star intensity
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x83); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69A0; JUMP; // sstep
case 0x69A0:
                                                     mon("         SUBA  #$02                    ; 69A0: 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 = 0x69A2; JUMP; // sstep
case 0x69A2:
                                                     mon("         BHI   L69A6                   ; 69A2: 22 02         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x69a6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x69A4; JUMP; // sstep
case 0x69A4:
                                                     mon("         LDA   #$00                    ; 69A4: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69A6; JUMP; // sstep
case 0x69A6:
                                                     mon("L69A6    STA   <$83                    ; 69A6: 97 83         \n"); // Star intensity
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x83; 
    wr_mem(ea, val); 
    // End of function sub_6968
    PC = 0x69A8; JUMP; // sstep
case 0x69A8:
                                                     mon("         RTS                           ; 69A8: 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/Bunkers init
  case 0x69A9:
                                                     mon("L69A9    LDA   $4B15                   ; 69A9: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69AC; JUMP; // sstep
case 0x69AC:
                                                     mon("         DECA                          ; 69AC: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x69AD; JUMP; // sstep
case 0x69AD:
                                                     mon("         CMPA  #$1F                    ; 69AD: 81 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x69AF; JUMP; // sstep
case 0x69AF:
                                                     mon("         BCS   L69B3                   ; 69AF: 25 02         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x69b3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x69B1; JUMP; // sstep
case 0x69B1:
                                                     mon("         LDA   #$1F                    ; 69B1: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69B3; JUMP; // sstep
case 0x69B3:
                                                     mon("L69B3    STA   $4B13                   ; 69B3: B7 4B 13      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b13, val); 
    PC = 0x69B6; JUMP; // sstep
case 0x69B6:
                                                     mon("         ADDA  $4B18                   ; 69B6: BB 4B 18      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b18); 
    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 = 0x69B9; JUMP; // sstep
case 0x69B9:
                                                     mon("         CMPA  #$0F                    ; 69B9: 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 = 0x69BB; JUMP; // sstep
case 0x69BB:
                                                     mon("         BLS   L69BF                   ; 69BB: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x69bf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x69BD; JUMP; // sstep
case 0x69BD:
                                                     mon("         LDA   #$0F                    ; 69BD: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69BF; JUMP; // sstep
case 0x69BF:
                                                     mon("L69BF    STA   $4B19                   ; 69BF: B7 4B 19      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b19, val); 
    PC = 0x69C2; JUMP; // sstep
case 0x69C2:
                                                     mon("         JSR   L615A                   ; 69C2: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x69C5:
                                                     mon("L69C5    JSR   L620F                   ; 69C5: BD 62 0F      \n"); // Init towers surface dots
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x620f; 
    JUMP;
  case 0x69C8:
                                                     mon("L69C8    JSR   $A1CE                   ; 69C8: BD A1 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xa1ce; 
    JUMP;
  case 0x69CB:
                                                     mon("L69CB    JSR   $B939                   ; 69CB: BD B9 39      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xb939; 
    JUMP;
  case 0x69CE:
                                                     mon("L69CE    LDD   #$0100                  ; 69CE: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x69D1; JUMP; // sstep
case 0x69D1:
                                                     mon("         STD   $5086                   ; 69D1: FD 50 86      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5086, A); // Care needed with I/O space and word fetches
    wr_mem(0x5087, B); 
    PC = 0x69D4; JUMP; // sstep
case 0x69D4:
                                                     mon("         ASRA                          ; 69D4: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x69D5; JUMP; // sstep
case 0x69D5:
                                                     mon("         RORB                          ; 69D5: 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 = 0x69D6; JUMP; // sstep
case 0x69D6:
                                                     mon("         STD   $5098                   ; 69D6: 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 = 0x69D9; JUMP; // sstep
case 0x69D9:
                                                     mon("         LDD   #$2000                  ; 69D9: CC 20 00      \n");
    clockticks = clockticks + 3; 
    A = 0x20; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x69DC; JUMP; // sstep
case 0x69DC:
                                                     mon("         STD   $509C                   ; 69DC: FD 50 9C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    PC = 0x69DF; JUMP; // sstep
case 0x69DF:
                                                     mon("         LDA   #$00                    ; 69DF: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69E1; JUMP; // sstep
case 0x69E1:
                                                     mon("         STA   <$A7                    ; 69E1: 97 A7         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xa7; 
    wr_mem(ea, val); 
    PC = 0x69E3; JUMP; // sstep
case 0x69E3:
                                                     mon("         STA   $4B35                   ; 69E3: B7 4B 35      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b35, val); 
    PC = 0x69E6; JUMP; // sstep
case 0x69E6:
                                                     mon("         STA   $4B3D                   ; 69E6: B7 4B 3D      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b3d, val); 
    PC = 0x69E9; JUMP; // sstep
case 0x69E9:
                                                     mon("         LDA   #$00                    ; 69E9: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x69EB; JUMP; // sstep
case 0x69EB:
                                                     mon("         STA   $4B0E                   ; 69EB: B7 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b0e, val); 
    PC = 0x69EE; JUMP; // sstep
case 0x69EE:
                                                     mon("         JSR   $BD94                   ; 69EE: BD BD 94      \n"); // Towers 1 music
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0xbd94; 
    JUMP;
  case 0x69F1:
                                                     mon("L69F1    INC   <$41                    ; 69F1: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_69A9
    PC = 0x69F3; JUMP; // sstep
case 0x69F3:
                                                     mon("         RTS                           ; 69F3: 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/Bunkers wave
    // FUNCTION CHUNK AT ROM:6CB6 SIZE 0000000E BYTES
  case 0x69F4:
                                                     mon("L69F4    JSR   L7390                   ; 69F4: BD 73 90      \n"); // Towers/Bunkers wave
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    PC = 0x7390; 
    JUMP;
  case 0x69F7:
                                                     mon("L69F7    LDA   <$60                    ; 69F7: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x69F9; JUMP; // sstep
case 0x69F9:
                                                     mon("         LBMI  L6CB6                   ; 69F9: 10 2B 02 B9   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N <  0) {
    clockticks = clockticks + 1; 
    PC = 0x6cb6; 
    JUMP;
    }
    PC = 0x69FD; JUMP; // sstep
case 0x69FD:
                                                     mon("         JSR   $A849                   ; 69FD: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x00); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x6A00:
                                                     mon("L6A00    JSR   $9890                   ; 6A00: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x03); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x6A03:
                                                     mon("L6A03    JSR   $9558                   ; 6A03: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x06); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6A06:
                                                     mon("L6A06    JSR   $B98B                   ; 6A06: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
    // End of function sub_69F4
  case 0x6A09:
                                                     mon("L6A09    JSR   L70DB                   ; 6A09: BD 70 DB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x70db; 
    JUMP;
    // =============== S U B R O U T I N E =======================================
  case 0x6A0C:
                                                     mon("L6A0C    JSR   L6E22                   ; 6A0C: BD 6E 22      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x6e22; 
    JUMP;
  case 0x6A0F:
                                                     mon("L6A0F    LDA   #$10                    ; 6A0F: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6A11; JUMP; // sstep
case 0x6A11:
                                                     mon("         JSR   $CE0C                   ; 6A11: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x14); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x6A14:
                                                     mon("L6A14    JSR   L6F6F                   ; 6A14: BD 6F 6F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x17); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x6f6f; 
    JUMP;
  case 0x6A17:
                                                     mon("L6A17    LDD   $5086                   ; 6A17: 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 = 0x6A1A; JUMP; // sstep
case 0x6A1A:
                                                     mon("         ADDD  #$01                    ; 6A1A: 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 = 0x6A1D; JUMP; // sstep
case 0x6A1D:
                                                     mon("         CMPD  #$0400                  ; 6A1D: 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 = 0x6A21; JUMP; // sstep
case 0x6A21:
                                                     mon("         BHI   L6A26                   ; 6A21: 22 03         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x6a26; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A23; JUMP; // sstep
case 0x6A23:
                                                     mon("         STD   $5086                   ; 6A23: FD 50 86      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5086, A); // Care needed with I/O space and word fetches
    wr_mem(0x5087, B); 
    PC = 0x6A26; JUMP; // sstep
case 0x6A26:
                                                     mon("L6A26    LDA   <$43                    ; 6A26: 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 = 0x6A28; JUMP; // sstep
case 0x6A28:
                                                     mon("         ANDA  #$0F                    ; 6A28: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6A2A; JUMP; // sstep
case 0x6A2A:
                                                     mon("         BNE   L6A39                   ; 6A2A: 26 0D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6a39; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A2C; JUMP; // sstep
case 0x6A2C:
                                                     mon("         LDA   $4B0E                   ; 6A2C: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A2F; JUMP; // sstep
case 0x6A2F:
                                                     mon("         CMPA  #$0E                    ; 6A2F: 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 = 0x6A31; JUMP; // sstep
case 0x6A31:
                                                     mon("         BNE   L6A36                   ; 6A31: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6a36; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A33; JUMP; // sstep
case 0x6A33:
                                                     mon("         JSR   $BD99                   ; 6A33: BD BD 99      \n"); // Towers 2 music
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x36); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xbd99; 
    JUMP;
  case 0x6A36:
                                                     mon("L6A36    INC   $4B0E                   ; 6A36: 7C 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4b0e, res); 
    clockticks = clockticks + 2; 
    PC = 0x6A39; JUMP; // sstep
case 0x6A39:
                                                     mon("L6A39    LDA   <$A7                    ; 6A39: 96 A7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa7); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A3B; JUMP; // sstep
case 0x6A3B:
                                                     mon("         CMPA  #$05                    ; 6A3B: 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 = 0x6A3D; JUMP; // sstep
case 0x6A3D:
                                                     mon("         BCS   locret_6A4F             ; 6A3D: 25 10         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6a4f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A3F; JUMP; // sstep
case 0x6A3F:
                                                     mon("         LDA   #$01                    ; 6A3F: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A41; JUMP; // sstep
case 0x6A41:
                                                     mon("         STA   $4B3D                   ; 6A41: B7 4B 3D      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b3d, val); 
    PC = 0x6A44; JUMP; // sstep
case 0x6A44:
                                                     mon("         LDA   $5098                   ; 6A44: B6 50 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5098); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A47; JUMP; // sstep
case 0x6A47:
                                                     mon("         CMPA  #$80                    ; 6A47: 81 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)); 
    PC = 0x6A49; JUMP; // sstep
case 0x6A49:
                                                     mon("         BCC   locret_6A4F             ; 6A49: 24 04         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x6a4f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A4B; JUMP; // sstep
case 0x6A4B:
                                                     mon("         LDA   #$2B                    ; 6A4B: 86 2B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A4D; JUMP; // sstep
case 0x6A4D:
                                                     mon("         STA   <$41                    ; 6A4D: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6A0C
    PC = 0x6A4F; JUMP; // sstep
case 0x6A4F:
                                                     mon("locret_6A4F RTS                           ; 6A4F: 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 =======================================
    // Entering Death Star zoomed fully in
  case 0x6A50:
                                                     mon("L6A50    LDA   #$00                    ; 6A50: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A52; JUMP; // sstep
case 0x6A52:
                                                     mon("         STA   <$98                    ; 6A52: 97 98         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x98; 
    wr_mem(ea, val); 
    PC = 0x6A54; JUMP; // sstep
case 0x6A54:
                                                     mon("         STA   $4B36                   ; 6A54: B7 4B 36      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b36, val); 
    PC = 0x6A57; JUMP; // sstep
case 0x6A57:
                                                     mon("         LDA   $4B15                   ; 6A57: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A5A; JUMP; // sstep
case 0x6A5A:
                                                     mon("         CMPA  #$1F                    ; 6A5A: 81 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x1f; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6A5C; JUMP; // sstep
case 0x6A5C:
                                                     mon("         BLS   L6A60                   ; 6A5C: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x6a60; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A5E; JUMP; // sstep
case 0x6A5E:
                                                     mon("         LDA   #$1F                    ; 6A5E: 86 1F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A60; JUMP; // sstep
case 0x6A60:
                                                     mon("L6A60    STA   $4B12                   ; 6A60: B7 4B 12      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b12, val); 
    PC = 0x6A63; JUMP; // sstep
case 0x6A63:
                                                     mon("         ADDA  $4B18                   ; 6A63: BB 4B 18      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b18); 
    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 = 0x6A66; JUMP; // sstep
case 0x6A66:
                                                     mon("         CMPA  #$0F                    ; 6A66: 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 = 0x6A68; JUMP; // sstep
case 0x6A68:
                                                     mon("         BLS   L6A6C                   ; 6A68: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x6a6c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6A6A; JUMP; // sstep
case 0x6A6A:
                                                     mon("         LDA   #$0F                    ; 6A6A: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A6C; JUMP; // sstep
case 0x6A6C:
                                                     mon("L6A6C    STA   $4B19                   ; 6A6C: B7 4B 19      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b19, val); 
    PC = 0x6A6F; JUMP; // sstep
case 0x6A6F:
                                                     mon("         JSR   $83A4                   ; 6A6F: BD 83 A4      \n"); // Called when starting trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x83a4; 
    JUMP;
  case 0x6A72:
                                                     mon("L6A72    JSR   $BD71                   ; 6A72: BD BD 71      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xbd71; 
    JUMP;
  case 0x6A75:
                                                     mon("L6A75    LDD   #$00                    ; 6A75: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6A78; JUMP; // sstep
case 0x6A78:
                                                     mon("         STD   $4B0E                   ; 6A78: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6A7B; JUMP; // sstep
case 0x6A7B:
                                                     mon("         INC   <$41                    ; 6A7B: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6A50
    PC = 0x6A7D; JUMP; // sstep
case 0x6A7D:
                                                     mon("         RTS                           ; 6A7D: 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 0x6A7E:
                                                     mon("L6A7E    JSR   L615A                   ; 6A7E: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x81); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6A81:
                                                     mon("L6A81    JSR   $8341                   ; 6A81: BD 83 41      \n"); // Entering trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x8341; 
    JUMP;
  case 0x6A84:
                                                     mon("L6A84    LDA   #$2F                    ; 6A84: 86 2F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6A86; JUMP; // sstep
case 0x6A86:
                                                     mon("         STA   <$41                    ; 6A86: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6A7E
    PC = 0x6A88; JUMP; // sstep
case 0x6A88:
                                                     mon("         RTS                           ; 6A88: 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 0x6A89:
                                                     mon("L6A89    JSR   L73EA                   ; 6A89: BD 73 EA      \n"); // Towers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x73ea; 
    JUMP;
  case 0x6A8C:
                                                     mon("L6A8C    JSR   $9890                   ; 6A8C: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x6A8F:
                                                     mon("L6A8F    JSR   $9558                   ; 6A8F: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x92); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6A92:
                                                     mon("L6A92    JSR   $B98B                   ; 6A92: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x95); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
  case 0x6A95:
                                                     mon("L6A95    JSR   L6FE0                   ; 6A95: BD 6F E0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x98); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x6fe0; 
    JUMP;
  case 0x6A98:
                                                     mon("L6A98    LDD   $4B0E                   ; 6A98: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6A9B; JUMP; // sstep
case 0x6A9B:
                                                     mon("         ADDD  #$01                    ; 6A9B: 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 = 0x6A9E; JUMP; // sstep
case 0x6A9E:
                                                     mon("L6A9E    STD   $4B0E                   ; 6A9E: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6AA1; JUMP; // sstep
case 0x6AA1:
                                                     mon("         SUBD  #$11                    ; 6AA1: 83 00 11      \n");
    clockticks = clockticks + 4; 
    val = 0x0011; 
    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 = 0x6AA4; JUMP; // sstep
case 0x6AA4:
                                                     mon("         BCS   locret_6AAA             ; 6AA4: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6aaa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6AA6; JUMP; // sstep
case 0x6AA6:
                                                     mon("         LDA   #$2D                    ; 6AA6: 86 2D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2d; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6AA8; JUMP; // sstep
case 0x6AA8:
                                                     mon("         STA   <$41                    ; 6AA8: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6A89
    PC = 0x6AAA; JUMP; // sstep
case 0x6AAA:
                                                     mon("locret_6AAA RTS                           ; 6AAA: 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 0x6AAB:
                                                     mon("L6AAB    LDD   #$00                    ; 6AAB: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6AAE; JUMP; // sstep
case 0x6AAE:
                                                     mon("         STD   $5098                   ; 6AAE: 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 = 0x6AB1; JUMP; // sstep
case 0x6AB1:
                                                     mon("         STD   $509A                   ; 6AB1: FD 50 9A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509a, A); // Care needed with I/O space and word fetches
    wr_mem(0x509b, B); 
    PC = 0x6AB4; JUMP; // sstep
case 0x6AB4:
                                                     mon("         STD   $4B0E                   ; 6AB4: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6AB7; JUMP; // sstep
case 0x6AB7:
                                                     mon("         JSR   L6FF1                   ; 6AB7: BD 6F F1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xba); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x6ff1; 
    JUMP;
  case 0x6ABA:
                                                     mon("L6ABA    JSR   $8341                   ; 6ABA: BD 83 41      \n"); // Entering trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x8341; 
    JUMP;
  case 0x6ABD:
                                                     mon("L6ABD    INC   <$41                    ; 6ABD: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x6ABF; JUMP; // sstep
case 0x6ABF:
                                                     mon("L6ABF    JSR   L7413                   ; 6ABF: BD 74 13      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x7413; 
    JUMP;
  case 0x6AC2:
                                                     mon("L6AC2    JSR   $9890                   ; 6AC2: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x6AC5:
                                                     mon("L6AC5    JSR   $9558                   ; 6AC5: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6AC8:
                                                     mon("L6AC8    JSR   $B98B                   ; 6AC8: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
  case 0x6ACB:
                                                     mon("L6ACB    JSR   L6FF1                   ; 6ACB: BD 6F F1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x6ff1; 
    JUMP;
  case 0x6ACE:
                                                     mon("L6ACE    LDD   $4B0E                   ; 6ACE: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6AD1; JUMP; // sstep
case 0x6AD1:
                                                     mon("         ADDD  #$01                    ; 6AD1: 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 = 0x6AD4; JUMP; // sstep
case 0x6AD4:
                                                     mon("         STD   $4B0E                   ; 6AD4: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6AD7; JUMP; // sstep
case 0x6AD7:
                                                     mon("         SUBD  #$11                    ; 6AD7: 83 00 11      \n");
    clockticks = clockticks + 4; 
    val = 0x0011; 
    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 = 0x6ADA; JUMP; // sstep
case 0x6ADA:
                                                     mon("         BCS   locret_6AFE             ; 6ADA: 25 22         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6afe; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6ADC; JUMP; // sstep
case 0x6ADC:
                                                     mon("         LDX   $5098                   ; 6ADC: BE 50 98      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5098)<<8; 
    ea = ea | rd_mem(0x5099); 
    X = ea; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x6ADF; JUMP; // sstep
case 0x6ADF:
                                                     mon("         LDU   $509A                   ; 6ADF: FE 50 9A      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x509a)<<8; 
    ea = ea | rd_mem(0x509b); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x6AE2; JUMP; // sstep
case 0x6AE2:
                                                     mon("         LDD   $509C                   ; 6AE2: 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 = 0x6AE5; JUMP; // sstep
case 0x6AE5:
                                                     mon("         PSHS  U,X,B,A                 ; 6AE5: 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 = 0x6AE7; JUMP; // sstep
case 0x6AE7:
                                                     mon("         JSR   L615A                   ; 6AE7: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xea); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6a); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6AEA:
                                                     mon("L6AEA    PULS  A,B,X,U                 ; 6AEA: 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 = 0x6AEC; JUMP; // sstep
case 0x6AEC:
                                                     mon("         STX   $5098                   ; 6AEC: BF 50 98      \n");
    clockticks = clockticks + 5; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x5098, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x5099, (UINT8)val); 
    PC = 0x6AEF; JUMP; // sstep
case 0x6AEF:
                                                     mon("         STU   $509A                   ; 6AEF: FF 50 9A      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x509a, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x509b, (UINT8)val); 
    PC = 0x6AF2; JUMP; // sstep
case 0x6AF2:
                                                     mon("         STD   $509C                   ; 6AF2: FD 50 9C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    PC = 0x6AF5; JUMP; // sstep
case 0x6AF5:
                                                     mon("         LDA   #$00                    ; 6AF5: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6AF7; JUMP; // sstep
case 0x6AF7:
                                                     mon("         STA   $4B36                   ; 6AF7: B7 4B 36      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b36, val); 
    PC = 0x6AFA; JUMP; // sstep
case 0x6AFA:
                                                     mon("         LDA   #$2F                    ; 6AFA: 86 2F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6AFC; JUMP; // sstep
case 0x6AFC:
                                                     mon("         STA   <$41                    ; 6AFC: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6AAB
    PC = 0x6AFE; JUMP; // sstep
case 0x6AFE:
                                                     mon("locret_6AFE RTS                           ; 6AFE: 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 0x6AFF:
                                                     mon("L6AFF    LDA   #$01                    ; 6AFF: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B01; JUMP; // sstep
case 0x6B01:
                                                     mon("         STA   <$98                    ; 6B01: 97 98         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x98; 
    wr_mem(ea, val); 
    PC = 0x6B03; JUMP; // sstep
case 0x6B03:
                                                     mon("         JSR   L615A                   ; 6B03: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x06); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6B06:
                                                     mon("L6B06    JSR   $8341                   ; 6B06: BD 83 41      \n"); // Entering trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x8341; 
    JUMP;
  case 0x6B09:
                                                     mon("L6B09    LDA   #$FF                    ; 6B09: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B0B; JUMP; // sstep
case 0x6B0B:
                                                     mon("         STA   $4B36                   ; 6B0B: B7 4B 36      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b36, val); 
    PC = 0x6B0E; JUMP; // sstep
case 0x6B0E:
                                                     mon("         LDA   $4B19                   ; 6B0E: B6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B11; JUMP; // sstep
case 0x6B11:
                                                     mon("         ADDA  $4B17                   ; 6B11: BB 4B 17      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b17); 
    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 = 0x6B14; JUMP; // sstep
case 0x6B14:
                                                     mon("         CMPA  #$0F                    ; 6B14: 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 = 0x6B16; JUMP; // sstep
case 0x6B16:
                                                     mon("         BLS   L6B1A                   ; 6B16: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x6b1a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B18; JUMP; // sstep
case 0x6B18:
                                                     mon("         LDA   #$0F                    ; 6B18: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B1A; JUMP; // sstep
case 0x6B1A:
                                                     mon("L6B1A    STA   $4B19                   ; 6B1A: B7 4B 19      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b19, val); 
    PC = 0x6B1D; JUMP; // sstep
case 0x6B1D:
                                                     mon("L6B1D    LDA   #$2F                    ; 6B1D: 86 2F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x2f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B1F; JUMP; // sstep
case 0x6B1F:
                                                     mon("         STA   <$41                    ; 6B1F: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6AFF
    PC = 0x6B21; JUMP; // sstep
case 0x6B21:
                                                     mon("         RTS                           ; 6B21: 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:6CE1 SIZE 0000000E BYTES
  case 0x6B22:
                                                     mon("L6B22    LDA   #$00                    ; 6B22: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B24; JUMP; // sstep
case 0x6B24:
                                                     mon("         STA   $4B3E                   ; 6B24: B7 4B 3E      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b3e, val); 
    PC = 0x6B27; JUMP; // sstep
case 0x6B27:
                                                     mon("         STA   $4B0E                   ; 6B27: B7 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b0e, val); 
    PC = 0x6B2A; JUMP; // sstep
case 0x6B2A:
                                                     mon("         LDD   #$0300                  ; 6B2A: CC 03 00      \n");
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6B2D; JUMP; // sstep
case 0x6B2D:
                                                     mon("         STD   $5086                   ; 6B2D: FD 50 86      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5086, A); // Care needed with I/O space and word fetches
    wr_mem(0x5087, B); 
    PC = 0x6B30; JUMP; // sstep
case 0x6B30:
                                                     mon("         INC   <$41                    ; 6B30: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x6B32; JUMP; // sstep
case 0x6B32:
                                                     mon("L6B32    JSR   L743C                   ; 6B32: BD 74 3C      \n"); // Trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x743c; 
    JUMP;
  case 0x6B35:
                                                     mon("L6B35    LDA   <$60                    ; 6B35: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6B37; JUMP; // sstep
case 0x6B37:
                                                     mon("         LBMI  L6CE1                   ; 6B37: 10 2B 01 A6   \n");
    clockticks = clockticks + 5; 
    if ((SINT8)N <  0) {
    clockticks = clockticks + 1; 
    PC = 0x6ce1; 
    JUMP;
    }
    PC = 0x6B3B; JUMP; // sstep
case 0x6B3B:
                                                     mon("         JSR   $A849                   ; 6B3B: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x6B3E:
                                                     mon("L6B3E    JSR   $AD6C                   ; 6B3E: BD AD 6C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x41); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xad6c; 
    JUMP;
  case 0x6B41:
                                                     mon("L6B41    JSR   $8495                   ; 6B41: BD 84 95      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x44); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x8495; 
    JUMP;
  case 0x6B44:
                                                     mon("L6B44    JSR   $9886                   ; 6B44: BD 98 86      \n"); // Fireball timer 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x47); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x9886; 
    JUMP;
  case 0x6B47:
                                                     mon("L6B47    JSR   $9558                   ; 6B47: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6B4A:
                                                     mon("L6B4A    JSR   L70DB                   ; 6B4A: BD 70 DB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x70db; 
    JUMP;
  case 0x6B4D:
                                                     mon("L6B4D    JSR   nullL1                  ; 6B4D: BD 6E A1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x50); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x6ea1; 
    JUMP;
  case 0x6B50:
                                                     mon("L6B50    LDA   #$10                    ; 6B50: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6B52; JUMP; // sstep
case 0x6B52:
                                                     mon("         JSR   $CE0C                   ; 6B52: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x55); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x6B55:
                                                     mon("L6B55    JSR   L703B                   ; 6B55: BD 70 3B      \n"); // Trench viewpoint calc
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x703b; 
    JUMP;
  case 0x6B58:
                                                     mon("L6B58    LDA   <$43                    ; 6B58: 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 = 0x6B5A; JUMP; // sstep
case 0x6B5A:
                                                     mon("         ANDA  #$0F                    ; 6B5A: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6B5C; JUMP; // sstep
case 0x6B5C:
                                                     mon("         BNE   L6B99                   ; 6B5C: 26 3B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6b99; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B5E; JUMP; // sstep
case 0x6B5E:
                                                     mon("         LDA   $4B0E                   ; 6B5E: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B61; JUMP; // sstep
case 0x6B61:
                                                     mon("         CMPA  #$02                    ; 6B61: 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 = 0x6B63; JUMP; // sstep
case 0x6B63:
                                                     mon("         BNE   L6B68                   ; 6B63: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6b68; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B65; JUMP; // sstep
case 0x6B65:
                                                     mon("         JSR   $BD9E                   ; 6B65: BD BD 9E      \n"); // Trench music
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd9e; 
    JUMP;
  case 0x6B68:
                                                     mon("L6B68    LDA   $4B12                   ; 6B68: B6 4B 12      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b12); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x6B6B; JUMP; // sstep
case 0x6B6B:
                                                     mon("         LSRA                          ; 6B6B: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x6B6C; JUMP; // sstep
case 0x6B6C:
                                                     mon("         BCS   L6B83                   ; 6B6C: 25 15         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6b83; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B6E; JUMP; // sstep
case 0x6B6E:
                                                     mon("         LDA   $4B0E                   ; 6B6E: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B71; JUMP; // sstep
case 0x6B71:
                                                     mon("         CMPA  #$10                    ; 6B71: 81 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x10; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6B73; JUMP; // sstep
case 0x6B73:
                                                     mon("         BNE   L6B7A                   ; 6B73: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6b7a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B75; JUMP; // sstep
case 0x6B75:
                                                     mon("         JSR   $BD6C                   ; 6B75: BD BD 6C      \n"); // Luke trust me
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd6c; 
    JUMP;
  case 0x6B78:
                                                     mon("L6B78    BRA   L6B81                   ; 6B78: 20 07         \n");
    PC = 0x6b81; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6B7A:
                                                     mon("L6B7A    CMPA  #$18                    ; 6B7A: 81 18         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x18; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6B7C; JUMP; // sstep
case 0x6B7C:
                                                     mon("         BNE   L6B81                   ; 6B7C: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6b81; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B7E; JUMP; // sstep
case 0x6B7E:
                                                     mon("         JSR   $BD76                   ; 6B7E: BD BD 76      \n"); // Yahoo youre all clear kid
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x81); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd76; 
    JUMP;
  case 0x6B81:
                                                     mon("L6B81    BRA   L6B96                   ; 6B81: 20 13         \n");
    PC = 0x6b96; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6B83:
                                                     mon("L6B83    LDA   $4B0E                   ; 6B83: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6B86; JUMP; // sstep
case 0x6B86:
                                                     mon("         CMPA  #$10                    ; 6B86: 81 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x10; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6B88; JUMP; // sstep
case 0x6B88:
                                                     mon("         BNE   L6B8F                   ; 6B88: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6b8f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B8A; JUMP; // sstep
case 0x6B8A:
                                                     mon("         JSR   $BD30                   ; 6B8A: BD BD 30      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd30; 
    JUMP;
  case 0x6B8D:
                                                     mon("L6B8D    BRA   L6B96                   ; 6B8D: 20 07         \n");
    PC = 0x6b96; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6B8F:
                                                     mon("L6B8F    CMPA  #$16                    ; 6B8F: 81 16         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x16; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6B91; JUMP; // sstep
case 0x6B91:
                                                     mon("         BNE   L6B96                   ; 6B91: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6b96; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B93; JUMP; // sstep
case 0x6B93:
                                                     mon("         JSR   $BD62                   ; 6B93: BD BD 62      \n"); // Force is strong in this one
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x96); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd62; 
    JUMP;
  case 0x6B96:
                                                     mon("L6B96    INC   $4B0E                   ; 6B96: 7C 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4b0e, res); 
    clockticks = clockticks + 2; 
    PC = 0x6B99; JUMP; // sstep
case 0x6B99:
                                                     mon("L6B99    LDA   <$92                    ; 6B99: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6B9B; JUMP; // sstep
case 0x6B9B:
                                                     mon("         BEQ   locret_6BDA             ; 6B9B: 27 3D         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6bda; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6B9D; JUMP; // sstep
case 0x6B9D:
                                                     mon("         LDD   <$93                    ; 6B9D: 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 = 0x6B9F; JUMP; // sstep
case 0x6B9F:
                                                     mon("         SUBD  $5098                   ; 6B9F: 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 = 0x6BA2; JUMP; // sstep
case 0x6BA2:
                                                     mon("         SUBD  #$0800                  ; 6BA2: 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 = 0x6BA5; JUMP; // sstep
case 0x6BA5:
                                                     mon("         BHI   locret_6BDA             ; 6BA5: 22 33         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x6bda; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6BA7; JUMP; // sstep
case 0x6BA7:
                                                     mon("         LDA   $4845                   ; 6BA7: B6 48 45      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4845); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6BAA; JUMP; // sstep
case 0x6BAA:
                                                     mon("         BNE   L6BC6                   ; 6BAA: 26 1A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6bc6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6BAC; JUMP; // sstep
case 0x6BAC:
                                                     mon("         LDA   #$01                    ; 6BAC: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BAE; JUMP; // sstep
case 0x6BAE:
                                                     mon("         STA   $4B3E                   ; 6BAE: B7 4B 3E      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b3e, val); 
    PC = 0x6BB1; JUMP; // sstep
case 0x6BB1:
                                                     mon("         JSR   $BDB2                   ; 6BB1: BD BD B2      \n"); // Explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbdb2; 
    JUMP;
  case 0x6BB4:
                                                     mon("L6BB4    JSR   $9874                   ; 6BB4: BD 98 74      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x9874; 
    JUMP;
  case 0x6BB7:
                                                     mon("L6BB7    LDA   <$60                    ; 6BB7: 96 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x60); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6BB9; JUMP; // sstep
case 0x6BB9:
                                                     mon("         LBLE  L6CE1                   ; 6BB9: 10 2F 01 24   \n");
    clockticks = clockticks + 5; 
    if (((SINT8)(N^V) <  0) || (!Z)) {
    clockticks = clockticks + 1; 
    PC = 0x6ce1; 
    JUMP;
    }
    PC = 0x6BBD; JUMP; // sstep
case 0x6BBD:
                                                     mon("         LDA   #$31                    ; 6BBD: 86 31         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x31; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BBF; JUMP; // sstep
case 0x6BBF:
                                                     mon("         STA   <$41                    ; 6BBF: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6BC1; JUMP; // sstep
case 0x6BC1:
                                                     mon("         JSR   $BD3A                   ; 6BC1: BD BD 3A      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd3a; 
    JUMP;
  case 0x6BC4:
                                                     mon("L6BC4    BRA   locret_6BDA             ; 6BC4: 20 14         \n");
    PC = 0x6bda; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6BC6:
                                                     mon("L6BC6    LDA   #$11                    ; 6BC6: 86 11         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x11; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BC8; JUMP; // sstep
case 0x6BC8:
                                                     mon("         STA   <$41                    ; 6BC8: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6BCA; JUMP; // sstep
case 0x6BCA:
                                                     mon("         LDA   $4B15                   ; 6BCA: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BCD; JUMP; // sstep
case 0x6BCD:
                                                     mon("         CMPA  #$03                    ; 6BCD: 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 = 0x6BCF; JUMP; // sstep
case 0x6BCF:
                                                     mon("         BLT   locret_6BDA             ; 6BCF: 2D 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x6bda; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6BD1; JUMP; // sstep
case 0x6BD1:
                                                     mon("         ANDA  #$01                    ; 6BD1: 84 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x01; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6BD3; JUMP; // sstep
case 0x6BD3:
                                                     mon("         BEQ   locret_6BDA             ; 6BD3: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6bda; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6BD5; JUMP; // sstep
case 0x6BD5:
                                                     mon("         JSR   $BD17                   ; 6BD5: BD BD 17      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0xbd17; 
    JUMP;
  case 0x6BD8:
                                                     mon("L6BD8    BRA   locret_6BDA             ; 6BD8: 20 00         \n");
    PC = 0x6bda; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // End of function sub_6B22
  case 0x6BDA:
                                                     mon("locret_6BDA RTS                           ; 6BDA: 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 0x6BDB:
                                                     mon("L6BDB    JSR   L61B5                   ; 6BDB: BD 61 B5      \n"); // Set up math constants
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xde); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x61b5; 
    JUMP;
  case 0x6BDE:
                                                     mon("L6BDE    JSR   L615A                   ; 6BDE: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6BE1:
                                                     mon("L6BE1    LDA   #$C0                    ; 6BE1: 86 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xc0; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BE3; JUMP; // sstep
case 0x6BE3:
                                                     mon("         STA   $5080                   ; 6BE3: B7 50 80      \n"); // Matrix 4
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x5080, val); 
    PC = 0x6BE6; JUMP; // sstep
case 0x6BE6:
                                                     mon("         STA   $508A                   ; 6BE6: B7 50 8A      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x508a, val); 
    PC = 0x6BE9; JUMP; // sstep
case 0x6BE9:
                                                     mon("         LDA   #$04                    ; 6BE9: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BEB; JUMP; // sstep
case 0x6BEB:
                                                     mon("         STA   $4B0E                   ; 6BEB: B7 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b0e, val); 
    PC = 0x6BEE; JUMP; // sstep
case 0x6BEE:
                                                     mon("         INC   <$41                    ; 6BEE: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6BDB
    PC = 0x6BF0; JUMP; // sstep
case 0x6BF0:
                                                     mon("         RTS                           ; 6BF0: 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 complete
  case 0x6BF1:
                                                     mon("L6BF1    LDA   <$43                    ; 6BF1: 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 = 0x6BF3; JUMP; // sstep
case 0x6BF3:
                                                     mon("         ANDA  #$0F                    ; 6BF3: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x6BF5; JUMP; // sstep
case 0x6BF5:
                                                     mon("         BNE   L6C2C                   ; 6BF5: 26 35         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6c2c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6BF7; JUMP; // sstep
case 0x6BF7:
                                                     mon("         DEC   $4B0E                   ; 6BF7: 7A 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(0x4b0e, res); 
    clockticks = clockticks + 2; 
    PC = 0x6BFA; JUMP; // sstep
case 0x6BFA:
                                                     mon("L6BFA    LDA   $4B0E                   ; 6BFA: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6BFD; JUMP; // sstep
case 0x6BFD:
                                                     mon("         CMPA  #$03                    ; 6BFD: 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 = 0x6BFF; JUMP; // sstep
case 0x6BFF:
                                                     mon("         BNE   L6C09                   ; 6BFF: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6c09; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C01; JUMP; // sstep
case 0x6C01:
                                                     mon("         LDA   $4845                   ; 6C01: B6 48 45      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4845); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6C04; JUMP; // sstep
case 0x6C04:
                                                     mon("         BEQ   L6C09                   ; 6C04: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6c09; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C06; JUMP; // sstep
case 0x6C06:
                                                     mon("         JSR   $9806                   ; 6C06: BD 98 06      \n"); // Exhaust port score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x9806; 
    JUMP;
  case 0x6C09:
                                                     mon("L6C09    LDA   $4B0E                   ; 6C09: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C0C; JUMP; // sstep
case 0x6C0C:
                                                     mon("         CMPA  #$02                    ; 6C0C: 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 = 0x6C0E; JUMP; // sstep
case 0x6C0E:
                                                     mon("         BNE   L6C13                   ; 6C0E: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6c13; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C10; JUMP; // sstep
case 0x6C10:
                                                     mon("         JSR   $9775                   ; 6C10: BD 97 75      \n"); // Shield bonus score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x13); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x9775; 
    JUMP;
  case 0x6C13:
                                                     mon("L6C13    LDA   $4B0E                   ; 6C13: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C16; JUMP; // sstep
case 0x6C16:
                                                     mon("         CMPA  #$01                    ; 6C16: 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 = 0x6C18; JUMP; // sstep
case 0x6C18:
                                                     mon("         BNE   L6C22                   ; 6C18: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6c22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C1A; JUMP; // sstep
case 0x6C1A:
                                                     mon("         LDA   $4845                   ; 6C1A: B6 48 45      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4845); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6C1D; JUMP; // sstep
case 0x6C1D:
                                                     mon("         BEQ   L6C22                   ; 6C1D: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6c22; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C1F; JUMP; // sstep
case 0x6C1F:
                                                     mon("         JSR   L953B                   ; 6C1F: BD 95 3B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x22); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x953b; 
    JUMP;
  case 0x6C22:
                                                     mon("L6C22    LDA   $4B0E                   ; 6C22: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C25; JUMP; // sstep
case 0x6C25:
                                                     mon("         CMPA  #$00                    ; 6C25: 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 = 0x6C27; JUMP; // sstep
case 0x6C27:
                                                     mon("         BNE   L6C2C                   ; 6C27: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6c2c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C29; JUMP; // sstep
case 0x6C29:
                                                     mon("         JSR   $9722                   ; 6C29: BD 97 22      \n"); // Death Star starting wave bonus score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x9722; 
    JUMP;
  case 0x6C2C:
                                                     mon("L6C2C    JSR   L7519                   ; 6C2C: BD 75 19      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x7519; 
    JUMP;
  case 0x6C2F:
                                                     mon("L6C2F    JSR   $9558                   ; 6C2F: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x32); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6C32:
                                                     mon("L6C32    JSR   L6F5F                   ; 6C32: BD 6F 5F      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x6f5f; 
    JUMP;
  case 0x6C35:
                                                     mon("L6C35    LDA   $4B0E                   ; 6C35: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C38; JUMP; // sstep
case 0x6C38:
                                                     mon("         CMPA  #$FE                    ; 6C38: 81 FE         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xfe; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6C3A; JUMP; // sstep
case 0x6C3A:
                                                     mon("         BNE   locret_6C75             ; 6C3A: 26 39         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6c75; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C3C; JUMP; // sstep
case 0x6C3C:
                                                     mon("         LDA   $4B15                   ; 6C3C: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C3F; JUMP; // sstep
case 0x6C3F:
                                                     mon("         INCA                          ; 6C3F: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x6C40; JUMP; // sstep
case 0x6C40:
                                                     mon("         CMPA  #$62                    ; 6C40: 81 62         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x62; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6C42; JUMP; // sstep
case 0x6C42:
                                                     mon("         BLS   L6C46                   ; 6C42: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x6c46; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C44; JUMP; // sstep
case 0x6C44:
                                                     mon("         LDA   #$62                    ; 6C44: 86 62         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x62; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C46; JUMP; // sstep
case 0x6C46:
                                                     mon("L6C46    STA   $4B15                   ; 6C46: B7 4B 15      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b15, val); 
    PC = 0x6C49; JUMP; // sstep
case 0x6C49:
                                                     mon("         LDA   $4B15                   ; 6C49: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C4C; JUMP; // sstep
case 0x6C4C:
                                                     mon("         CMPA  #$05                    ; 6C4C: 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 = 0x6C4E; JUMP; // sstep
case 0x6C4E:
                                                     mon("         BCC   L6C5D                   ; 6C4E: 24 0D         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x6c5d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C50; JUMP; // sstep
case 0x6C50:
                                                     mon("         LDA   $4B17                   ; 6C50: B6 4B 17      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b17); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C53; JUMP; // sstep
case 0x6C53:
                                                     mon("         INCA                          ; 6C53: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x6C54; JUMP; // sstep
case 0x6C54:
                                                     mon("         CMPA  #$04                    ; 6C54: 81 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x6C56; JUMP; // sstep
case 0x6C56:
                                                     mon("         BLS   L6C5A                   ; 6C56: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x6c5a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C58; JUMP; // sstep
case 0x6C58:
                                                     mon("         LDA   #$04                    ; 6C58: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C5A; JUMP; // sstep
case 0x6C5A:
                                                     mon("L6C5A    STA   $4B17                   ; 6C5A: B7 4B 17      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b17, val); 
    PC = 0x6C5D; JUMP; // sstep
case 0x6C5D:
                                                     mon("L6C5D    LDA   $4B18                   ; 6C5D: B6 4B 18      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b18); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C60; JUMP; // sstep
case 0x6C60:
                                                     mon("         ADDA  $4B17                   ; 6C60: BB 4B 17      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4b17); 
    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 = 0x6C63; JUMP; // sstep
case 0x6C63:
                                                     mon("         CMPA  #$0F                    ; 6C63: 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 = 0x6C65; JUMP; // sstep
case 0x6C65:
                                                     mon("         BLS   L6C69                   ; 6C65: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x6c69; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6C67; JUMP; // sstep
case 0x6C67:
                                                     mon("         LDA   #$0F                    ; 6C67: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C69; JUMP; // sstep
case 0x6C69:
                                                     mon("L6C69    STA   $4B18                   ; 6C69: B7 4B 18      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b18, val); 
    PC = 0x6C6C; JUMP; // sstep
case 0x6C6C:
                                                     mon("         LDA   #$FF                    ; 6C6C: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C6E; JUMP; // sstep
case 0x6C6E:
                                                     mon("         STA   $4B2D                   ; 6C6E: B7 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2d, val); 
    PC = 0x6C71; JUMP; // sstep
case 0x6C71:
                                                     mon("         LDA   #$1D                    ; 6C71: 86 1D         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x1d; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C73; JUMP; // sstep
case 0x6C73:
                                                     mon("         STA   <$41                    ; 6C73: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6BF1
    PC = 0x6C75; JUMP; // sstep
case 0x6C75:
                                                     mon("locret_6C75 RTS                           ; 6C75: 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_6838
  case 0x6C76:
                                                     mon("L6C76    JSR   $BD58                   ; 6C76: BD BD 58      \n"); // Stay in attack formation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xbd58; 
    JUMP;
  case 0x6C79:
                                                     mon("L6C79    LDA   #$36                    ; 6C79: 86 36         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x36; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6C7B; JUMP; // sstep
case 0x6C7B:
                                                     mon("         STA   <$41                    ; 6C7B: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6C7D; JUMP; // sstep
case 0x6C7D:
                                                     mon("         LDD   #$00                    ; 6C7D: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6C80; JUMP; // sstep
case 0x6C80:
                                                     mon("         STD   $4B0E                   ; 6C80: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    // END OF FUNCTION CHUNK FOR sub_6838
    PC = 0x6C83; JUMP; // sstep
case 0x6C83:
                                                     mon("         RTS                           ; 6C83: 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
  case 0x6C84:
                                                     mon("L6C84    JSR   L7315                   ; 6C84: BD 73 15      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x7315; 
    JUMP;
  case 0x6C87:
                                                     mon("L6C87    JSR   $A849                   ; 6C87: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x6C8A:
                                                     mon("L6C8A    JSR   $987F                   ; 6C8A: BD 98 7F      \n"); // Fireball timer
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x987f; 
    JUMP;
  case 0x6C8D:
                                                     mon("L6C8D    JSR   $9898                   ; 6C8D: BD 98 98      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x90); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x9898; 
    JUMP;
  case 0x6C90:
                                                     mon("L6C90    JSR   $B98B                   ; 6C90: BD B9 8B      \n"); // Check if tie/bunker/tower been hit
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x93); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xb98b; 
    JUMP;
  case 0x6C93:
                                                     mon("L6C93    LDD   #$FB01                  ; 6C93: CC FB 01      \n");
    clockticks = clockticks + 3; 
    A = 0xfb; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6C96; JUMP; // sstep
case 0x6C96:
                                                     mon("         STD   $5022                   ; 6C96: 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 = 0x6C99; JUMP; // sstep
case 0x6C99:
                                                     mon("         LDD   #$3FCE                  ; 6C99: CC 3F CE      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xce; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6C9C; JUMP; // sstep
case 0x6C9C:
                                                     mon("         STD   $5024                   ; 6C9C: 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 = 0x6C9F; JUMP; // sstep
case 0x6C9F:
                                                     mon("         JSR   $CE24                   ; 6C9F: BD CE 24      \n"); // Run math program $00 Roll on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xce24; 
    JUMP;
  case 0x6CA2:
                                                     mon("L6CA2    LDD   $4B0E                   ; 6CA2: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6CA5; JUMP; // sstep
case 0x6CA5:
                                                     mon("         ADDD  #$01                    ; 6CA5: 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 = 0x6CA8; JUMP; // sstep
case 0x6CA8:
                                                     mon("         STD   $4B0E                   ; 6CA8: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6CAB; JUMP; // sstep
case 0x6CAB:
                                                     mon("         CMPD  #$28                    ; 6CAB: 10 83 00 28   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0028; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6CAF; JUMP; // sstep
case 0x6CAF:
                                                     mon("         BCS   locret_6CB5             ; 6CAF: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6cb5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6CB1; JUMP; // sstep
case 0x6CB1:
                                                     mon("         LDA   #$3B                    ; 6CB1: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6CB3; JUMP; // sstep
case 0x6CB3:
                                                     mon("         STA   <$41                    ; 6CB3: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6C84
    PC = 0x6CB5; JUMP; // sstep
case 0x6CB5:
                                                     mon("locret_6CB5 RTS                           ; 6CB5: 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_69F4
  case 0x6CB6:
                                                     mon("L6CB6    JSR   $BD58                   ; 6CB6: BD BD 58      \n"); // Stay in attack formation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xbd58; 
    JUMP;
  case 0x6CB9:
                                                     mon("L6CB9    LDA   #$38                    ; 6CB9: 86 38         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x38; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6CBB; JUMP; // sstep
case 0x6CBB:
                                                     mon("         STA   <$41                    ; 6CBB: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6CBD; JUMP; // sstep
case 0x6CBD:
                                                     mon("         LDD   #$00                    ; 6CBD: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6CC0; JUMP; // sstep
case 0x6CC0:
                                                     mon("         STD   $4B0E                   ; 6CC0: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    // END OF FUNCTION CHUNK FOR sub_69F4
    PC = 0x6CC3; JUMP; // sstep
case 0x6CC3:
                                                     mon("         RTS                           ; 6CC3: 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 0x6CC4:
                                                     mon("L6CC4    JSR   L73C3                   ; 6CC4: BD 73 C3      \n"); // Towers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x73c3; 
    JUMP;
  case 0x6CC7:
                                                     mon("L6CC7    JSR   $A849                   ; 6CC7: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xca); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x6CCA:
                                                     mon("L6CCA    JSR   $987F                   ; 6CCA: BD 98 7F      \n"); // Fireball timer
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x987f; 
    JUMP;
  case 0x6CCD:
                                                     mon("L6CCD    LDD   $4B0E                   ; 6CCD: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6CD0; JUMP; // sstep
case 0x6CD0:
                                                     mon("         ADDD  #$01                    ; 6CD0: 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 = 0x6CD3; JUMP; // sstep
case 0x6CD3:
                                                     mon("         STD   $4B0E                   ; 6CD3: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6CD6; JUMP; // sstep
case 0x6CD6:
                                                     mon("         CMPD  #$28                    ; 6CD6: 10 83 00 28   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0028; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6CDA; JUMP; // sstep
case 0x6CDA:
                                                     mon("         BCS   locret_6CE0             ; 6CDA: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6ce0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6CDC; JUMP; // sstep
case 0x6CDC:
                                                     mon("         LDA   #$3B                    ; 6CDC: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6CDE; JUMP; // sstep
case 0x6CDE:
                                                     mon("         STA   <$41                    ; 6CDE: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6CC4
    PC = 0x6CE0; JUMP; // sstep
case 0x6CE0:
                                                     mon("locret_6CE0 RTS                           ; 6CE0: 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_6B22
  case 0x6CE1:
                                                     mon("L6CE1    JSR   $BD58                   ; 6CE1: BD BD 58      \n"); // Stay in attack formation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xbd58; 
    JUMP;
  case 0x6CE4:
                                                     mon("L6CE4    LDA   #$3A                    ; 6CE4: 86 3A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3a; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6CE6; JUMP; // sstep
case 0x6CE6:
                                                     mon("         STA   <$41                    ; 6CE6: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6CE8; JUMP; // sstep
case 0x6CE8:
                                                     mon("         LDD   #$00                    ; 6CE8: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6CEB; JUMP; // sstep
case 0x6CEB:
                                                     mon("         STD   $4B0E                   ; 6CEB: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    // END OF FUNCTION CHUNK FOR sub_6B22
    PC = 0x6CEE; JUMP; // sstep
case 0x6CEE:
                                                     mon("         RTS                           ; 6CEE: 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 =======================================
    // Game over
  case 0x6CEF:
                                                     mon("L6CEF    JSR   L74D5                   ; 6CEF: BD 74 D5      \n"); // Game over
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x74d5; 
    JUMP;
  case 0x6CF2:
                                                     mon("L6CF2    JSR   $A849                   ; 6CF2: BD A8 49      \n"); // Fireball movement
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0xa849; 
    JUMP;
  case 0x6CF5:
                                                     mon("L6CF5    JSR   $987F                   ; 6CF5: BD 98 7F      \n"); // Fireball timer
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    PC = 0x987f; 
    JUMP;
  case 0x6CF8:
                                                     mon("L6CF8    LDD   $4B0E                   ; 6CF8: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6CFB; JUMP; // sstep
case 0x6CFB:
                                                     mon("         ADDD  #$01                    ; 6CFB: 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 = 0x6CFE; JUMP; // sstep
case 0x6CFE:
                                                     mon("         STD   $4B0E                   ; 6CFE: FD 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b0e, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b0f, B); 
    PC = 0x6D01; JUMP; // sstep
case 0x6D01:
                                                     mon("         CMPD  #$28                    ; 6D01: 10 83 00 28   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0028; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6D05; JUMP; // sstep
case 0x6D05:
                                                     mon("         BCS   locret_6D0B             ; 6D05: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6d0b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6D07; JUMP; // sstep
case 0x6D07:
                                                     mon("         LDA   #$3B                    ; 6D07: 86 3B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x3b; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6D09; JUMP; // sstep
case 0x6D09:
                                                     mon("         STA   <$41                    ; 6D09: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6CEF
    PC = 0x6D0B; JUMP; // sstep
case 0x6D0B:
                                                     mon("locret_6D0B RTS                           ; 6D0B: 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 =======================================
    // Game over init
  case 0x6D0C:
                                                     mon("L6D0C    JSR   $BD49                   ; 6D0C: BD BD 49      \n"); // Remember
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xbd49; 
    JUMP;
  case 0x6D0F:
                                                     mon("L6D0F    JSR   $BD0D                   ; 6D0F: BD BD 0D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xbd0d; 
    JUMP;
  case 0x6D12:
                                                     mon("L6D12    INC   <$41                    ; 6D12: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6D0C
    PC = 0x6D14; JUMP; // sstep
case 0x6D14:
                                                     mon("         RTS                           ; 6D14: 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 =======================================
    // Game over
  case 0x6D15:
                                                     mon("L6D15    JSR   L61B5                   ; 6D15: BD 61 B5      \n"); // Set up math constants
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x18); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x61b5; 
    JUMP;
  case 0x6D18:
                                                     mon("L6D18    JSR   L615A                   ; 6D18: BD 61 5A      \n"); // More stars/ties init stuff
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x615a; 
    JUMP;
  case 0x6D1B:
                                                     mon("L6D1B    JSR   L61EC                   ; 6D1B: BD 61 EC      \n"); // Init stars math data
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x61ec; 
    JUMP;
  case 0x6D1E:
                                                     mon("L6D1E    LDU   #$5038                  ; 6D1E: CE 50 38      \n"); // Matrix 2
    clockticks = clockticks + 3; 
    U = 0x5038; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x6D21; JUMP; // sstep
case 0x6D21:
                                                     mon("         JSR   $CDC3                   ; 6D21: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x24); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x6D24:
                                                     mon("L6D24    JSR   $C0FF                   ; 6D24: BD C0 FF      \n"); // NVRAM something
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x27); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xc0ff; 
    JUMP;
  case 0x6D27:
                                                     mon("L6D27    JSR   $CA8C                   ; 6D27: BD CA 8C      \n"); // Score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xca8c; 
    JUMP;
  case 0x6D2A:
                                                     mon("L6D2A    LDA   $4AEC                   ; 6D2A: B6 4A EC      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4aec); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6D2D; JUMP; // sstep
case 0x6D2D:
                                                     mon("         BMI   L6D33                   ; 6D2D: 2B 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x6d33; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6D2F; JUMP; // sstep
case 0x6D2F:
                                                     mon("         LDA   #$0F                    ; 6D2F: 86 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x0f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6D31; JUMP; // sstep
case 0x6D31:
                                                     mon("         BRA   L6D38                   ; 6D31: 20 05         \n");
    PC = 0x6d38; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6D33:
                                                     mon("L6D33    JSR   $BD7B                   ; 6D33: BD BD 7B      \n"); // High score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x36); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xbd7b; 
    JUMP;
  case 0x6D36:
                                                     mon("L6D36    LDA   #$05                    ; 6D36: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6D38; JUMP; // sstep
case 0x6D38:
                                                     mon("L6D38    STA   <$41                    ; 6D38: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6D15
    PC = 0x6D3A; JUMP; // sstep
case 0x6D3A:
                                                     mon("         RTS                           ; 6D3A: 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 0x6D3B:
                                                     mon("L6D3B    LDD   #$7304                  ; 6D3B: CC 73 04      \n"); // Exhaust port hit init
    clockticks = clockticks + 3; 
    A = 0x73; 
    B = 0x04; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6D3E; JUMP; // sstep
case 0x6D3E:
                                                     mon("         STD   <$56                    ; 6D3E: DD 56         \n"); // Zoom value
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x56; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6D40; JUMP; // sstep
case 0x6D40:
                                                     mon("         LDD   #$0AFF                  ; 6D40: CC 0A FF      \n");
    clockticks = clockticks + 3; 
    A = 0x0a; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6D43; JUMP; // sstep
case 0x6D43:
                                                     mon("         STD   <$58                    ; 6D43: DD 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x58; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6D45; JUMP; // sstep
case 0x6D45:
                                                     mon("         JSR   L61EC                   ; 6D45: BD 61 EC      \n"); // Init stars math data
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x48); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x61ec; 
    JUMP;
  case 0x6D48:
                                                     mon("L6D48    LDU   #$5038                  ; 6D48: CE 50 38      \n"); // Matrix 2
    clockticks = clockticks + 3; 
    U = 0x5038; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x6D4B; JUMP; // sstep
case 0x6D4B:
                                                     mon("         JSR   $CDC3                   ; 6D4B: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x6D4E:
                                                     mon("L6D4E    INC   <$41                    ; 6D4E: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    PC = 0x6D50; JUMP; // sstep
case 0x6D50:
                                                     mon("         JSR   $BD8F                   ; 6D50: BD BD 8F      \n"); // Death Star destroyed
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x53); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xbd8f; 
    JUMP;
    // End of function sub_6D3B
  case 0x6D53:
                                                     mon("L6D53    RTS                           ; 6D53: 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 0x6D54:
                                                     mon("L6D54    JSR   L75B9                   ; 6D54: BD 75 B9      \n"); // Death Star hit zoom out
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x57); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x75b9; 
    JUMP;
  case 0x6D57:
                                                     mon("L6D57    JSR   $9558                   ; 6D57: BD 95 58      \n"); // Process shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x9558; 
    JUMP;
  case 0x6D5A:
                                                     mon("L6D5A    JSR   $9890                   ; 6D5A: BD 98 90      \n"); // Fireball timer 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x9890; 
    JUMP;
  case 0x6D5D:
                                                     mon("L6D5D    LDB   <$58                    ; 6D5D: D6 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x58); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6D5F; JUMP; // sstep
case 0x6D5F:
                                                     mon("         SEX                           ; 6D5F: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x6D60; JUMP; // sstep
case 0x6D60:
                                                     mon("         ADDD  <$56                    ; 6D60: D3 56         \n"); // Zoom value
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0x56)<<8; 
    ea = ea | rd_mem(DP|0x57); 
    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 = 0x6D62; JUMP; // sstep
case 0x6D62:
                                                     mon("         ADDD  #$80                    ; 6D62: 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 = 0x6D65; JUMP; // sstep
case 0x6D65:
                                                     mon("         ANDB  #$7F                    ; 6D65: C4 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x7f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6D67; JUMP; // sstep
case 0x6D67:
                                                     mon("         STD   <$56                    ; 6D67: DD 56         \n"); // Zoom value
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x56; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6D69; JUMP; // sstep
case 0x6D69:
                                                     mon("         CMPD  #$7680                  ; 6D69: 10 83 76 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x7680; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6D6D; JUMP; // sstep
case 0x6D6D:
                                                     mon("         BCS   L6D73                   ; 6D6D: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6d73; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6D6F; JUMP; // sstep
case 0x6D6F:
                                                     mon("         LDA   #$13                    ; 6D6F: 86 13         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x13; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6D71; JUMP; // sstep
case 0x6D71:
                                                     mon("         STA   <$41                    ; 6D71: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    PC = 0x6D73; JUMP; // sstep
case 0x6D73:
                                                     mon("L6D73    LDD   <$58                    ; 6D73: DC 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x58); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x59); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6D75; JUMP; // sstep
case 0x6D75:
                                                     mon("         SUBD  #$10                    ; 6D75: 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 = 0x6D78; JUMP; // sstep
case 0x6D78:
                                                     mon("         BPL   L6D7D                   ; 6D78: 2A 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6d7d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6D7A; JUMP; // sstep
case 0x6D7A:
                                                     mon("         LDD   #$00                    ; 6D7A: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6D7D; JUMP; // sstep
case 0x6D7D:
                                                     mon("L6D7D    STD   <$58                    ; 6D7D: DD 58         \n"); // Death Star zoom value
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x58; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_6D54
    PC = 0x6D7F; JUMP; // sstep
case 0x6D7F:
                                                     mon("         RTS                           ; 6D7F: 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 0x6D80:
                                                     mon("L6D80    JSR   $BB7B                   ; 6D80: BD BB 7B      \n"); // Death Star explosion init
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xbb7b; 
    JUMP;
  case 0x6D83:
                                                     mon("L6D83    INC   <$41                    ; 6D83: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6D80
    PC = 0x6D85; JUMP; // sstep
case 0x6D85:
                                                     mon("         RTS                           ; 6D85: 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 init
  case 0x6D86:
                                                     mon("L6D86    JSR   L75D9                   ; 6D86: BD 75 D9      \n"); // Space wave
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x75d9; 
    JUMP;
  case 0x6D89:
                                                     mon("L6D89    LDA   $48A1                   ; 6D89: B6 48 A1      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48a1); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6D8C; JUMP; // sstep
case 0x6D8C:
                                                     mon("         CMPA  #$01                    ; 6D8C: 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 = 0x6D8E; JUMP; // sstep
case 0x6D8E:
                                                     mon("         BCS   locret_6D94             ; 6D8E: 25 04         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6d94; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6D90; JUMP; // sstep
case 0x6D90:
                                                     mon("         LDA   #$15                    ; 6D90: 86 15         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x15; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6D92; JUMP; // sstep
case 0x6D92:
                                                     mon("         STA   <$41                    ; 6D92: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6D86
    PC = 0x6D94; JUMP; // sstep
case 0x6D94:
                                                     mon("locret_6D94 RTS                           ; 6D94: 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 0x6D95:
                                                     mon("L6D95    INC   <$41                    ; 6D95: 0C 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x41); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0x41, res); 
    clockticks = clockticks + 2; 
    // End of function sub_6D95
    PC = 0x6D97; JUMP; // sstep
case 0x6D97:
                                                     mon("         RTS                           ; 6D97: 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 0x6D98:
                                                     mon("L6D98    JSR   L760A                   ; 6D98: BD 76 0A      \n"); // Death Star explosion
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x760a; 
    JUMP;
  case 0x6D9B:
                                                     mon("L6D9B    LDA   $48A1                   ; 6D9B: B6 48 A1      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x48a1); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6D9E; JUMP; // sstep
case 0x6D9E:
                                                     mon("         BNE   locret_6DA4             ; 6D9E: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6da4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6DA0; JUMP; // sstep
case 0x6DA0:
                                                     mon("         LDA   #$33                    ; 6DA0: 86 33         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x33; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6DA2; JUMP; // sstep
case 0x6DA2:
                                                     mon("         STA   <$41                    ; 6DA2: 97 41         \n"); // Game mode/screen state
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x41; 
    wr_mem(ea, val); 
    // End of function sub_6D98
    PC = 0x6DA4; JUMP; // sstep
case 0x6DA4:
                                                     mon("locret_6DA4 RTS                           ; 6DA4: 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 stars forward and down translate
  case 0x6DA5:
                                                     mon("L6DA5    LDD   <$89                    ; 6DA5: DC 89         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x89); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x8a); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DA7; JUMP; // sstep
case 0x6DA7:
                                                     mon("         ADDD  #$80                    ; 6DA7: 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 = 0x6DAA; JUMP; // sstep
case 0x6DAA:
                                                     mon("         STD   <$89                    ; 6DAA: DD 89         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x89; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6DAC; JUMP; // sstep
case 0x6DAC:
                                                     mon("         LDD   $4B26                   ; 6DAC: FC 4B 26      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b26); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b27); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DAF; JUMP; // sstep
case 0x6DAF:
                                                     mon("         ADDD  #$80                    ; 6DAF: 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 = 0x6DB2; JUMP; // sstep
case 0x6DB2:
                                                     mon("         STD   $4B26                   ; 6DB2: FD 4B 26      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b26, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b27, B); 
    // End of function sub_6DA5
    PC = 0x6DB5; JUMP; // sstep
case 0x6DB5:
                                                     mon("         RTS                           ; 6DB5: 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 3 stars YT move
  case 0x6DB6:
                                                     mon("L6DB6    LDD   $4B24                   ; 6DB6: FC 4B 24      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b24); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b25); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DB9; JUMP; // sstep
case 0x6DB9:
                                                     mon("         ADDD  #$FF80                  ; 6DB9: C3 FF 80      \n");
    clockticks = clockticks + 4; 
    val = 0xff80; 
    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 = 0x6DBC; JUMP; // sstep
case 0x6DBC:
                                                     mon("         STD   $4B24                   ; 6DBC: FD 4B 24      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b24, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b25, B); 
    // End of function sub_6DB6
    PC = 0x6DBF; JUMP; // sstep
case 0x6DBF:
                                                     mon("         RTS                           ; 6DBF: 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 4 stars ZT move
  case 0x6DC0:
                                                     mon("L6DC0    LDD   $4B26                   ; 6DC0: FC 4B 26      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b26); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b27); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DC3; JUMP; // sstep
case 0x6DC3:
                                                     mon("         ADDD  #$80                    ; 6DC3: 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 = 0x6DC6; JUMP; // sstep
case 0x6DC6:
                                                     mon("         STD   $4B26                   ; 6DC6: FD 4B 26      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x4b26, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b27, B); 
    // End of function sub_6DC0
    PC = 0x6DC9; JUMP; // sstep
case 0x6DC9:
                                                     mon("         RTS                           ; 6DC9: 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 =======================================
    // Move stars XT translate position
  case 0x6DCA:
                                                     mon("L6DCA    LDD   <$89                    ; 6DCA: DC 89         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x89); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x8a); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DCC; JUMP; // sstep
case 0x6DCC:
                                                     mon("         ADDD  #$80                    ; 6DCC: 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 = 0x6DCF; JUMP; // sstep
case 0x6DCF:
                                                     mon("         STD   <$89                    ; 6DCF: DD 89         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x89; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_6DCA
    PC = 0x6DD1; JUMP; // sstep
case 0x6DD1:
                                                     mon("         RTS                           ; 6DD1: 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 0x6DD2:
                                                     mon("L6DD2    LDA   <$63                    ; 6DD2: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6DD4; JUMP; // sstep
case 0x6DD4:
                                                     mon("         BEQ   L6DF0                   ; 6DD4: 27 1A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6df0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6DD6; JUMP; // sstep
case 0x6DD6:
                                                     mon("         BLE   L6DDF                   ; 6DD6: 2F 07         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6ddf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6DD8; JUMP; // sstep
case 0x6DD8:
                                                     mon("         DEC   <$63                    ; 6DD8: 0A 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0x63, res); 
    clockticks = clockticks + 2; 
    PC = 0x6DDA; JUMP; // sstep
case 0x6DDA:
                                                     mon("         LDD   #$04FF                  ; 6DDA: CC 04 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6DDD; JUMP; // sstep
case 0x6DDD:
                                                     mon("         BRA   L6DE4                   ; 6DDD: 20 05         \n");
    PC = 0x6de4; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6DDF:
                                                     mon("L6DDF    INC   <$63                    ; 6DDF: 0C 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x63, res); 
    clockticks = clockticks + 2; 
    PC = 0x6DE1; JUMP; // sstep
case 0x6DE1:
                                                     mon("         LDD   #$FB01                  ; 6DE1: CC FB 01      \n");
    clockticks = clockticks + 3; 
    A = 0xfb; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DE4; JUMP; // sstep
case 0x6DE4:
                                                     mon("L6DE4    STD   $5022                   ; 6DE4: 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 = 0x6DE7; JUMP; // sstep
case 0x6DE7:
                                                     mon("         LDD   #$3FCE                  ; 6DE7: CC 3F CE      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xce; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6DEA; JUMP; // sstep
case 0x6DEA:
                                                     mon("         STD   $5024                   ; 6DEA: 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 = 0x6DED; JUMP; // sstep
case 0x6DED:
                                                     mon("         JSR   $CE24                   ; 6DED: BD CE 24      \n"); // Run math program $00 Roll on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0xce24; 
    JUMP;
  case 0x6DF0:
                                                     mon("L6DF0    JSR   L6EA2                   ; 6DF0: BD 6E A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x6ea2; 
    JUMP;
  case 0x6DF3:
                                                     mon("L6DF3    JSR   L70BD                   ; 6DF3: BD 70 BD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x70bd; 
    JUMP;
  case 0x6DF6:
                                                     mon("L6DF6    JSR   L70CC                   ; 6DF6: BD 70 CC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    PC = 0x70cc; 
    JUMP;
    // End of function sub_6DD2
  case 0x6DF9:
                                                     mon("L6DF9    RTS                           ; 6DF9: 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 0x6DFA:
                                                     mon("L6DFA    LDA   <$63                    ; 6DFA: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6DFC; JUMP; // sstep
case 0x6DFC:
                                                     mon("         BEQ   L6E18                   ; 6DFC: 27 1A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6e18; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6DFE; JUMP; // sstep
case 0x6DFE:
                                                     mon("         BLE   L6E07                   ; 6DFE: 2F 07         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6e07; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E00; JUMP; // sstep
case 0x6E00:
                                                     mon("         DEC   <$63                    ; 6E00: 0A 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0x63, res); 
    clockticks = clockticks + 2; 
    PC = 0x6E02; JUMP; // sstep
case 0x6E02:
                                                     mon("         LDD   #$04FF                  ; 6E02: CC 04 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x04; 
    B = 0xff; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6E05; JUMP; // sstep
case 0x6E05:
                                                     mon("         BRA   L6E0C                   ; 6E05: 20 05         \n");
    PC = 0x6e0c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6E07:
                                                     mon("L6E07    INC   <$63                    ; 6E07: 0C 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(DP|0x63, res); 
    clockticks = clockticks + 2; 
    PC = 0x6E09; JUMP; // sstep
case 0x6E09:
                                                     mon("         LDD   #$FB01                  ; 6E09: CC FB 01      \n");
    clockticks = clockticks + 3; 
    A = 0xfb; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6E0C; JUMP; // sstep
case 0x6E0C:
                                                     mon("L6E0C    STD   $5022                   ; 6E0C: 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 = 0x6E0F; JUMP; // sstep
case 0x6E0F:
                                                     mon("         LDD   #$3FCE                  ; 6E0F: CC 3F CE      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xce; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6E12; JUMP; // sstep
case 0x6E12:
                                                     mon("         STD   $5024                   ; 6E12: 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 = 0x6E15; JUMP; // sstep
case 0x6E15:
                                                     mon("         JSR   $CE24                   ; 6E15: BD CE 24      \n"); // Run math program $00 Roll on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x18); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0xce24; 
    JUMP;
  case 0x6E18:
                                                     mon("L6E18    JSR   L6ECB                   ; 6E18: BD 6E CB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0x6ecb; 
    JUMP;
  case 0x6E1B:
                                                     mon("L6E1B    JSR   L70BD                   ; 6E1B: BD 70 BD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0x70bd; 
    JUMP;
  case 0x6E1E:
                                                     mon("L6E1E    JSR   L70CC                   ; 6E1E: BD 70 CC      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0x70cc; 
    JUMP;
    // End of function sub_6DFA
  case 0x6E21:
                                                     mon("L6E21    RTS                           ; 6E21: 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 0x6E22:
                                                     mon("L6E22    LDA   <$63                    ; 6E22: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6E24; JUMP; // sstep
case 0x6E24:
                                                     mon("         BEQ   L6E2E                   ; 6E24: 27 08         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6e2e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E26; JUMP; // sstep
case 0x6E26:
                                                     mon("         BLE   L6E2B                   ; 6E26: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6e2b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E28; JUMP; // sstep
case 0x6E28:
                                                     mon("         DECA                          ; 6E28: 4A            \n");
    val = (UINT8)A; 
    res = (UINT8)(val - 1); 
    N = res; 
    Z = res; 
    V = val & ~res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x6E29; JUMP; // sstep
case 0x6E29:
                                                     mon("         BRA   L6E2C                   ; 6E29: 20 01         \n");
    PC = 0x6e2c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6E2B:
                                                     mon("L6E2B    INCA                          ; 6E2B: 4C            \n");
    val = (UINT8)A; 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x6E2C; JUMP; // sstep
case 0x6E2C:
                                                     mon("L6E2C    STA   <$63                    ; 6E2C: 97 63         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0x6E2E; JUMP; // sstep
case 0x6E2E:
                                                     mon("L6E2E    LDA   <$63                    ; 6E2E: 96 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6E30; JUMP; // sstep
case 0x6E30:
                                                     mon("         BPL   L6E33                   ; 6E30: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6e33; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E32; JUMP; // sstep
case 0x6E32:
                                                     mon("         NEGA                          ; 6E32: 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 = 0x6E33; JUMP; // sstep
case 0x6E33:
                                                     mon("L6E33    LDB   #$20                    ; 6E33: C6 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6E35; JUMP; // sstep
case 0x6E35:
                                                     mon("         MUL                           ; 6E35: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x6E36; JUMP; // sstep
case 0x6E36:
                                                     mon("         TST   <$63                    ; 6E36: 0D 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6E38; JUMP; // sstep
case 0x6E38:
                                                     mon("         BPL   L6E3E                   ; 6E38: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6e3e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E3A; JUMP; // sstep
case 0x6E3A:
                                                     mon("         COMA                          ; 6E3A: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6E3B; JUMP; // sstep
case 0x6E3B:
                                                     mon("         NEGB                          ; 6E3B: 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 = 0x6E3C; JUMP; // sstep
case 0x6E3C:
                                                     mon("         SBCA  #$FF                    ; 6E3C: 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 = 0x6E3E; JUMP; // sstep
case 0x6E3E:
                                                     mon("L6E3E    STD   <$A5                    ; 6E3E: DD A5         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xa5; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6E40; JUMP; // sstep
case 0x6E40:
                                                     mon("         LDA   <$7D                    ; 6E40: 96 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6E42; JUMP; // sstep
case 0x6E42:
                                                     mon("         BPL   L6E45                   ; 6E42: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6e45; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E44; JUMP; // sstep
case 0x6E44:
                                                     mon("         COMA                          ; 6E44: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6E45; JUMP; // sstep
case 0x6E45:
                                                     mon("L6E45    LDB   #$02                    ; 6E45: C6 02         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x02; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6E47; JUMP; // sstep
case 0x6E47:
                                                     mon("         MUL                           ; 6E47: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x6E48; JUMP; // sstep
case 0x6E48:
                                                     mon("         TST   <$7D                    ; 6E48: 0D 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6E4A; JUMP; // sstep
case 0x6E4A:
                                                     mon("         BPL   L6E50                   ; 6E4A: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6e50; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E4C; JUMP; // sstep
case 0x6E4C:
                                                     mon("         COMA                          ; 6E4C: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6E4D; JUMP; // sstep
case 0x6E4D:
                                                     mon("         NEGB                          ; 6E4D: 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 = 0x6E4E; JUMP; // sstep
case 0x6E4E:
                                                     mon("         SBCA  #$FF                    ; 6E4E: 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 = 0x6E50; JUMP; // sstep
case 0x6E50:
                                                     mon("L6E50    ADDD  <$A5                    ; 6E50: D3 A5         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa5)<<8; 
    ea = ea | rd_mem(DP|0xa6); 
    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 = 0x6E52; JUMP; // sstep
case 0x6E52:
                                                     mon("         TST   <$63                    ; 6E52: 0D 63         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x63); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6E54; JUMP; // sstep
case 0x6E54:
                                                     mon("         BNE   L6E70                   ; 6E54: 26 1A         \n"); // Towers collision roll limits
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6e70; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E56; JUMP; // sstep
case 0x6E56:
                                                     mon("         SUBD  <$A3                    ; 6E56: 93 A3         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa3)<<8; 
    ea = ea | rd_mem(DP|0xa4); 
    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 = 0x6E58; JUMP; // sstep
case 0x6E58:
                                                     mon("         BLE   L6E65                   ; 6E58: 2F 0B         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6e65; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E5A; JUMP; // sstep
case 0x6E5A:
                                                     mon("         CMPD  #$10                    ; 6E5A: 10 83 00 10   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0010; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6E5E; JUMP; // sstep
case 0x6E5E:
                                                     mon("         BLE   L6E63                   ; 6E5E: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6e63; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E60; JUMP; // sstep
case 0x6E60:
                                                     mon("         LDD   #$10                    ; 6E60: CC 00 10      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x10; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6E63; JUMP; // sstep
case 0x6E63:
                                                     mon("L6E63    BRA   L6E6E                   ; 6E63: 20 09         \n");
    PC = 0x6e6e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6E65:
                                                     mon("L6E65    CMPD  #$FFF0                  ; 6E65: 10 83 FF F0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfff0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6E69; JUMP; // sstep
case 0x6E69:
                                                     mon("         BGE   L6E6E                   ; 6E69: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x6e6e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E6B; JUMP; // sstep
case 0x6E6B:
                                                     mon("         LDD   #$FFF0                  ; 6E6B: CC FF F0      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0xf0; 
    Z = A|B; 
    N = A; 
    V = 0; 
    // End of function sub_6E22
    PC = 0x6E6E; JUMP; // sstep
case 0x6E6E:
                                                     mon("L6E6E    BRA   L6E88                   ; 6E6E: 20 18         \n");
    PC = 0x6e88; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
    // Towers collision roll limits
  case 0x6E70:
                                                     mon("L6E70    SUBD  <$A3                    ; 6E70: 93 A3         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa3)<<8; 
    ea = ea | rd_mem(DP|0xa4); 
    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 = 0x6E72; JUMP; // sstep
case 0x6E72:
                                                     mon("         BLE   L6E7F                   ; 6E72: 2F 0B         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6e7f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E74; JUMP; // sstep
case 0x6E74:
                                                     mon("         CMPD  #$32                    ; 6E74: 10 83 00 32   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0032; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6E78; JUMP; // sstep
case 0x6E78:
                                                     mon("         BLE   L6E7D                   ; 6E78: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6e7d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E7A; JUMP; // sstep
case 0x6E7A:
                                                     mon("         LDD   #$32                    ; 6E7A: CC 00 32      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x32; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6E7D; JUMP; // sstep
case 0x6E7D:
                                                     mon("L6E7D    BRA   L6E88                   ; 6E7D: 20 09         \n");
    PC = 0x6e88; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6E7F:
                                                     mon("L6E7F    CMPD  #$FFCE                  ; 6E7F: 10 83 FF CE   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xffce; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6E83; JUMP; // sstep
case 0x6E83:
                                                     mon("         BGE   L6E88                   ; 6E83: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x6e88; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E85; JUMP; // sstep
case 0x6E85:
                                                     mon("         LDD   #$FFCE                  ; 6E85: CC FF CE      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0xce; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6E88; JUMP; // sstep
case 0x6E88:
                                                     mon("L6E88    TFR   B,A                     ; 6E88: 1F 98         \n");
    A = (UINT8)B; 
    clockticks = clockticks + 6; 
    PC = 0x6E8A; JUMP; // sstep
case 0x6E8A:
                                                     mon("         ADDA  $4878                   ; 6E8A: BB 48 78      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4878); 
    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 = 0x6E8D; JUMP; // sstep
case 0x6E8D:
                                                     mon("         STA   $4878                   ; 6E8D: B7 48 78      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4878, val); 
    PC = 0x6E90; JUMP; // sstep
case 0x6E90:
                                                     mon("         SEX                           ; 6E90: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x6E91; JUMP; // sstep
case 0x6E91:
                                                     mon("         ADDD  <$A3                    ; 6E91: D3 A3         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa3)<<8; 
    ea = ea | rd_mem(DP|0xa4); 
    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 = 0x6E93; JUMP; // sstep
case 0x6E93:
                                                     mon("         STD   <$A3                    ; 6E93: DD A3         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xa3; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x6E95; JUMP; // sstep
case 0x6E95:
                                                     mon("         LDX   #$4870                  ; 6E95: 8E 48 70      \n");
    clockticks = clockticks + 3; 
    X = 0x4870; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x6E98; JUMP; // sstep
case 0x6E98:
                                                     mon("         JSR   L7111                   ; 6E98: BD 71 11      \n"); // Some joystick driven matrix rotations for pitch/roll
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0x7111; 
    JUMP;
  case 0x6E9B:
                                                     mon("L6E9B    BEQ   locret_6EA0             ; 6E9B: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x6ea0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6E9D; JUMP; // sstep
case 0x6E9D:
                                                     mon("         JSR   $CE24                   ; 6E9D: BD CE 24      \n"); // Run math program $00 Roll on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0xce24; 
    JUMP;
    // End of function sub_6E70
  case 0x6EA0:
                                                     mon("locret_6EA0 RTS                           ; 6EA0: 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 nullsub_1
  case 0x6EA1:
                                                     mon("nullL1   RTS                           ; 6EA1: 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 0x6EA2:
                                                     mon("L6EA2    LDX   $4B32                   ; 6EA2: BE 4B 32      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b32)<<8; 
    ea = ea | rd_mem(0x4b33); 
    X = ea; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x6EA5; JUMP; // sstep
case 0x6EA5:
                                                     mon("         BNE   L6EAA                   ; 6EA5: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6eaa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6EA7; JUMP; // sstep
case 0x6EA7:
                                                     mon("         LDX   #$4900                  ; 6EA7: 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 = 0x6EAA; JUMP; // sstep
case 0x6EAA:
                                                     mon("L6EAA    LDA   $03,X                   ; 6EAA: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6EAC; JUMP; // sstep
case 0x6EAC:
                                                     mon("         CMPA  #$01                    ; 6EAC: 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 = 0x6EAE; JUMP; // sstep
case 0x6EAE:
                                                     mon("         BNE   L6EB9                   ; 6EAE: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6eb9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6EB0; JUMP; // sstep
case 0x6EB0:
                                                     mon("         LDA   $06,X                   ; 6EB0: A6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6EB2; JUMP; // sstep
case 0x6EB2:
                                                     mon("         BNE   L6EB9                   ; 6EB2: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x6eb9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6EB4; JUMP; // sstep
case 0x6EB4:
                                                     mon("         STX   <$64                    ; 6EB4: 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 = 0x6EB6; JUMP; // sstep
case 0x6EB6:
                                                     mon("         JMP   L6EF7                   ; 6EB6: 7E 6E F7      \n"); // Point BIC to 5080
    clockticks = clockticks + 4; 
    PC = 0x6ef7; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x6EB9:
                                                     mon("L6EB9    LDA   $4B3C                   ; 6EB9: B6 4B 3C      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3c); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6EBC; JUMP; // sstep
case 0x6EBC:
                                                     mon("         BLE   L6EC3                   ; 6EBC: 2F 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6ec3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6EBE; JUMP; // sstep
case 0x6EBE:
                                                     mon("         LDA   #$09                    ; 6EBE: 86 09         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x09; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6EC0; JUMP; // sstep
case 0x6EC0:
                                                     mon("         STA   $4B3C                   ; 6EC0: B7 4B 3C      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b3c, val); 
    PC = 0x6EC3; JUMP; // sstep
case 0x6EC3:
                                                     mon("L6EC3    LEAX  $19,X                   ; 6EC3: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x6EC6; JUMP; // sstep
case 0x6EC6:
                                                     mon("         CMPX  #$494B                  ; 6EC6: 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 = 0x6EC9; JUMP; // sstep
case 0x6EC9:
                                                     mon("         BCS   L6EAA                   ; 6EC9: 25 DF         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x6eaa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6ECB; JUMP; // sstep
case 0x6ECB:
                                                     mon("L6ECB    LDD   #$00                    ; 6ECB: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6ECE; JUMP; // sstep
case 0x6ECE:
                                                     mon("         STD   $4B32                   ; 6ECE: FD 4B 32      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4b32, A); // Care needed with I/O space and word fetches
    wr_mem(0x4b33, B); 
    PC = 0x6ED1; JUMP; // sstep
case 0x6ED1:
                                                     mon("         LDA   $5080                   ; 6ED1: B6 50 80      \n"); // Matrix 4
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5080); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6ED4; JUMP; // sstep
case 0x6ED4:
                                                     mon("         BMI   L6EDB                   ; 6ED4: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x6edb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6ED6; JUMP; // sstep
case 0x6ED6:
                                                     mon("         LDB   $5084                   ; 6ED6: F6 50 84      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5084); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6ED9; JUMP; // sstep
case 0x6ED9:
                                                     mon("         BRA   L6EE0                   ; 6ED9: 20 05         \n");
    PC = 0x6ee0; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6EDB:
                                                     mon("L6EDB    LDB   #$7F                    ; 6EDB: C6 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x7f; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6EDD; JUMP; // sstep
case 0x6EDD:
                                                     mon("         SUBB  $5084                   ; 6EDD: F0 50 84      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x5084); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0x6EE0; JUMP; // sstep
case 0x6EE0:
                                                     mon("L6EE0    STB   $486D                   ; 6EE0: F7 48 6D      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x486d, val); 
    PC = 0x6EE3; JUMP; // sstep
case 0x6EE3:
                                                     mon("         LDA   $5080                   ; 6EE3: B6 50 80      \n"); // Matrix 4
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5080); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6EE6; JUMP; // sstep
case 0x6EE6:
                                                     mon("         BMI   L6EED                   ; 6EE6: 2B 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x6eed; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6EE8; JUMP; // sstep
case 0x6EE8:
                                                     mon("         LDB   $5082                   ; 6EE8: F6 50 82      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5082); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6EEB; JUMP; // sstep
case 0x6EEB:
                                                     mon("         BRA   L6EF2                   ; 6EEB: 20 05         \n");
    PC = 0x6ef2; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6EED:
                                                     mon("L6EED    LDB   #$7F                    ; 6EED: C6 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x7f; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6EEF; JUMP; // sstep
case 0x6EEF:
                                                     mon("         SUBB  $5082                   ; 6EEF: F0 50 82      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)B; 
    arg = rd_mem(0x5082); 
    res = val - (UINT8)arg; 
/**/C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    B = (UINT8)(res); 
    PC = 0x6EF2; JUMP; // sstep
case 0x6EF2:
                                                     mon("L6EF2    COMB                          ; 6EF2: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6EF3; JUMP; // sstep
case 0x6EF3:
                                                     mon("         STB   $4876                   ; 6EF3: F7 48 76      \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4876, val); 
    PC = 0x6EF6; JUMP; // sstep
case 0x6EF6:
                                                     mon("         RTS                           ; 6EF6: 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 0x6EF7:
                                                     mon("L6EF7    LDA   #$10                    ; 6EF7: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6EF9; JUMP; // sstep
case 0x6EF9:
                                                     mon("         JSR   $CE0C                   ; 6EF9: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x6EFC:
                                                     mon("L6EFC    JSR   L7160                   ; 6EFC: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xff); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x6EFF:
                                                     mon("L6EFF    LDX   <$64                    ; 6EFF: 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 = 0x6F01; JUMP; // sstep
case 0x6F01:
                                                     mon("         STX   $4B32                   ; 6F01: BF 4B 32      \n");
    clockticks = clockticks + 5; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x4b32, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4b33, (UINT8)val); 
    PC = 0x6F04; JUMP; // sstep
case 0x6F04:
                                                     mon("         CLRA                          ; 6F04: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6F05; JUMP; // sstep
case 0x6F05:
                                                     mon("         LDB   $02,X                   ; 6F05: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6F07; JUMP; // sstep
case 0x6F07:
                                                     mon("         ADDB  #$03                    ; 6F07: 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 = 0x6F09; JUMP; // sstep
case 0x6F09:
                                                     mon("         STD   $4701                   ; 6F09: 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 = 0x6F0C; JUMP; // sstep
case 0x6F0C:
                                                     mon("         LDA   #$67                    ; 6F0C: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6F0E; JUMP; // sstep
case 0x6F0E:
                                                     mon("         JSR   $CDBA                   ; 6F0E: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x11); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x6F11:
                                                     mon("L6F11    LDA   $5000                   ; 6F11: B6 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5000); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6F14; JUMP; // sstep
case 0x6F14:
                                                     mon("         BLE   L6F39                   ; 6F14: 2F 23         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6f39; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F16; JUMP; // sstep
case 0x6F16:
                                                     mon("         LDD   $5002                   ; 6F16: 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 = 0x6F19; JUMP; // sstep
case 0x6F19:
                                                     mon("L6F19    ASL   $5001                   ; 6F19: 78 50 01      \n"); // Math result X
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5001); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(0x5001, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F1C; JUMP; // sstep
case 0x6F1C:
                                                     mon("         ROL   $5000                   ; 6F1C: 79 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5000); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    wr_mem(0x5000, (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0x6F1F; JUMP; // sstep
case 0x6F1F:
                                                     mon("         BVS   L6F54                   ; 6F1F: 29 33         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x6f54; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F21; JUMP; // sstep
case 0x6F21:
                                                     mon("         ASLB                          ; 6F21: 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 = 0x6F22; JUMP; // sstep
case 0x6F22:
                                                     mon("         ROLA                          ; 6F22: 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 = 0x6F23; JUMP; // sstep
case 0x6F23:
                                                     mon("         BVC   L6F29                   ; 6F23: 28 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x6f29; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F25; JUMP; // sstep
case 0x6F25:
                                                     mon("         RORA                          ; 6F25: 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 = 0x6F26; JUMP; // sstep
case 0x6F26:
                                                     mon("         RORB                          ; 6F26: 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 = 0x6F27; JUMP; // sstep
case 0x6F27:
                                                     mon("         BRA   L6F54                   ; 6F27: 20 2B         \n");
    PC = 0x6f54; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6F29:
                                                     mon("L6F29    ASL   $5005                   ; 6F29: 78 50 05      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5005); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(0x5005, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F2C; JUMP; // sstep
case 0x6F2C:
                                                     mon("         ROL   $5004                   ; 6F2C: 79 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5004); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    wr_mem(0x5004, (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0x6F2F; JUMP; // sstep
case 0x6F2F:
                                                     mon("         BVC   L6F19                   ; 6F2F: 28 E8         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x6f19; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F31; JUMP; // sstep
case 0x6F31:
                                                     mon("         ROR   $5004                   ; 6F31: 76 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x5004)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem(0x5004, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F34; JUMP; // sstep
case 0x6F34:
                                                     mon("         ROR   $5005                   ; 6F34: 76 50 05      \n"); // Math result Z
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x5005)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
    Z = res; 
    N = res; 
    wr_mem(0x5005, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F37; JUMP; // sstep
case 0x6F37:
                                                     mon("         BRA   L6F54                   ; 6F37: 20 1B         \n");
    PC = 0x6f54; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6F39:
                                                     mon("L6F39    LDD   $5002                   ; 6F39: 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 = 0x6F3C; JUMP; // sstep
case 0x6F3C:
                                                     mon("         ORB   #$01                    ; 6F3C: CA 01         \n");
    clockticks = clockticks + 2; 
    res = B | (UINT8)0x01; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x6F3E; JUMP; // sstep
case 0x6F3E:
                                                     mon("L6F3E    ASLB                          ; 6F3E: 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 = 0x6F3F; JUMP; // sstep
case 0x6F3F:
                                                     mon("         ROLA                          ; 6F3F: 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 = 0x6F40; JUMP; // sstep
case 0x6F40:
                                                     mon("         BVC   L6F46                   ; 6F40: 28 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x6f46; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F42; JUMP; // sstep
case 0x6F42:
                                                     mon("         RORA                          ; 6F42: 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 = 0x6F43; JUMP; // sstep
case 0x6F43:
                                                     mon("         RORB                          ; 6F43: 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 = 0x6F44; JUMP; // sstep
case 0x6F44:
                                                     mon("         BRA   L6F54                   ; 6F44: 20 0E         \n");
    PC = 0x6f54; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6F46:
                                                     mon("L6F46    ASL   $5005                   ; 6F46: 78 50 05      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5005); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(0x5005, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F49; JUMP; // sstep
case 0x6F49:
                                                     mon("         ROL   $5004                   ; 6F49: 79 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5004); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    wr_mem(0x5004, (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0x6F4C; JUMP; // sstep
case 0x6F4C:
                                                     mon("         BVC   L6F3E                   ; 6F4C: 28 F0         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x6f3e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F4E; JUMP; // sstep
case 0x6F4E:
                                                     mon("         ROR   $5004                   ; 6F4E: 76 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x5004)) | ((C != 0) ? 0x100 : 0); 
    C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem(0x5004, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F51; JUMP; // sstep
case 0x6F51:
                                                     mon("         ROR   $5005                   ; 6F51: 76 50 05      \n"); // Math result Z
    clockticks = clockticks + 5; 
    res = ((UINT8)rd_mem(0x5005)) | ((C != 0) ? 0x100 : 0); 
/**/C = res & 1; 
    res = (UINT8)(res >> 1); 
/**/Z = res; 
/**/N = res; 
    wr_mem(0x5005, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F54; JUMP; // sstep
case 0x6F54:
                                                     mon("L6F54    COMA                          ; 6F54: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6F55; JUMP; // sstep
case 0x6F55:
                                                     mon("         STA   $4876                   ; 6F55: B7 48 76      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4876, val); 
    PC = 0x6F58; JUMP; // sstep
case 0x6F58:
                                                     mon("         LDB   $5004                   ; 6F58: F6 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5004); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x6F5B; JUMP; // sstep
case 0x6F5B:
                                                     mon("         STB   $486D                   ; 6F5B: F7 48 6D      \n");
    clockticks = clockticks + 5; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x486d, val); 
    // End of function sub_6EA2
    PC = 0x6F5E; JUMP; // sstep
case 0x6F5E:
                                                     mon("         RTS                           ; 6F5E: 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 0x6F5F:
                                                     mon("L6F5F    LDD   <$42                    ; 6F5F: DC 42         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x42); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x43); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6F61; JUMP; // sstep
case 0x6F61:
                                                     mon("         JSR   $CDAB                   ; 6F61: BD CD AB      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcdab; 
    JUMP;
  case 0x6F64:
                                                     mon("L6F64    STD   <$89                    ; 6F64: DD 89         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x89; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_6F5F
    PC = 0x6F66; JUMP; // sstep
case 0x6F66:
                                                     mon("         RTS                           ; 6F66: 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 0x6F67:
                                                     mon("L6F67    LDD   <$42                    ; 6F67: DC 42         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x42); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x43); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6F69; JUMP; // sstep
case 0x6F69:
                                                     mon("         JSR   $CDA9                   ; 6F69: BD CD A9      \n"); // Shift D register left
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcda9; 
    JUMP;
  case 0x6F6C:
                                                     mon("L6F6C    STD   <$89                    ; 6F6C: DD 89         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x89; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    // End of function sub_6F67
    PC = 0x6F6E; JUMP; // sstep
case 0x6F6E:
                                                     mon("         RTS                           ; 6F6E: 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 0x6F6F:
                                                     mon("L6F6F    LDD   $5086                   ; 6F6F: 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 = 0x6F72; JUMP; // sstep
case 0x6F72:
                                                     mon("         ADDD  $5098                   ; 6F72: 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 = 0x6F75; JUMP; // sstep
case 0x6F75:
                                                     mon("         BVC   L6F7D                   ; 6F75: 28 06         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x6f7d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F77; JUMP; // sstep
case 0x6F77:
                                                     mon("         INC   <$A7                    ; 6F77: 0C A7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa7); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(DP|0xa7, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F79; JUMP; // sstep
case 0x6F79:
                                                     mon("         BVC   L6F7D                   ; 6F79: 28 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x6f7d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F7B; JUMP; // sstep
case 0x6F7B:
                                                     mon("         DEC   <$A7                    ; 6F7B: 0A A7         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0xa7); 
    res = (UINT8)(val - 1); 
/**/N = res; 
/**/Z = res; 
/**/V = val & ~res; 
    wr_mem(DP|0xa7, res); 
    clockticks = clockticks + 2; 
    PC = 0x6F7D; JUMP; // sstep
case 0x6F7D:
                                                     mon("L6F7D    STD   $5098                   ; 6F7D: 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 = 0x6F80; JUMP; // sstep
case 0x6F80:
                                                     mon("         STD   $5040                   ; 6F80: 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 = 0x6F83; JUMP; // sstep
case 0x6F83:
                                                     mon("         LDD   $5086                   ; 6F83: 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 = 0x6F86; JUMP; // sstep
case 0x6F86:
                                                     mon("         JSR   $CDB1                   ; 6F86: BD CD B1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcdb1; 
    JUMP;
  case 0x6F89:
                                                     mon("L6F89    LDB   <$7D                    ; 6F89: D6 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6F8B; JUMP; // sstep
case 0x6F8B:
                                                     mon("         BPL   L6F8E                   ; 6F8B: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6f8e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F8D; JUMP; // sstep
case 0x6F8D:
                                                     mon("         COMB                          ; 6F8D: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6F8E; JUMP; // sstep
case 0x6F8E:
                                                     mon("L6F8E    ASLB                          ; 6F8E: 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 = 0x6F8F; JUMP; // sstep
case 0x6F8F:
                                                     mon("         MUL                           ; 6F8F: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x6F90; JUMP; // sstep
case 0x6F90:
                                                     mon("         TST   <$7D                    ; 6F90: 0D 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6F92; JUMP; // sstep
case 0x6F92:
                                                     mon("         BGE   L6F98                   ; 6F92: 2C 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x6f98; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6F94; JUMP; // sstep
case 0x6F94:
                                                     mon("         COMA                          ; 6F94: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6F95; JUMP; // sstep
case 0x6F95:
                                                     mon("         NEGB                          ; 6F95: 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 = 0x6F96; JUMP; // sstep
case 0x6F96:
                                                     mon("         SBCA  #$FF                    ; 6F96: 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 = 0x6F98; JUMP; // sstep
case 0x6F98:
                                                     mon("L6F98    JSR   $CDA0                   ; 6F98: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0x6F9B:
                                                     mon("L6F9B    STD   $508E                   ; 6F9B: FD 50 8E      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x508e, A); // Care needed with I/O space and word fetches
    wr_mem(0x508f, B); 
    PC = 0x6F9E; JUMP; // sstep
case 0x6F9E:
                                                     mon("         ADDD  $509A                   ; 6F9E: 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 = 0x6FA1; JUMP; // sstep
case 0x6FA1:
                                                     mon("         STD   $509A                   ; 6FA1: FD 50 9A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509a, A); // Care needed with I/O space and word fetches
    wr_mem(0x509b, B); 
    PC = 0x6FA4; JUMP; // sstep
case 0x6FA4:
                                                     mon("         STD   $5042                   ; 6FA4: 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 = 0x6FA7; JUMP; // sstep
case 0x6FA7:
                                                     mon("         LDD   $5086                   ; 6FA7: 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 = 0x6FAA; JUMP; // sstep
case 0x6FAA:
                                                     mon("         JSR   $CDB1                   ; 6FAA: BD CD B1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcdb1; 
    JUMP;
  case 0x6FAD:
                                                     mon("L6FAD    LDB   <$7F                    ; 6FAD: D6 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7f); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x6FAF; JUMP; // sstep
case 0x6FAF:
                                                     mon("         BPL   L6FB2                   ; 6FAF: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6fb2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6FB1; JUMP; // sstep
case 0x6FB1:
                                                     mon("         COMB                          ; 6FB1: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6FB2; JUMP; // sstep
case 0x6FB2:
                                                     mon("L6FB2    NOP                           ; 6FB2: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0x6FB3; JUMP; // sstep
case 0x6FB3:
                                                     mon("         MUL                           ; 6FB3: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x6FB4; JUMP; // sstep
case 0x6FB4:
                                                     mon("         TST   <$7F                    ; 6FB4: 0D 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7f); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x6FB6; JUMP; // sstep
case 0x6FB6:
                                                     mon("         BPL   L6FBC                   ; 6FB6: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x6fbc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6FB8; JUMP; // sstep
case 0x6FB8:
                                                     mon("         COMA                          ; 6FB8: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x6FB9; JUMP; // sstep
case 0x6FB9:
                                                     mon("         NEGB                          ; 6FB9: 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 = 0x6FBA; JUMP; // sstep
case 0x6FBA:
                                                     mon("         SBCA  #$FF                    ; 6FBA: 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 = 0x6FBC; JUMP; // sstep
case 0x6FBC:
                                                     mon("L6FBC    JSR   $CDA0                   ; 6FBC: BD CD A0      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x6f); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0x6FBF:
                                                     mon("L6FBF    STD   $5096                   ; 6FBF: FD 50 96      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5096, A); // Care needed with I/O space and word fetches
    wr_mem(0x5097, B); 
    PC = 0x6FC2; JUMP; // sstep
case 0x6FC2:
                                                     mon("         ADDD  $509C                   ; 6FC2: F3 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 ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x6FC5; JUMP; // sstep
case 0x6FC5:
                                                     mon("         CMPD  #$1C00                  ; 6FC5: 10 83 1C 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x1c00; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6FC9; JUMP; // sstep
case 0x6FC9:
                                                     mon("         BLE   L6FD0                   ; 6FC9: 2F 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6fd0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6FCB; JUMP; // sstep
case 0x6FCB:
                                                     mon("         LDD   #$1C00                  ; 6FCB: CC 1C 00      \n");
    clockticks = clockticks + 3; 
    A = 0x1c; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x6FCE; JUMP; // sstep
case 0x6FCE:
                                                     mon("         BRA   L6FD9                   ; 6FCE: 20 09         \n");
    PC = 0x6fd9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x6FD0:
                                                     mon("L6FD0    CMPD  #$0200                  ; 6FD0: 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 = 0x6FD4; JUMP; // sstep
case 0x6FD4:
                                                     mon("         BGE   L6FD9                   ; 6FD4: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x6fd9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6FD6; JUMP; // sstep
case 0x6FD6:
                                                     mon("         LDD   #$0200                  ; 6FD6: CC 02 00      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x6FD9; JUMP; // sstep
case 0x6FD9:
                                                     mon("L6FD9    STD   $509C                   ; 6FD9: FD 50 9C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    PC = 0x6FDC; JUMP; // sstep
case 0x6FDC:
                                                     mon("         STD   $5044                   ; 6FDC: 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_6F6F
    PC = 0x6FDF; JUMP; // sstep
case 0x6FDF:
                                                     mon("         RTS                           ; 6FDF: 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 0x6FE0:
                                                     mon("L6FE0    LDD   $509C                   ; 6FE0: 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 = 0x6FE3; JUMP; // sstep
case 0x6FE3:
                                                     mon("         CMPD  #$0380                  ; 6FE3: 10 83 03 80   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0380; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6FE7; JUMP; // sstep
case 0x6FE7:
                                                     mon("         BLE   L6FEF                   ; 6FE7: 2F 06         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x6fef; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6FE9; JUMP; // sstep
case 0x6FE9:
                                                     mon("         SUBD  #$0180                  ; 6FE9: 83 01 80      \n");
    clockticks = clockticks + 4; 
    val = 0x0180; 
    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 = 0x6FEC; JUMP; // sstep
case 0x6FEC:
                                                     mon("         STD   $509C                   ; 6FEC: FD 50 9C      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    // End of function sub_6FE0
    PC = 0x6FEF; JUMP; // sstep
case 0x6FEF:
                                                     mon("L6FEF    BRA   L7000                   ; 6FEF: 20 0F         \n");
    PC = 0x7000; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // =============== S U B R O U T I N E =======================================
  case 0x6FF1:
                                                     mon("L6FF1    LDD   $509C                   ; 6FF1: 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 = 0x6FF4; JUMP; // sstep
case 0x6FF4:
                                                     mon("         CMPD  #$F300                  ; 6FF4: 10 83 F3 00   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xf300; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x6FF8; JUMP; // sstep
case 0x6FF8:
                                                     mon("         BLE   L7000                   ; 6FF8: 2F 06         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x7000; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x6FFA; JUMP; // sstep
case 0x6FFA:
                                                     mon("         SUBD  #$0100                  ; 6FFA: 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 = 0x6FFD; JUMP; // sstep
case 0x6FFD:
                                                     mon("         STD   $509C                   ; 6FFD: FD 50 9C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    PC = 0x7000; JUMP; // sstep
case 0x7000:
                                                     mon("L7000    LDD   $5086                   ; 7000: 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 = 0x7003; JUMP; // sstep
case 0x7003:
                                                     mon("         ADDD  $5098                   ; 7003: 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 = 0x7006; JUMP; // sstep
case 0x7006:
                                                     mon("         STD   $5098                   ; 7006: 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 = 0x7009; JUMP; // sstep
case 0x7009:
                                                     mon("         LDD   #$0300                  ; 7009: CC 03 00      \n");
    clockticks = clockticks + 3; 
    A = 0x03; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x700C; JUMP; // sstep
case 0x700C:
                                                     mon("         SUBD  $5086                   ; 700C: 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 = 0x700F; JUMP; // sstep
case 0x700F:
                                                     mon("         JSR   $CDA2                   ; 700F: BD CD A2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0xcda2; 
    JUMP;
  case 0x7012:
                                                     mon("L7012    ADDD  $5086                   ; 7012: 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 = 0x7015; JUMP; // sstep
case 0x7015:
                                                     mon("         STD   $5086                   ; 7015: FD 50 86      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5086, A); // Care needed with I/O space and word fetches
    wr_mem(0x5087, B); 
    PC = 0x7018; JUMP; // sstep
case 0x7018:
                                                     mon("         LDA   $4B15                   ; 7018: B6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x701B; JUMP; // sstep
case 0x701B:
                                                     mon("         LSRA                          ; 701B: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x701C; JUMP; // sstep
case 0x701C:
                                                     mon("         BCC   L7023                   ; 701C: 24 05         \n"); // Towers roll calcs
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x7023; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x701E; JUMP; // sstep
case 0x701E:
                                                     mon("         LDD   #$0BB8                  ; 701E: CC 0B B8      \n");
    clockticks = clockticks + 3; 
    A = 0x0b; 
    B = 0xb8; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x7021; JUMP; // sstep
case 0x7021:
                                                     mon("         BRA   L7026                   ; 7021: 20 03         \n");
    PC = 0x7026; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x7023:
                                                     mon("L7023    LDD   #$F448                  ; 7023: CC F4 48      \n"); // Towers roll calcs
    clockticks = clockticks + 3; 
    A = 0xf4; 
    B = 0x48; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7026; JUMP; // sstep
case 0x7026:
                                                     mon("L7026    STD   $5022                   ; 7026: 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 = 0x7029; JUMP; // sstep
case 0x7029:
                                                     mon("         LDD   #$3EEB                  ; 7029: CC 3E EB      \n");
    clockticks = clockticks + 3; 
    A = 0x3e; 
    B = 0xeb; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x702C; JUMP; // sstep
case 0x702C:
                                                     mon("         STD   $5024                   ; 702C: 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 = 0x702F; JUMP; // sstep
case 0x702F:
                                                     mon("         JSR   $CE24                   ; 702F: BD CE 24      \n"); // Run math program $00 Roll on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x32); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0xce24; 
    JUMP;
  case 0x7032:
                                                     mon("L7032    LDD   #$00                    ; 7032: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7035; JUMP; // sstep
case 0x7035:
                                                     mon("         SUBD  <$A3                    ; 7035: 93 A3         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xa3)<<8; 
    ea = ea | rd_mem(DP|0xa4); 
    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 = 0x7037; JUMP; // sstep
case 0x7037:
                                                     mon("         JSR   L6E70                   ; 7037: BD 6E 70      \n"); // Towers collision roll limits
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0x6e70; 
    JUMP;
    // End of function sub_6FF1
  case 0x703A:
                                                     mon("L703A    RTS                           ; 703A: 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 viewpoint calc
  case 0x703B:
                                                     mon("L703B    LDD   $5086                   ; 703B: 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 = 0x703E; JUMP; // sstep
case 0x703E:
                                                     mon("         ADDD  $5098                   ; 703E: 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 = 0x7041; JUMP; // sstep
case 0x7041:
                                                     mon("         STD   $5098                   ; 7041: 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 = 0x7044; JUMP; // sstep
case 0x7044:
                                                     mon("         STD   $5040                   ; 7044: 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 = 0x7047; JUMP; // sstep
case 0x7047:
                                                     mon("         LDD   $5086                   ; 7047: 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 = 0x704A; JUMP; // sstep
case 0x704A:
                                                     mon("         JSR   $CDB1                   ; 704A: BD CD B1      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0xcdb1; 
    JUMP;
  case 0x704D:
                                                     mon("L704D    LDB   <$7D                    ; 704D: D6 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x704F; JUMP; // sstep
case 0x704F:
                                                     mon("         BPL   L7052                   ; 704F: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7052; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7051; JUMP; // sstep
case 0x7051:
                                                     mon("         COMB                          ; 7051: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x7052; JUMP; // sstep
case 0x7052:
                                                     mon("L7052    MUL                           ; 7052: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x7053; JUMP; // sstep
case 0x7053:
                                                     mon("L7053    TST   <$7D                    ; 7053: 0D 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7d); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7055; JUMP; // sstep
case 0x7055:
                                                     mon("         BGE   L705B                   ; 7055: 2C 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x705b; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7057; JUMP; // sstep
case 0x7057:
                                                     mon("         COMA                          ; 7057: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x7058; JUMP; // sstep
case 0x7058:
                                                     mon("         NEGB                          ; 7058: 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 = 0x7059; JUMP; // sstep
case 0x7059:
                                                     mon("         SBCA  #$FF                    ; 7059: 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 = 0x705B; JUMP; // sstep
case 0x705B:
                                                     mon("L705B    JSR   $CDA0                   ; 705B: BD CD A0      \n"); // Trench X min/max limits
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0xcda0; 
    JUMP;
  case 0x705E:
                                                     mon("L705E    STD   $508E                   ; 705E: FD 50 8E      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x508e, A); // Care needed with I/O space and word fetches
    wr_mem(0x508f, B); 
    PC = 0x7061; JUMP; // sstep
case 0x7061:
                                                     mon("         ADDD  $509A                   ; 7061: 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 = 0x7064; JUMP; // sstep
case 0x7064:
                                                     mon("         CMPD  #$01FF                  ; 7064: 10 83 01 FF   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x01ff; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x7068; JUMP; // sstep
case 0x7068:
                                                     mon("         BLE   L706D                   ; 7068: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x706d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x706A; JUMP; // sstep
case 0x706A:
                                                     mon("         LDD   #$01FF                  ; 706A: CC 01 FF      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x706D; JUMP; // sstep
case 0x706D:
                                                     mon("L706D    CMPD  #$FE01                  ; 706D: 10 83 FE 01   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfe01; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x7071; JUMP; // sstep
case 0x7071:
                                                     mon("         BGE   L7076                   ; 7071: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x7076; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7073; JUMP; // sstep
case 0x7073:
                                                     mon("         LDD   #$FE01                  ; 7073: CC FE 01      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7076; JUMP; // sstep
case 0x7076:
                                                     mon("L7076    STD   $509A                   ; 7076: FD 50 9A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509a, A); // Care needed with I/O space and word fetches
    wr_mem(0x509b, B); 
    PC = 0x7079; JUMP; // sstep
case 0x7079:
                                                     mon("         STD   $5042                   ; 7079: 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 = 0x707C; JUMP; // sstep
case 0x707C:
                                                     mon("         LDD   $5086                   ; 707C: 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 = 0x707F; JUMP; // sstep
case 0x707F:
                                                     mon("         ASLB                          ; 707F: 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 = 0x7080; JUMP; // sstep
case 0x7080:
                                                     mon("         ROLA                          ; 7080: 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 = 0x7081; JUMP; // sstep
case 0x7081:
                                                     mon("         ASLB                          ; 7081: 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 = 0x7082; JUMP; // sstep
case 0x7082:
                                                     mon("         ROLA                          ; 7082: 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 = 0x7083; JUMP; // sstep
case 0x7083:
                                                     mon("         ASLB                          ; 7083: 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 = 0x7084; JUMP; // sstep
case 0x7084:
                                                     mon("         ROLA                          ; 7084: 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 = 0x7085; JUMP; // sstep
case 0x7085:
                                                     mon("         ASLB                          ; 7085: 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 = 0x7086; JUMP; // sstep
case 0x7086:
                                                     mon("         ROLA                          ; 7086: 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 = 0x7087; JUMP; // sstep
case 0x7087:
                                                     mon("         LDB   <$7F                    ; 7087: D6 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7f); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7089; JUMP; // sstep
case 0x7089:
                                                     mon("         BPL   L708C                   ; 7089: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x708c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x708B; JUMP; // sstep
case 0x708B:
                                                     mon("         COMB                          ; 708B: 53            \n");
    val = (UINT8)B ^ 0xff; 
    B = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x708C; JUMP; // sstep
case 0x708C:
                                                     mon("L708C    ASLB                          ; 708C: 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 = 0x708D; JUMP; // sstep
case 0x708D:
                                                     mon("         MUL                           ; 708D: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x708E; JUMP; // sstep
case 0x708E:
                                                     mon("         TST   <$7F                    ; 708E: 0D 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x7f); 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7090; JUMP; // sstep
case 0x7090:
                                                     mon("         BPL   L7096                   ; 7090: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7096; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7092; JUMP; // sstep
case 0x7092:
                                                     mon("         COMA                          ; 7092: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x7093; JUMP; // sstep
case 0x7093:
                                                     mon("         NEGB                          ; 7093: 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 = 0x7094; JUMP; // sstep
case 0x7094:
                                                     mon("         SBCA  #$FF                    ; 7094: 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 = 0x7096; JUMP; // sstep
case 0x7096:
                                                     mon("L7096    ASRA                          ; 7096: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x7097; JUMP; // sstep
case 0x7097:
                                                     mon("         RORB                          ; 7097: 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 = 0x7098; JUMP; // sstep
case 0x7098:
                                                     mon("         ASRA                          ; 7098: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x7099; JUMP; // sstep
case 0x7099:
                                                     mon("         RORB                          ; 7099: 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 = 0x709A; JUMP; // sstep
case 0x709A:
                                                     mon("         ASRA                          ; 709A: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x709B; JUMP; // sstep
case 0x709B:
                                                     mon("         RORB                          ; 709B: 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 = 0x709C; JUMP; // sstep
case 0x709C:
                                                     mon("         ASRA                          ; 709C: 47            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = (UINT8)((SINT8)val >> 1); 
    A = val; 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
    PC = 0x709D; JUMP; // sstep
case 0x709D:
                                                     mon("         RORB                          ; 709D: 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 = 0x709E; JUMP; // sstep
case 0x709E:
                                                     mon("         STD   $5096                   ; 709E: FD 50 96      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5096, A); // Care needed with I/O space and word fetches
    wr_mem(0x5097, B); 
    PC = 0x70A1; JUMP; // sstep
case 0x70A1:
                                                     mon("         ADDD  $509C                   ; 70A1: F3 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 ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x70A4; JUMP; // sstep
case 0x70A4:
                                                     mon("         CMPD  #$FEFF                  ; 70A4: 10 83 FE FF   \n"); // Trench Y top/bottom limits
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xfeff; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x70A8; JUMP; // sstep
case 0x70A8:
                                                     mon("         BLE   L70AD                   ; 70A8: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x70ad; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x70AA; JUMP; // sstep
case 0x70AA:
                                                     mon("         LDD   #$FEFF                  ; 70AA: CC FE FF      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0xff; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x70AD; JUMP; // sstep
case 0x70AD:
                                                     mon("L70AD    CMPD  #$F201                  ; 70AD: 10 83 F2 01   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0xf201; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x70B1; JUMP; // sstep
case 0x70B1:
                                                     mon("         BGE   L70B6                   ; 70B1: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x70b6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x70B3; JUMP; // sstep
case 0x70B3:
                                                     mon("         LDD   #$F201                  ; 70B3: CC F2 01      \n");
    clockticks = clockticks + 3; 
    A = 0xf2; 
    B = 0x01; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x70B6; JUMP; // sstep
case 0x70B6:
                                                     mon("L70B6    STD   $509C                   ; 70B6: FD 50 9C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    PC = 0x70B9; JUMP; // sstep
case 0x70B9:
                                                     mon("         STD   $5044                   ; 70B9: 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_703B
    PC = 0x70BC; JUMP; // sstep
case 0x70BC:
                                                     mon("         RTS                           ; 70BC: 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 0x70BD:
                                                     mon("L70BD    LDX   #$4866                  ; 70BD: 8E 48 66      \n"); // Joystick pitch data structure
    clockticks = clockticks + 3; 
    X = 0x4866; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x70C0; JUMP; // sstep
case 0x70C0:
                                                     mon("         JSR   L70F0                   ; 70C0: BD 70 F0      \n"); // Some joystick data calculation ?
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0x70f0; 
    JUMP;
  case 0x70C3:
                                                     mon("L70C3    JSR   L7111                   ; 70C3: BD 71 11      \n"); // Some joystick driven matrix rotations for pitch/roll
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0x7111; 
    JUMP;
  case 0x70C6:
                                                     mon("L70C6    BEQ   locret_70CB             ; 70C6: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x70cb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x70C8; JUMP; // sstep
case 0x70C8:
                                                     mon("         JSR   $CE2F                   ; 70C8: BD CE 2F      \n"); // Run math program $0E Pitch on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0xce2f; 
    JUMP;
    // End of function sub_70BD
  case 0x70CB:
                                                     mon("locret_70CB RTS                           ; 70CB: 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 0x70CC:
                                                     mon("L70CC    LDX   #$486F                  ; 70CC: 8E 48 6F      \n"); // Joystick roll data structure
    clockticks = clockticks + 3; 
    X = 0x486f; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x70CF; JUMP; // sstep
case 0x70CF:
                                                     mon("         JSR   L70F0                   ; 70CF: BD 70 F0      \n"); // Some joystick data calculation ?
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0x70f0; 
    JUMP;
  case 0x70D2:
                                                     mon("L70D2    JSR   L7111                   ; 70D2: BD 71 11      \n"); // Some joystick driven matrix rotations for pitch/roll
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0x7111; 
    JUMP;
  case 0x70D5:
                                                     mon("L70D5    BEQ   locret_70DA             ; 70D5: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x70da; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x70D7; JUMP; // sstep
case 0x70D7:
                                                     mon("         JSR   $CE3A                   ; 70D7: BD CE 3A      \n"); // Run math program $1C Yaw on Matrix 4
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xda); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x70); 
    clockticks = clockticks + 1; 
    PC = 0xce3a; 
    JUMP;
    // End of function sub_70CC
  case 0x70DA:
                                                     mon("locret_70DA RTS                           ; 70DA: 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 0x70DB:
                                                     mon("L70DB    ORCC  #$10                    ; 70DB: 1A 10         \n"); // Disable interrupts
    I = 1; 
    clockticks = clockticks + 3; 
    PC = 0x70DD; JUMP; // sstep
case 0x70DD:
                                                     mon("         LDD   <$6B                    ; 70DD: 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 = 0x70DF; JUMP; // sstep
case 0x70DF:
                                                     mon("         STD   <$7F                    ; 70DF: DD 7F         \n"); // Joystick Y
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x7f; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x70E1; JUMP; // sstep
case 0x70E1:
                                                     mon("         LDD   <$74                    ; 70E1: 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 = 0x70E3; JUMP; // sstep
case 0x70E3:
                                                     mon("         STD   <$7D                    ; 70E3: DD 7D         \n"); // Joystick X
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x7d; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x70E5; JUMP; // sstep
case 0x70E5:
                                                     mon("         LDD   <$2F                    ; 70E5: 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 = 0x70E7; JUMP; // sstep
case 0x70E7:
                                                     mon("         STD   <$7B                    ; 70E7: DD 7B         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x7b; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x70E9; JUMP; // sstep
case 0x70E9:
                                                     mon("         LDD   <$2D                    ; 70E9: 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 = 0x70EB; JUMP; // sstep
case 0x70EB:
                                                     mon("         STD   <$79                    ; 70EB: DD 79         \n");
    clockticks = clockticks + 4; 
    Z = A | B; 
    N = A; 
    V = 0; 
    ea = DP|0x79; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x70ED; JUMP; // sstep
case 0x70ED:
                                                     mon("         ANDCC #$EF                    ; 70ED: 1C EF         \n"); // Enable interrupts
    I = 0; 
    clockticks = clockticks + 3; 
    // End of function sub_70DB
    PC = 0x70EF; JUMP; // sstep
case 0x70EF:
                                                     mon("         RTS                           ; 70EF: 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 joystick data calculation ?
  case 0x70F0:
                                                     mon("L70F0    LDA   $07,X                   ; 70F0: A6 07         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0007)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x70F2; JUMP; // sstep
case 0x70F2:
                                                     mon("         BPL   L70F5                   ; 70F2: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x70f5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x70F4; JUMP; // sstep
case 0x70F4:
                                                     mon("         COMA                          ; 70F4: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x70F5; JUMP; // sstep
case 0x70F5:
                                                     mon("L70F5    LDB   #$80                    ; 70F5: C6 80         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x80; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x70F7; JUMP; // sstep
case 0x70F7:
                                                     mon("         MUL                           ; 70F7: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
    C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x70F8; JUMP; // sstep
case 0x70F8:
                                                     mon("         NOP                           ; 70F8: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0x70F9; JUMP; // sstep
case 0x70F9:
                                                     mon("         NOP                           ; 70F9: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0x70FA; JUMP; // sstep
case 0x70FA:
                                                     mon("         NOP                           ; 70FA: 12            \n");
    clockticks = clockticks + 2; 
    PC = 0x70FB; JUMP; // sstep
case 0x70FB:
                                                     mon("         LDB   $07,X                   ; 70FB: E6 07         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0007)); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x70FD; JUMP; // sstep
case 0x70FD:
                                                     mon("         BMI   L7107                   ; 70FD: 2B 08         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N <  0) {
    PC = 0x7107; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x70FF; JUMP; // sstep
case 0x70FF:
                                                     mon("         ADDA  $08,X                   ; 70FF: AB 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0008)); 
    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 = 0x7101; JUMP; // sstep
case 0x7101:
                                                     mon("         BVC   L7105                   ; 7101: 28 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x7105; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7103; JUMP; // sstep
case 0x7103:
                                                     mon("         LDA   #$7F                    ; 7103: 86 7F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x7f; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7105; JUMP; // sstep
case 0x7105:
                                                     mon("L7105    BRA   L710E                   ; 7105: 20 07         \n");
    PC = 0x710e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x7107:
                                                     mon("L7107    NEGA                          ; 7107: 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 = 0x7108; JUMP; // sstep
case 0x7108:
                                                     mon("         ADDA  $08,X                   ; 7108: AB 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0008)); 
    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 = 0x710A; JUMP; // sstep
case 0x710A:
                                                     mon("         BVC   L710E                   ; 710A: 28 02         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V >= 0) {
    PC = 0x710e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x710C; JUMP; // sstep
case 0x710C:
                                                     mon("         LDA   #$81                    ; 710C: 86 81         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x81; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x710E; JUMP; // sstep
case 0x710E:
                                                     mon("L710E    STA   $08,X                   ; 710E: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    // End of function sub_70F0
    PC = 0x7110; JUMP; // sstep
case 0x7110:
                                                     mon("         RTS                           ; 7110: 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 joystick driven matrix rotations for pitch/roll
  case 0x7111:
                                                     mon("L7111    LDA   $08,X                   ; 7111: A6 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0008)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7113; JUMP; // sstep
case 0x7113:
                                                     mon("         BPL   L7116                   ; 7113: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7116; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7115; JUMP; // sstep
case 0x7115:
                                                     mon("         NEGA                          ; 7115: 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 = 0x7116; JUMP; // sstep
case 0x7116:
                                                     mon("L7116    CMPA  #$4E                    ; 7116: 81 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x4e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x7118; JUMP; // sstep
case 0x7118:
                                                     mon("         BCS   L713A                   ; 7118: 25 20         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x713a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x711A; JUMP; // sstep
case 0x711A:
                                                     mon("         LDD   #$3FC2                  ; 711A: CC 3F C2      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xc2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x711D; JUMP; // sstep
case 0x711D:
                                                     mon("         STD   $5024                   ; 711D: 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 = 0x7120; JUMP; // sstep
case 0x7120:
                                                     mon("         LDA   $08,X                   ; 7120: A6 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0008)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7122; JUMP; // sstep
case 0x7122:
                                                     mon("         BPL   L712F                   ; 7122: 2A 0B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x712f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7124; JUMP; // sstep
case 0x7124:
                                                     mon("         ADDA  #$4E                    ; 7124: 8B 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x4e; 
    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 = 0x7126; JUMP; // sstep
case 0x7126:
                                                     mon("         STA   $08,X                   ; 7126: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    PC = 0x7128; JUMP; // sstep
case 0x7128:
                                                     mon("         LDD   #$FA70                  ; 7128: CC FA 70      \n");
    clockticks = clockticks + 3; 
    A = 0xfa; 
    B = 0x70; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x712B; JUMP; // sstep
case 0x712B:
                                                     mon("         STD   $5022                   ; 712B: 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 = 0x712E; JUMP; // sstep
case 0x712E:
                                                     mon("         RTS                           ; 712E: 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 0x712F:
                                                     mon("L712F    SUBA  #$4E                    ; 712F: 80 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x4e; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)((val ^ arg) & (val ^ res)); 
    A = (UINT8)(res); 
    PC = 0x7131; JUMP; // sstep
case 0x7131:
                                                     mon("         STA   $08,X                   ; 7131: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    PC = 0x7133; JUMP; // sstep
case 0x7133:
                                                     mon("         LDD   #$0590                  ; 7133: CC 05 90      \n");
    clockticks = clockticks + 3; 
    A = 0x05; 
    B = 0x90; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7136; JUMP; // sstep
case 0x7136:
                                                     mon("         STD   $5022                   ; 7136: 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 = 0x7139; JUMP; // sstep
case 0x7139:
                                                     mon("         RTS                           ; 7139: 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 0x713A:
                                                     mon("L713A    CMPA  #$0E                    ; 713A: 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 = 0x713C; JUMP; // sstep
case 0x713C:
                                                     mon("         BCS   L715E                   ; 713C: 25 20         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x715e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x713E; JUMP; // sstep
case 0x713E:
                                                     mon("         LDD   #$3FFE                  ; 713E: CC 3F FE      \n");
    clockticks = clockticks + 3; 
    A = 0x3f; 
    B = 0xfe; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7141; JUMP; // sstep
case 0x7141:
                                                     mon("         STD   $5024                   ; 7141: 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 = 0x7144; JUMP; // sstep
case 0x7144:
                                                     mon("         LDA   $08,X                   ; 7144: A6 08         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0008)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7146; JUMP; // sstep
case 0x7146:
                                                     mon("         BPL   L7153                   ; 7146: 2A 0B         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7153; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7148; JUMP; // sstep
case 0x7148:
                                                     mon("         ADDA  #$0E                    ; 7148: 8B 0E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x0e; 
    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 = 0x714A; JUMP; // sstep
case 0x714A:
                                                     mon("         STA   $08,X                   ; 714A: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    PC = 0x714C; JUMP; // sstep
case 0x714C:
                                                     mon("         LDD   #$FF00                  ; 714C: CC FF 00      \n");
    clockticks = clockticks + 3; 
    A = 0xff; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x714F; JUMP; // sstep
case 0x714F:
                                                     mon("         STD   $5022                   ; 714F: 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 = 0x7152; JUMP; // sstep
case 0x7152:
                                                     mon("         RTS                           ; 7152: 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 0x7153:
                                                     mon("L7153    SUBA  #$0E                    ; 7153: 80 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)); 
    A = (UINT8)(res); 
    PC = 0x7155; JUMP; // sstep
case 0x7155:
                                                     mon("         STA   $08,X                   ; 7155: A7 08         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + 0x0008); 
    wr_mem(ea, val); 
    PC = 0x7157; JUMP; // sstep
case 0x7157:
                                                     mon("         LDD   #$0100                  ; 7157: CC 01 00      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x715A; JUMP; // sstep
case 0x715A:
                                                     mon("         STD   $5022                   ; 715A: 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 = 0x715D; JUMP; // sstep
case 0x715D:
                                                     mon("         RTS                           ; 715D: 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 0x715E:
                                                     mon("L715E    CLRB                          ; 715E: 5F            \n");
    B = 0; 
    V = 0; 
    Z = 0; 
    N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    // End of function sub_7111
    PC = 0x715F; JUMP; // sstep
case 0x715F:
                                                     mon("         RTS                           ; 715F: 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 =======================================
    // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
  case 0x7160:
                                                     mon("L7160    LDA   $486E                   ; 7160: B6 48 6E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x486e); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7163; JUMP; // sstep
case 0x7163:
                                                     mon("         BEQ   L7181                   ; 7163: 27 1C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x7181; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7165; JUMP; // sstep
case 0x7165:
                                                     mon("         JSR   L71C4                   ; 7165: BD 71 C4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    PC = 0x71c4; 
    JUMP;
  case 0x7168:
                                                     mon("L7168    LDA   $486E                   ; 7168: B6 48 6E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x486e); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x716B; JUMP; // sstep
case 0x716B:
                                                     mon("         BPL   L7176                   ; 716B: 2A 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7176; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x716D; JUMP; // sstep
case 0x716D:
                                                     mon("         LDD   #$00                    ; 716D: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7170; JUMP; // sstep
case 0x7170:
                                                     mon("         SUBD  $5022                   ; 7170: B3 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5022)<<8; 
    ea = ea | rd_mem(0x5023); 
    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 = 0x7173; JUMP; // sstep
case 0x7173:
                                                     mon("         STD   $5022                   ; 7173: 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 = 0x7176; JUMP; // sstep
case 0x7176:
                                                     mon("L7176    CLRA                          ; 7176: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7177; JUMP; // sstep
case 0x7177:
                                                     mon("         LDB   #$05                    ; 7177: C6 05         \n"); // Point BIC to[ A,B,C ][x, y, z] 2
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7179; JUMP; // sstep
case 0x7179:
                                                     mon("         STD   $4701                   ; 7179: 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 = 0x717C; JUMP; // sstep
case 0x717C:
                                                     mon("         LDA   #$0E                    ; 717C: 86 0E         \n"); // Pitch program
    clockticks = clockticks + 2; 
    val = (UINT8)0x0e; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x717E; JUMP; // sstep
case 0x717E:
                                                     mon("         JSR   $CDBA                   ; 717E: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x81); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x7181:
                                                     mon("L7181    LDA   $4877                   ; 7181: B6 48 77      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4877); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7184; JUMP; // sstep
case 0x7184:
                                                     mon("         BEQ   L71A2                   ; 7184: 27 1C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x71a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7186; JUMP; // sstep
case 0x7186:
                                                     mon("         JSR   L71C4                   ; 7186: BD 71 C4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    PC = 0x71c4; 
    JUMP;
  case 0x7189:
                                                     mon("L7189    LDA   $4877                   ; 7189: B6 48 77      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4877); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x718C; JUMP; // sstep
case 0x718C:
                                                     mon("         BPL   L7197                   ; 718C: 2A 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7197; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x718E; JUMP; // sstep
case 0x718E:
                                                     mon("         LDD   #$00                    ; 718E: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7191; JUMP; // sstep
case 0x7191:
                                                     mon("         SUBD  $5022                   ; 7191: B3 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5022)<<8; 
    ea = ea | rd_mem(0x5023); 
    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 = 0x7194; JUMP; // sstep
case 0x7194:
                                                     mon("         STD   $5022                   ; 7194: 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 = 0x7197; JUMP; // sstep
case 0x7197:
                                                     mon("L7197    CLRA                          ; 7197: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7198; JUMP; // sstep
case 0x7198:
                                                     mon("         LDB   #$05                    ; 7198: C6 05         \n"); // Point BIC to[ A,B,C ][x, y, z] 2
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x719A; JUMP; // sstep
case 0x719A:
                                                     mon("         STD   $4701                   ; 719A: 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 = 0x719D; JUMP; // sstep
case 0x719D:
                                                     mon("         LDA   #$1C                    ; 719D: 86 1C         \n"); // Yaw program
    clockticks = clockticks + 2; 
    val = (UINT8)0x1c; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x719F; JUMP; // sstep
case 0x719F:
                                                     mon("         JSR   $CDBA                   ; 719F: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x71A2:
                                                     mon("L71A2    LDA   $4878                   ; 71A2: B6 48 78      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4878); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x71A5; JUMP; // sstep
case 0x71A5:
                                                     mon("         BEQ   locret_71C3             ; 71A5: 27 1C         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x71c3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x71A7; JUMP; // sstep
case 0x71A7:
                                                     mon("         JSR   L71C4                   ; 71A7: BD 71 C4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    PC = 0x71c4; 
    JUMP;
  case 0x71AA:
                                                     mon("L71AA    LDA   $4878                   ; 71AA: B6 48 78      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4878); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x71AD; JUMP; // sstep
case 0x71AD:
                                                     mon("         BPL   L71B8                   ; 71AD: 2A 09         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x71b8; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x71AF; JUMP; // sstep
case 0x71AF:
                                                     mon("         LDD   #$00                    ; 71AF: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x71B2; JUMP; // sstep
case 0x71B2:
                                                     mon("         SUBD  $5022                   ; 71B2: B3 50 22      \n"); // Sine for rotation
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5022)<<8; 
    ea = ea | rd_mem(0x5023); 
    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 = 0x71B5; JUMP; // sstep
case 0x71B5:
                                                     mon("         STD   $5022                   ; 71B5: 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 = 0x71B8; JUMP; // sstep
case 0x71B8:
                                                     mon("L71B8    CLRA                          ; 71B8: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
    C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x71B9; JUMP; // sstep
case 0x71B9:
                                                     mon("         LDB   #$05                    ; 71B9: C6 05         \n"); // Point BIC to[ A,B,C ][x, y, z] 2
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x71BB; JUMP; // sstep
case 0x71BB:
                                                     mon("         STD   $4701                   ; 71BB: 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 = 0x71BE; JUMP; // sstep
case 0x71BE:
                                                     mon("         LDA   #$00                    ; 71BE: 86 00         \n"); // Roll program
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x71C0; JUMP; // sstep
case 0x71C0:
                                                     mon("         JSR   $CDBA                   ; 71C0: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x71); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
    // End of function sub_7160
  case 0x71C3:
                                                     mon("locret_71C3 RTS                           ; 71C3: 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 0x71C4:
                                                     mon("L71C4    BPL   L71C7                   ; 71C4: 2A 01         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x71c7; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x71C6; JUMP; // sstep
case 0x71C6:
                                                     mon("         NEGA                          ; 71C6: 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 = 0x71C7; JUMP; // sstep
case 0x71C7:
                                                     mon("L71C7    LDB   #$03                    ; 71C7: C6 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x03; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x71C9; JUMP; // sstep
case 0x71C9:
                                                     mon("         MUL                           ; 71C9: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x71CA; JUMP; // sstep
case 0x71CA:
                                                     mon("         LDX   #$71DA                  ; 71CA: 8E 71 DA      \n");
    clockticks = clockticks + 3; 
    X = 0x71da; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x71CD; JUMP; // sstep
case 0x71CD:
                                                     mon("         ABX                           ; 71CD: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0x71CE; JUMP; // sstep
case 0x71CE:
                                                     mon("         LDD   ,X                      ; 71CE: 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 = 0x71D0; JUMP; // sstep
case 0x71D0:
                                                     mon("         STD   $5022                   ; 71D0: 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 = 0x71D3; JUMP; // sstep
case 0x71D3:
                                                     mon("         LDB   $02,X                   ; 71D3: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x71D5; JUMP; // sstep
case 0x71D5:
                                                     mon("         SEX                           ; 71D5: 1D            \n");
/**/Z = B; 
/**/N = B; 
    A = ((SINT8)B < 0 ? 0xff : 0); 
    clockticks = clockticks + 2; 
    PC = 0x71D6; JUMP; // sstep
case 0x71D6:
                                                     mon("         ADDD  #$4000                  ; 71D6: C3 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 ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x71D9; JUMP; // sstep
case 0x71D9:
                                                     mon("L71D9    STD   $5024                   ; 71D9: 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_71C4
    // ---------------------------------------------------------------------------
    PC = 0x71DC; JUMP; // sstep
case 0x71DC:
                                                     mon("         RTS                           ; 71DC: 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
  case 0x72C7:
                                                     mon("L72C7    JSR   L6112                   ; 72C7: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xca); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x72CA:
                                                     mon("L72CA    LDA   #$10                    ; 72CA: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x72CC; JUMP; // sstep
case 0x72CC:
                                                     mon("         JSR   $CE0C                   ; 72CC: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x72CF:
                                                     mon("L72CF    JSR   L7160                   ; 72CF: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x72D2:
                                                     mon("L72D2    JSR   L761D                   ; 72D2: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x72D5:
                                                     mon("L72D5    LDA   $4B2D                   ; 72D5: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x72D8; JUMP; // sstep
case 0x72D8:
                                                     mon("         BNE   L72F0                   ; 72D8: 26 16         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x72f0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x72DA; JUMP; // sstep
case 0x72DA:
                                                     mon("         LDD   $4B0E                   ; 72DA: FC 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    A = rd_mem(0x4b0e); // Care needed with I/O space and word fetches
    B = rd_mem(0x4b0f); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x72DD; JUMP; // sstep
case 0x72DD:
                                                     mon("         CMPD  #$A0                    ; 72DD: 10 83 00 A0   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x00a0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x72E1; JUMP; // sstep
case 0x72E1:
                                                     mon("         BCC   L72F0                   ; 72E1: 24 0D         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x72f0; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x72E3; JUMP; // sstep
case 0x72E3:
                                                     mon("         ANDB  #$10                    ; 72E3: C4 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x10; 
    B = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x72E5; JUMP; // sstep
case 0x72E5:
                                                     mon("         BNE   L72EB                   ; 72E5: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x72eb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x72E7; JUMP; // sstep
case 0x72E7:
                                                     mon("         LDB   #$4C                    ; 72E7: C6 4C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4c; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x72E9; JUMP; // sstep
case 0x72E9:
                                                     mon("         BRA   L72ED                   ; 72E9: 20 02         \n");
    PC = 0x72ed; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x72EB:
                                                     mon("L72EB    LDB   #$4D                    ; 72EB: C6 4D         \n"); // "Shoot Tie Fighters text index", Shoot Tie Fighters text index
    clockticks = clockticks + 2; 
    val = (UINT8)0x4d; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x72ED; JUMP; // sstep
case 0x72ED:
                                                     mon("L72ED    JSR   $E7C7                   ; 72ED: BD E7 C7      \n"); // "Print text string from pointer table", Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x72F0:
                                                     mon("L72F0    JSR   $95A7                   ; 72F0: BD 95 A7      \n"); // "Insert vector instructions for shields", Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x72F3:
                                                     mon("L72F3    JSR   L7765                   ; 72F3: BD 77 65      \n"); // Space wave sub_7765
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0x7765; 
    JUMP;
  case 0x72F6:
                                                     mon("L72F6    JSR   $B6B9                   ; 72F6: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x72F9:
                                                     mon("L72F9    JSR   $CD80                   ; 72F9: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x72FC:
                                                     mon("L72FC    JSR   $BA12                   ; 72FC: BD BA 12      \n"); // Process tie/tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xff); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    PC = 0xba12; 
    JUMP;
  case 0x72FF:
                                                     mon("L72FF    JSR   $AE60                   ; 72FF: BD AE 60      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x02); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xae60; 
    JUMP;
  case 0x7302:
                                                     mon("L7302    JSR   L786A                   ; 7302: BD 78 6A      \n"); // Process tie fighters and insert vectors
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x05); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x786a; 
    JUMP;
  case 0x7305:
                                                     mon("L7305    JSR   $AAE4                   ; 7305: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x08); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x7308:
                                                     mon("L7308    JSR   $B32B                   ; 7308: BD B3 2B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xb32b; 
    JUMP;
  case 0x730B:
                                                     mon("L730B    JSR   $AEBD                   ; 730B: BD AE BD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaebd; 
    JUMP;
  case 0x730E:
                                                     mon("L730E    JSR   $98B0                   ; 730E: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x11); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x7311:
                                                     mon("L7311    JSR   L612F                   ; 7311: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x14); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_72C7
  case 0x7314:
                                                     mon("L7314    RTS                           ; 7314: 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 0x7315:
                                                     mon("L7315    JSR   L6112                   ; 7315: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x18); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x7318:
                                                     mon("L7318    LDA   #$10                    ; 7318: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x731A; JUMP; // sstep
case 0x731A:
                                                     mon("         JSR   $CE0C                   ; 731A: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x731D:
                                                     mon("L731D    JSR   L7160                   ; 731D: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x20); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x7320:
                                                     mon("L7320    JSR   L761D                   ; 7320: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x23); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x7323:
                                                     mon("L7323    JSR   $95A7                   ; 7323: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x26); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x7326:
                                                     mon("L7326    JSR   $CD80                   ; 7326: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x7329:
                                                     mon("L7329    JSR   $BA12                   ; 7329: BD BA 12      \n"); // Process tie/tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xba12; 
    JUMP;
  case 0x732C:
                                                     mon("L732C    JSR   L786A                   ; 732C: BD 78 6A      \n"); // Process tie fighters and insert vectors
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x786a; 
    JUMP;
  case 0x732F:
                                                     mon("L732F    JSR   $AAE4                   ; 732F: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x32); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x7332:
                                                     mon("L7332    JSR   L7707                   ; 7332: BD 77 07      \n"); // Game Over text handling
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7707; 
    JUMP;
  case 0x7335:
                                                     mon("L7335    JSR   $98B0                   ; 7335: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x7338:
                                                     mon("L7338    JSR   L612F                   ; 7338: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_7315
  case 0x733B:
                                                     mon("L733B    RTS                           ; 733B: 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 space wave? Also Trench catwalks
  case 0x733C:
                                                     mon("L733C    JSR   L6112                   ; 733C: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x733F:
                                                     mon("L733F    LDA   #$10                    ; 733F: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7341; JUMP; // sstep
case 0x7341:
                                                     mon("         JSR   $CE0C                   ; 7341: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x44); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x7344:
                                                     mon("L7344    JSR   L7160                   ; 7344: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x47); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x7347:
                                                     mon("L7347    JSR   L761D                   ; 7347: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x734A:
                                                     mon("L734A    JSR   $95A7                   ; 734A: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x734D:
                                                     mon("L734D    JSR   $B6B9                   ; 734D: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x50); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x7350:
                                                     mon("L7350    JSR   $CD80                   ; 7350: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x53); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x7353:
                                                     mon("L7353    JSR   L7765                   ; 7353: BD 77 65      \n"); // Space wave sub_7765
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x56); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7765; 
    JUMP;
  case 0x7356:
                                                     mon("L7356    JSR   $BA12                   ; 7356: BD BA 12      \n"); // Process tie/tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x59); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xba12; 
    JUMP;
  case 0x7359:
                                                     mon("L7359    JSR   $AE60                   ; 7359: BD AE 60      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xae60; 
    JUMP;
  case 0x735C:
                                                     mon("L735C    JSR   L786A                   ; 735C: BD 78 6A      \n"); // Process tie fighters and insert vectors
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x786a; 
    JUMP;
  case 0x735F:
                                                     mon("L735F    JSR   $AAE4                   ; 735F: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x62); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x7362:
                                                     mon("L7362    JSR   $B32B                   ; 7362: BD B3 2B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x65); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xb32b; 
    JUMP;
  case 0x7365:
                                                     mon("L7365    JSR   $AEBD                   ; 7365: BD AE BD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaebd; 
    JUMP;
  case 0x7368:
                                                     mon("L7368    JSR   $98B0                   ; 7368: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x736B:
                                                     mon("L736B    JSR   L612F                   ; 736B: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_733C
  case 0x736E:
                                                     mon("L736E    RTS                           ; 736E: 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 0x736F:
                                                     mon("L736F    JSR   L6112                   ; 736F: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x7372:
                                                     mon("L7372    LDA   #$10                    ; 7372: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7374; JUMP; // sstep
case 0x7374:
                                                     mon("         JSR   $CE0C                   ; 7374: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x7377:
                                                     mon("L7377    JSR   L7160                   ; 7377: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x737A:
                                                     mon("L737A    JSR   L761D                   ; 737A: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x7d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x737D:
                                                     mon("L737D    JSR   $95A7                   ; 737D: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x80); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x7380:
                                                     mon("L7380    JSR   $B6B9                   ; 7380: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x7383:
                                                     mon("L7383    JSR   $CD80                   ; 7383: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x86); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x7386:
                                                     mon("L7386    JSR   L77A4                   ; 7386: BD 77 A4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x89); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x77a4; 
    JUMP;
  case 0x7389:
                                                     mon("L7389    JSR   $98B0                   ; 7389: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x738C:
                                                     mon("L738C    JSR   L612F                   ; 738C: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_736F
  case 0x738F:
                                                     mon("L738F    RTS                           ; 738F: 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/Bunkers wave
  case 0x7390:
                                                     mon("L7390    JSR   L6112                   ; 7390: BD 61 12      \n"); // Towers/Bunkers wave
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x93); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x7393:
                                                     mon("L7393    LDA   #$10                    ; 7393: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7395; JUMP; // sstep
case 0x7395:
                                                     mon("         JSR   $CE0C                   ; 7395: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x98); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x7398:
                                                     mon("L7398    JSR   L7160                   ; 7398: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x739B:
                                                     mon("L739B    JSR   L761D                   ; 739B: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x739E:
                                                     mon("L739E    JSR   L768D                   ; 739E: BD 76 8D      \n"); // Display tower count and hit score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x768d; 
    JUMP;
  case 0x73A1:
                                                     mon("L73A1    JSR   $95A7                   ; 73A1: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x73A4:
                                                     mon("L73A4    JSR   $B6B9                   ; 73A4: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x73A7:
                                                     mon("L73A7    JSR   $CD8C                   ; 73A7: BD CD 8C      \n"); // Towers surface dots
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xaa); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xcd8c; 
    JUMP;
  case 0x73AA:
                                                     mon("L73AA    JSR   $AE60                   ; 73AA: BD AE 60      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xad); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xae60; 
    JUMP;
  case 0x73AD:
                                                     mon("L73AD    JSR   $AAE4                   ; 73AD: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x73B0:
                                                     mon("L73B0    JSR   $A214                   ; 73B0: BD A2 14      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xa214; 
    JUMP;
  case 0x73B3:
                                                     mon("L73B3    JSR   $B2D2                   ; 73B3: BD B2 D2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xb2d2; 
    JUMP;
  case 0x73B6:
                                                     mon("L73B6    JSR   $AEBD                   ; 73B6: BD AE BD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaebd; 
    JUMP;
  case 0x73B9:
                                                     mon("L73B9    JSR   $BA12                   ; 73B9: BD BA 12      \n"); // Process tie/tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xba12; 
    JUMP;
  case 0x73BC:
                                                     mon("L73BC    JSR   $98B0                   ; 73BC: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x73BF:
                                                     mon("L73BF    JSR   L612F                   ; 73BF: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_7390
  case 0x73C2:
                                                     mon("L73C2    RTS                           ; 73C2: 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
  case 0x73C3:
                                                     mon("L73C3    JSR   L6112                   ; 73C3: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x73C6:
                                                     mon("L73C6    LDA   #$10                    ; 73C6: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x73C8; JUMP; // sstep
case 0x73C8:
                                                     mon("         JSR   $CE0C                   ; 73C8: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x73CB:
                                                     mon("L73CB    JSR   L7160                   ; 73CB: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x73CE:
                                                     mon("L73CE    JSR   L761D                   ; 73CE: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x73D1:
                                                     mon("L73D1    JSR   L768D                   ; 73D1: BD 76 8D      \n"); // Display tower count and hit score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x768d; 
    JUMP;
  case 0x73D4:
                                                     mon("L73D4    JSR   $95A7                   ; 73D4: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x73D7:
                                                     mon("L73D7    JSR   $CD8C                   ; 73D7: BD CD 8C      \n"); // Towers surface dots
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xda); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xcd8c; 
    JUMP;
  case 0x73DA:
                                                     mon("L73DA    JSR   $AAE4                   ; 73DA: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x73DD:
                                                     mon("L73DD    JSR   $A214                   ; 73DD: BD A2 14      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xa214; 
    JUMP;
  case 0x73E0:
                                                     mon("L73E0    JSR   L7707                   ; 73E0: BD 77 07      \n"); // Game Over text handling
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7707; 
    JUMP;
  case 0x73E3:
                                                     mon("L73E3    JSR   $98B0                   ; 73E3: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x73E6:
                                                     mon("L73E6    JSR   L612F                   ; 73E6: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_73C3
  case 0x73E9:
                                                     mon("L73E9    RTS                           ; 73E9: 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
  case 0x73EA:
                                                     mon("L73EA    JSR   L6112                   ; 73EA: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xed); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x73ED:
                                                     mon("L73ED    LDA   #$10                    ; 73ED: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x73EF; JUMP; // sstep
case 0x73EF:
                                                     mon("         JSR   $CE0C                   ; 73EF: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x73F2:
                                                     mon("L73F2    JSR   L7160                   ; 73F2: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x73F5:
                                                     mon("L73F5    JSR   L761D                   ; 73F5: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x73F8:
                                                     mon("L73F8    JSR   L76D3                   ; 73F8: BD 76 D3      \n"); // Towers left to shoot count
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x73); 
    clockticks = clockticks + 1; 
    PC = 0x76d3; 
    JUMP;
  case 0x73FB:
                                                     mon("L73FB    LDB   #$4F                    ; 73FB: C6 4F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4f; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x73FD; JUMP; // sstep
case 0x73FD:
                                                     mon("         JSR   $E7C7                   ; 73FD: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x00); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7400:
                                                     mon("L7400    JSR   $95A7                   ; 7400: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x03); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x7403:
                                                     mon("L7403    JSR   $B6B9                   ; 7403: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x06); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x7406:
                                                     mon("L7406    JSR   $CD8C                   ; 7406: BD CD 8C      \n"); // Towers surface dots
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xcd8c; 
    JUMP;
  case 0x7409:
                                                     mon("L7409    JSR   $BA12                   ; 7409: BD BA 12      \n"); // Process tie/tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xba12; 
    JUMP;
  case 0x740C:
                                                     mon("L740C    JSR   $98B0                   ; 740C: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x740F:
                                                     mon("L740F    JSR   L612F                   ; 740F: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_73EA
  case 0x7412:
                                                     mon("L7412    RTS                           ; 7412: 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 0x7413:
                                                     mon("L7413    JSR   L6112                   ; 7413: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x7416:
                                                     mon("L7416    LDA   #$10                    ; 7416: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7418; JUMP; // sstep
case 0x7418:
                                                     mon("         JSR   $CE0C                   ; 7418: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x741B:
                                                     mon("L741B    JSR   L7160                   ; 741B: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x741E:
                                                     mon("L741E    JSR   L761D                   ; 741E: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x7421:
                                                     mon("L7421    JSR   L76D3                   ; 7421: BD 76 D3      \n"); // Towers left to shoot count
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x24); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x76d3; 
    JUMP;
  case 0x7424:
                                                     mon("L7424    LDB   #$4F                    ; 7424: C6 4F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4f; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7426; JUMP; // sstep
case 0x7426:
                                                     mon("         JSR   $E7C7                   ; 7426: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x29); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7429:
                                                     mon("L7429    JSR   $95A7                   ; 7429: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x742C:
                                                     mon("L742C    JSR   $B6B9                   ; 742C: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x742F:
                                                     mon("L742F    JSR   $859B                   ; 742F: BD 85 9B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x32); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x859b; 
    JUMP;
  case 0x7432:
                                                     mon("L7432    JSR   $BA12                   ; 7432: BD BA 12      \n"); // Process tie/tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xba12; 
    JUMP;
  case 0x7435:
                                                     mon("L7435    JSR   $98B0                   ; 7435: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x38); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x7438:
                                                     mon("L7438    JSR   L612F                   ; 7438: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_7413
  case 0x743B:
                                                     mon("L743B    RTS                           ; 743B: 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 0x743C:
                                                     mon("L743C    JSR   L6112                   ; 743C: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x743F:
                                                     mon("L743F    LDA   #$10                    ; 743F: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7441; JUMP; // sstep
case 0x7441:
                                                     mon("         JSR   $CE0C                   ; 7441: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x44); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x7444:
                                                     mon("L7444    JSR   L7160                   ; 7444: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x47); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x7447:
                                                     mon("L7447    JSR   L761D                   ; 7447: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x744A:
                                                     mon("L744A    LDA   $4B0E                   ; 744A: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x744D; JUMP; // sstep
case 0x744D:
                                                     mon("         CMPA  #$04                    ; 744D: 81 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x744F; JUMP; // sstep
case 0x744F:
                                                     mon("         BHI   L7464                   ; 744F: 22 13         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x7464; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7451; JUMP; // sstep
case 0x7451:
                                                     mon("         LDA   <$98                    ; 7451: 96 98         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x98); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7453; JUMP; // sstep
case 0x7453:
                                                     mon("         BNE   L745A                   ; 7453: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x745a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7455; JUMP; // sstep
case 0x7455:
                                                     mon("         JSR   L76D3                   ; 7455: BD 76 D3      \n"); // Towers left to shoot count
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x58); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x76d3; 
    JUMP;
  case 0x7458:
                                                     mon("L7458    BRA   L7464                   ; 7458: 20 0A         \n");
    PC = 0x7464; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x745A:
                                                     mon("L745A    LDD   #$7100                  ; 745A: CC 71 00      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x745D; JUMP; // sstep
case 0x745D:
                                                     mon("         STD   ,Y++                    ; 745D: 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 = 0x745F; JUMP; // sstep
case 0x745F:
                                                     mon("         LDB   #$46                    ; 745F: C6 46         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x46; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7461; JUMP; // sstep
case 0x7461:
                                                     mon("         JSR   $E7C7                   ; 7461: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x64); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7464:
                                                     mon("L7464    LDA   $4B2D                   ; 7464: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7467; JUMP; // sstep
case 0x7467:
                                                     mon("         BNE   L7491                   ; 7467: 26 28         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7491; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7469; JUMP; // sstep
case 0x7469:
                                                     mon("         LDA   $4B0E                   ; 7469: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x746C; JUMP; // sstep
case 0x746C:
                                                     mon("         CMPA  #$08                    ; 746C: 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 = 0x746E; JUMP; // sstep
case 0x746E:
                                                     mon("         BHI   L7491                   ; 746E: 22 21         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x7491; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7470; JUMP; // sstep
case 0x7470:
                                                     mon("         LDA   <$98                    ; 7470: 96 98         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x98); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7472; JUMP; // sstep
case 0x7472:
                                                     mon("         BNE   L7491                   ; 7472: 26 1D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7491; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7474; JUMP; // sstep
case 0x7474:
                                                     mon("         LDA   $4B35                   ; 7474: B6 4B 35      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b35); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7477; JUMP; // sstep
case 0x7477:
                                                     mon("         BNE   L7491                   ; 7477: 26 18         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7491; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7479; JUMP; // sstep
case 0x7479:
                                                     mon("         LDA   $4B12                   ; 7479: B6 4B 12      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b12); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x747C; JUMP; // sstep
case 0x747C:
                                                     mon("         BNE   L7482                   ; 747C: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7482; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x747E; JUMP; // sstep
case 0x747E:
                                                     mon("         LDB   #$4C                    ; 747E: C6 4C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4c; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7480; JUMP; // sstep
case 0x7480:
                                                     mon("         BRA   L748E                   ; 7480: 20 0C         \n");
    PC = 0x748e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x7482:
                                                     mon("L7482    LDA   <$43                    ; 7482: 96 43         \n"); // "Game over/insert coins timer", Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7484; JUMP; // sstep
case 0x7484:
                                                     mon("         ANDA  #$10                    ; 7484: 84 10         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x10; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x7486; JUMP; // sstep
case 0x7486:
                                                     mon("L7486    BNE   L748C                   ; 7486: 26 04         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x748c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7488; JUMP; // sstep
case 0x7488:
                                                     mon("         LDB   #$4C                    ; 7488: C6 4C         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4c; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x748A; JUMP; // sstep
case 0x748A:
                                                     mon("L748A    BRA   L748E                   ; 748A: 20 02         \n");
    PC = 0x748e; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x748C:
                                                     mon("L748C    LDB   #$4E                    ; 748C: C6 4E         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4e; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x748E; JUMP; // sstep
case 0x748E:
                                                     mon("L748E    JSR   $E7C7                   ; 748E: BD E7 C7      \n"); // "Print text string from pointer table", Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x91); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7491:
                                                     mon("L7491    LDA   $4B2D                   ; 7491: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7494; JUMP; // sstep
case 0x7494:
                                                     mon("         BNE   L74A5                   ; 7494: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x74a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7496; JUMP; // sstep
case 0x7496:
                                                     mon("         LDA   $4895                   ; 7496: B6 48 95      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4895); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7499; JUMP; // sstep
case 0x7499:
                                                     mon("         BEQ   L74A5                   ; 7499: 27 0A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x74a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x749B; JUMP; // sstep
case 0x749B:
                                                     mon("         LDD   #$7100                  ; 749B: CC 71 00      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x749E; JUMP; // sstep
case 0x749E:
                                                     mon("         STD   ,Y++                    ; 749E: 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 = 0x74A0; JUMP; // sstep
case 0x74A0:
                                                     mon("         LDB   #$44                    ; 74A0: C6 44         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x44; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74A2; JUMP; // sstep
case 0x74A2:
                                                     mon("         JSR   $E7C7                   ; 74A2: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x74A5:
                                                     mon("L74A5    LDA   $4B36                   ; 74A5: B6 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74A8; JUMP; // sstep
case 0x74A8:
                                                     mon("         BLT   L74B6                   ; 74A8: 2D 0C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x74b6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x74AA; JUMP; // sstep
case 0x74AA:
                                                     mon("         BNE   L74B3                   ; 74AA: 26 07         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x74b3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x74AC; JUMP; // sstep
case 0x74AC:
                                                     mon("         LDB   #$4F                    ; 74AC: C6 4F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4f; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74AE; JUMP; // sstep
case 0x74AE:
                                                     mon("         JSR   $E7C7                   ; 74AE: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x74B1:
                                                     mon("L74B1    BRA   L74B6                   ; 74B1: 20 03         \n");
    PC = 0x74b6; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x74B3:
                                                     mon("L74B3    JSR   $97C2                   ; 74B3: BD 97 C2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb6); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x97c2; 
    JUMP;
  case 0x74B6:
                                                     mon("L74B6    JSR   $95A7                   ; 74B6: BD 95 A7      \n"); // "Insert vector instructions for shields", Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x74B9:
                                                     mon("L74B9    JSR   $B6B9                   ; 74B9: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x74BC:
                                                     mon("L74BC    JSR   $859B                   ; 74BC: BD 85 9B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x859b; 
    JUMP;
  case 0x74BF:
                                                     mon("L74BF    JSR   $AE60                   ; 74BF: BD AE 60      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xae60; 
    JUMP;
  case 0x74C2:
                                                     mon("L74C2    JSR   $AAE4                   ; 74C2: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x74C5:
                                                     mon("L74C5    JSR   $B071                   ; 74C5: BD B0 71      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xb071; 
    JUMP;
  case 0x74C8:
                                                     mon("L74C8    JSR   $AEBD                   ; 74C8: BD AE BD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xaebd; 
    JUMP;
  case 0x74CB:
                                                     mon("L74CB    JSR   $ADAF                   ; 74CB: BD AD AF      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xce); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xadaf; 
    JUMP;
  case 0x74CE:
                                                     mon("L74CE    JSR   $98B0                   ; 74CE: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x74D1:
                                                     mon("L74D1    JSR   L612F                   ; 74D1: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_743C
  case 0x74D4:
                                                     mon("L74D4    RTS                           ; 74D4: 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 =======================================
    // Game over
  case 0x74D5:
                                                     mon("L74D5    JSR   L6112                   ; 74D5: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x74D8:
                                                     mon("L74D8    LDA   #$10                    ; 74D8: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74DA; JUMP; // sstep
case 0x74DA:
                                                     mon("         JSR   $CE0C                   ; 74DA: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x74DD:
                                                     mon("L74DD    JSR   L7160                   ; 74DD: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x74E0:
                                                     mon("L74E0    JSR   L761D                   ; 74E0: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x74E3:
                                                     mon("L74E3    LDA   $4B3E                   ; 74E3: B6 4B 3E      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3e); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74E6; JUMP; // sstep
case 0x74E6:
                                                     mon("         BEQ   L74F2                   ; 74E6: 27 0A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x74f2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x74E8; JUMP; // sstep
case 0x74E8:
                                                     mon("         LDD   #$7100                  ; 74E8: CC 71 00      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x74EB; JUMP; // sstep
case 0x74EB:
                                                     mon("         STD   ,Y++                    ; 74EB: 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 = 0x74ED; JUMP; // sstep
case 0x74ED:
                                                     mon("         LDB   #$46                    ; 74ED: C6 46         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x46; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74EF; JUMP; // sstep
case 0x74EF:
                                                     mon("         JSR   $E7C7                   ; 74EF: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x74F2:
                                                     mon("L74F2    JSR   $95A7                   ; 74F2: BD 95 A7      \n"); // "Insert vector instructions for shields", Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x74F5:
                                                     mon("L74F5    JSR   $859B                   ; 74F5: BD 85 9B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0x859b; 
    JUMP;
  case 0x74F8:
                                                     mon("L74F8    JSR   $AAE4                   ; 74F8: BD AA E4      \n"); // Fireball processing
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x74); 
    clockticks = clockticks + 1; 
    PC = 0xaae4; 
    JUMP;
  case 0x74FB:
                                                     mon("L74FB    LDA   $4B2D                   ; 74FB: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x74FE; JUMP; // sstep
case 0x74FE:
                                                     mon("         BNE   L750F                   ; 74FE: 26 0F         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x750f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7500; JUMP; // sstep
case 0x7500:
                                                     mon("         LDA   $4895                   ; 7500: B6 48 95      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4895); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7503; JUMP; // sstep
case 0x7503:
                                                     mon("         BEQ   L750F                   ; 7503: 27 0A         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x750f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7505; JUMP; // sstep
case 0x7505:
                                                     mon("         LDD   #$7100                  ; 7505: CC 71 00      \n");
    clockticks = clockticks + 3; 
    A = 0x71; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7508; JUMP; // sstep
case 0x7508:
                                                     mon("         STD   ,Y++                    ; 7508: 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 = 0x750A; JUMP; // sstep
case 0x750A:
                                                     mon("         LDB   #$44                    ; 750A: C6 44         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x44; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x750C; JUMP; // sstep
case 0x750C:
                                                     mon("         JSR   $E7C7                   ; 750C: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x750F:
                                                     mon("L750F    JSR   L7707                   ; 750F: BD 77 07      \n"); // "Game Over text handling", Game Over text handling
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x12); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x7707; 
    JUMP;
  case 0x7512:
                                                     mon("L7512    JSR   $98B0                   ; 7512: BD 98 B0      \n"); // Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x15); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x7515:
                                                     mon("L7515    JSR   L612F                   ; 7515: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x18); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_74D5
  case 0x7518:
                                                     mon("L7518    RTS                           ; 7518: 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 0x7519:
                                                     mon("L7519    JSR   L6112                   ; 7519: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x751C:
                                                     mon("L751C    LDA   #$10                    ; 751C: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x751E; JUMP; // sstep
case 0x751E:
                                                     mon("         JSR   $CE0C                   ; 751E: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x21); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x7521:
                                                     mon("L7521    JSR   L7160                   ; 7521: BD 71 60      \n"); // Update Roll, Pitch and Yaw for [A, B, C][x, y, z] 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x24); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x7160; 
    JUMP;
  case 0x7524:
                                                     mon("L7524    JSR   L761D                   ; 7524: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x27); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x7527:
                                                     mon("L7527    JSR   $95A7                   ; 7527: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x752A:
                                                     mon("L752A    JSR   $B6B9                   ; 752A: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x2d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x752D:
                                                     mon("L752D    JSR   $CD80                   ; 752D: BD CD 80      \n"); // Starfield
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x30); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xcd80; 
    JUMP;
  case 0x7530:
                                                     mon("L7530    LDB   #$45                    ; 7530: C6 45         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x45; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7532; JUMP; // sstep
case 0x7532:
                                                     mon("         JSR   $E7C7                   ; 7532: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x35); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7535:
                                                     mon("L7535    LDA   $4B0E                   ; 7535: B6 4B 0E      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7538; JUMP; // sstep
case 0x7538:
                                                     mon("         CMPA  #$02                    ; 7538: 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 = 0x753A; JUMP; // sstep
case 0x753A:
                                                     mon("         BGT   L755A                   ; 753A: 2E 1E         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x755a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x753C; JUMP; // sstep
case 0x753C:
                                                     mon("         LDB   #$47                    ; 753C: C6 47         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x47; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x753E; JUMP; // sstep
case 0x753E:
                                                     mon("         JSR   $E7C7                   ; 753E: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x41); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7541:
                                                     mon("L7541    LDB   #$48                    ; 7541: C6 48         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x48; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7543; JUMP; // sstep
case 0x7543:
                                                     mon("         JSR   $E7C7                   ; 7543: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x46); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x7546:
                                                     mon("L7546    LDD   #$90                    ; 7546: CC 00 90      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x90; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7549; JUMP; // sstep
case 0x7549:
                                                     mon("         STD   ,Y++                    ; 7549: 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 = 0x754B; JUMP; // sstep
case 0x754B:
                                                     mon("         LDD   #$70                    ; 754B: CC 00 70      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x70; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x754E; JUMP; // sstep
case 0x754E:
                                                     mon("         STD   ,Y++                    ; 754E: 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 = 0x7550; JUMP; // sstep
case 0x7550:
                                                     mon("         LDA   <$8E                    ; 7550: 96 8E         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x8e); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7552; JUMP; // sstep
case 0x7552:
                                                     mon("         JSR   $E7AD                   ; 7552: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x55); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0x7555:
                                                     mon("L7555    LDD   #$8040                  ; 7555: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7558; JUMP; // sstep
case 0x7558:
                                                     mon("         STD   ,Y++                    ; 7558: 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 = 0x755A; JUMP; // sstep
case 0x755A:
                                                     mon("L755A    LDA   $4B0E                   ; 755A: B6 4B 0E      \n"); // "Attract screen/game phase  timer", Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x755D; JUMP; // sstep
case 0x755D:
                                                     mon("         CMPA  #$01                    ; 755D: 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 = 0x755F; JUMP; // sstep
case 0x755F:
                                                     mon("         BGT   L759C                   ; 755F: 2E 3B         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x759c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7561; JUMP; // sstep
case 0x7561:
                                                     mon("         LDA   $4845                   ; 7561: B6 48 45      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4845); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7564; JUMP; // sstep
case 0x7564:
                                                     mon("         BEQ   L759C                   ; 7564: 27 36         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x759c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7566; JUMP; // sstep
case 0x7566:
                                                     mon("         LDA   $4592                   ; 7566: B6 45 92      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4592); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7569; JUMP; // sstep
case 0x7569:
                                                     mon("         ANDA  #$03                    ; 7569: 84 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x03; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x756B; JUMP; // sstep
case 0x756B:
                                                     mon("         BEQ   L759C                   ; 756B: 27 2F         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x759c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x756D; JUMP; // sstep
case 0x756D:
                                                     mon("         LDB   $4593                   ; 756D: F6 45 93      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4593); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7570; JUMP; // sstep
case 0x7570:
                                                     mon("         ANDB  #$03                    ; 7570: C4 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x03; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x7572; JUMP; // sstep
case 0x7572:
                                                     mon("         ADDB  #$06                    ; 7572: CB 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    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)); 
    B = (UINT8)res; 
    PC = 0x7574; JUMP; // sstep
case 0x7574:
                                                     mon("         CMPB  <$60                    ; 7574: D1 60         \n"); // Shield count
    clockticks = clockticks + 4; 
    val = (UINT8)B; 
    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 = 0x7576; JUMP; // sstep
case 0x7576:
                                                     mon("         BHI   L757C                   ; 7576: 22 04         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x757c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7578; JUMP; // sstep
case 0x7578:
                                                     mon("         LDB   #$4A                    ; 7578: C6 4A         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4a; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x757A; JUMP; // sstep
case 0x757A:
                                                     mon("         BRA   L7599                   ; 757A: 20 1D         \n");
    PC = 0x7599; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x757C:
                                                     mon("L757C    LDU   #$A01A                  ; 757C: CE A0 1A      \n");
    clockticks = clockticks + 3; 
    U = 0xa01a; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x757F; JUMP; // sstep
case 0x757F:
                                                     mon("         STU   ,Y++                    ; 757F: 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 = 0x7581; JUMP; // sstep
case 0x7581:
                                                     mon("         LDU   #$48                    ; 7581: CE 00 48      \n");
    clockticks = clockticks + 3; 
    U = 0x0048; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x7584; JUMP; // sstep
case 0x7584:
                                                     mon("         STU   ,Y++                    ; 7584: 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 = 0x7586; JUMP; // sstep
case 0x7586:
                                                     mon("         LDU   #$1EC0                  ; 7586: CE 1E C0      \n");
    clockticks = clockticks + 3; 
    U = 0x1ec0; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x7589; JUMP; // sstep
case 0x7589:
                                                     mon("         STU   ,Y++                    ; 7589: 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 = 0x758B; JUMP; // sstep
case 0x758B:
                                                     mon("         LDB   #$01                    ; 758B: C6 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x758D; JUMP; // sstep
case 0x758D:
                                                     mon("         STB   <$AD                    ; 758D: D7 AD         \n");
    clockticks = clockticks + 4; 
    val = B; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x758F; JUMP; // sstep
case 0x758F:
                                                     mon("         JSR   $E7AD                   ; 758F: BD E7 AD      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x92); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7ad; 
    JUMP;
  case 0x7592:
                                                     mon("L7592    LDD   #$8040                  ; 7592: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7595; JUMP; // sstep
case 0x7595:
                                                     mon("         STD   ,Y++                    ; 7595: 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 = 0x7597; JUMP; // sstep
case 0x7597:
                                                     mon("         LDB   #$49                    ; 7597: C6 49         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x49; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7599; JUMP; // sstep
case 0x7599:
                                                     mon("L7599    JSR   $E7C7                   ; 7599: BD E7 C7      \n"); // "Print text string from pointer table", Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x759C:
                                                     mon("L759C    LDA   $4B0E                   ; 759C: B6 4B 0E      \n"); // "Attract screen/game phase  timer", Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0e); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x759F; JUMP; // sstep
case 0x759F:
                                                     mon("         CMPA  #$00                    ; 759F: 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 = 0x75A1; JUMP; // sstep
case 0x75A1:
                                                     mon("         BGT   L75B2                   ; 75A1: 2E 0F         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x75b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x75A3; JUMP; // sstep
case 0x75A3:
                                                     mon("         LDA   $4B2D                   ; 75A3: B6 4B 2D      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2d); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x75A6; JUMP; // sstep
case 0x75A6:
                                                     mon("         BNE   L75B2                   ; 75A6: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x75b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x75A8; JUMP; // sstep
case 0x75A8:
                                                     mon("         LDB   $4B15                   ; 75A8: F6 4B 15      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b15); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x75AB; JUMP; // sstep
case 0x75AB:
                                                     mon("         BEQ   L75B2                   ; 75AB: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x75b2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x75AD; JUMP; // sstep
case 0x75AD:
                                                     mon("         LDB   #$4B                    ; 75AD: C6 4B         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x4b; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x75AF; JUMP; // sstep
case 0x75AF:
                                                     mon("         JSR   $E7C7                   ; 75AF: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x75B2:
                                                     mon("L75B2    JSR   $98B0                   ; 75B2: BD 98 B0      \n"); // "Insert vector laser explosion small circle", Insert vector laser explosion small circle
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x98b0; 
    JUMP;
  case 0x75B5:
                                                     mon("L75B5    JSR   L612F                   ; 75B5: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_7519
  case 0x75B8:
                                                     mon("L75B8    RTS                           ; 75B8: 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 0x75B9:
                                                     mon("L75B9    JSR   L6112                   ; 75B9: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x75BC:
                                                     mon("L75BC    LDA   #$10                    ; 75BC: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x75BE; JUMP; // sstep
case 0x75BE:
                                                     mon("         JSR   $CE0C                   ; 75BE: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x75C1:
                                                     mon("L75C1    JSR   L761D                   ; 75C1: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xc4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x75C4:
                                                     mon("L75C4    LDA   $4B36                   ; 75C4: B6 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x75C7; JUMP; // sstep
case 0x75C7:
                                                     mon("         BLE   L75CC                   ; 75C7: 2F 03         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x75cc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x75C9; JUMP; // sstep
case 0x75C9:
                                                     mon("         JSR   $97C2                   ; 75C9: BD 97 C2      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x97c2; 
    JUMP;
  case 0x75CC:
                                                     mon("L75CC    JSR   $95A7                   ; 75CC: BD 95 A7      \n"); // "Insert vector instructions for shields", Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xcf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x75CF:
                                                     mon("L75CF    JSR   $B6B9                   ; 75CF: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd2); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x75D2:
                                                     mon("L75D2    JSR   L77A4                   ; 75D2: BD 77 A4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x77a4; 
    JUMP;
  case 0x75D5:
                                                     mon("L75D5    JSR   L612F                   ; 75D5: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd8); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_75B9
  case 0x75D8:
                                                     mon("L75D8    RTS                           ; 75D8: 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
  case 0x75D9:
                                                     mon("L75D9    JSR   L6112                   ; 75D9: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x75DC:
                                                     mon("L75DC    LDA   #$10                    ; 75DC: 86 10         \n"); // BIC points to Matrix 4
    clockticks = clockticks + 2; 
    val = (UINT8)0x10; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x75DE; JUMP; // sstep
case 0x75DE:
                                                     mon("         JSR   $CE0C                   ; 75DE: BD CE 0C      \n"); // Copy transform data from [BIC] to matrix 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe1); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xce0c; 
    JUMP;
  case 0x75E1:
                                                     mon("L75E1    JSR   L761D                   ; 75E1: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe4); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x75E4:
                                                     mon("L75E4    JSR   $95A7                   ; 75E4: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x75E7:
                                                     mon("L75E7    JSR   $B6B9                   ; 75E7: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xea); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x75); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x75EA:
                                                     mon("L75EA    LDD   #$1F98                  ; 75EA: CC 1F 98      \n");
    clockticks = clockticks + 3; 
    A = 0x1f; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x75ED; JUMP; // sstep
case 0x75ED:
                                                     mon("         STD   ,Y++                    ; 75ED: 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 = 0x75EF; JUMP; // sstep
case 0x75EF:
                                                     mon("         LDD   #$00                    ; 75EF: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x75F2; JUMP; // sstep
case 0x75F2:
                                                     mon("         STD   ,Y++                    ; 75F2: 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 = 0x75F4; JUMP; // sstep
case 0x75F4:
                                                     mon("         LDD   #$7200                  ; 75F4: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x75F7; JUMP; // sstep
case 0x75F7:
                                                     mon("         STD   ,Y++                    ; 75F7: 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 = 0x75F9; JUMP; // sstep
case 0x75F9:
                                                     mon("         LDD   #$BE50                  ; 75F9: CC BE 50      \n");
    clockticks = clockticks + 3; 
    A = 0xbe; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x75FC; JUMP; // sstep
case 0x75FC:
                                                     mon("         STD   ,Y++                    ; 75FC: 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 = 0x75FE; JUMP; // sstep
case 0x75FE:
                                                     mon("         LDD   #$7200                  ; 75FE: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7601; JUMP; // sstep
case 0x7601:
                                                     mon("         STD   ,Y++                    ; 7601: 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 = 0x7603; JUMP; // sstep
case 0x7603:
                                                     mon("         JSR   $BB85                   ; 7603: BD BB 85      \n"); // Death Star explosion animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x06); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xbb85; 
    JUMP;
  case 0x7606:
                                                     mon("L7606    JSR   L612F                   ; 7606: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x09); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_75D9
  case 0x7609:
                                                     mon("L7609    RTS                           ; 7609: 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
  case 0x760A:
                                                     mon("L760A    JSR   L6112                   ; 760A: BD 61 12      \n"); // Insert vector data for four blue dots in screen corners
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0x6112; 
    JUMP;
  case 0x760D:
                                                     mon("L760D    JSR   L761D                   ; 760D: BD 76 1D      \n"); // Display score
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x10); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0x761d; 
    JUMP;
  case 0x7610:
                                                     mon("L7610    JSR   $95A7                   ; 7610: BD 95 A7      \n"); // Insert vector instructions for shields
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x13); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0x95a7; 
    JUMP;
  case 0x7613:
                                                     mon("L7613    JSR   $B6B9                   ; 7613: BD B6 B9      \n"); // Insert vector instructions at joystick position for laser explosion 2
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x16); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xb6b9; 
    JUMP;
  case 0x7616:
                                                     mon("L7616    JSR   $BB85                   ; 7616: BD BB 85      \n"); // Death Star explosion animation
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x19); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xbb85; 
    JUMP;
  case 0x7619:
                                                     mon("L7619    JSR   L612F                   ; 7619: BD 61 2F      \n"); // Vector instructions end
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0x612f; 
    JUMP;
    // End of function sub_760A
  case 0x761C:
                                                     mon("L761C    RTS                           ; 761C: 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 =======================================
    // Display score
  case 0x761D:
                                                     mon("L761D    LDD   #$B9F2                  ; 761D: CC B9 F2      \n");
    clockticks = clockticks + 3; 
    A = 0xb9; 
    B = 0xf2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7620; JUMP; // sstep
case 0x7620:
                                                     mon("         STD   ,Y++                    ; 7620: 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 = 0x7622; JUMP; // sstep
case 0x7622:
                                                     mon("         LDD   #$6280                  ; 7622: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7625; JUMP; // sstep
case 0x7625:
                                                     mon("         STD   ,Y++                    ; 7625: 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 = 0x7627; JUMP; // sstep
case 0x7627:
                                                     mon("         LDD   #$01E0                  ; 7627: CC 01 E0      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xe0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x762A; JUMP; // sstep
case 0x762A:
                                                     mon("L762A    STD   ,Y++                    ; 762A: 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 = 0x762C; JUMP; // sstep
case 0x762C:
                                                     mon("L762C    LDD   #$1E20                  ; 762C: CC 1E 20      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0x20; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x762F; JUMP; // sstep
case 0x762F:
                                                     mon("         STD   ,Y++                    ; 762F: 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 = 0x7631; JUMP; // sstep
case 0x7631:
                                                     mon("         LDA   #$06                    ; 7631: 86 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7633; JUMP; // sstep
case 0x7633:
                                                     mon("         STA   <$AD                    ; 7633: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x7635; JUMP; // sstep
case 0x7635:
                                                     mon("         LDX   #$485C                  ; 7635: 8E 48 5C      \n");
    clockticks = clockticks + 3; 
    X = 0x485c; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x7638; JUMP; // sstep
case 0x7638:
                                                     mon("         JSR   $E764                   ; 7638: BD E7 64      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe764; 
    JUMP;
  case 0x763B:
                                                     mon("L763B    LDD   #$8040                  ; 763B: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x763E; JUMP; // sstep
case 0x763E:
                                                     mon("         STD   ,Y++                    ; 763E: 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 = 0x7640; JUMP; // sstep
case 0x7640:
                                                     mon("         LDB   $4B2C                   ; 7640: F6 4B 2C      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b2c); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7643; JUMP; // sstep
case 0x7643:
                                                     mon("         BEQ   L766E                   ; 7643: 27 29         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x766e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7645; JUMP; // sstep
case 0x7645:
                                                     mon("         SUBB  #$08                    ; 7645: C0 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)); 
    B = (UINT8)(res); 
    PC = 0x7647; JUMP; // sstep
case 0x7647:
                                                     mon("         CMPB  #$20                    ; 7647: 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 = 0x7649; JUMP; // sstep
case 0x7649:
                                                     mon("         BCC   L764D                   ; 7649: 24 02         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x764d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x764B; JUMP; // sstep
case 0x764B:
                                                     mon("         LDB   #$00                    ; 764B: C6 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x764D; JUMP; // sstep
case 0x764D:
                                                     mon("L764D    STB   $4B2C                   ; 764D: F7 4B 2C      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4b2c, val); 
    PC = 0x7650; JUMP; // sstep
case 0x7650:
                                                     mon("         LSRB                          ; 7650: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x7651; JUMP; // sstep
case 0x7651:
                                                     mon("L7651    LDA   #$66                    ; 7651: 86 66         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x66; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7653; JUMP; // sstep
case 0x7653:
                                                     mon("         STD   ,Y++                    ; 7653: 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 = 0x7655; JUMP; // sstep
case 0x7655:
                                                     mon("         LDD   #$01B0                  ; 7655: CC 01 B0      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0xb0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7658; JUMP; // sstep
case 0x7658:
                                                     mon("         STD   ,Y++                    ; 7658: 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 = 0x765A; JUMP; // sstep
case 0x765A:
                                                     mon("         LDD   #$1E50                  ; 765A: CC 1E 50      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x765D; JUMP; // sstep
case 0x765D:
                                                     mon("         STD   ,Y++                    ; 765D: 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 = 0x765F; JUMP; // sstep
case 0x765F:
                                                     mon("         LDA   #$05                    ; 765F: 86 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x05; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7661; JUMP; // sstep
case 0x7661:
                                                     mon("         STA   <$AD                    ; 7661: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x7663; JUMP; // sstep
case 0x7663:
                                                     mon("         LDX   #$4B28                  ; 7663: 8E 4B 28      \n");
    clockticks = clockticks + 3; 
    X = 0x4b28; 
    Z = X; 
    N = (X) >> 8; 
    V = 0; 
    PC = 0x7666; JUMP; // sstep
case 0x7666:
                                                     mon("         JSR   $E772                   ; 7666: BD E7 72      \n"); // Display BCD number text
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x69); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe772; 
    JUMP;
  case 0x7669:
                                                     mon("L7669    LDD   #$8040                  ; 7669: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x766C; JUMP; // sstep
case 0x766C:
                                                     mon("         STD   ,Y++                    ; 766C: 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 = 0x766E; JUMP; // sstep
case 0x766E:
                                                     mon("L766E    LDD   #$6280                  ; 766E: CC 62 80      \n");
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7671; JUMP; // sstep
case 0x7671:
                                                     mon("         STD   ,Y++                    ; 7671: 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 = 0x7673; JUMP; // sstep
case 0x7673:
                                                     mon("         LDD   #$0210                  ; 7673: CC 02 10      \n");
    clockticks = clockticks + 3; 
    A = 0x02; 
    B = 0x10; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7676; JUMP; // sstep
case 0x7676:
                                                     mon("         STD   ,Y++                    ; 7676: 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 = 0x7678; JUMP; // sstep
case 0x7678:
                                                     mon("         LDD   #$0138                  ; 7678: CC 01 38      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x38; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x767B; JUMP; // sstep
case 0x767B:
                                                     mon("         STD   ,Y++                    ; 767B: 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 = 0x767D; JUMP; // sstep
case 0x767D:
                                                     mon("         LDA   #$01                    ; 767D: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x767F; JUMP; // sstep
case 0x767F:
                                                     mon("         STA   <$AD                    ; 767F: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x7681; JUMP; // sstep
case 0x7681:
                                                     mon("         LDA   $4B16                   ; 7681: B6 4B 16      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b16); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7684; JUMP; // sstep
case 0x7684:
                                                     mon("         JSR   $E790                   ; 7684: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x87); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x7687:
                                                     mon("L7687    LDD   #$8040                  ; 7687: CC 80 40      \n");
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x768A; JUMP; // sstep
case 0x768A:
                                                     mon("         STD   ,Y++                    ; 768A: 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_761D
    PC = 0x768C; JUMP; // sstep
case 0x768C:
                                                     mon("         RTS                           ; 768C: 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 =======================================
    // Display tower count and hit score
  case 0x768D:
                                                     mon("L768D    LDA   $4B13                   ; 768D: B6 4B 13      \n"); // Display tower hit score
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b13); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7690; JUMP; // sstep
case 0x7690:
                                                     mon("         BLE   L76FC                   ; 7690: 2F 6A         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x76fc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7692; JUMP; // sstep
case 0x7692:
                                                     mon("         LDA   $4B1A                   ; 7692: B6 4B 1A      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b1a); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7695; JUMP; // sstep
case 0x7695:
                                                     mon("         BEQ   L76D3                   ; 7695: 27 3C         \n"); // Towers left to shoot count
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x76d3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7697; JUMP; // sstep
case 0x7697:
                                                     mon("         LDA   <$43                    ; 7697: 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 = 0x7699; JUMP; // sstep
case 0x7699:
                                                     mon("         ANDA  #$30                    ; 7699: 84 30         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x30; 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x769B; JUMP; // sstep
case 0x769B:
                                                     mon("         BEQ   L76CE                   ; 769B: 27 31         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x76ce; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x769D; JUMP; // sstep
case 0x769D:
                                                     mon("         LDB   #$40                    ; 769D: C6 40         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x40; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x769F; JUMP; // sstep
case 0x769F:
                                                     mon("         JSR   $E7C7                   ; 769F: 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, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x76A2:
                                                     mon("L76A2    LDD   #$6280                  ; 76A2: CC 62 80      \n"); // Vector STAT 2,80 instruction
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76A5; JUMP; // sstep
case 0x76A5:
                                                     mon("         STD   ,Y++                    ; 76A5: 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 = 0x76A7; JUMP; // sstep
case 0x76A7:
                                                     mon("         LDD   #$0180                  ; 76A7: CC 01 80      \n"); // Vector draw to position
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76AA; JUMP; // sstep
case 0x76AA:
                                                     mon("         STD   ,Y++                    ; 76AA: 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 = 0x76AC; JUMP; // sstep
case 0x76AC:
                                                     mon("         LDD   #$1ED0                  ; 76AC: CC 1E D0      \n");
    clockticks = clockticks + 3; 
    A = 0x1e; 
    B = 0xd0; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76AF; JUMP; // sstep
case 0x76AF:
                                                     mon("         STD   ,Y++                    ; 76AF: 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 = 0x76B1; JUMP; // sstep
case 0x76B1:
                                                     mon("         LDA   #$04                    ; 76B1: 86 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x76B3; JUMP; // sstep
case 0x76B3:
                                                     mon("         STA   <$AD                    ; 76B3: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x76B5; JUMP; // sstep
case 0x76B5:
                                                     mon("         LDA   $4B2E                   ; 76B5: 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 = 0x76B8; JUMP; // sstep
case 0x76B8:
                                                     mon("         JSR   $E790                   ; 76B8: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xbb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x76BB:
                                                     mon("L76BB    LDA   $4B2F                   ; 76BB: 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 = 0x76BE; JUMP; // sstep
case 0x76BE:
                                                     mon("         JSR   $E790                   ; 76BE: 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, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x76C1:
                                                     mon("L76C1    LDA   $4B30                   ; 76C1: 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 = 0x76C4; JUMP; // sstep
case 0x76C4:
                                                     mon("         JSR   $E790                   ; 76C4: 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, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x76C7:
                                                     mon("L76C7    LDD   #$8040                  ; 76C7: CC 80 40      \n"); // Vector CNTR instruction
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76CA; JUMP; // sstep
case 0x76CA:
                                                     mon("         STD   ,Y++                    ; 76CA: 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 = 0x76CC; JUMP; // sstep
case 0x76CC:
                                                     mon("         BRA   L76D3                   ; 76CC: 20 05         \n"); // Towers left to shoot count
    PC = 0x76d3; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x76CE:
                                                     mon("L76CE    LDB   #$43                    ; 76CE: C6 43         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x43; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    // End of function sub_768D
    PC = 0x76D0; JUMP; // sstep
case 0x76D0:
                                                     mon("         JSR   $E7C7                   ; 76D0: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // =============== S U B R O U T I N E =======================================
    // Towers left to shoot count
  case 0x76D3:
                                                     mon("L76D3    LDA   $4B13                   ; 76D3: B6 4B 13      \n"); // Display towers left to shoot count
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b13); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x76D6; JUMP; // sstep
case 0x76D6:
                                                     mon("         BLE   L76FC                   ; 76D6: 2F 24         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x76fc; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x76D8; JUMP; // sstep
case 0x76D8:
                                                     mon("         LDD   #$41                    ; 76D8: CC 00 41      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x41; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x76DB; JUMP; // sstep
case 0x76DB:
                                                     mon("         JSR   $E7C7                   ; 76DB: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xde); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
  case 0x76DE:
                                                     mon("L76DE    LDD   #$6280                  ; 76DE: CC 62 80      \n"); // Vector STAT 2,80 instruction
    clockticks = clockticks + 3; 
    A = 0x62; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76E1; JUMP; // sstep
case 0x76E1:
                                                     mon("         STD   ,Y++                    ; 76E1: 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 = 0x76E3; JUMP; // sstep
case 0x76E3:
                                                     mon("         LDD   #$0198                  ; 76E3: CC 01 98      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x98; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76E6; JUMP; // sstep
case 0x76E6:
                                                     mon("         STD   ,Y++                    ; 76E6: 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 = 0x76E8; JUMP; // sstep
case 0x76E8:
                                                     mon("         LDD   #$0168                  ; 76E8: CC 01 68      \n");
    clockticks = clockticks + 3; 
    A = 0x01; 
    B = 0x68; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76EB; JUMP; // sstep
case 0x76EB:
                                                     mon("         STD   ,Y++                    ; 76EB: 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 = 0x76ED; JUMP; // sstep
case 0x76ED:
                                                     mon("         LDA   #$01                    ; 76ED: 86 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x01; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x76EF; JUMP; // sstep
case 0x76EF:
                                                     mon("         STA   <$AD                    ; 76EF: 97 AD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xad; 
    wr_mem(ea, val); 
    PC = 0x76F1; JUMP; // sstep
case 0x76F1:
                                                     mon("         LDA   $4B1A                   ; 76F1: B6 4B 1A      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b1a); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x76F4; JUMP; // sstep
case 0x76F4:
                                                     mon("         JSR   $E790                   ; 76F4: BD E7 90      \n"); // Display BCD numbers
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    PC = 0xe790; 
    JUMP;
  case 0x76F7:
                                                     mon("L76F7    LDD   #$8040                  ; 76F7: CC 80 40      \n"); // Vector CNTR instruction
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x76FA; JUMP; // sstep
case 0x76FA:
                                                     mon("         STD   ,Y++                    ; 76FA: 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 = 0x76FC; JUMP; // sstep
case 0x76FC:
                                                     mon("L76FC    LDA   $4B35                   ; 76FC: B6 4B 35      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b35); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x76FF; JUMP; // sstep
case 0x76FF:
                                                     mon("         BEQ   locret_7706             ; 76FF: 27 05         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x7706; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7701; JUMP; // sstep
case 0x7701:
                                                     mon("         LDB   #$42                    ; 7701: C6 42         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x42; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7703; JUMP; // sstep
case 0x7703:
                                                     mon("         JSR   $E7C7                   ; 7703: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x06); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // End of function sub_76D3
  case 0x7706:
                                                     mon("locret_7706 RTS                           ; 7706: 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 =======================================
    // Game Over text handling
  case 0x7707:
                                                     mon("L7707    LDA   $4B0F                   ; 7707: B6 4B 0F      \n"); // Attract screen/game phase  timer
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b0f); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x770A; JUMP; // sstep
case 0x770A:
                                                     mon("         CMPA  #$20                    ; 770A: 81 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x20; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x770C; JUMP; // sstep
case 0x770C:
                                                     mon("         BLS   L7710                   ; 770C: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x7710; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x770E; JUMP; // sstep
case 0x770E:
                                                     mon("         LDA   #$20                    ; 770E: 86 20         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x20; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7710; JUMP; // sstep
case 0x7710:
                                                     mon("L7710    LDB   #$06                    ; 7710: C6 06         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x06; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7712; JUMP; // sstep
case 0x7712:
                                                     mon("         MUL                           ; 7712: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x7713; JUMP; // sstep
case 0x7713:
                                                     mon("         NEGB                          ; 7713: 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 = 0x7714; JUMP; // sstep
case 0x7714:
                                                     mon("         ADDB  #$C0                    ; 7714: 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 = 0x7716; JUMP; // sstep
case 0x7716:
                                                     mon("         LDA   #$70                    ; 7716: 86 70         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x70; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7718; JUMP; // sstep
case 0x7718:
                                                     mon("         STD   ,Y++                    ; 7718: 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 = 0x771A; JUMP; // sstep
case 0x771A:
                                                     mon("         LDB   #$04                    ; 771A: C6 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x04; 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x771C; JUMP; // sstep
case 0x771C:
                                                     mon("         JSR   $E7C7                   ; 771C: BD E7 C7      \n"); // Print text string from pointer table
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x1f); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0xe7c7; 
    JUMP;
    // End of function sub_7707
  case 0x771F:
                                                     mon("L771F    RTS                           ; 771F: 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 0x7720:
                                                     mon("L7720    STD   $4AD7                   ; 7720: FD 4A D7      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ad7, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ad8, B); 
    PC = 0x7723; JUMP; // sstep
case 0x7723:
                                                     mon("         LDD   #$00                    ; 7723: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7726; JUMP; // sstep
case 0x7726:
                                                     mon("         STD   $4AD4                   ; 7726: FD 4A D4      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4ad4, A); // Care needed with I/O space and word fetches
    wr_mem(0x4ad5, B); 
    PC = 0x7729; JUMP; // sstep
case 0x7729:
                                                     mon("         STA   $4AD6                   ; 7729: B7 4A D6      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4ad6, val); 
    PC = 0x772C; JUMP; // sstep
case 0x772C:
                                                     mon("L772C    ASL   $4AD8                   ; 772C: 78 4A D8      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad8); 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    wr_mem(0x4ad8, res); 
    clockticks = clockticks + 2; 
    PC = 0x772F; JUMP; // sstep
case 0x772F:
                                                     mon("         ROL   $4AD7                   ; 772F: 79 4A D7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad7); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
/**/V = (UINT8)res ^ val; 
    wr_mem(0x4ad7, (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0x7732; JUMP; // sstep
case 0x7732:
                                                     mon("         LDA   $4AD6                   ; 7732: B6 4A D6      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad6); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7735; JUMP; // sstep
case 0x7735:
                                                     mon("         ADCA  $4AD6                   ; 7735: B9 4A D6      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4ad6); 
    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 = 0x7738; JUMP; // sstep
case 0x7738:
                                                     mon("         DAA                           ; 7738: 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 = 0x7739; JUMP; // sstep
case 0x7739:
                                                     mon("         STA   $4AD6                   ; 7739: B7 4A D6      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4ad6, val); 
    PC = 0x773C; JUMP; // sstep
case 0x773C:
                                                     mon("         LDA   $4AD5                   ; 773C: B6 4A D5      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad5); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x773F; JUMP; // sstep
case 0x773F:
                                                     mon("         ADCA  $4AD5                   ; 773F: B9 4A D5      \n");
    clockticks = clockticks + 5; 
    arg = A; 
    val = rd_mem(0x4ad5); 
    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 = 0x7742; JUMP; // sstep
case 0x7742:
                                                     mon("         DAA                           ; 7742: 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 = 0x7743; JUMP; // sstep
case 0x7743:
                                                     mon("         STA   $4AD5                   ; 7743: B7 4A D5      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4ad5, val); 
    PC = 0x7746; JUMP; // sstep
case 0x7746:
                                                     mon("         ROL   $4AD4                   ; 7746: 79 4A D4      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad4); 
    res = (val << 1) + (C != 0 ?1:0); 
    C = res & 0x100; 
/**/Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)res ^ val; 
    wr_mem(0x4ad4, (UINT8)res); 
    clockticks = clockticks + 2; 
    PC = 0x7749; JUMP; // sstep
case 0x7749:
                                                     mon("         LEAX  -1,X                    ; 7749: 30 1F         \n");
    clockticks = clockticks + 5; 
    X = (X + 0xffff); 
    Z = X; 
    PC = 0x774B; JUMP; // sstep
case 0x774B:
                                                     mon("         BNE   L772C                   ; 774B: 26 DF         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x772c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_7720
    PC = 0x774D; JUMP; // sstep
case 0x774D:
                                                     mon("         RTS                           ; 774D: 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 0x774E:
                                                     mon("L774E    STA   $4AD7                   ; 774E: B7 4A D7      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4ad7, val); 
    PC = 0x7751; JUMP; // sstep
case 0x7751:
                                                     mon("         ANDA  #$F0                    ; 7751: 84 F0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xf0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x7753; JUMP; // sstep
case 0x7753:
                                                     mon("         LDB   #$A0                    ; 7753: C6 A0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xa0; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7755; JUMP; // sstep
case 0x7755:
                                                     mon("         MUL                           ; 7755: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x7756; JUMP; // sstep
case 0x7756:
                                                     mon("         LDB   $4AD7                   ; 7756: F6 4A D7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4ad7); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7759; JUMP; // sstep
case 0x7759:
                                                     mon("         ANDB  #$0F                    ; 7759: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x775B; JUMP; // sstep
case 0x775B:
                                                     mon("         STB   $4AD7                   ; 775B: F7 4A D7      \n");
    clockticks = clockticks + 5; 
    val = B; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4ad7, val); 
    PC = 0x775E; JUMP; // sstep
case 0x775E:
                                                     mon("         ADDA  $4AD7                   ; 775E: BB 4A D7      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem(0x4ad7); 
    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 = 0x7761; JUMP; // sstep
case 0x7761:
                                                     mon("         STA   $4AD7                   ; 7761: B7 4A D7      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4ad7, val); 
    // End of function sub_774E
    PC = 0x7764; JUMP; // sstep
case 0x7764:
                                                     mon("         RTS                           ; 7764: 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 sub_7765
  case 0x7765:
                                                     mon("L7765    LDD   $5028                   ; 7765: FC 50 28      \n"); // Ax2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5028); // Care needed with I/O space and word fetches
    B = rd_mem(0x5029); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x7768; JUMP; // sstep
case 0x7768:
                                                     mon("         BLE   locret_77A3             ; 7768: 2F 39         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x77a3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x776A; JUMP; // sstep
case 0x776A:
                                                     mon("         STD   $4704                   ; 776A: 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 = 0x776D; JUMP; // sstep
case 0x776D:
                                                     mon("         LDD   $502A                   ; 776D: 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 = 0x7770; JUMP; // sstep
case 0x7770:
                                                     mon("         STD   $5002                   ; 7770: 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 = 0x7773; JUMP; // sstep
case 0x7773:
                                                     mon("         TSTA                          ; 7773: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7774; JUMP; // sstep
case 0x7774:
                                                     mon("         BPL   L777A                   ; 7774: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x777a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7776; JUMP; // sstep
case 0x7776:
                                                     mon("         COMA                          ; 7776: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x7777; JUMP; // sstep
case 0x7777:
                                                     mon("         NEGB                          ; 7777: 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 = 0x7778; JUMP; // sstep
case 0x7778:
                                                     mon("         SBCA  #$FF                    ; 7778: 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 = 0x777A; JUMP; // sstep
case 0x777A:
                                                     mon("L777A    SUBD  $5028                   ; 777A: B3 50 28      \n"); // "Ax2", Ax2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5028)<<8; 
    ea = ea | rd_mem(0x5029); 
    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 = 0x777D; JUMP; // sstep
case 0x777D:
                                                     mon("         BGE   locret_77A3             ; 777D: 2C 24         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x77a3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x777F; JUMP; // sstep
case 0x777F:
                                                     mon("         LDD   $502C                   ; 777F: 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 = 0x7782; JUMP; // sstep
case 0x7782:
                                                     mon("         STD   $5004                   ; 7782: 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 = 0x7785; JUMP; // sstep
case 0x7785:
                                                     mon("         TSTA                          ; 7785: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7786; JUMP; // sstep
case 0x7786:
                                                     mon("         BPL   L778C                   ; 7786: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x778c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7788; JUMP; // sstep
case 0x7788:
                                                     mon("         COMA                          ; 7788: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x7789; JUMP; // sstep
case 0x7789:
                                                     mon("         NEGB                          ; 7789: 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 = 0x778A; JUMP; // sstep
case 0x778A:
                                                     mon("         SBCA  #$FF                    ; 778A: 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 = 0x778C; JUMP; // sstep
case 0x778C:
                                                     mon("L778C    SUBD  $5028                   ; 778C: B3 50 28      \n"); // "Ax2", Ax2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5028)<<8; 
    ea = ea | rd_mem(0x5029); 
    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 = 0x778F; JUMP; // sstep
case 0x778F:
                                                     mon("L778F    BGE   locret_77A3             ; 778F: 2C 12         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x77a3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7791; JUMP; // sstep
case 0x7791:
                                                     mon("         JSR   $CCF0                   ; 7791: 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, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0xccf0; 
    JUMP;
  case 0x7794:
                                                     mon("L7794    LDD   #$7300                  ; 7794: CC 73 00      \n");
    clockticks = clockticks + 3; 
    A = 0x73; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7797; JUMP; // sstep
case 0x7797:
                                                     mon("         STD   ,Y++                    ; 7797: 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 = 0x7799; JUMP; // sstep
case 0x7799:
                                                     mon("         LDD   #$BE50                  ; 7799: CC BE 50      \n"); // Vector JRSL Small Death Star
    clockticks = clockticks + 3; 
    A = 0xbe; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x779C; JUMP; // sstep
case 0x779C:
                                                     mon("         STD   ,Y++                    ; 779C: 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 = 0x779E; JUMP; // sstep
case 0x779E:
                                                     mon("         LDD   #$7200                  ; 779E: CC 72 00      \n");
    clockticks = clockticks + 3; 
    A = 0x72; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x77A1; JUMP; // sstep
case 0x77A1:
                                                     mon("         STD   ,Y++                    ; 77A1: 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_7765
    PC = 0x77A3; JUMP; // sstep
case 0x77A3:
                                                     mon("locret_77A3 RTS                           ; 77A3: 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 0x77A4:
                                                     mon("L77A4    LDD   $5028                   ; 77A4: FC 50 28      \n"); // Ax2
    clockticks = clockticks + 5; 
    A = rd_mem(0x5028); // Care needed with I/O space and word fetches
    B = rd_mem(0x5029); 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x77A7; JUMP; // sstep
case 0x77A7:
                                                     mon("         BLE   locret_77D3             ; 77A7: 2F 2A         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) <  0) || (!Z)) {
    PC = 0x77d3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x77A9; JUMP; // sstep
case 0x77A9:
                                                     mon("         STD   $4704                   ; 77A9: 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 = 0x77AC; JUMP; // sstep
case 0x77AC:
                                                     mon("         LDD   $502A                   ; 77AC: 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 = 0x77AF; JUMP; // sstep
case 0x77AF:
                                                     mon("         STD   $5002                   ; 77AF: 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 = 0x77B2; JUMP; // sstep
case 0x77B2:
                                                     mon("         TSTA                          ; 77B2: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x77B3; JUMP; // sstep
case 0x77B3:
                                                     mon("         BPL   L77B9                   ; 77B3: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x77b9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x77B5; JUMP; // sstep
case 0x77B5:
                                                     mon("         COMA                          ; 77B5: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x77B6; JUMP; // sstep
case 0x77B6:
                                                     mon("         NEGB                          ; 77B6: 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 = 0x77B7; JUMP; // sstep
case 0x77B7:
                                                     mon("         SBCA  #$FF                    ; 77B7: 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 = 0x77B9; JUMP; // sstep
case 0x77B9:
                                                     mon("L77B9    SUBD  $5028                   ; 77B9: B3 50 28      \n"); // "Ax2", Ax2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5028)<<8; 
    ea = ea | rd_mem(0x5029); 
    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 = 0x77BC; JUMP; // sstep
case 0x77BC:
                                                     mon("         BGE   locret_77D3             ; 77BC: 2C 15         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x77d3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x77BE; JUMP; // sstep
case 0x77BE:
                                                     mon("         LDD   $502C                   ; 77BE: 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 = 0x77C1; JUMP; // sstep
case 0x77C1:
                                                     mon("         STD   $5004                   ; 77C1: 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 = 0x77C4; JUMP; // sstep
case 0x77C4:
                                                     mon("         TSTA                          ; 77C4: 4D            \n");
    val = (UINT8)A; 
    Z = val; 
    N = val; 
    V = 0; 
    clockticks = clockticks + 2; 
    PC = 0x77C5; JUMP; // sstep
case 0x77C5:
                                                     mon("         BPL   L77CB                   ; 77C5: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x77cb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x77C7; JUMP; // sstep
case 0x77C7:
                                                     mon("         COMA                          ; 77C7: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x77C8; JUMP; // sstep
case 0x77C8:
                                                     mon("         NEGB                          ; 77C8: 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 = 0x77C9; JUMP; // sstep
case 0x77C9:
                                                     mon("         SBCA  #$FF                    ; 77C9: 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 = 0x77CB; JUMP; // sstep
case 0x77CB:
                                                     mon("L77CB    SUBD  $5028                   ; 77CB: B3 50 28      \n"); // "Ax2", Ax2
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5028)<<8; 
    ea = ea | rd_mem(0x5029); 
    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 = 0x77CE; JUMP; // sstep
case 0x77CE:
                                                     mon("         BGE   locret_77D3             ; 77CE: 2C 03         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x77d3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x77D0; JUMP; // sstep
case 0x77D0:
                                                     mon("         JSR   L77D4                   ; 77D0: BD 77 D4      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xd3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0x77d4; 
    JUMP;
    // End of function sub_77A4
  case 0x77D3:
                                                     mon("locret_77D3 RTS                           ; 77D3: 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 0x77D4:
                                                     mon("L77D4    JSR   $CCF0                   ; 77D4: 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, 0xd7); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0xccf0; 
    JUMP;
  case 0x77D7:
                                                     mon("L77D7    LDD   -4,Y                    ; 77D7: 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 = 0x77D9; JUMP; // sstep
case 0x77D9:
                                                     mon("         STD   <$05                    ; 77D9: DD 05         \n"); // Zoom value
    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 = 0x77DB; JUMP; // sstep
case 0x77DB:
                                                     mon("         LDD   -2,Y                    ; 77DB: 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 = 0x77DD; JUMP; // sstep
case 0x77DD:
                                                     mon("         STD   <$03                    ; 77DD: 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 = 0x77DF; JUMP; // sstep
case 0x77DF:
                                                     mon("         LDD   <$56                    ; 77DF: DC 56         \n"); // Zoom value
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x56); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x57); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x77E1; JUMP; // sstep
case 0x77E1:
                                                     mon("         STD   <$01                    ; 77E1: 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 = 0x77E3; JUMP; // sstep
case 0x77E3:
                                                     mon("         LDU   #$BD68                  ; 77E3: CE BD 68      \n");
    clockticks = clockticks + 3; 
    U = 0xbd68; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x77E6; JUMP; // sstep
case 0x77E6:
                                                     mon("         JSR   L7863                   ; 77E6: BD 78 63      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xe9); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0x7863; 
    JUMP;
  case 0x77E9:
                                                     mon("L77E9    LDU   #$BDA6                  ; 77E9: CE BD A6      \n");
    clockticks = clockticks + 3; 
    U = 0xbda6; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x77EC; JUMP; // sstep
case 0x77EC:
                                                     mon("         JSR   L785B                   ; 77EC: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xef); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x77EF:
                                                     mon("L77EF    LDU   #$BDB2                  ; 77EF: CE BD B2      \n");
    clockticks = clockticks + 3; 
    U = 0xbdb2; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x77F2; JUMP; // sstep
case 0x77F2:
                                                     mon("         JSR   L785B                   ; 77F2: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xf5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x77F5:
                                                     mon("L77F5    LDU   #$BDDA                  ; 77F5: CE BD DA      \n");
    clockticks = clockticks + 3; 
    U = 0xbdda; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x77F8; JUMP; // sstep
case 0x77F8:
                                                     mon("         JSR   L785B                   ; 77F8: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfb); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x77FB:
                                                     mon("L77FB    LDU   #$BE06                  ; 77FB: CE BE 06      \n");
    clockticks = clockticks + 3; 
    U = 0xbe06; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x77FE; JUMP; // sstep
case 0x77FE:
                                                     mon("         JSR   L785B                   ; 77FE: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x01); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x7801:
                                                     mon("L7801    LDD   <$56                    ; 7801: DC 56         \n"); // Zoom value
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x56); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x57); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7803; JUMP; // sstep
case 0x7803:
                                                     mon("         SUBA  #$03                    ; 7803: 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 = 0x7805; JUMP; // sstep
case 0x7805:
                                                     mon("         CMPD  #L7000                  ; 7805: 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 = 0x7809; JUMP; // sstep
case 0x7809:
                                                     mon("         BCC   L780E                   ; 7809: 24 03         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x780e; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x780B; JUMP; // sstep
case 0x780B:
                                                     mon("         LDD   #L7000                  ; 780B: CC 70 00      \n");
    clockticks = clockticks + 3; 
    A = 0x70; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x780E; JUMP; // sstep
case 0x780E:
                                                     mon("L780E    STD   <$01                    ; 780E: 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 = 0x7810; JUMP; // sstep
case 0x7810:
                                                     mon("         CMPA  #$70                    ; 7810: 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 = 0x7812; JUMP; // sstep
case 0x7812:
                                                     mon("         BNE   L7819                   ; 7812: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7819; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7814; JUMP; // sstep
case 0x7814:
                                                     mon("         LDD   #$6660                  ; 7814: CC 66 60      \n");
    clockticks = clockticks + 3; 
    A = 0x66; 
    B = 0x60; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x7817; JUMP; // sstep
case 0x7817:
                                                     mon("         BRA   L781C                   ; 7817: 20 03         \n");
    PC = 0x781c; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x7819:
                                                     mon("L7819    LDD   #$6630                  ; 7819: CC 66 30      \n");
    clockticks = clockticks + 3; 
    A = 0x66; 
    B = 0x30; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x781C; JUMP; // sstep
case 0x781C:
                                                     mon("L781C    STD   ,Y++                    ; 781C: 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 = 0x781E; JUMP; // sstep
case 0x781E:
                                                     mon("         LDA   $4B14                   ; 781E: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7821; JUMP; // sstep
case 0x7821:
                                                     mon("         BITA  #$01                    ; 7821: 85 01         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x01; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x7823; JUMP; // sstep
case 0x7823:
                                                     mon("         BNE   L782A                   ; 7823: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x782a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7825; JUMP; // sstep
case 0x7825:
                                                     mon("         LDU   #$B728                  ; 7825: CE B7 28      \n");
    clockticks = clockticks + 3; 
    U = 0xb728; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7828; JUMP; // sstep
case 0x7828:
                                                     mon("         BRA   L7839                   ; 7828: 20 0F         \n");
    PC = 0x7839; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x782A:
                                                     mon("L782A    LDU   #$B73C                  ; 782A: CE B7 3C      \n");
    clockticks = clockticks + 3; 
    U = 0xb73c; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x782D; JUMP; // sstep
case 0x782D:
                                                     mon("         JSR   L785B                   ; 782D: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x30); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x7830:
                                                     mon("L7830    LDU   #$B749                  ; 7830: CE B7 49      \n");
    clockticks = clockticks + 3; 
    U = 0xb749; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7833; JUMP; // sstep
case 0x7833:
                                                     mon("         JSR   L785B                   ; 7833: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x36); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x7836:
                                                     mon("L7836    LDU   #$B754                  ; 7836: CE B7 54      \n");
    clockticks = clockticks + 3; 
    U = 0xb754; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7839; JUMP; // sstep
case 0x7839:
                                                     mon("L7839    JSR   L785B                   ; 7839: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x3c); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x783C:
                                                     mon("L783C    LDA   $4B14                   ; 783C: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x783F; JUMP; // sstep
case 0x783F:
                                                     mon("         BITA  #$01                    ; 783F: 85 01         \n");
    clockticks = clockticks + 2; 
    res = A & (SINT8)0x01; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x7841; JUMP; // sstep
case 0x7841:
                                                     mon("         BNE   L7848                   ; 7841: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7848; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7843; JUMP; // sstep
case 0x7843:
                                                     mon("         LDU   #$B75E                  ; 7843: CE B7 5E      \n");
    clockticks = clockticks + 3; 
    U = 0xb75e; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7846; JUMP; // sstep
case 0x7846:
                                                     mon("         BRA   L7857                   ; 7846: 20 0F         \n");
    PC = 0x7857; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x7848:
                                                     mon("L7848    LDU   #$B770                  ; 7848: CE B7 70      \n");
    clockticks = clockticks + 3; 
    U = 0xb770; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x784B; JUMP; // sstep
case 0x784B:
                                                     mon("         JSR   L785B                   ; 784B: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x784E:
                                                     mon("L784E    LDU   #$B77C                  ; 784E: CE B7 7C      \n");
    clockticks = clockticks + 3; 
    U = 0xb77c; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7851; JUMP; // sstep
case 0x7851:
                                                     mon("         JSR   L785B                   ; 7851: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x54); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
  case 0x7854:
                                                     mon("L7854    LDU   #$B788                  ; 7854: CE B7 88      \n");
    clockticks = clockticks + 3; 
    U = 0xb788; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7857; JUMP; // sstep
case 0x7857:
                                                     mon("L7857    JSR   L785B                   ; 7857: BD 78 5B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x5a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x785b; 
    JUMP;
    // End of function sub_77D4
  case 0x785A:
                                                     mon("L785A    RTS                           ; 785A: 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 0x785B:
                                                     mon("L785B    LDD   <$05                    ; 785B: 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 = 0x785D; JUMP; // sstep
case 0x785D:
                                                     mon("         STD   ,Y++                    ; 785D: 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 = 0x785F; JUMP; // sstep
case 0x785F:
                                                     mon("         LDD   <$03                    ; 785F: 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; 
    // End of function sub_785B
    PC = 0x7861; JUMP; // sstep
case 0x7861:
                                                     mon("         STD   ,Y++                    ; 7861: 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 = 0x7863; JUMP; // sstep
case 0x7863:
                                                     mon("L7863    LDD   <$01                    ; 7863: 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 = 0x7865; JUMP; // sstep
case 0x7865:
                                                     mon("         STD   ,Y++                    ; 7865: 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 = 0x7867; JUMP; // sstep
case 0x7867:
                                                     mon("         STU   ,Y++                    ; 7867: 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_7863
    PC = 0x7869; JUMP; // sstep
case 0x7869:
                                                     mon("         RTS                           ; 7869: 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 fighters and insert vectors
  case 0x786A:
                                                     mon("L786A    LDX   #$4900                  ; 786A: 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 = 0x786D; JUMP; // sstep
case 0x786D:
                                                     mon("L786D    STX   <$64                    ; 786D: 9F 64         \n"); // "Pointer to Tie fighter data", 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 = 0x786F; JUMP; // sstep
case 0x786F:
                                                     mon("         LDA   $03,X                   ; 786F: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7871; JUMP; // sstep
case 0x7871:
                                                     mon("         BEQ   L7876                   ; 7871: 27 03         \n");
    // temp fix to ensure flags synched
    if (!Z) {
    PC = 0x7876; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7873; JUMP; // sstep
case 0x7873:
                                                     mon("         JSR   L7881                   ; 7873: BD 78 81      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x76); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0x7881; 
    JUMP;
  case 0x7876:
                                                     mon("L7876    LDX   <$64                    ; 7876: 9E 64         \n"); // "Pointer to Tie fighter data", 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 = 0x7878; JUMP; // sstep
case 0x7878:
                                                     mon("         LEAX  $19,X                   ; 7878: 30 88 19      \n");
    clockticks = clockticks + 5; 
    X = (X + (SINT8)0x19); 
/**/Z = X; 
    PC = 0x787B; JUMP; // sstep
case 0x787B:
                                                     mon("         CMPX  #$494B                  ; 787B: 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 = 0x787E; JUMP; // sstep
case 0x787E:
                                                     mon("         BCS   L786D                   ; 787E: 25 ED         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x786d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_786A
    PC = 0x7880; JUMP; // sstep
case 0x7880:
                                                     mon("locret_7880 RTS                           ; 7880: 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 0x7881:
                                                     mon("L7881    LDX   <$64                    ; 7881: 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 = 0x7883; JUMP; // sstep
case 0x7883:
                                                     mon("         CLRA                          ; 7883: 4F            \n");
    A = 0; 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7884; JUMP; // sstep
case 0x7884:
                                                     mon("         LDB   $02,X                   ; 7884: E6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7886; JUMP; // sstep
case 0x7886:
                                                     mon("         ADDB  #$03                    ; 7886: 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 = 0x7888; JUMP; // sstep
case 0x7888:
                                                     mon("         STD   $4701                   ; 7888: 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 = 0x788B; JUMP; // sstep
case 0x788B:
                                                     mon("         LDA   #$67                    ; 788B: 86 67         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x67; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x788D; JUMP; // sstep
case 0x788D:
                                                     mon("         JSR   $CDBA                   ; 788D: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x90); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x7890:
                                                     mon("L7890    LDA   $5000                   ; 7890: B6 50 00      \n"); // Math result X
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5000); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7893; JUMP; // sstep
case 0x7893:
                                                     mon("         ASLA                          ; 7893: 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 = 0x7894; JUMP; // sstep
case 0x7894:
                                                     mon("         BVS   L7909                   ; 7894: 29 73         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x7909; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7896; JUMP; // sstep
case 0x7896:
                                                     mon("         LDA   $5002                   ; 7896: B6 50 02      \n"); // Math result Y
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5002); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7899; JUMP; // sstep
case 0x7899:
                                                     mon("         ASLA                          ; 7899: 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 = 0x789A; JUMP; // sstep
case 0x789A:
                                                     mon("         BVS   L7909                   ; 789A: 29 6D         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x7909; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x789C; JUMP; // sstep
case 0x789C:
                                                     mon("         LDA   $5004                   ; 789C: B6 50 04      \n"); // Math result Z
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5004); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x789F; JUMP; // sstep
case 0x789F:
                                                     mon("         ASLA                          ; 789F: 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 = 0x78A0; JUMP; // sstep
case 0x78A0:
                                                     mon("         BVS   L7909                   ; 78A0: 29 67         \n");
    // temp fix to ensure flags synched
    if ((SINT8)V <  0) {
    PC = 0x7909; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78A2; JUMP; // sstep
case 0x78A2:
                                                     mon("         LDD   $5070                   ; 78A2: FC 50 70      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5070); // Care needed with I/O space and word fetches
    B = rd_mem(0x5071); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x78A5; JUMP; // sstep
case 0x78A5:
                                                     mon("         ADDD  $5072                   ; 78A5: F3 50 72      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5072)<<8; 
    ea = ea | rd_mem(0x5073); 
    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 = 0x78A8; JUMP; // sstep
case 0x78A8:
                                                     mon("         ADDD  $5074                   ; 78A8: 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 = 0x78AB; JUMP; // sstep
case 0x78AB:
                                                     mon("         TFR   D,U                     ; 78AB: 1F 03         \n");
    U = ((A << 8) | B); 
    clockticks = clockticks + 6; 
    PC = 0x78AD; JUMP; // sstep
case 0x78AD:
                                                     mon("         CMPU  #$0900                  ; 78AD: 11 83 09 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x0900; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x78B1; JUMP; // sstep
case 0x78B1:
                                                     mon("         BHI   L78BB                   ; 78B1: 22 08         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x78bb; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78B3; JUMP; // sstep
case 0x78B3:
                                                     mon("         LDD   $15,X                   ; 78B3: 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 = 0x78B6; JUMP; // sstep
case 0x78B6:
                                                     mon("         ORA   #$20                    ; 78B6: 8A 20         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x20; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x78B8; JUMP; // sstep
case 0x78B8:
                                                     mon("         STD   $15,X                   ; 78B8: 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 = 0x78BB; JUMP; // sstep
case 0x78BB:
                                                     mon("L78BB    CMPU  #$0100                  ; 78BB: 11 83 01 00   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x0100; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x78BF; JUMP; // sstep
case 0x78BF:
                                                     mon("         BHI   L78C9                   ; 78BF: 22 08         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x78c9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78C1; JUMP; // sstep
case 0x78C1:
                                                     mon("         LDD   $15,X                   ; 78C1: 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 = 0x78C4; JUMP; // sstep
case 0x78C4:
                                                     mon("         ORA   #$04                    ; 78C4: 8A 04         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x04; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x78C6; JUMP; // sstep
case 0x78C6:
                                                     mon("         STD   $15,X                   ; 78C6: 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 = 0x78C9; JUMP; // sstep
case 0x78C9:
                                                     mon("L78C9    CMPU  #$A0                    ; 78C9: 11 83 00 A0   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x00a0; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x78CD; JUMP; // sstep
case 0x78CD:
                                                     mon("         BHI   L78FF                   ; 78CD: 22 30         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x78ff; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78CF; JUMP; // sstep
case 0x78CF:
                                                     mon("         LDA   $4B38                   ; 78CF: B6 4B 38      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b38); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x78D2; JUMP; // sstep
case 0x78D2:
                                                     mon("         BNE   L78E4                   ; 78D2: 26 10         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x78e4; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78D4; JUMP; // sstep
case 0x78D4:
                                                     mon("         LDA   $02,X                   ; 78D4: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x78D6; JUMP; // sstep
case 0x78D6:
                                                     mon("         STA   $4B38                   ; 78D6: B7 4B 38      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b38, val); 
    PC = 0x78D9; JUMP; // sstep
case 0x78D9:
                                                     mon("         JSR   $BD08                   ; 78D9: BD BD 08      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdc); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0xbd08; 
    JUMP;
  case 0x78DC:
                                                     mon("L78DC    JSR   $BDC6                   ; 78DC: BD BD C6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xdf); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0xbdc6; 
    JUMP;
  case 0x78DF:
                                                     mon("L78DF    STU   $4B39                   ; 78DF: FF 4B 39      \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x4b39, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4b3a, (UINT8)val); 
    PC = 0x78E2; JUMP; // sstep
case 0x78E2:
                                                     mon("         BRA   L78FD                   ; 78E2: 20 19         \n");
    PC = 0x78fd; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x78E4:
                                                     mon("L78E4    CMPA  $02,X                   ; 78E4: A1 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    arg = rd_mem((UINT16)(X + 0x0002)); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x78E6; JUMP; // sstep
case 0x78E6:
                                                     mon("         BNE   L78FD                   ; 78E6: 26 15         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x78fd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78E8; JUMP; // sstep
case 0x78E8:
                                                     mon("         CMPU  $4B39                   ; 78E8: 11 B3 4B 39   \n");
    clockticks = clockticks + 7; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x4b39)<<8; 
    ea = ea | rd_mem(0x4b3a); 
    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 = 0x78EC; JUMP; // sstep
case 0x78EC:
                                                     mon("         BGT   L78F3                   ; 78EC: 2E 05         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x78f3; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78EE; JUMP; // sstep
case 0x78EE:
                                                     mon("         STU   $4B39                   ; 78EE: FF 4B 39      \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x4b39, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x4b3a, (UINT8)val); 
    PC = 0x78F1; JUMP; // sstep
case 0x78F1:
                                                     mon("         BRA   L78FD                   ; 78F1: 20 0A         \n");
    PC = 0x78fd; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x78F3:
                                                     mon("L78F3    BCS   L78FD                   ; 78F3: 25 08         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x78fd; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x78F5; JUMP; // sstep
case 0x78F5:
                                                     mon("         LDA   #$FF                    ; 78F5: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x78F7; JUMP; // sstep
case 0x78F7:
                                                     mon("         STA   $4B39                   ; 78F7: B7 4B 39      \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    wr_mem(0x4b39, val); 
    PC = 0x78FA; JUMP; // sstep
case 0x78FA:
                                                     mon("         JSR   $BDDA                   ; 78FA: BD BD DA      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfd); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x78); 
    clockticks = clockticks + 1; 
    PC = 0xbdda; 
    JUMP;
  case 0x78FD:
                                                     mon("L78FD    BRA   L7909                   ; 78FD: 20 0A         \n");
    PC = 0x7909; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x78FF:
                                                     mon("L78FF    LDA   $02,X                   ; 78FF: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7901; JUMP; // sstep
case 0x7901:
                                                     mon("         CMPA  $4B38                   ; 7901: 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 = 0x7904; JUMP; // sstep
case 0x7904:
                                                     mon("         BNE   L7909                   ; 7904: 26 03         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7909; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7906; JUMP; // sstep
case 0x7906:
                                                     mon("         CLR   $4B38                   ; 7906: 7F 4B 38      \n");
    clockticks = clockticks + 5; 
    wr_mem(0x4b38, 0); 
/**/V = 0; 
/**/Z = 0; 
/**/N = 0; 
/**/C = 0; 
    clockticks = clockticks + 2; 
    PC = 0x7909; JUMP; // sstep
case 0x7909:
                                                     mon("L7909    LDD   $5000                   ; 7909: FC 50 00      \n"); // "Math result X", 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 = 0x790C; JUMP; // sstep
case 0x790C:
                                                     mon("         CMPD  #$10                    ; 790C: 10 83 00 10   \n");
    clockticks = clockticks + 5; 
    val = (((UINT8)A<<8)|(UINT8)B); 
    arg = 0x0010; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x7910; JUMP; // sstep
case 0x7910:
                                                     mon("         LBLE  locret_7880             ; 7910: 10 2F FF 6C   \n");
    clockticks = clockticks + 5; 
    if (((SINT8)(N^V) <  0) || (!Z)) {
    clockticks = clockticks + 1; 
    PC = 0x7880; 
    JUMP;
    }
    PC = 0x7914; JUMP; // sstep
case 0x7914:
                                                     mon("         CMPD  #$7F00                  ; 7914: 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 = 0x7918; JUMP; // sstep
case 0x7918:
                                                     mon("         LBHI  locret_7880             ; 7918: 10 22 FF 64   \n");
    clockticks = clockticks + 5; 
    if (Z && (!C)) {
    clockticks = clockticks + 1; 
    PC = 0x7880; 
    JUMP;
    }
    PC = 0x791C; JUMP; // sstep
case 0x791C:
                                                     mon("         STD   $4704                   ; 791C: 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 = 0x791F; JUMP; // sstep
case 0x791F:
                                                     mon("         STD   $5018                   ; 791F: 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 = 0x7922; JUMP; // sstep
case 0x7922:
                                                     mon("         LDD   $5002                   ; 7922: 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 = 0x7925; JUMP; // sstep
case 0x7925:
                                                     mon("         STD   $501A                   ; 7925: 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 = 0x7928; JUMP; // sstep
case 0x7928:
                                                     mon("         LDD   $5072                   ; 7928: 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 = 0x792B; JUMP; // sstep
case 0x792B:
                                                     mon("         SUBD  $5070                   ; 792B: B3 50 70      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5070)<<8; 
    ea = ea | rd_mem(0x5071); 
    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 = 0x792E; JUMP; // sstep
case 0x792E:
                                                     mon("         LBCC  locret_7880             ; 792E: 10 24 FF 4E   \n");
    clockticks = clockticks + 5; 
    if (!C) {
    clockticks = clockticks + 1; 
    PC = 0x7880; 
    JUMP;
    }
    PC = 0x7932; JUMP; // sstep
case 0x7932:
                                                     mon("         LDD   $5004                   ; 7932: 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 = 0x7935; JUMP; // sstep
case 0x7935:
                                                     mon("         STD   $501C                   ; 7935: 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 = 0x7938; JUMP; // sstep
case 0x7938:
                                                     mon("         LDD   $5074                   ; 7938: FC 50 74      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x5074); // Care needed with I/O space and word fetches
    B = rd_mem(0x5075); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x793B; JUMP; // sstep
case 0x793B:
                                                     mon("         SUBD  $5070                   ; 793B: B3 50 70      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x5070)<<8; 
    ea = ea | rd_mem(0x5071); 
    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 = 0x793E; JUMP; // sstep
case 0x793E:
                                                     mon("         LBCC  locret_7880             ; 793E: 10 24 FF 3E   \n");
    clockticks = clockticks + 5; 
    if (!C) {
    clockticks = clockticks + 1; 
    PC = 0x7880; 
    JUMP;
    }
    PC = 0x7942; JUMP; // sstep
case 0x7942:
                                                     mon("         LDX   <$64                    ; 7942: 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 = 0x7944; JUMP; // sstep
case 0x7944:
                                                     mon("         LDD   $15,X                   ; 7944: 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 = 0x7947; JUMP; // sstep
case 0x7947:
                                                     mon("         ORA   #$10                    ; 7947: 8A 10         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x10; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x7949; JUMP; // sstep
case 0x7949:
                                                     mon("         STD   $15,X                   ; 7949: 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 = 0x794C; JUMP; // sstep
case 0x794C:
                                                     mon("         LDA   $4B3B                   ; 794C: B6 4B 3B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3b); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x794F; JUMP; // sstep
case 0x794F:
                                                     mon("         BNE   L7972                   ; 794F: 26 21         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7972; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7951; JUMP; // sstep
case 0x7951:
                                                     mon("         LDA   $04,X                   ; 7951: A6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x7953; JUMP; // sstep
case 0x7953:
                                                     mon("         CMPA  #$04                    ; 7953: 81 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x7955; JUMP; // sstep
case 0x7955:
                                                     mon("         BNE   L7972                   ; 7955: 26 1B         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x7972; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7957; JUMP; // sstep
case 0x7957:
                                                     mon("         INC   $4B3B                   ; 7957: 7C 4B 3B      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b3b); 
    res = (UINT8)(val + 1); 
/**/Z = res; 
/**/N = res; 
/**/V = res & ~val; 
    wr_mem(0x4b3b, res); 
    clockticks = clockticks + 2; 
    PC = 0x795A; JUMP; // sstep
case 0x795A:
                                                     mon("         LDA   $4B14                   ; 795A: B6 4B 14      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b14); 
    A = val; 
/**/N = val; 
/**/Z = val; 
    V = 0; 
    PC = 0x795D; JUMP; // sstep
case 0x795D:
                                                     mon("         LSRA                          ; 795D: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
    N = 0; 
    Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x795E; JUMP; // sstep
case 0x795E:
                                                     mon("         BCS   L796F                   ; 795E: 25 0F         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x796f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7960; JUMP; // sstep
case 0x7960:
                                                     mon("         LDA   $4703                   ; 7960: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7963; JUMP; // sstep
case 0x7963:
                                                     mon("         BPL   L796A                   ; 7963: 2A 05         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x796a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7965; JUMP; // sstep
case 0x7965:
                                                     mon("         JSR   $BD5D                   ; 7965: BD BD 5D      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x68); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xbd5d; 
    JUMP;
  case 0x7968:
                                                     mon("L7968    BRA   L796D                   ; 7968: 20 03         \n");
    PC = 0x796d; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x796A:
                                                     mon("L796A    JSR   $BD2B                   ; 796A: BD BD 2B      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x6d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xbd2b; 
    JUMP;
  case 0x796D:
                                                     mon("L796D    BRA   L7972                   ; 796D: 20 03         \n");
    PC = 0x7972; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x796F:
                                                     mon("L796F    JSR   $BD1C                   ; 796F: BD BD 1C      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x72); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xbd1c; 
    JUMP;
  case 0x7972:
                                                     mon("L7972    LDA   $02,X                   ; 7972: A6 02         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0002)); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7974; JUMP; // sstep
case 0x7974:
                                                     mon("         JSR   $CE18                   ; 7974: BD CE 18      \n"); // Run math program $80 Copy [BIC] to Matrix 3
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x77); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xce18; 
    JUMP;
  case 0x7977:
                                                     mon("L7977    JSR   $CCF0                   ; 7977: 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, 0x7a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xccf0; 
    JUMP;
  case 0x797A:
                                                     mon("L797A    LDD   #$50                    ; 797A: CC 00 50      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x50; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x797D; JUMP; // sstep
case 0x797D:
                                                     mon("         STD   $5002                   ; 797D: 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 = 0x7980; JUMP; // sstep
case 0x7980:
                                                     mon("         LDA   #$86                    ; 7980: 86 86         \n"); // Reg02 = Reg02 x Reg00
    clockticks = clockticks + 2; 
    val = (UINT8)0x86; 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x7982; JUMP; // sstep
case 0x7982:
                                                     mon("         JSR   $CDBA                   ; 7982: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x7985:
                                                     mon("L7985    LDD   $5002                   ; 7985: 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 = 0x7988; JUMP; // sstep
case 0x7988:
                                                     mon("         ADDD  #$0A                    ; 7988: 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 = 0x798B; JUMP; // sstep
case 0x798B:
                                                     mon("         STD   <$01                    ; 798B: 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 = 0x798D; JUMP; // sstep
case 0x798D:
                                                     mon("         LDD   <$D6                    ; 798D: 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 = 0x798F; JUMP; // sstep
case 0x798F:
                                                     mon("         SUBD  <$B3                    ; 798F: 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 = 0x7991; JUMP; // sstep
case 0x7991:
                                                     mon("         BPL   L7997                   ; 7991: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x7997; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x7993; JUMP; // sstep
case 0x7993:
                                                     mon("         COMA                          ; 7993: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x7994; JUMP; // sstep
case 0x7994:
                                                     mon("         NEGB                          ; 7994: 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 = 0x7995; JUMP; // sstep
case 0x7995:
                                                     mon("         SBCA  #$FF                    ; 7995: 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 = 0x7997; JUMP; // sstep
case 0x7997:
                                                     mon("L7997    STD   <$05                    ; 7997: 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 = 0x7999; JUMP; // sstep
case 0x7999:
                                                     mon("         STD   <$03                    ; 7999: 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 = 0x799B; JUMP; // sstep
case 0x799B:
                                                     mon("         LDD   <$D8                    ; 799B: 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 = 0x799D; JUMP; // sstep
case 0x799D:
                                                     mon("         SUBD  <$B5                    ; 799D: 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 = 0x799F; JUMP; // sstep
case 0x799F:
                                                     mon("         BPL   L79A5                   ; 799F: 2A 04         \n");
    // temp fix to ensure flags synched
    if ((SINT8)N >= 0) {
    PC = 0x79a5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79A1; JUMP; // sstep
case 0x79A1:
                                                     mon("         COMA                          ; 79A1: 43            \n");
    val = (UINT8)A ^ 0xff; 
    A = val; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
/**/C = 1; 
    clockticks = clockticks + 2; 
    PC = 0x79A2; JUMP; // sstep
case 0x79A2:
                                                     mon("         NEGB                          ; 79A2: 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 = 0x79A3; JUMP; // sstep
case 0x79A3:
                                                     mon("         SBCA  #$FF                    ; 79A3: 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 = 0x79A5; JUMP; // sstep
case 0x79A5:
                                                     mon("L79A5    STD   <$07                    ; 79A5: DD 07         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x07; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x79A7; JUMP; // sstep
case 0x79A7:
                                                     mon("         ADDD  <$03                    ; 79A7: 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 = 0x79A9; JUMP; // sstep
case 0x79A9:
                                                     mon("         STD   <$03                    ; 79A9: 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 = 0x79AB; JUMP; // sstep
case 0x79AB:
                                                     mon("         LDD   <$05                    ; 79AB: 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 = 0x79AD; JUMP; // sstep
case 0x79AD:
                                                     mon("         SUBD  <$01                    ; 79AD: 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 = 0x79AF; JUMP; // sstep
case 0x79AF:
                                                     mon("         BGT   L79CF                   ; 79AF: 2E 1E         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x79cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79B1; JUMP; // sstep
case 0x79B1:
                                                     mon("         LDD   <$07                    ; 79B1: DC 07         \n");
    clockticks = clockticks + 4; 
    A = rd_mem(DP|0x07); // Care needed with I/O space and word fetches
    B = rd_mem(DP|0x08); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x79B3; JUMP; // sstep
case 0x79B3:
                                                     mon("         SUBD  <$01                    ; 79B3: 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 = 0x79B5; JUMP; // sstep
case 0x79B5:
                                                     mon("         BGT   L79CF                   ; 79B5: 2E 18         \n");
    // temp fix to ensure flags synched
    if (((SINT8)(N^V) >= 0) && Z) {
    PC = 0x79cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79B7; JUMP; // sstep
case 0x79B7:
                                                     mon("         LDD   <$01                    ; 79B7: 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 = 0x79B9; JUMP; // sstep
case 0x79B9:
                                                     mon("         LSRA                          ; 79B9: 44            \n");
    val = (UINT8)A; 
    C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x79BA; JUMP; // sstep
case 0x79BA:
                                                     mon("         RORB                          ; 79BA: 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 = 0x79BB; JUMP; // sstep
case 0x79BB:
                                                     mon("         ADDD  <$01                    ; 79BB: 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 = 0x79BD; JUMP; // sstep
case 0x79BD:
                                                     mon("         SUBD  <$03                    ; 79BD: 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 = 0x79BF; JUMP; // sstep
case 0x79BF:
                                                     mon("         BLT   L79CF                   ; 79BF: 2D 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x79cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79C1; JUMP; // sstep
case 0x79C1:
                                                     mon("         LDD   $5018                   ; 79C1: 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 = 0x79C4; JUMP; // sstep
case 0x79C4:
                                                     mon("         CMPD  <$C4                    ; 79C4: 10 93 C4      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(DP|0xc4)<<8; 
    ea = ea | rd_mem(DP|0xc5); 
    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 = 0x79C7; JUMP; // sstep
case 0x79C7:
                                                     mon("         BCC   L79CF                   ; 79C7: 24 06         \n");
    // temp fix to ensure flags synched
    if (!C) {
    PC = 0x79cf; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79C9; JUMP; // sstep
case 0x79C9:
                                                     mon("         STD   <$C4                    ; 79C9: DD C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xc4; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x79CB; JUMP; // sstep
case 0x79CB:
                                                     mon("         LDX   <$64                    ; 79CB: 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 = 0x79CD; JUMP; // sstep
case 0x79CD:
                                                     mon("         STX   <$C2                    ; 79CD: 9F C2         \n");
    clockticks = clockticks + 4; 
    val = X; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    ea = DP|0xc2; 
    wr_mem(ea, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem((UINT16)(ea + 1), (UINT8)val); 
    PC = 0x79CF; JUMP; // sstep
case 0x79CF:
                                                     mon("L79CF    LDD   <$01                    ; 79CF: 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 = 0x79D1; JUMP; // sstep
case 0x79D1:
                                                     mon("         ADDD  <$01                    ; 79D1: 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 = 0x79D3; JUMP; // sstep
case 0x79D3:
                                                     mon("         ADDD  <$01                    ; 79D3: 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 = 0x79D5; JUMP; // sstep
case 0x79D5:
                                                     mon("         SUBD  <$03                    ; 79D5: 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 = 0x79D7; JUMP; // sstep
case 0x79D7:
                                                     mon("         BCS   L79E9                   ; 79D7: 25 10         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x79e9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79D9; JUMP; // sstep
case 0x79D9:
                                                     mon("         LDX   <$64                    ; 79D9: 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 = 0x79DB; JUMP; // sstep
case 0x79DB:
                                                     mon("         LDA   $03,X                   ; 79DB: A6 03         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0003)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x79DD; JUMP; // sstep
case 0x79DD:
                                                     mon("         CMPA  #$01                    ; 79DD: 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 = 0x79DF; JUMP; // sstep
case 0x79DF:
                                                     mon("         BNE   L79E9                   ; 79DF: 26 08         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x79e9; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x79E1; JUMP; // sstep
case 0x79E1:
                                                     mon("         LDD   $15,X                   ; 79E1: 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 = 0x79E4; JUMP; // sstep
case 0x79E4:
                                                     mon("         ORA   #$08                    ; 79E4: 8A 08         \n");
    clockticks = clockticks + 2; 
    res = A | (UINT8)0x08; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x79E6; JUMP; // sstep
case 0x79E6:
                                                     mon("         STD   $15,X                   ; 79E6: 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 = 0x79E9; JUMP; // sstep
case 0x79E9:
                                                     mon("L79E9    LDX   <$64                    ; 79E9: 9E 64         \n"); // "Pointer to Tie fighter data", 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 = 0x79EB; JUMP; // sstep
case 0x79EB:
                                                     mon("         LDB   $06,X                   ; 79EB: E6 06         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0006)); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x79ED; JUMP; // sstep
case 0x79ED:
                                                     mon("         LDU   #word_7A08              ; 79ED: CE 7A 08      \n"); // Tie fighter colour table
    clockticks = clockticks + 3; 
    U = 0x7a08; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x79F0; JUMP; // sstep
case 0x79F0:
                                                     mon("         ASLB                          ; 79F0: 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 = 0x79F1; JUMP; // sstep
case 0x79F1:
                                                     mon("         LDD   B,U                     ; 79F1: 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 = 0x79F3; JUMP; // sstep
case 0x79F3:
                                                     mon("         STD   ,Y++                    ; 79F3: 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 = 0x79F5; JUMP; // sstep
case 0x79F5:
                                                     mon("         LDA   #$40                    ; 79F5: 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 = 0x79F7; JUMP; // sstep
case 0x79F7:
                                                     mon("         JSR   $CDBA                   ; 79F7: BD CD BA      \n"); // Do math program run
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xfa); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xcdba; 
    JUMP;
  case 0x79FA:
                                                     mon("L79FA    LDB   $04,X                   ; 79FA: E6 04         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + 0x0004)); 
    B = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x79FC; JUMP; // sstep
case 0x79FC:
                                                     mon("         JSR   $CD14                   ; 79FC: BD CD 14      \n"); // Math program 0x50. Matrix Multiply - Transposed, Then do perspective division?
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xff); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x79); 
    clockticks = clockticks + 1; 
    PC = 0xcd14; 
    JUMP;
  case 0x79FF:
                                                     mon("L79FF    JSR   $CD2C                   ; 79FF: BD CD 2C      \n"); // Format vectors for ties, and tower/bunker explosions
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x02); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    PC = 0xcd2c; 
    JUMP;
  case 0x7A02:
                                                     mon("L7A02    LDD   #$8040                  ; 7A02: CC 80 40      \n"); // Insert vector CNTR instruction
    clockticks = clockticks + 3; 
    A = 0x80; 
    B = 0x40; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7A05; JUMP; // sstep
case 0x7A05:
                                                     mon("         STD   ,Y++                    ; 7A05: 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_7881
    // ---------------------------------------------------------------------------
    PC = 0x7A07; JUMP; // sstep
case 0x7A07:
                                                     mon("         RTS                           ; 7A07: 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 0x7A48:
                                                     mon("L7A48    LDU   #$5090                  ; 7A48: CE 50 90      \n");
    clockticks = clockticks + 3; 
    U = 0x5090; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x7A4B; JUMP; // sstep
case 0x7A4B:
                                                     mon("         JSR   $CDC3                   ; 7A4B: BD CD C3      \n"); // Initialise math registers matrix
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x4e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x7a); 
    clockticks = clockticks + 1; 
    PC = 0xcdc3; 
    JUMP;
  case 0x7A4E:
                                                     mon("L7A4E    LDD   #$00                    ; 7A4E: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7A51; JUMP; // sstep
case 0x7A51:
                                                     mon("         STD   $5098                   ; 7A51: 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 = 0x7A54; JUMP; // sstep
case 0x7A54:
                                                     mon("         STD   $509A                   ; 7A54: FD 50 9A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509a, A); // Care needed with I/O space and word fetches
    wr_mem(0x509b, B); 
    PC = 0x7A57; JUMP; // sstep
case 0x7A57:
                                                     mon("         STD   $509C                   ; 7A57: FD 50 9C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x509c, A); // Care needed with I/O space and word fetches
    wr_mem(0x509d, B); 
    PC = 0x7A5A; JUMP; // sstep
case 0x7A5A:
                                                     mon("L7A5A    LDD   #$00                    ; 7A5A: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x7A5D; JUMP; // sstep
case 0x7A5D:
                                                     mon("         STA   <$62                    ; 7A5D: 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 = 0x7A5F; JUMP; // sstep
case 0x7A5F:
                                                     mon("         STA   <$63                    ; 7A5F: 97 63         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x63; 
    wr_mem(ea, val); 
    PC = 0x7A61; JUMP; // sstep
case 0x7A61:
                                                     mon("         STA   <$31                    ; 7A61: 97 31         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x31; 
    wr_mem(ea, val); 
    PC = 0x7A63; JUMP; // sstep
case 0x7A63:
                                                     mon("         STA   <$BC                    ; 7A63: 97 BC         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbc; 
    wr_mem(ea, val); 
    PC = 0x7A65; JUMP; // sstep
case 0x7A65:
                                                     mon("         STA   <$B7                    ; 7A65: 97 B7         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xb7; 
    wr_mem(ea, val); 
    PC = 0x7A67; JUMP; // sstep
case 0x7A67:
                                                     mon("         STA   <$BD                    ; 7A67: 97 BD         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0xbd; 
    wr_mem(ea, val); 
    PC = 0x7A69; JUMP; // sstep
case 0x7A69:
                                                     mon("         STD   <$A3                    ; 7A69: DD A3         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0xa3; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x7A6B; JUMP; // sstep
case 0x7A6B:
                                                     mon("         STA   $4878                   ; 7A6B: B7 48 78      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4878, val); 
    PC = 0x7A6E; JUMP; // sstep
case 0x7A6E:
                                                     mon("         STA   $486E                   ; 7A6E: B7 48 6E      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x486e, val); 
    PC = 0x7A71; JUMP; // sstep
case 0x7A71:
                                                     mon("         STA   $4877                   ; 7A71: B7 48 77      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x4877, val); 
    PC = 0x7A74; JUMP; // sstep
case 0x7A74:
                                                     mon("         STD   $4874                   ; 7A74: FD 48 74      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x4874, A); // Care needed with I/O space and word fetches
    wr_mem(0x4875, B); 
    PC = 0x7A77; JUMP; // sstep
case 0x7A77:
                                                     mon("         STD   $486B                   ; 7A77: FD 48 6B      \n");
    clockticks = clockticks + 5; 
    Z = A | B; 
    N = A; 
    V = 0; 
    wr_mem(0x486b, A); // Care needed with I/O space and word fetches
    wr_mem(0x486c, B); 
    // End of function sub_7A48
    // ---------------------------------------------------------------------------
    PC = 0x7A7A; JUMP; // sstep
case 0x7A7A:
                                                     mon("         RTS                           ; 7A7A: 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;
    
