Skip to content

Commit

Permalink
[#37] Print some more pin levels.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Sep 28, 2021
1 parent b231657 commit 441f5ac
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/z80sim/z80sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def __load_defs(self):
self.__ngnd = self.__node_ids['vss']
self.__npwr = self.__node_ids['vcc']

self.__nm1 = self.__node_ids['~m1']
self.__nrd = self.__node_ids['~rd']
self.__nmreq = self.__node_ids['~mreq']

self.__load_transistors()

def __all_nodes(self):
Expand Down Expand Up @@ -297,6 +301,9 @@ def __read_bits(self, name, n=8):
res += (1 if self.__is_node_high(nn) else 0) << i
return res

def __read_abus(self):
return self.__read_bits('ab', 16)

def __read_a(self):
return self.__read_bits('reg_a')

Expand All @@ -311,10 +318,14 @@ def __read_pc(self):
# TODO
def do_something(self):
for _ in range(20):
print(f'{self.__read_pc():04x} '
f'{self.__read_a():02x} '
f'{self.__read_r():02x}')
self.__tick()
print(f'PC {self.__read_pc():04x}, '
f'A {self.__read_a():02x}, '
f'R, {self.__read_r():02x}, '
f'abus {self.__read_abus():04x}, '
f'~m1 {int(self.__is_node_high(self.__nm1))}, '
f'~rd {int(self.__is_node_high(self.__nrd))}, '
f'~mreq {int(self.__is_node_high(self.__nmreq))}')


def main():
Expand Down

0 comments on commit 441f5ac

Please sign in to comment.