Fix wait source encoding

Change the wait instruction encoding to shift the source by 5 bits instead of 4.
This commit is contained in:
ryang14 2021-01-25 20:44:49 -05:00 committed by GitHub
parent 25618d8385
commit e4f2740f40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,7 +96,7 @@ def assemble(text_program):
if not 0 <= polarity <= 1:
raise RuntimeError("Invalid polarity")
assembled[-1] |= polarity << 7
assembled[-1] |= WAIT_SOURCES.index(instruction[2]) << 4
assembled[-1] |= WAIT_SOURCES.index(instruction[2]) << 5
num = int(instruction[3])
if not 0 <= num <= 31:
raise RuntimeError("Wait num out of range")