Skip to content

Commit

Permalink
Corrigindo acesso a segunda memoria
Browse files Browse the repository at this point in the history
  • Loading branch information
JN513 committed Nov 27, 2024
1 parent 2b33aab commit 523f2c2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def print_data(self, data: int) -> None:
Args:
data (int): Data to be printed.
"""
data = data.to_bytes(4, 'big')

for byte in data:
print(f'{byte:02x}', end='')
print()
Expand Down Expand Up @@ -149,7 +147,7 @@ def write_memory(
self._send_command(0x57, address)
self.send_rawdata(value)

def read_memory(self, address: int, second_memory: bool = False) -> int:
def read_memory(self, address: int, second_memory: bool = False) -> bytes:
"""
Reads a value from the processor's memory.
Expand All @@ -162,10 +160,10 @@ def read_memory(self, address: int, second_memory: bool = False) -> int:
"""
address = address >> 2
if second_memory:
address = address | 0x80000000
address = address & 0xFFFFFF
address = address | 0x800000
self._send_command(0x4C, address)
data = self.read_data()
return int.from_bytes(data, 'big')
return self.read_data()

def load_msb_accumulator(self, value: int) -> None:
"""
Expand Down

0 comments on commit 523f2c2

Please sign in to comment.