diff options
author | ubq323 <ubq323@ubq323.website> | 2024-05-02 23:16:30 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-05-02 23:16:30 +0100 |
commit | a71e6c729761d07c7bf189c057951440d1fe251f (patch) | |
tree | 9b4c6e02cc4997357e944a7bf6ca4f7d2ce8c5b6 /mnems.py | |
parent | 20ddcf5e3733677b695d50d86d65c8de5b386e60 (diff) |
more things
Diffstat (limited to 'mnems.py')
-rwxr-xr-x | mnems.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mnems.py b/mnems.py new file mode 100755 index 0000000..db00fbc --- /dev/null +++ b/mnems.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +mnems = """ +nop +rot +nrt +dup +swp +ovr +drp +tck +nip +equ +neq +add +sub +mul +div +neg +slt +ult +sle +ule +lod +sto +psh +pop +hlt +put +""".split() +mnems.extend(['???']*(64-len(mnems))) +def opws(kw): + for k in range(16): + mnems.append(kw + str(k)) +opws("mark") # who is mark +opws("loc") +opws("ret") +opws("lit") + +if __name__ == "__main__": + print("type op = enum u8 {") + for opc,mnem in enumerate(mnems): + if mnem != "???": + print(f"\t{mnem.upper()} = {opc},") + print("};") |