                   // ORG   $8000
  case 0x8000:
                                                     mon("L8000    NEG   <$00                    ; 8000: 00 00         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x00); 
    res = -val; 
/**/V = val & (UINT8)res; 
/**/C = res & 0x100; 
    val = (UINT8)res; 
    wr_mem(DP|0x00, val); 
/**/Z = val; 
/**/N = val; 
    clockticks = clockticks + 2; 
                   // FCB   $05                     ; 8002:  ' ' 05             Invalid ; 
    // =============== S U B R O U T I N E =======================================
    // Entering trench
    PC = 0x8341; JUMP; // sstep
case 0x8341:
                                                     mon("L8341    LDA   #$00                    ; 8341: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8343; JUMP; // sstep
case 0x8343:
                                                     mon("         STA   <$44                    ; 8343: 97 44         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x44; 
    wr_mem(ea, val); 
    PC = 0x8345; JUMP; // sstep
case 0x8345:
                                                     mon("         STA   <$45                    ; 8345: 97 45         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x45; 
    wr_mem(ea, val); 
    PC = 0x8347; JUMP; // sstep
case 0x8347:
                                                     mon("         LDX   #$4989                  ; 8347: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x834A; JUMP; // sstep
case 0x834A:
                                                     mon("         LDA   #$00                    ; 834A: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x834C; JUMP; // sstep
case 0x834C:
                                                     mon("L834C    STA   ,X+                     ; 834C: A7 80         \n");
    clockticks = clockticks + 6; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = X; 
    wr_mem(ea, val); 
    X = X + 1; 
    PC = 0x834E; JUMP; // sstep
case 0x834E:
                                                     mon("         CMPX  #$49A9                  ; 834E: 8C 49 A9      \n");
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x49a9; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x8351; JUMP; // sstep
case 0x8351:
                                                     mon("         BCS   L834C                   ; 8351: 25 F9         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x834c; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8353; JUMP; // sstep
case 0x8353:
                                                     mon("         LDB   $4B12                   ; 8353: F6 4B 12      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b12); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8356; JUMP; // sstep
case 0x8356:
                                                     mon("         ASLB                          ; 8356: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x8357; JUMP; // sstep
case 0x8357:
                                                     mon("         LDX   #$7CC0                  ; 8357: 8E 7C C0      \n"); // Trench catwalk/turrets data?
    clockticks = clockticks + 3; 
    X = 0x7cc0; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x835A; JUMP; // sstep
case 0x835A:
                                                     mon("         ABX                           ; 835A: 3A            \n");
    X = X + B; 
    clockticks = clockticks + 3; 
    PC = 0x835B; JUMP; // sstep
case 0x835B:
                                                     mon("         CMPX  #$7CD6                  ; 835B: 8C 7C D6      \n"); // Trench catwalk/turrets data?
    clockticks = clockticks + 4; 
    val = X; 
    arg = 0x7cd6; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x835E; JUMP; // sstep
case 0x835E:
                                                     mon("         BCS   L8365                   ; 835E: 25 05         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8365; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8360; JUMP; // sstep
case 0x8360:
                                                     mon("         LDU   #$4B3F                  ; 8360: CE 4B 3F      \n");
    clockticks = clockticks + 3; 
    U = 0x4b3f; 
    Z = U; 
    N = (U) >> 8; 
    V = 0; 
    PC = 0x8363; JUMP; // sstep
case 0x8363:
                                                     mon("         BRA   L8367                   ; 8363: 20 02         \n");
    PC = 0x8367; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8365:
                                                     mon("L8365    LDU   ,X                      ; 8365: EE 84         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(X)<<8; 
    ea = ea | rd_mem((UINT16)((X)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8367; JUMP; // sstep
case 0x8367:
                                                     mon("L8367    STU   $49A9                   ; 8367: FF 49 A9      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49a9, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49aa, (UINT8)val); 
    PC = 0x836A; JUMP; // sstep
case 0x836A:
                                                     mon("         STU   $49AB                   ; 836A: FF 49 AB      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49ab, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49ac, (UINT8)val); 
    PC = 0x836D; JUMP; // sstep
case 0x836D:
                                                     mon("         LDU   ,U                      ; 836D: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x836F; JUMP; // sstep
case 0x836F:
                                                     mon("         LDD   #$00                    ; 836F: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8372; JUMP; // sstep
case 0x8372:
                                                     mon("         STA   $49C0                   ; 8372: B7 49 C0      \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    wr_mem(0x49c0, val); 
    PC = 0x8375; JUMP; // sstep
case 0x8375:
                                                     mon("         STD   $49B1                   ; 8375: FD 49 B1      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b1, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b2, B); 
    PC = 0x8378; JUMP; // sstep
case 0x8378:
                                                     mon("         STD   $49B5                   ; 8378: FD 49 B5      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b5, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b6, B); 
    PC = 0x837B; JUMP; // sstep
case 0x837B:
                                                     mon("         STA   <$92                    ; 837B: 97 92         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x92; 
    wr_mem(ea, val); 
    PC = 0x837D; JUMP; // sstep
case 0x837D:
                                                     mon("         STA   <$95                    ; 837D: 97 95         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x95; 
    wr_mem(ea, val); 
    PC = 0x837F; JUMP; // sstep
case 0x837F:
                                                     mon("         STU   $49AF                   ; 837F: FF 49 AF      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49af, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b0, (UINT8)val); 
    PC = 0x8382; JUMP; // sstep
case 0x8382:
                                                     mon("         STU   $49B3                   ; 8382: FF 49 B3      \n");
    clockticks = clockticks + 5; 
    val = U; 
    Z = val; 
    N = (UINT8)(val >> 8); 
    V = 0; 
    wr_mem(0x49b3, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b4, (UINT8)val); 
    PC = 0x8385; JUMP; // sstep
case 0x8385:
                                                     mon("         JSR   L8434                   ; 8385: BD 84 34      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x88); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x8434; 
    JUMP;
  case 0x8388:
                                                     mon("L8388    JSR   L8408                   ; 8388: BD 84 08      \n"); // Trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8b); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x8408; 
    JUMP;
  case 0x838B:
                                                     mon("L838B    JSR   L83CE                   ; 838B: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x8e); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x838E:
                                                     mon("L838E    JSR   L83CE                   ; 838E: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x91); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x8391:
                                                     mon("L8391    JSR   L83CE                   ; 8391: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x94); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x8394:
                                                     mon("L8394    JSR   L83CE                   ; 8394: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x97); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x8397:
                                                     mon("L8397    JSR   L83CE                   ; 8397: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9a); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x839A:
                                                     mon("L839A    JSR   L83CE                   ; 839A: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x9d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x839D:
                                                     mon("L839D    JSR   L83CE                   ; 839D: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa0); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
  case 0x83A0:
                                                     mon("L83A0    JSR   L83CE                   ; 83A0: BD 83 CE      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xa3); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x83); 
    clockticks = clockticks + 1; 
    PC = 0x83ce; 
    JUMP;
    // End of function sub_8341
  case 0x83A3:
                                                     mon("L83A3    RTS                           ; 83A3: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Called when starting trench
  case 0x83A4:
                                                     mon("L83A4    LDU   #$4B3F                  ; 83A4: CE 4B 3F      \n");
    clockticks = clockticks + 3; 
    U = 0x4b3f; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83A7; JUMP; // sstep
case 0x83A7:
                                                     mon("         LDX   #$7C7E                  ; 83A7: 8E 7C 7E      \n"); // Copy pointers from ROM to RAM starting at word_4B3F
    clockticks = clockticks + 3; 
    X = 0x7c7e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x83AA; JUMP; // sstep
case 0x83AA:
                                                     mon("L83AA    LDD   ,X++                    ; 83AA: EC 81         \n");
    clockticks = clockticks + 7; 
    A = rd_mem(X); // Care needed with I/O space and word fetches. Use 'ea' here?
    B = rd_mem((UINT16)(X+1)); 
    X = X + 2; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x83AC; JUMP; // sstep
case 0x83AC:
                                                     mon("         STD   ,U++                    ; 83AC: ED C1         \n");
    clockticks = clockticks + 7; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    U = U + 2; 
    PC = 0x83AE; JUMP; // sstep
case 0x83AE:
                                                     mon("         CMPU  #$4B5F                  ; 83AE: 11 83 4B 5F   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x4b5f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x83B2; JUMP; // sstep
case 0x83B2:
                                                     mon("         BCS   L83AA                   ; 83B2: 25 F6         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x83aa; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83B4; JUMP; // sstep
case 0x83B4:
                                                     mon("         LDU   #$4B43                  ; 83B4: CE 4B 43      \n");
    clockticks = clockticks + 3; 
    U = 0x4b43; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83B7; JUMP; // sstep
case 0x83B7:
                                                     mon("         LDX   #$7C9E                  ; 83B7: 8E 7C 9E      \n");
    clockticks = clockticks + 3; 
    X = 0x7c9e; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x83BA; JUMP; // sstep
case 0x83BA:
                                                     mon("L83BA    LDA   #$11                    ; 83BA: 86 11         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x11; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83BC; JUMP; // sstep
case 0x83BC:
                                                     mon("         LDB   $4703                   ; 83BC: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83BF; JUMP; // sstep
case 0x83BF:
                                                     mon("         MUL                           ; 83BF: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x83C0; JUMP; // sstep
case 0x83C0:
                                                     mon("         ASLA                          ; 83C0: 48            \n");
    val = (UINT8)A; 
    res = val << 1; 
/**/C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    A = res; 
    clockticks = clockticks + 2; 
    PC = 0x83C1; JUMP; // sstep
case 0x83C1:
                                                     mon("         LDD   A,X                     ; 83C1: EC 86         \n");
    clockticks = clockticks + 5; 
    ea = (UINT16)(X + (SINT8)A); 
    A = rd_mem(ea); // Care needed with I/O space and word fetches
    B = rd_mem((UINT16)(ea+1)); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x83C3; JUMP; // sstep
case 0x83C3:
                                                     mon("         STD   ,U                      ; 83C3: ED C4         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = U; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x83C5; JUMP; // sstep
case 0x83C5:
                                                     mon("         LEAU  $04,U                   ; 83C5: 33 44         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0004); 
    PC = 0x83C7; JUMP; // sstep
case 0x83C7:
                                                     mon("         CMPU  #$4B5F                  ; 83C7: 11 83 4B 5F   \n");
    clockticks = clockticks + 5; 
    val = U; 
    arg = 0x4b5f; 
    res = val - arg; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    N = res >> 8; 
    V = ((val ^ arg) & (val ^ res)) >> 8; 
    PC = 0x83CB; JUMP; // sstep
case 0x83CB:
                                                     mon("         BCS   L83BA                   ; 83CB: 25 ED         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x83ba; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    // End of function sub_83A4
    PC = 0x83CD; JUMP; // sstep
case 0x83CD:
                                                     mon("         RTS                           ; 83CD: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x83CE:
                                                     mon("L83CE    LDA   <$92                    ; 83CE: 96 92         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x92); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x83D0; JUMP; // sstep
case 0x83D0:
                                                     mon("         BNE   locret_8407             ; 83D0: 26 35         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8407; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83D2; JUMP; // sstep
case 0x83D2:
                                                     mon("         LDU   $49B3                   ; 83D2: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83D5; JUMP; // sstep
case 0x83D5:
                                                     mon("         LEAU  $03,U                   ; 83D5: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x83D7; JUMP; // sstep
case 0x83D7:
                                                     mon("         LDA   ,U                      ; 83D7: A6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83D9; JUMP; // sstep
case 0x83D9:
                                                     mon("         CMPA  #$05                    ; 83D9: 81 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x83DB; JUMP; // sstep
case 0x83DB:
                                                     mon("         BNE   L83E2                   ; 83DB: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x83e2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83DD; JUMP; // sstep
case 0x83DD:
                                                     mon("         LDU   $49AB                   ; 83DD: FE 49 AB      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49ab)<<8; 
    ea = ea | rd_mem(0x49ac); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83E0; JUMP; // sstep
case 0x83E0:
                                                     mon("         LDU   $02,U                   ; 83E0: EE 42         \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem((UINT16)(U + 0x0002))<<8; 
    ea = ea | rd_mem((UINT16)(((UINT16)(U + 0x0002))+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x83E2; JUMP; // sstep
case 0x83E2:
                                                     mon("L83E2    LDB   ,U                      ; 83E2: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x83E4; JUMP; // sstep
case 0x83E4:
                                                     mon("         CMPB  #$01                    ; 83E4: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x83E6; JUMP; // sstep
case 0x83E6:
                                                     mon("         BNE   L83ED                   ; 83E6: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x83ed; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83E8; JUMP; // sstep
case 0x83E8:
                                                     mon("         LDD   #$0800                  ; 83E8: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x83EB; JUMP; // sstep
case 0x83EB:
                                                     mon("         BRA   L83F9                   ; 83EB: 20 0C         \n");
    PC = 0x83f9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x83ED:
                                                     mon("L83ED    CMPB  #$03                    ; 83ED: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x83EF; JUMP; // sstep
case 0x83EF:
                                                     mon("         BNE   L83F6                   ; 83EF: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x83f6; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x83F1; JUMP; // sstep
case 0x83F1:
                                                     mon("         LDD   #$00                    ; 83F1: CC 00 00      \n");
    clockticks = clockticks + 3; 
    A = 0x00; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x83F4; JUMP; // sstep
case 0x83F4:
                                                     mon("         BRA   L83F9                   ; 83F4: 20 03         \n");
    PC = 0x83f9; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x83F6:
                                                     mon("L83F6    LDD   #$1000                  ; 83F6: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x83F9; JUMP; // sstep
case 0x83F9:
                                                     mon("L83F9    ADDD  $49B7                   ; 83F9: F3 49 B7      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b7)<<8; 
    ea = ea | rd_mem(0x49b8); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x83FC; JUMP; // sstep
case 0x83FC:
                                                     mon("         SUBD  $49B1                   ; 83FC: B3 49 B1      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b1)<<8; 
    ea = ea | rd_mem(0x49b2); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x83FF; JUMP; // sstep
case 0x83FF:
                                                     mon("         SUBD  #$6000                  ; 83FF: 83 60 00      \n");
    clockticks = clockticks + 4; 
    val = 0x6000; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8402; JUMP; // sstep
case 0x8402:
                                                     mon("         BHI   locret_8407             ; 8402: 22 03         \n");
    // temp fix to ensure flags synched
    if (Z && (!C)) {
    PC = 0x8407; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8404; JUMP; // sstep
case 0x8404:
                                                     mon("         JSR   L8408                   ; 8404: BD 84 08      \n"); // Trench
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x07); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    PC = 0x8408; 
    JUMP;
    // End of function sub_83CE
  case 0x8407:
                                                     mon("locret_8407 RTS                           ; 8407: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
    // Trench
  case 0x8408:
                                                     mon("L8408    LDU   $49B3                   ; 8408: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x840B; JUMP; // sstep
case 0x840B:
                                                     mon("         LDB   ,U                      ; 840B: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x840D; JUMP; // sstep
case 0x840D:
                                                     mon("         CMPB  #$01                    ; 840D: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x840F; JUMP; // sstep
case 0x840F:
                                                     mon("         BNE   L8416                   ; 840F: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8416; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8411; JUMP; // sstep
case 0x8411:
                                                     mon("         LDD   #$0800                  ; 8411: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8414; JUMP; // sstep
case 0x8414:
                                                     mon("         BRA   L8419                   ; 8414: 20 03         \n");
    PC = 0x8419; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8416:
                                                     mon("L8416    LDD   #$1000                  ; 8416: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8419; JUMP; // sstep
case 0x8419:
                                                     mon("L8419    ADDD  $49B5                   ; 8419: F3 49 B5      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b5)<<8; 
    ea = ea | rd_mem(0x49b6); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x841C; JUMP; // sstep
case 0x841C:
                                                     mon("         STD   $49B5                   ; 841C: FD 49 B5      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b5, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b6, B); 
    PC = 0x841F; JUMP; // sstep
case 0x841F:
                                                     mon("         LEAU  $03,U                   ; 841F: 33 43         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0003); 
    PC = 0x8421; JUMP; // sstep
case 0x8421:
                                                     mon("         LDB   ,U                      ; 8421: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8423; JUMP; // sstep
case 0x8423:
                                                     mon("         CMPB  #$05                    ; 8423: C1 05         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x05; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8425; JUMP; // sstep
case 0x8425:
                                                     mon("L8425    BNE   L8431                   ; 8425: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8431; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8427; JUMP; // sstep
case 0x8427:
                                                     mon("         LDU   $49AB                   ; 8427: FE 49 AB      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49ab)<<8; 
    ea = ea | rd_mem(0x49ac); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x842A; JUMP; // sstep
case 0x842A:
                                                     mon("         LEAU  $02,U                   ; 842A: 33 42         \n");
    clockticks = clockticks + 5; 
    U = (U + 0x0002); 
    PC = 0x842C; JUMP; // sstep
case 0x842C:
                                                     mon("         STU   $49AB                   ; 842C: FF 49 AB      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49ab, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49ac, (UINT8)val); 
    PC = 0x842F; JUMP; // sstep
case 0x842F:
                                                     mon("         LDU   ,U                      ; 842F: EE C4         \n");
    clockticks = clockticks + 4; 
    clockticks = clockticks + 1; 
    ea = rd_mem(U)<<8; 
    ea = ea | rd_mem((UINT16)((U)+1)); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8431; JUMP; // sstep
case 0x8431:
                                                     mon("L8431    STU   $49B3                   ; 8431: FF 49 B3      \n");
    clockticks = clockticks + 5; 
    val = U; 
/**/Z = val; 
/**/N = (UINT8)(val >> 8); 
/**/V = 0; 
    wr_mem(0x49b3, (UINT8)(val >> 8)); // Care needed with I/O space and word fetches
    wr_mem(0x49b4, (UINT8)val); 
    PC = 0x8434; JUMP; // sstep
case 0x8434:
                                                     mon("L8434    LDU   $49B3                   ; 8434: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x8437; JUMP; // sstep
case 0x8437:
                                                     mon("         LDB   ,U                      ; 8437: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8439; JUMP; // sstep
case 0x8439:
                                                     mon("         CMPB  #$03                    ; 8439: C1 03         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x03; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x843B; JUMP; // sstep
case 0x843B:
                                                     mon("         BNE   L8447                   ; 843B: 26 0A         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8447; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x843D; JUMP; // sstep
case 0x843D:
                                                     mon("         LDD   $49B5                   ; 843D: FC 49 B5      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49b5); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8440; JUMP; // sstep
case 0x8440:
                                                     mon("         STD   <$93                    ; 8440: DD 93         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x93; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8442; JUMP; // sstep
case 0x8442:
                                                     mon("         LDA   #$FF                    ; 8442: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8444; JUMP; // sstep
case 0x8444:
                                                     mon("         STA   <$92                    ; 8444: 97 92         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x92; 
    wr_mem(ea, val); 
    PC = 0x8446; JUMP; // sstep
case 0x8446:
                                                     mon("         RTS                           ; 8446: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // ---------------------------------------------------------------------------
  case 0x8447:
                                                     mon("L8447    LDB   ,U                      ; 8447: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8449; JUMP; // sstep
case 0x8449:
                                                     mon("         CMPB  #$04                    ; 8449: C1 04         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x04; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x844B; JUMP; // sstep
case 0x844B:
                                                     mon("         BNE   L846A                   ; 844B: 26 1D         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x846a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x844D; JUMP; // sstep
case 0x844D:
                                                     mon("         LDD   $49B5                   ; 844D: FC 49 B5      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x49b5); // Care needed with I/O space and word fetches
    B = rd_mem(0x49b6); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8450; JUMP; // sstep
case 0x8450:
                                                     mon("         STD   <$96                    ; 8450: DD 96         \n");
    clockticks = clockticks + 4; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    ea = DP|0x96; 
    wr_mem(ea, A); // Care needed with I/O space and word fetches
    wr_mem(ea + 1, B); 
    PC = 0x8452; JUMP; // sstep
case 0x8452:
                                                     mon("         LDA   #$FF                    ; 8452: 86 FF         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0xff; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8454; JUMP; // sstep
case 0x8454:
                                                     mon("         STA   <$95                    ; 8454: 97 95         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x95; 
    wr_mem(ea, val); 
    PC = 0x8456; JUMP; // sstep
case 0x8456:
                                                     mon("         LDA   #$00                    ; 8456: 86 00         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x00; 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8458; JUMP; // sstep
case 0x8458:
                                                     mon("         STA   <$44                    ; 8458: 97 44         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x44; 
    wr_mem(ea, val); 
    PC = 0x845A; JUMP; // sstep
case 0x845A:
                                                     mon("         STA   <$45                    ; 845A: 97 45         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x45; 
    wr_mem(ea, val); 
    PC = 0x845C; JUMP; // sstep
case 0x845C:
                                                     mon("         LDA   $4B36                   ; 845C: B6 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x845F; JUMP; // sstep
case 0x845F:
                                                     mon("         BNE   L846A                   ; 845F: 26 09         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x846a; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8461; JUMP; // sstep
case 0x8461:
                                                     mon("         INC   $4B36                   ; 8461: 7C 4B 36      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b36); 
    res = (UINT8)(val + 1); 
    Z = res; 
    N = res; 
    V = res & ~val; 
    wr_mem(0x4b36, res); 
    clockticks = clockticks + 2; 
    PC = 0x8464; JUMP; // sstep
case 0x8464:
                                                     mon("         JSR   L97E3                   ; 8464: BD 97 E3      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x67); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    PC = 0x97e3; 
    JUMP;
  case 0x8467:
                                                     mon("L8467    LDU   $49B3                   ; 8467: FE 49 B3      \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b3)<<8; 
    ea = ea | rd_mem(0x49b4); 
    U = ea; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x846A; JUMP; // sstep
case 0x846A:
                                                     mon("L846A    LDB   ,U                      ; 846A: E6 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(U); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x846C; JUMP; // sstep
case 0x846C:
                                                     mon("         CMPB  #$01                    ; 846C: C1 01         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x01; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x846E; JUMP; // sstep
case 0x846E:
                                                     mon("         BNE   L8475                   ; 846E: 26 05         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8475; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8470; JUMP; // sstep
case 0x8470:
                                                     mon("         LDD   #$0800                  ; 8470: CC 08 00      \n");
    clockticks = clockticks + 3; 
    A = 0x08; 
    B = 0x00; 
    Z = A|B; 
    N = A; 
    V = 0; 
    PC = 0x8473; JUMP; // sstep
case 0x8473:
                                                     mon("         BRA   L8478                   ; 8473: 20 03         \n");
    PC = 0x8478; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x8475:
                                                     mon("L8475    LDD   #$1000                  ; 8475: CC 10 00      \n");
    clockticks = clockticks + 3; 
    A = 0x10; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8478; JUMP; // sstep
case 0x8478:
                                                     mon("L8478    ADDD  $49B5                   ; 8478: F3 49 B5      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x49b5)<<8; 
    ea = ea | rd_mem(0x49b6); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg + val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ res) & (val ^ res)) >> 8; 
/**/N = res >> 8; 
    A = (UINT8)(res >> 8); 
    B = (UINT8)res; 
    PC = 0x847B; JUMP; // sstep
case 0x847B:
                                                     mon("         STD   $49B7                   ; 847B: FD 49 B7      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x49b7, A); // Care needed with I/O space and word fetches
    wr_mem(0x49b8, B); 
    PC = 0x847E; JUMP; // sstep
case 0x847E:
                                                     mon("         LDB   $49B5                   ; 847E: F6 49 B5      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x49b5); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8481; JUMP; // sstep
case 0x8481:
                                                     mon("         LSRB                          ; 8481: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8482; JUMP; // sstep
case 0x8482:
                                                     mon("         LSRB                          ; 8482: 54            \n");
    val = (UINT8)B; 
/**/C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8483; JUMP; // sstep
case 0x8483:
                                                     mon("         LSRB                          ; 8483: 54            \n");
    val = (UINT8)B; 
    C = val & 1; 
    val = val >> 1; 
    B = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x8484; JUMP; // sstep
case 0x8484:
                                                     mon("         ANDB  #$0F                    ; 8484: C4 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    res = val & (SINT8)0x0f; 
    B = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x8486; JUMP; // sstep
case 0x8486:
                                                     mon("         LDX   #$4989                  ; 8486: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8489; JUMP; // sstep
case 0x8489:
                                                     mon("         LDA   $01,U                   ; 8489: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x848B; JUMP; // sstep
case 0x848B:
                                                     mon("         STA   B,X                     ; 848B: A7 85         \n");
    clockticks = clockticks + 5; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = (UINT16)(X + (SINT8)B); 
    wr_mem(ea, val); 
    PC = 0x848D; JUMP; // sstep
case 0x848D:
                                                     mon("         LDX   #$4999                  ; 848D: 8E 49 99      \n");
    clockticks = clockticks + 3; 
    X = 0x4999; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x8490; JUMP; // sstep
case 0x8490:
                                                     mon("         LDA   $02,U                   ; 8490: A6 42         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0002)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8492; JUMP; // sstep
case 0x8492:
                                                     mon("         STA   B,X                     ; 8492: A7 85         \n");
    clockticks = clockticks + 5; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = (UINT16)(X + (SINT8)B); 
    wr_mem(ea, val); 
    // End of function sub_8408
    PC = 0x8494; JUMP; // sstep
case 0x8494:
                                                     mon("         RTS                           ; 8494: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x8495:
                                                     mon("L8495    LDA   <$45                    ; 8495: 96 45         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x45); 
    A = val; 
    N = val; 
    Z = val; 
    V = 0; 
    PC = 0x8497; JUMP; // sstep
case 0x8497:
                                                     mon("         BNE   locret_84B5             ; 8497: 26 1C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x84b5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8499; JUMP; // sstep
case 0x8499:
                                                     mon("         LDB   $4B19                   ; 8499: F6 4B 19      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4b19); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x849C; JUMP; // sstep
case 0x849C:
                                                     mon("         CMPB  #$07                    ; 849C: C1 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)B; 
    arg = 0x07; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x849E; JUMP; // sstep
case 0x849E:
                                                     mon("         BLS   L84A2                   ; 849E: 23 02         \n");
    // temp fix to ensure flags synched
    if ((!Z) || C) {
    PC = 0x84a2; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84A0; JUMP; // sstep
case 0x84A0:
                                                     mon("         LDB   #$07                    ; 84A0: C6 07         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)0x07; 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84A2; JUMP; // sstep
case 0x84A2:
                                                     mon("L84A2    ASLB                          ; 84A2: 58            \n");
    val = (UINT8)B; 
    res = val << 1; 
    C = res & 0x100; 
    res = (UINT8)res; 
/**/Z = res; 
/**/N = res; 
/**/V = val ^ res; 
    B = res; 
    clockticks = clockticks + 2; 
    PC = 0x84A3; JUMP; // sstep
case 0x84A3:
                                                     mon("         LDU   #byte_84B6              ; 84A3: CE 84 B6      \n");
    clockticks = clockticks + 3; 
    U = 0x84b6; 
/**/Z = U; 
/**/N = (U) >> 8; 
/**/V = 0; 
    PC = 0x84A6; JUMP; // sstep
case 0x84A6:
                                                     mon("         LEAU  B,U                     ; 84A6: 33 C5         \n");
    clockticks = clockticks + 5; 
    U = (U + (SINT8)B); 
    PC = 0x84A8; JUMP; // sstep
case 0x84A8:
                                                     mon("         LDA   <$43                    ; 84A8: 96 43         \n"); // Game over/insert coins timer
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x43); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84AA; JUMP; // sstep
case 0x84AA:
                                                     mon("         ANDA  ,U                      ; 84AA: A4 C4         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    res = val & rd_mem(U); 
    A = res; 
    Z = res; 
    N = res; 
    V = 0; 
    PC = 0x84AC; JUMP; // sstep
case 0x84AC:
                                                     mon("         BNE   locret_84B5             ; 84AC: 26 07         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x84b5; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84AE; JUMP; // sstep
case 0x84AE:
                                                     mon("         LDA   $01,U                   ; 84AE: A6 41         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(U + 0x0001)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84B0; JUMP; // sstep
case 0x84B0:
                                                     mon("         STA   <$9B                    ; 84B0: 97 9B         \n");
    clockticks = clockticks + 4; 
    val = A; 
    Z = val; 
    N = val; 
    V = 0; 
    ea = DP|0x9b; 
    wr_mem(ea, val); 
    PC = 0x84B2; JUMP; // sstep
case 0x84B2:
                                                     mon("         JSR   L84C6                   ; 84B2: BD 84 C6      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0xb5); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x84); 
    clockticks = clockticks + 1; 
    PC = 0x84c6; 
    JUMP;
    // End of function sub_8495
    // ---------------------------------------------------------------------------
  case 0x84B5:
                                                     mon("locret_84B5 RTS                           ; 84B5: 39            \n");
    clockticks = clockticks + 5; 
    clockticks = clockticks + 1; 
    PC = rd_mem(S)<<8; 
    S = S + 1; 
    PC = PC | rd_mem(S); 
    S = S + 1; 
    JUMP;
    
    // =============== S U B R O U T I N E =======================================
  case 0x84C6:
                                                     mon("L84C6    LDD   #$F800                  ; 84C6: CC F8 00      \n");
    clockticks = clockticks + 3; 
    A = 0xf8; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84C9; JUMP; // sstep
case 0x84C9:
                                                     mon("         ANDA  $5098                   ; 84C9: B4 50 98      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)A; 
    res = val & rd_mem(0x5098); 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x84CC; JUMP; // sstep
case 0x84CC:
                                                     mon("         ADDA  #$24                    ; 84CC: 8B 24         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0x24; 
    res = val + (UINT8)arg; 
    C = (res >> 1) & 0x80; 
/**/Z = (UINT8)res; 
/**/N = (UINT8)res; 
    H = (UINT8)((val ^ arg) ^ (res ^ C)); 
/**/V = (UINT8)((val ^ arg) ^ (res ^ C)); 
    A = (UINT8)res; 
    PC = 0x84CE; JUMP; // sstep
case 0x84CE:
                                                     mon("         STD   $5078                   ; 84CE: FD 50 78      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x5078, A); // Care needed with I/O space and word fetches
    wr_mem(0x5079, B); 
    PC = 0x84D1; JUMP; // sstep
case 0x84D1:
                                                     mon("L84D1    LDA   $5078                   ; 84D1: B6 50 78      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x5078); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84D4; JUMP; // sstep
case 0x84D4:
                                                     mon("         LSRA                          ; 84D4: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x84D5; JUMP; // sstep
case 0x84D5:
                                                     mon("         LSRA                          ; 84D5: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x84D6; JUMP; // sstep
case 0x84D6:
                                                     mon("         LSRA                          ; 84D6: 44            \n");
    val = (UINT8)A; 
/**/C = val & 1; 
    val = val >> 1; 
    A = val; 
/**/N = 0; 
/**/Z = val; 
    clockticks = clockticks + 2; 
    PC = 0x84D7; JUMP; // sstep
case 0x84D7:
                                                     mon("         ANDA  #$0F                    ; 84D7: 84 0F         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0x0f; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x84D9; JUMP; // sstep
case 0x84D9:
                                                     mon("         STA   <$99                    ; 84D9: 97 99         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x99; 
    wr_mem(ea, val); 
    PC = 0x84DB; JUMP; // sstep
case 0x84DB:
                                                     mon("         LDD   #$FE00                  ; 84DB: CC FE 00      \n");
    clockticks = clockticks + 3; 
    A = 0xfe; 
    B = 0x00; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84DE; JUMP; // sstep
case 0x84DE:
                                                     mon("         STD   $507C                   ; 84DE: FD 50 7C      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507c, A); // Care needed with I/O space and word fetches
    wr_mem(0x507d, B); 
    PC = 0x84E1; JUMP; // sstep
case 0x84E1:
                                                     mon("         LDD   #$FC80                  ; 84E1: CC FC 80      \n");
    clockticks = clockticks + 3; 
    A = 0xfc; 
    B = 0x80; 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84E4; JUMP; // sstep
case 0x84E4:
                                                     mon("         STD   $507A                   ; 84E4: FD 50 7A      \n");
    clockticks = clockticks + 5; 
/**/Z = A | B; 
/**/N = A; 
/**/V = 0; 
    wr_mem(0x507a, A); // Care needed with I/O space and word fetches
    wr_mem(0x507b, B); 
    PC = 0x84E7; JUMP; // sstep
case 0x84E7:
                                                     mon("         LDX   #$4989                  ; 84E7: 8E 49 89      \n");
    clockticks = clockticks + 3; 
    X = 0x4989; 
/**/Z = X; 
/**/N = (X) >> 8; 
/**/V = 0; 
    PC = 0x84EA; JUMP; // sstep
case 0x84EA:
                                                     mon("         LDB   <$99                    ; 84EA: D6 99         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)rd_mem(DP|0x99); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84EC; JUMP; // sstep
case 0x84EC:
                                                     mon("         LDA   B,X                     ; 84EC: A6 85         \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem((UINT16)(X + (SINT8)B)); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x84EE; JUMP; // sstep
case 0x84EE:
                                                     mon("L84EE    STA   <$9A                    ; 84EE: 97 9A         \n");
    clockticks = clockticks + 4; 
    val = A; 
/**/Z = val; 
/**/N = val; 
/**/V = 0; 
    ea = DP|0x9a; 
    wr_mem(ea, val); 
    PC = 0x84F0; JUMP; // sstep
case 0x84F0:
                                                     mon("         ANDA  #$C0                    ; 84F0: 84 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    res = val & (SINT8)0xc0; 
    A = res; 
/**/Z = res; 
/**/N = res; 
/**/V = 0; 
    PC = 0x84F2; JUMP; // sstep
case 0x84F2:
                                                     mon("         CMPA  #$C0                    ; 84F2: 81 C0         \n");
    clockticks = clockticks + 2; 
    val = (UINT8)A; 
    arg = 0xc0; 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x84F4; JUMP; // sstep
case 0x84F4:
                                                     mon("         BNE   L8522                   ; 84F4: 26 2C         \n");
    // temp fix to ensure flags synched
    if (Z) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84F6; JUMP; // sstep
case 0x84F6:
                                                     mon("         LDD   $509C                   ; 84F6: FC 50 9C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x509c); // Care needed with I/O space and word fetches
    B = rd_mem(0x509d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x84F9; JUMP; // sstep
case 0x84F9:
                                                     mon("         SUBD  $507C                   ; 84F9: B3 50 7C      \n");
    clockticks = clockticks + 6; 
    clockticks = clockticks + 1; 
    ea = rd_mem(0x507c)<<8; 
    ea = ea | rd_mem(0x507d); 
    val = ea; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x84FC; JUMP; // sstep
case 0x84FC:
                                                     mon("         BLT   L8522                   ; 84FC: 2D 24         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) <  0) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x84FE; JUMP; // sstep
case 0x84FE:
                                                     mon("L84FE    SUBD  #$0400                  ; 84FE: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8501; JUMP; // sstep
case 0x8501:
                                                     mon("         BGE   L850F                   ; 8501: 2C 0C         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x850f; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8503; JUMP; // sstep
case 0x8503:
                                                     mon("L8503    LDA   $4703                   ; 8503: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8506; JUMP; // sstep
case 0x8506:
                                                     mon("         CMPA  <$9B                    ; 8506: 91 9B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9b); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x8508; JUMP; // sstep
case 0x8508:
                                                     mon("         BCS   L850D                   ; 8508: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x850d; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x850A; JUMP; // sstep
case 0x850A:
                                                     mon("         JSR   LA7F7                   ; 850A: BD A7 F7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x0d); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xa7f7; 
    JUMP;
  case 0x850D:
                                                     mon("L850D    BRA   L8522                   ; 850D: 20 13         \n");
    PC = 0x8522; 
    JUMP;
    clockticks = clockticks + 3; 
    
    // ---------------------------------------------------------------------------
  case 0x850F:
                                                     mon("L850F    SUBD  #$0400                  ; 850F: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
    C = res & 0x10000; 
    res = (UINT16)res; 
    Z = res; 
    V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
    N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8512; JUMP; // sstep
case 0x8512:
                                                     mon("         BGE   L8522                   ; 8512: 2C 0E         \n");
    // temp fix to ensure flags synched
    if ((SINT8)(N^V) >= 0) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x8514; JUMP; // sstep
case 0x8514:
                                                     mon("         LDA   $4703                   ; 8514: B6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    A = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x8517; JUMP; // sstep
case 0x8517:
                                                     mon("         LDB   $4703                   ; 8517: F6 47 03      \n");
    clockticks = clockticks + 5; 
    val = (UINT8)rd_mem(0x4703); 
    B = val; 
/**/N = val; 
/**/Z = val; 
/**/V = 0; 
    PC = 0x851A; JUMP; // sstep
case 0x851A:
                                                     mon("         MUL                           ; 851A: 3D            \n");
    res = (UINT16)(A * B); 
/**/Z = res; 
/**/C = res & 0x80; 
    A = res >> 8; 
    B = (UINT8)res; 
    clockticks = clockticks + 11; 
    PC = 0x851B; JUMP; // sstep
case 0x851B:
                                                     mon("         CMPA  <$9B                    ; 851B: 91 9B         \n");
    clockticks = clockticks + 4; 
    val = (UINT8)A; 
    arg = rd_mem(DP|0x9b); 
    res = val - (UINT8)arg; 
    C = res & 0x100; 
    Z = (UINT8)res; 
    N = (UINT8)res; 
    V = (UINT8)((val ^ arg) & (val ^ res)); 
    PC = 0x851D; JUMP; // sstep
case 0x851D:
                                                     mon("         BCS   L8522                   ; 851D: 25 03         \n");
    // temp fix to ensure flags synched
    if (C) {
    PC = 0x8522; 
    JUMP;
    }
    clockticks = clockticks + 3; 
    PC = 0x851F; JUMP; // sstep
case 0x851F:
                                                     mon("         JSR   LA7F7                   ; 851F: BD A7 F7      \n");
    clockticks = clockticks + 8; 
    S = S - 1; 
    wr_mem(S, 0x22); 
    clockticks = clockticks + 1; 
    S = S - 1; 
    wr_mem(S, 0x85); 
    clockticks = clockticks + 1; 
    PC = 0xa7f7; 
    JUMP;
  case 0x8522:
                                                     mon("L8522    LDD   $507C                   ; 8522: FC 50 7C      \n");
    clockticks = clockticks + 5; 
    A = rd_mem(0x507c); // Care needed with I/O space and word fetches
    B = rd_mem(0x507d); 
/**/Z = A|B; 
/**/N = A; 
/**/V = 0; 
    PC = 0x8525; JUMP; // sstep
case 0x8525:
                                                     mon("         SUBD  #$0400                  ; 8525: 83 04 00      \n");
    clockticks = clockticks + 4; 
    val = 0x0400; 
    arg = (A << 8) | B; 
    res = arg - val; 
/**/C = res & 0x10000; 
    res = (UINT16)res; 
/**/Z = res; 
/**/V = ((arg ^ val) & (arg ^ res)) >> 8; 
    A = (UINT8)(res >> 8); 
/**/N = res >> 8; 
    B = (UINT8)res; 
    PC = 0x8528; JUMP; // sstep
case 0x8528:
                                                     mon("         STD   $507C                   ; 8528: FD 50 7C      \n");
    clockticks = clockticks + 5; 
