Browse Source

Add a rst() function.

master
Ben Kurtovic 9 years ago
parent
commit
3b757cced7
3 changed files with 11 additions and 33 deletions
  1. +6
    -0
      scripts/update_asm_instructions.py
  2. +3
    -17
      src/assembler/instructions.inc.c
  3. +2
    -16
      src/assembler/instructions.yml

+ 6
- 0
scripts/update_asm_instructions.py View File

@@ -324,6 +324,12 @@ class Instruction(object):
ret[i] = "0x{0:02X} + 8 * INST_IMM({1}).uval".format( ret[i] = "0x{0:02X} + 8 * INST_IMM({1}).uval".format(
_atoi(base), index) _atoi(base), index)


elif _is_call(byte, "rst"):
index = types.index("immediate")
base = _call_args(byte, "rst")
ret[i] = "0x{0:02X} + INST_IMM({1}).uval".format(
_atoi(base), index)

elif _is_call(byte, "reg"): elif _is_call(byte, "reg"):
ret[i] = handle_reg_func(byte) ret[i] = handle_reg_func(byte)




+ 3
- 17
src/assembler/instructions.inc.c View File

@@ -7,7 +7,7 @@
`make` should trigger a rebuild when it is modified; if not, use: `make` should trigger a rebuild when it is modified; if not, use:
`python scripts/update_asm_instructions.py`. `python scripts/update_asm_instructions.py`.


@AUTOGEN_DATE Fri May 22 00:55:44 2015 UTC
@AUTOGEN_DATE Fri May 22 00:59:54 2015 UTC
*/ */


/* @AUTOGEN_INST_BLOCK_START */ /* @AUTOGEN_INST_BLOCK_START */
@@ -1594,22 +1594,8 @@ INST_FUNC(rst)
AT_NONE AT_NONE
) )
if (INST_TYPE(0) == AT_IMMEDIATE) { if (INST_TYPE(0) == AT_IMMEDIATE) {
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 0))
INST_RETURN(1, 0xC7)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 8))
INST_RETURN(1, 0xCF)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 16))
INST_RETURN(1, 0xD7)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 24))
INST_RETURN(1, 0xDF)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 32))
INST_RETURN(1, 0xE7)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 40))
INST_RETURN(1, 0xEF)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 48))
INST_RETURN(1, 0xF7)
if ((INST_IMM(0).mask & IMM_RST && INST_IMM(0).uval == 56))
INST_RETURN(1, 0xFF)
if (INST_IMM(0).mask & IMM_RST)
INST_RETURN(1, 0xC7 + INST_IMM(0).uval)
INST_ERROR(ARG_VALUE) INST_ERROR(ARG_VALUE)
} }
INST_ERROR(ARG_TYPE) INST_ERROR(ARG_TYPE)


+ 2
- 16
src/assembler/instructions.yml View File

@@ -581,22 +581,8 @@ rst:
cases: cases:
- type: [immediate] - type: [immediate]
cases: cases:
- if: [rst.0x00]
return: [0xC7]
- if: [rst.0x08]
return: [0xCF]
- if: [rst.0x10]
return: [0xD7]
- if: [rst.0x18]
return: [0xDF]
- if: [rst.0x20]
return: [0xE7]
- if: [rst.0x28]
return: [0xEF]
- if: [rst.0x30]
return: [0xF7]
- if: [rst.0x38]
return: [0xFF]
- if: [rst]
return: [rst(0xC7)]


sbc: sbc:
args: yes args: yes


Loading…
Cancel
Save