Annotation of nono/debugger/branchhistory.cpp, revision 1.1.1.10

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
1.1.1.5   root        7: //
1.1       root        8: // ブランチ履歴
1.1.1.5   root        9: //
1.1       root       10: 
                     11: #include "branchhistory.h"
1.1.1.10! root       12: #include "m680x0disasm.h"
1.1       root       13: #include "m88100.h"
1.1.1.10! root       14: #include "monitor.h"
1.1.1.7   root       15: #include "mpu64180.h"
1.1.1.5   root       16: #include "vectortable.h"
1.1       root       17: 
                     18: // コンストラクタ
1.1.1.9   root       19: BranchHistory::BranchHistory(uint objid_)
1.1.1.7   root       20:        : inherited(objid_)
1.1       root       21: {
1.1.1.7   root       22:        int monitor_id;
                     23: 
                     24:        switch (GetId()) {
                     25:         case OBJ_MPU_BRHIST:
                     26:                is_exhist = false;
                     27:                monitor_id = ID_SUBWIN_BRHIST;
                     28:                break;
                     29:         case OBJ_MPU_EXHIST:
                     30:                is_exhist = true;
                     31:                monitor_id = ID_SUBWIN_EXHIST;
                     32:                break;
                     33:         case OBJ_XP_BRHIST:
                     34:                is_exhist = false;
                     35:                monitor_id = ID_SUBWIN_XPBRHIST;
                     36:                break;
                     37:         case OBJ_XP_EXHIST:
                     38:                is_exhist = true;
                     39:                monitor_id = ID_SUBWIN_XPEXHIST;
                     40:                break;
                     41:         default:
                     42:                PANIC("unknown id %s", GetIdStr());
                     43:        }
1.1.1.4   root       44: 
1.1.1.5   root       45:        // ログは不要
                     46:        ClearAlias();
                     47: 
1.1.1.7   root       48:        vectortable = GetVectorTable();
                     49: 
1.1.1.10! root       50:        monitor = gMonitorManager->Regist(monitor_id, this);
        !            51:        monitor->func = ToMonitorCallback(&BranchHistory::MonitorUpdate);
        !            52:        monitor->SetSize(55, 1 + 32); // ヘッダ1行とエントリ数
        !            53:        monitor->SetMaxHeight(1 + 256);
1.1.1.7   root       54: 
                     55:        // hd64180 はこれを上書きする
                     56:        x_count = 45;
1.1       root       57: }
                     58: 
                     59: // デストラクタ
                     60: BranchHistory::~BranchHistory()
                     61: {
                     62: }
                     63: 
                     64: // 初期化
                     65: void
                     66: BranchHistory::Clear()
                     67: {
                     68:        top = 0;
                     69:        for (int i = 0; i < countof(entry); i++) {
                     70:                BranchEntry& e = entry[i];
                     71:                e.count = 0;
                     72:                e.from  = 0xffffffff;
                     73:                e.to    = 0xffffffff;
                     74:                e.inst  = 0;
                     75:        }
                     76: }
                     77: 
                     78: // 使用中のエントリ数を取得する
                     79: int
                     80: BranchHistory::GetUsed() const
                     81: {
                     82:        int i = 0;
                     83: 
                     84:        // top の位置から一巡するまで。有効エントリは count > 0。
                     85:        for (; i < 256; i++) {
                     86:                if (entry[(256 + top - i) % 256].count == 0) {
                     87:                        break;
                     88:                }
                     89:        }
                     90:        return i;
                     91: }
                     92: 
                     93: // モニタ更新
                     94: void
1.1.1.4   root       95: BranchHistory::MonitorUpdate(Monitor *, TextScreen& screen)
1.1       root       96: {
                     97:        uint8 t;
                     98:        int y;
                     99:        int ydelta;
                    100:        int row;
                    101: 
                    102:        // userdata は表示開始位置と各種フラグ。
                    103:        // 下位 32bit が表示開始位置で、0 なら先頭のエントリから、1 なら先頭の
1.1.1.4   root      104:        // 一つ次のエントリから、…を表す (表示行数は screen の高さ分)。
1.1       root      105:        // BottomToTop が %1 なら並び順を下から上に変える (コンソール用)。
1.1.1.4   root      106:        bool bottom_to_top = (screen.userdata & BottomToTop);
                    107:        int pos = (int)screen.userdata;
1.1       root      108: 
                    109:        // 0         1         2         3         4         5         6
                    110:        // 0123456789012345678901234567890123456789012345678901234567890123456789
                    111:        // No. FromAddr  Instruction          ToAddr    Iteration
                    112:        // 001 U:01234567(01234567:bcnd.n) -> $01234567 x123456789
                    113:        // 001 U:01234567(0123:trap )      -> $01234567 x123456789
                    114:        // 002 S:01234567<  2> Bus Error
                    115:        // 002 S:01234567< 69> MFP Timer-C
                    116:        //                     01234567890123456789012
                    117: 
1.1.1.4   root      118:        screen.Clear();
                    119:        row = screen.GetRow();
1.1       root      120: 
                    121:        // 最初の1行は常にヘッダ
1.1.1.7   root      122:        std::string header = FormatHeader();
                    123:        screen.Puts(0, 0, header.c_str());
1.1       root      124: 
                    125:        // pos は最新を 0 とした通し番号。(スクロールしてたら開始が 0 とは限らない)
                    126:        // t が entry[] 上の現在位置。
                    127:        // y は表示座標。(上から表示か下から表示かが変わる)
                    128:        t = top - pos;
                    129:        int pos_end = pos + row - 1;
                    130:        if (bottom_to_top == false) {
                    131:                y = 1;
                    132:                ydelta = 1;
                    133:        } else {
                    134:                y = row - 1;
                    135:                ydelta = -1;
                    136:        }
                    137:        for (; pos < pos_end; pos++, y += ydelta) {
                    138:                BranchEntry& e = entry[t--];
                    139:                if (e.count == 0) {
                    140:                        continue;
                    141:                }
                    142:                std::string str = FormatEntry(e);
1.1.1.9   root      143:                screen.Print(0, y, "%3u %s", pos, str.c_str());
1.1       root      144:                if (e.count > 1) {
1.1.1.7   root      145:                        screen.Print(x_count, y, "x%9u", e.count);
1.1       root      146:                }
                    147:        }
                    148: }
                    149: 
1.1.1.7   root      150: // ヘッダ文字列を返す。(m68k, m88k 共通)
                    151: std::string
                    152: BranchHistory::FormatHeader() const
                    153: {
                    154:        if (is_exhist) {
                    155:                //      012345678901234567890123456789012345678901234567890123456789
                    156:                return "No. FromAddr   Vec. Exception                Iteration";
                    157:        } else {
                    158:                //      012345678901234567890123456789012345678901234567890123456789
                    159:                return "No. FromAddr  Instruction          ToAddr    Iteration";
                    160:        }
                    161: }
1.1       root      162: 
                    163: 
                    164: //
                    165: // m680x0 ブランチ履歴 (どこに置くのがよいか)
                    166: //
                    167: 
1.1.1.8   root      168: // m680x0 ブランチ履歴では、通常ブランチ、例外発生 (IOCS コールと
                    169: // それ以外)、例外ベクタによるジャンプの4つを区別する。
1.1       root      170: //
1.1.1.8   root      171: // 1. 通常の分岐:
                    172: //     from は上位31ビットが分岐元 PC、最下位ビットが S/U。
                    173: //     to   は32ビット全体が分岐先 PC。
                    174: //     inst は上位2ビットが %00 (Normal)、下位16ビットに分岐元命令の1ワード目。
                    175: //
                    176: //      31  30         15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
                    177: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    178: //     | 0 | 0 |  ..  |               instruction word                |
                    179: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    180: //
                    181: // 2. 例外発生 (IOCS コール以外の場合):
                    182: //     from は上位31ビットが例外発生時の PC、最下位ビットが S/U。
                    183: //     to   は不問だが 0 にすること。
                    184: //     inst は上位2ビットが %11 (Exception)、Number はベクタ番号 (0-255)。
                    185: //     例外が TRAP#15 で IOCS コールっぽくない場合もこちら。
                    186: //
                    187: //      31  30         15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
                    188: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    189: //     | 1 | 1 |  ..  |           0           |        Vector         |
                    190: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    191: //
                    192: // 3. 例外発生 (IOCS コールの場合):
                    193: //     from, to は同じ。
                    194: //     inst は上位2ビットが %10 (IOCSCall)、Number は IOCS コール番号 (0-255)。
                    195: //
                    196: //      31  30         15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
                    197: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    198: //     | 1 | 0 |  ..  |           0           |   IOCS Call Number    |
                    199: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.1       root      200: //
1.1.1.8   root      201: // 4. 例外ベクタによる分岐 (例外処理の最後に起きる):
1.1.1.3   root      202: //     from はベクタアドレス、
                    203: //     to   は分岐先 (0 も起こりえる)、
1.1.1.8   root      204: //     inst は上位2ビットが %01 (VectorJump)。
                    205: //
                    206: //      31  30         15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
                    207: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    208: //     | 0 | 1 |  ..  |                       0                       |
                    209: //     +---+---+--  --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
                    210: //
1.1       root      211: 
                    212: // コンストラクタ
1.1.1.9   root      213: BranchHistory_m680x0::BranchHistory_m680x0(uint objid_)
1.1.1.7   root      214:        : inherited(objid_)
1.1       root      215: {
                    216: }
                    217: 
                    218: // デストラクタ
                    219: BranchHistory_m680x0::~BranchHistory_m680x0()
                    220: {
                    221: }
                    222: 
                    223: // 1エントリ分の表示内容作成
                    224: std::string
                    225: BranchHistory_m680x0::FormatEntry(const BranchEntry& e)
                    226: {
                    227:        // m68k では from の最下位1ビットを S/U として使う
                    228:        std::string desc = string_format("%c:%08x",
                    229:                (e.from & 1) ? 'S' : 'U', (e.from & ~1));
                    230: 
1.1.1.8   root      231:        switch (e.inst >> 30) {
                    232:         case 0:        // 通常分岐
                    233:         {
1.1       root      234:                const char *mnemonic;
1.1.1.8   root      235:                uint32 inst = e.inst & 0xffff;
1.1       root      236:                if (inst == 0x4e73) {
                    237:                        mnemonic = ":rte";
                    238:                } else if (inst == 0x4e75) {
                    239:                        mnemonic = ":rts";
                    240:                } else if (inst == 0x4e77) {
                    241:                        mnemonic = ":rtr";
                    242:                } else if ((inst & 0xffc0) == 0x4e80) {
                    243:                        mnemonic = ":jsr";
                    244:                } else if ((inst & 0xffc0) == 0x4ec0) {
                    245:                        mnemonic = ":jmp";
                    246:                } else if ((inst & 0xfff8) == 0x51c8) {
                    247:                        mnemonic = ":dbra";
                    248:                } else if ((inst & 0xf0f8) == 0x50c8) {
                    249:                        mnemonic = ":dbcc";
                    250:                } else if ((inst & 0xff00) == 0x6000) {
                    251:                        mnemonic = ":bra";
                    252:                } else if ((inst & 0xff00) == 0x6100) {
                    253:                        mnemonic = ":bsr";
                    254:                } else if ((inst & 0xf000) == 0x6000) {
                    255:                        mnemonic = ":bcc";
                    256:                } else if ((inst & 0xfff8) == 0xf248) {
                    257:                        mnemonic = ":fdbcc";
                    258:                } else if ((inst & 0xff80) == 0xf280) {
                    259:                        mnemonic = ":fbcc";
                    260:                } else {
                    261:                        mnemonic = "";
                    262:                }
                    263:                desc += string_format("(%04x%-6s)      -> $%08x", inst, mnemonic, e.to);
1.1.1.8   root      264:                break;
                    265:         }
                    266: 
                    267:         case 1:        // 例外ベクタフェッチによるジャンプ
                    268:                // 例外ベクタフェッチしてジャンプ
                    269:                desc += string_format("(vector fetch)    -> $%08x", e.to);
                    270:                break;
                    271: 
                    272:         case 2:        // 例外発生 (IOCS コール)
                    273:         {
                    274:                uint num = e.inst & 0xff;
                    275:                const char *name = m680x0disasm::GetIOCSName(num);
                    276:                if (name != NULL) {
1.1.1.9   root      277:                        desc += string_format("<%3u> IOCS %s", M68K::EXCEP_TRAP15, name);
1.1.1.8   root      278:                } else {
1.1.1.9   root      279:                        desc += string_format("<%3u> IOCS $%02x", M68K::EXCEP_TRAP15, num);
1.1.1.8   root      280:                }
                    281:                break;
                    282:         }
                    283: 
                    284:         case 3:        // 例外発生 (IOCS コール以外)
                    285:         {
                    286:                uint32 vector = e.inst & 0xff;
                    287:                const char *name = vectortable->GetExceptionName(vector);
1.1.1.9   root      288:                desc += string_format("<%3u> %s", vector, name ?: "");
1.1.1.8   root      289:                break;
                    290:         }
                    291: 
                    292:         default:
                    293:                __unreachable();
1.1       root      294:        }
                    295:        return desc;
                    296: }
                    297: 
                    298: 
                    299: //
                    300: // m88xx0 ブランチ履歴 (どこに置くのがよいか)
                    301: //
                    302: 
                    303: // m88xx0 ブランチ履歴では、通常ブランチ、例外発生の2つを区別する。
                    304: // m68k は例外ベクタに書いてあるアドレスに飛ぶのでもう1種類分けてあったが、
                    305: // m88k は例外ベクタを直接実行するのでそれは不要。
                    306: //
                    307: // 通常の分岐:
1.1.1.3   root      308: //     from は上位30ビットが分岐元 XIP、最下位ビットが S/U、
                    309: //     to   は32ビット全体が分岐先アドレス、
                    310: //     inst は命令ワード。
1.1       root      311: //
                    312: // 例外発生:
1.1.1.3   root      313: //     from は上位30ビットが例外発生時の XIP、最下位ビットが S/U、
                    314: //     to   は 0。
                    315: //     inst は $fc000VVV で VVV (9ビット)がベクタ番号。
                    316: //     命令ワードとは衝突しない (instruction.txt 参照)。
1.1       root      317: 
                    318: // コンストラクタ
1.1.1.9   root      319: BranchHistory_m88xx0::BranchHistory_m88xx0(uint objid_)
1.1.1.7   root      320:        : inherited(objid_)
1.1       root      321: {
                    322: }
                    323: 
                    324: // デストラクタ
                    325: BranchHistory_m88xx0::~BranchHistory_m88xx0()
                    326: {
                    327: }
                    328: 
                    329: // 1エントリ分の表示内容作成
                    330: std::string
                    331: BranchHistory_m88xx0::FormatEntry(const BranchEntry& e)
                    332: {
                    333:        // m88k では from の最下位1ビットを S/U として使う
                    334:        std::string desc = string_format("%c:%08x",
                    335:                (e.from & 1) ? 'S' : 'U', (e.from & ~1));
                    336: 
                    337:        if (e.inst >= 0xfc000000 && e.to == 0) {
                    338:                // 例外発生記録
                    339:                // 発生アドレスとベクタを表示
                    340:                uint32 vector = e.inst & 0x1ff;
1.1.1.7   root      341:                const char *name = vectortable->GetExceptionName(vector);
1.1.1.9   root      342:                desc += string_format("<%3u> %s", vector, name ?: "");
1.1.1.7   root      343:                if (vector == 128 || vector == 450) {
                    344:                        // 450 なら OpenBSD のシステムコール番号を追加。
                    345:                        // 非公式 NetBSD/luna88k は(今の所?) 128 を使ってるようだ。
1.1.1.9   root      346:                        desc += string_format("(%u)", (e.inst >> 12) & 0xfff);
1.1       root      347:                }
                    348:        } else if (e.inst >= 0xc0000000) {
                    349:                // ブランチ
                    350:                const char *mnemonic = "";
                    351:                uint32 up4 = (e.inst >> 26) & 0xf;
                    352:                switch (up4) {
                    353:                 case 0:        mnemonic = ":br";               break;
                    354:                 case 1:        mnemonic = ":br.n";             break;
                    355:                 case 2:        mnemonic = ":bsr";              break;
                    356:                 case 3:        mnemonic = ":bsr.n";    break;
                    357:                 case 4:        mnemonic = ":bb0";              break;
                    358:                 case 5:        mnemonic = ":bb0.n";    break;
1.1.1.2   root      359:                 case 6:        mnemonic = ":bb1";              break;
1.1       root      360:                 case 7:        mnemonic = ":bb1.n";    break;
                    361: 
                    362:                 case 0xa:      mnemonic = ":bcnd";             break;
                    363:                 case 0xb:      mnemonic = ":bcnd.n";   break;
                    364:                 case 0xc: {
                    365:                        uint32 lo6 = (e.inst >> 10) & 0x3f;
                    366:                        if (lo6 == 0x34) {
                    367:                                mnemonic = ":tb0";
                    368:                        } else if (lo6 == 0x36) {
                    369:                                mnemonic = ":tb1";
                    370:                        } else if (lo6 == 0x3a) {
                    371:                                mnemonic = ":tcnd";
                    372:                        }
                    373:                        break;
                    374:                 }
                    375:                 case 0xd: {
                    376:                        uint32 lo6 = (e.inst >> 10) & 0x3f;
                    377:                        if (lo6 == 0x30) {
                    378:                                if ((e.inst & 0x1f) == 1) {
                    379:                                        mnemonic = ":jmp r1";
                    380:                                } else {
                    381:                                        mnemonic = ":jmp";
                    382:                                }
                    383:                        } else if (lo6 == 0x31) {
                    384:                                mnemonic = ":jmp.n";
                    385:                        } else if (lo6 == 0x32) {
                    386:                                mnemonic = ":jsr";
                    387:                        } else if (lo6 == 0x33) {
                    388:                                mnemonic = ":jsr.n";
                    389:                        } else if (lo6 == 0x3f) {
                    390:                                mnemonic = ":rte";
                    391:                        }
                    392:                        break;
                    393:                 }
                    394:                 case 0xe:      mnemonic = ":tbnd";     break;
                    395:                 default:
                    396:                        break;
                    397:                }
                    398:                desc += string_format("(%08x%-7s) -> $%08x", e.inst, mnemonic, e.to);
                    399:        }
                    400:        return desc;
                    401: }
1.1.1.7   root      402: 
                    403: 
                    404: //
                    405: // XP ブランチ履歴
                    406: //
                    407: 
                    408: // XP ブランチ履歴では、通常ブランチ、例外発生、例外ベクタによるジャンプの
                    409: // 3つを区別する。
                    410: //
                    411: // 通常の分岐
                    412: //     from は下位 16 ビットが分岐元 PC
                    413: //     to   は下位 16 ビットが分岐先 PC
                    414: //     inst の最上位ビットが %0 で区別する。
                    415: //     inst の下位 16 ビットに命令を上詰めで。例えば
                    416: //     CALL (1バイト命令 CD nn nn) なら $0000'cd00、
                    417: //     RETI (2バイト命令 ED 4D) なら $0000'ed4d。
                    418: //
                    419: // 例外発生
                    420: //     from は下位 16 ビットが例外発生時の PC
                    421: //     to   は $ffffffff ならこのエントリはベクタ方式の例外発生時側を示す、
                    422: //             そうでなければダイレクト方式で下位 16 ビットが分岐先 PC
                    423: //     inst の最上位ビットが %1 で inst が $ffffffff でなければ
                    424: //     下位に優先度(0-15)。
                    425: //
                    426: // 例外ベクタジャンプの場合
                    427: //     from はベクタアドレス
                    428: //     to   は分岐先 PC、
                    429: //     inst が $ffffffff で区別する。
                    430: 
                    431: // コンストラクタ
1.1.1.9   root      432: BranchHistory_hd64180::BranchHistory_hd64180(uint objid_)
1.1.1.7   root      433:        : inherited(objid_)
                    434: {
1.1.1.10! root      435:        monitor->SetSize(48, 1 + 32); // ヘッダ1行とエントリ数
1.1.1.7   root      436:        x_count = 38;
                    437: }
                    438: 
                    439: // デストラクタ
                    440: BranchHistory_hd64180::~BranchHistory_hd64180()
                    441: {
                    442: }
                    443: 
                    444: // ヘッダ文字列を返す。
                    445: std::string
                    446: BranchHistory_hd64180::FormatHeader() const
                    447: {
                    448:        if (is_exhist) {
                    449:                //      01234567890123456789012345678901234567890123456789
                    450:                return "No. From  Exception                   Iteration";
                    451:        } else {
                    452:                //      01234567890123456789012345678901234567890123456789
                    453:                return "No. From Instruction           ToAddr Iteration";
                    454:        }
                    455: }
                    456: 
                    457: // 1エントリ分の表示内容作成
                    458: std::string
                    459: BranchHistory_hd64180::FormatEntry(const BranchEntry& e)
                    460: {
                    461:        // 0         1         2         3         4         5
                    462:        // 012345678901234567890123456789012345678901234567890
                    463:        // No. From Instruction           ToAddr Iteration
                    464:        // 001 0123(0000:CALL NZ)      -> $0234 x123456899
                    465:        // No. From Exception
                    466:        // 002 0123<00> Timer Overflow
                    467:        // 003 0038(vector fetch)      -> $0000
                    468: 
                    469:        std::string desc = strhex(e.from, 4);
                    470: 
                    471:        if (e.inst == 0xffffffff) {
                    472:                // 例外ベクタフェッチしてジャンプ
                    473:                desc += string_format("(vector fetch)      -> $%04x", e.to);
                    474:        } else if ((int32)e.inst < 0) {
                    475:                // 例外発生
                    476:                uint32 vector = e.inst & 0xff;
1.1.1.9   root      477:                desc += string_format("<%2u>%-15s",
1.1.1.7   root      478:                        vector, MPU64180Device::InterruptName[vector]);
                    479:                // 例外履歴には宛先は出さないほうに統一。
                    480:                // ブランチ履歴でも、ベクタ方式なら宛先不要。
                    481:                if (is_exhist == false && e.to != -1) {
                    482:                        desc += string_format(" -> $%04x", e.to);
                    483:                }
                    484:        } else {
                    485:                // ブランチ
                    486:                std::string mnemonic;
                    487:                uint32 inst = e.inst & 0xffff;
                    488:                if (inst == 0x1000) {
                    489:                        mnemonic = ":DJNZ";
                    490:                } else if (inst == 0x1800) {
                    491:                        mnemonic = ":JR";
                    492:                } else if (inst == 0xc300) {
                    493:                        mnemonic = ":JP";
                    494:                } else if (inst == 0xc900) {
                    495:                        mnemonic = ":RET";
                    496:                } else if (inst == 0xcd00) {
                    497:                        mnemonic = ":CALL";
                    498:                } else if (inst == 0xe900) {
                    499:                        mnemonic = ":JP (HL)";
                    500:                } else if (inst == 0xed45) {
                    501:                        mnemonic = ":RETN";
                    502:                } else if (inst == 0xed4d) {
                    503:                        mnemonic = ":RETI";
                    504:                } else if (inst == 0xdde9) {
                    505:                        mnemonic = ":JP (IX)";
                    506:                } else if (inst == 0xfde9) {
                    507:                        mnemonic = ":JP (IY)";
                    508:                } else if ((inst & 0xe700) == 0x2000) {
                    509:                        mnemonic = ":JR " + fstr((inst >> 11) & 3);
                    510:                } else if ((inst & 0xc700) == 0xc000) {
                    511:                        mnemonic = ":RET " + fstr((inst >> 11) & 7);
                    512:                } else if ((inst & 0xc700) == 0xc200) {
                    513:                        mnemonic = ":JP " + fstr((inst >> 11) & 7);
                    514:                } else if ((inst & 0xc700) == 0xc400) {
                    515:                        mnemonic = ":CALL " + fstr((inst >> 11) & 7);
                    516:                } else if ((inst & 0xc700) == 0xc700) {
                    517:                        mnemonic = string_format(":RST %02xH", (inst >> 8) & 0x38);
                    518:                }
                    519:                desc += string_format("(%04x%-8s)      -> $%04x",
                    520:                        inst, mnemonic.c_str(), e.to);
                    521:        }
                    522:        return desc;
                    523: }
                    524: 
                    525: /*static*/ std::string
                    526: BranchHistory_hd64180::fstr(int f)
                    527: {
                    528:        static const char fff[] =
                    529:                "NZ\0\0"
                    530:                "Z\0\0\0"
                    531:                "NC\0\0"
                    532:                "C\0\0\0"
                    533:                "PO\0\0"
                    534:                "PE\0\0"
                    535:                "P\0\0\0"
                    536:                "M";
                    537: 
                    538:        return &fff[f * 4];
                    539: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.