Fixed signed integer printing

This commit is contained in:
Kyler 2024-02-25 00:01:42 -07:00
parent 26ae9ab526
commit 53409c6f49
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ class tty(Device):
def __setitem__(self, index: int, value: int):
if index & 0xf == 0xd:
if value & 0x800:
print(((~(value & 0x7FF)) + 1) * -1)
print((((value & 0x7FF) ^ 0x7FF) + 1) * -1)
else:
print(value)
elif index & 0xf == 0xe:

View File

@ -11,7 +11,7 @@ def main(argv: Sequence[str] | None = None):
from time import sleep
machines = {
'tty': lambda rom: Computer(Memory(rom, [tty(0x7FE, 0x7FF)]))
'tty': lambda rom: Computer(Memory(rom, [tty(0x7FD, 0x7FF)]))
}
parser = argparse.ArgumentParser(

View File

@ -13,7 +13,7 @@ main:
loop:
; Output current value
liu 0x1f
lil 0x3E
lil 0x3D
str D0
; Move values down