Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cocas/assembler/targets/cdm16/target_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ def special(line: InstructionNode, temp_storage: dict, _):
arg = line.arguments[0]
if len(arg.add_terms) != 0 or len(arg.sub_terms) != 0:
raise CdmTempException('Const number expected')
if arg.const_term < 0:
raise CdmTempException('Interrupt number must be not negative')
return [InstructionBytesSegment(pack("u3u4s9", 0b100, 0, arg.const_term), line.location)]
if not 0 <= arg.const_term < 512:
raise CdmTempException('Interrupt number out of range')
return [InstructionBytesSegment(pack("u3u4u9", 0b100, 0, arg.const_term), line.location)]
elif line.mnemonic == 'reset':
if len(line.arguments) == 0:
arg = RelocatableExpressionNode(None, [], [], 0)
Expand All @@ -348,9 +348,9 @@ def special(line: InstructionNode, temp_storage: dict, _):
raise CdmTempException(f'Expected 0 or 1 arguments, found {len(line.arguments)}')
if len(arg.add_terms) != 0 or len(arg.sub_terms) != 0:
raise CdmTempException('Const number expected')
if arg.const_term < 0:
raise CdmTempException('Vector number must be not negative')
return [InstructionBytesSegment(pack("u3u4s9", 0b100, 1, arg.const_term), line.location)]
if not 0 <= arg.const_term < 512:
raise CdmTempException('Vector number out of range')
return [InstructionBytesSegment(pack("u3u4u9", 0b100, 1, arg.const_term), line.location)]
elif line.mnemonic == 'addsp':
assert_count_args(line.arguments, Union[RelocatableExpressionNode, RegisterNode])
if isinstance(line.arguments[0], RelocatableExpressionNode):
Expand Down
Loading