Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wmvanvliet committed May 31, 2022
1 parent 69a26d0 commit af6fed6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ def error(msg):
for token in tokens:
instruction = token[0]

# The "db" pseudo-instruction places the parameter in memory
if instruction == 'db':
bin_output.append(token[1])
continue

# Get the opcode for the instruction and place it into the upper 4 bits
# of the memory.
bin_line = opcodes[instruction] << 4
if instruction == 'db':
# The "db" pseudo-instruction has no opcode.
bin_line = 0
else:
bin_line = opcodes[instruction.lower()] << 4

# If the instruction has a parameter, place it into the lower 4 bits of
# the memory.
Expand Down

0 comments on commit af6fed6

Please sign in to comment.