Get it running again by default + displaying on meowbit screen
This commit is contained in:
parent
3fd770ab53
commit
6f164294e5
30
src/cpu.py
30
src/cpu.py
|
|
@ -55,6 +55,13 @@ class TwoDigitHexInput:
|
||||||
print(self.digits)
|
print(self.digits)
|
||||||
|
|
||||||
|
|
||||||
|
group = displayio.Group()
|
||||||
|
board.DISPLAY.root_group = group
|
||||||
|
text_area = label.Label(terminalio.FONT, text="")
|
||||||
|
text_area.x = 10
|
||||||
|
text_area.y = 10
|
||||||
|
group.append(text_area)
|
||||||
|
|
||||||
class CPU:
|
class CPU:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
@ -90,14 +97,11 @@ class CPU:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def print_monitor(self):
|
def print_monitor(self):
|
||||||
displayGroup = displayio.Group()
|
text1 = "IP " + str(self.IP) + " DATA " + str(self.memory[self.IP]) # + "ACC " + str(self.acc)
|
||||||
board.DISPLAY.root_group = displayGroup
|
print(text1)
|
||||||
|
text_area.text = text1
|
||||||
|
|
||||||
|
|
||||||
text = "IP " + str(self.IP) + "DATA " + str(self.memory[self.IP]) + "ACC " + str(self.acc)
|
|
||||||
text_area = label.Label(terminalio.FONT, text=text)
|
|
||||||
text_area.x = 10
|
|
||||||
text_area.y = 100
|
|
||||||
displayGroup.append(text_area)
|
|
||||||
|
|
||||||
|
|
||||||
def read_keys(self):
|
def read_keys(self):
|
||||||
|
|
@ -172,10 +176,10 @@ class CPU:
|
||||||
t = time.time()
|
t = time.time()
|
||||||
while (time.time() - t) < 30:
|
while (time.time() - t) < 30:
|
||||||
self.read_keys()
|
self.read_keys()
|
||||||
# self.print_monitor()
|
if self.running:
|
||||||
# if self.running:
|
self.step()
|
||||||
# self.step()
|
self.print_monitor()
|
||||||
# time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
print("timeout")
|
print("timeout")
|
||||||
print(self.memory)
|
print(self.memory)
|
||||||
|
|
||||||
|
|
@ -300,8 +304,8 @@ class CPU:
|
||||||
|
|
||||||
cpu = CPU()
|
cpu = CPU()
|
||||||
|
|
||||||
#prog = '04 FF 04 01 14 01 00 00'
|
prog = '04 FF 04 01 14 01 00 00'
|
||||||
prog = '00'
|
#prog = '00'
|
||||||
program_bytes = bytearray.fromhex(prog.replace(" ", ""))
|
program_bytes = bytearray.fromhex(prog.replace(" ", ""))
|
||||||
# Add jmp at addr 254:
|
# Add jmp at addr 254:
|
||||||
program_with_jump = program_bytes + bytearray(254 - len(program_bytes)) + bytearray.fromhex('0600')
|
program_with_jump = program_bytes + bytearray(254 - len(program_bytes)) + bytearray.fromhex('0600')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue