Skip to content

Commit

Permalink
Add script to find addresses available for arbitrary read/write
Browse files Browse the repository at this point in the history
  • Loading branch information
mnaberez committed Aug 28, 2024
1 parent 806bd96 commit 3a03b09
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
#
# Print the range of accessible addresses around each address in the
# exposed_addresses table, then combine them to print all contiguous
# areas in memory that can be accessed.
#

# address words in the exposed_addresses table at 0xB190 in software23.asm
exposed_addresses = sorted(set([
0xB190,
0xB1B5,
0xAF70,
0xAF70,
0xFE30,
0xAF70,
0xFB56,
0xF225,
0xFE57,
0xF257,
0xFE43,
0xFBAC,
0xF1B3,
0xAF70,
0xF1B9,
0xFE4C,
0xFE44,
0xFC75,
]))

# find all accessible addresses around each exposed address
# and mark them as exposed in the 64K memory space
memory = [False] * 65536
for exposed_address in exposed_addresses:
lowest_address = exposed_address - 128
highest_address = exposed_address + 127

print("%04X: %04X - %04X" % (exposed_address, lowest_address, highest_address))

for address in range(lowest_address, highest_address+1, 1):
memory[address] = True # exposed
print()

# find all contiguous areas in memory that can be accessed
ranges = []
current_range = None
for address, exposed in enumerate(memory):
if exposed:
if current_range is None:
current_range = [address, address] # low, high
ranges.append(current_range)
else:
current_range[1] = address
else:
current_range = None

for r in ranges:
print("%04X - %04X" % (r[0], r[1]))

0 comments on commit 3a03b09

Please sign in to comment.