Skip to content

Commit

Permalink
Bug fixes for PSHU and PULU.
Browse files Browse the repository at this point in the history
Update the workflow to use latest Python version.

Update actions to latest versions.

Try to get version names correct.
  • Loading branch information
craigthomas committed Jun 19, 2023
1 parent 6f58550 commit f1d6833
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Build Test Coverage
on: [push, pull_request]
jobs:
run:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
OS: ubuntu-latest
PYTHON: '3.6.8'
OS: ubuntu-20.04
PYTHON: '3.8.10'
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v4
with:
python-version: 3.6.8
python-version: 3.8.10
- name: Generate Report
run: |
pip install -r requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions cocoasm/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ class Instruction(NamedTuple):
Instruction(mnemonic="ORB", mode=Mode(imm=0xCA, imm_sz=2, dir=0xDA, dir_sz=2, ind=0xEA, ind_sz=2, ext=0xFA, ext_sz=3)),
Instruction(mnemonic="ORCC", mode=Mode(imm=0x1A, imm_sz=2)),
Instruction(mnemonic="PSHS", mode=Mode(imm=0x34, imm_sz=2), is_special=True),
Instruction(mnemonic="PSHU", mode=Mode(imm=0x36, imm_sz=2)),
Instruction(mnemonic="PSHU", mode=Mode(imm=0x36, imm_sz=2), is_special=True),
Instruction(mnemonic="PULS", mode=Mode(imm=0x35, imm_sz=2), is_special=True),
Instruction(mnemonic="PULU", mode=Mode(imm=0x37, imm_sz=2)),
Instruction(mnemonic="PULU", mode=Mode(imm=0x37, imm_sz=2), is_special=True),
Instruction(mnemonic="ROLA", mode=Mode(inh=0x49, inh_sz=1)),
Instruction(mnemonic="ROLB", mode=Mode(inh=0x59, inh_sz=1)),
Instruction(mnemonic="ROL", mode=Mode(dir=0x09, dir_sz=2, ind=0x69, ind_sz=2, ext=0x79, ext_sz=3)),
Expand Down
2 changes: 1 addition & 1 deletion cocoasm/operands.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def resolve_symbols(self, symbol_table):
def translate(self):
post_byte = 0x00

if self.instruction.mnemonic == "PSHS" or self.instruction.mnemonic == "PULS":
if self.instruction.mnemonic in ["PSHS", "PSHU", "PULS", "PULU"]:
if not self.operand_string:
raise OperandTypeError("one or more registers must be specified")

Expand Down
36 changes: 36 additions & 0 deletions test/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,42 @@ def test_multi_word_declaration(self):
program.translate_statements()
self.assertEqual([0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE], program.get_binary_array())

def test_pshu_regression(self):
statements = [
Statement(" PSHU A"),
]
program = Program()
program.statements = statements
program.translate_statements()
self.assertEquals([0x36, 0x02], program.get_binary_array())

def test_pshu_multi_regression(self):
statements = [
Statement(" PSHU A,B"),
]
program = Program()
program.statements = statements
program.translate_statements()
self.assertEquals([0x36, 0x06], program.get_binary_array())

def test_pulu_regression(self):
statements = [
Statement(" PULU A"),
]
program = Program()
program.statements = statements
program.translate_statements()
self.assertEquals([0x37, 0x02], program.get_binary_array())

def test_pulu_multi_regression(self):
statements = [
Statement(" PULU A,B"),
]
program = Program()
program.statements = statements
program.translate_statements()
self.assertEquals([0x37, 0x06], program.get_binary_array())

# M A I N #####################################################################


Expand Down

0 comments on commit f1d6833

Please sign in to comment.