diff --git a/README.md b/README.md index 857bab0..c206158 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ specifications, as well as pseudo operations. | Mnemonic | Opcode | Operands | Description | |------------|--------|:--------:|-------------------------------------------------------| +| `SCRU` | `00Dn` | 1 | Scrolls the current bitplane up `n` pixels | | `SAVESUB` | `5st2` | 2 | Saves subset of registers from `s` to `t` in memory | | `LOADSUB` | `5st3` | 2 | Loads subset of registers from `s` to `t` from memory | | `AUDIO` | `F002` | 0 | Load 16-byte audio pattern buffer from `index` | diff --git a/chip8asm/statement.py b/chip8asm/statement.py index 2154d8b..152932b 100644 --- a/chip8asm/statement.py +++ b/chip8asm/statement.py @@ -70,6 +70,7 @@ Operation(op="Fs75", operands=1, source=1, target=0, numeric=0, mnemonic="SRPL"), Operation(op="Fs85", operands=1, source=1, target=0, numeric=0, mnemonic="LRPL"), # XO Chip Instructions + Operation(op="00Dn", operands=1, source=0, target=0, numeric=1, mnemonic="SCRU"), Operation(op="5st2", operands=2, source=1, target=1, numeric=0, mnemonic="SAVESUB"), Operation(op="5st3", operands=2, source=1, target=1, numeric=0, mnemonic="LOADSUB"), Operation(op="F002", operands=0, source=0, target=0, numeric=0, mnemonic="AUDIO"), diff --git a/test/test_integration.py b/test/test_integration.py index 129c1fc..7467562 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -79,4 +79,13 @@ def test_loadsub_mnemonic_translate_correct(self): machine_code = program.generate_machine_code() self.assertEqual([0x51, 0x63], machine_code) + def test_scrollup_mnemonic_translate_correct(self): + program = Program() + statement = Statement() + statement.parse_line(" SCRU 5 ; scroll up statement") + program.statements.append(statement) + program = self.translate_statements(program) + machine_code = program.generate_machine_code() + self.assertEqual([0x00, 0xD5], machine_code) + # E N D O F F I L E #######################################################