diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-11-12 18:52:38 +0100 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-11-12 18:52:38 +0100 |
| commit | d4f6774c172ac1e7c193fc4e89230c873d179c2b (patch) | |
| tree | 049b855ac7b68482dc9e1e35b339f5b4d18d675b /src/sim86/libs/reference_decoder/sim86_text_table.cpp | |
| parent | e20d69ffb1f5676bb7960ac4d71c1013e4582149 (diff) | |
checkpoint
Diffstat (limited to 'src/sim86/libs/reference_decoder/sim86_text_table.cpp')
| -rw-r--r-- | src/sim86/libs/reference_decoder/sim86_text_table.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/sim86/libs/reference_decoder/sim86_text_table.cpp b/src/sim86/libs/reference_decoder/sim86_text_table.cpp new file mode 100644 index 0000000..e90a649 --- /dev/null +++ b/src/sim86/libs/reference_decoder/sim86_text_table.cpp @@ -0,0 +1,57 @@ +/* ======================================================================== + + (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Please see https://computerenhance.com for more information + + ======================================================================== */ + +char const *OpcodeMnemonics[] = +{ + "", + +#define INST(Mnemonic, ...) #Mnemonic, +#define INSTALT(...) +#include "sim86_instruction_table.inl" +}; + +static char const *GetMnemonic(operation_type Op) +{ + char const *Result = ""; + if(Op < Op_Count) + { + Result = OpcodeMnemonics[Op]; + } + + return Result; +} + +static char const *GetRegName(register_access Reg) +{ + char const *Names[][3] = + { + {"", "", ""}, + {"al", "ah", "ax"}, + {"bl", "bh", "bx"}, + {"cl", "ch", "cx"}, + {"dl", "dh", "dx"}, + {"sp", "sp", "sp"}, + {"bp", "bp", "bp"}, + {"si", "si", "si"}, + {"di", "di", "di"}, + {"es", "es", "es"}, + {"cs", "cs", "cs"}, + {"ss", "ss", "ss"}, + {"ds", "ds", "ds"}, + {"ip", "ip", "ip"}, + {"flags", "flags", "flags"}, + {"", "", ""} + }; + + char const *Result = Names[Reg.Index % ArrayCount(Names)][(Reg.Count == 2) ? 2 : Reg.Offset&1]; + return Result; +} |
