Added block of 6502 code that must be in CF image

This commit is contained in:
Bobbi Webber-Manners 2021-03-17 17:18:47 -04:00
parent 5ac8e3b84c
commit 50d57e2fb0
1 changed files with 44 additions and 5 deletions

49
mdttool
View File

@ -29,6 +29,43 @@ parttab['len2'] = list()
blocksz = 512
# This is 6502 code that must be present in the disk image from offset 0x0200 to 0x03ff
code_200 = [
0x8e, 0x00, 0x82, 0x86, 0x43, 0x8a, 0x4a, 0x4a, 0x4a, 0x4a, 0x09, 0xc0, 0x85, 0x01, 0x8d, 0x81,
0x80, 0xa0, 0x00, 0x84, 0x00, 0x84, 0x02, 0xa0, 0xff, 0xb1, 0x00, 0x8d, 0x80, 0x80, 0xa0, 0xf2,
0xb1, 0x00, 0xc9, 0xc9, 0xd0, 0x38, 0xc8, 0xb1, 0x00, 0xc9, 0xc4, 0xd0, 0x31, 0xc8, 0xb1, 0x00,
0xc9, 0xc5, 0xf0, 0x16, 0xc9, 0xc4, 0xf0, 0x0e, 0x85, 0x02, 0xc9, 0xd2, 0xf0, 0x0c, 0xc9, 0xd5,
0xf0, 0x04, 0xc9, 0xd4, 0xd0, 0x18, 0xa9, 0x02, 0xd0, 0x02, 0xa9, 0x00, 0x8d, 0x02, 0x82, 0xa0,
0xf9, 0xb1, 0x00, 0xc9, 0xca, 0xd0, 0x07, 0xc8, 0xb1, 0x00, 0xc9, 0xcc, 0xf0, 0x0a, 0x20, 0x58,
0xfc, 0x20, 0x39, 0xfb, 0xa0, 0x08, 0xd0, 0x2e, 0x20, 0x5c, 0x81, 0xa0, 0x00, 0x84, 0x46, 0x84,
0x47, 0x84, 0x44, 0xc8, 0x84, 0x42, 0xa9, 0x08, 0x85, 0x45, 0xad, 0x00, 0x82, 0x85, 0x43, 0x20,
0xff, 0xff, 0xb0, 0x0d, 0xad, 0x00, 0x08, 0xc9, 0x01, 0xd0, 0x06, 0xae, 0x00, 0x82, 0x4c, 0x01,
0x08, 0x20, 0x58, 0xfc, 0xa0, 0x06, 0x20, 0x36, 0x81,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xa2, 0x00,
0xb1, 0x00, 0xf0, 0x07, 0x9d, 0xff, 0xff, 0xc8, 0xe8, 0xd0, 0xf5, 0x60, 0xac, 0x02, 0x82, 0x20,
0x36, 0x81, 0xa0, 0x04, 0x20, 0x36, 0x81, 0xa5, 0x02, 0xf0, 0xf0, 0xac, 0x1a, 0xc8, 0xc0, 0x02,
0x90, 0x11, 0xa5, 0x02, 0xf0, 0x0d, 0xb9, 0xec, 0x81, 0x48, 0xa0, 0x0a, 0x20, 0x36, 0x81, 0x68,
0x8d, 0xe3, 0x07, 0xad, 0x61, 0xc0, 0x0d, 0x62, 0xc0, 0x10, 0xd0, 0xa5, 0x02, 0xf0, 0xf4, 0xad,
0x00, 0xc0, 0x10, 0xef, 0xc9, 0xba, 0x90, 0x02, 0x29, 0xdf, 0xac, 0x10, 0xc0, 0xac, 0x1a, 0xc8,
0xd9, 0xec, 0x81, 0xf0, 0x05, 0x88, 0xd0, 0xf8, 0xf0, 0xd9, 0x88, 0xf0, 0xae, 0x98, 0x0a, 0x0a,
0xa8, 0x8c, 0x01, 0x82, 0xa2, 0x00, 0xb9, 0x80, 0xc8, 0x48, 0xbd, 0x80, 0xc8, 0x85, 0x1e, 0x68,
0x9d, 0x80, 0xc8, 0xa5, 0x1e, 0x99, 0x80, 0xc8, 0xc8, 0xe8, 0xe0, 0x04, 0x90, 0xe8, 0xac, 0x01,
0x82, 0xa2, 0x00, 0xb9, 0x40, 0xc8, 0x48, 0xbd, 0x40, 0xc8, 0x85, 0x1e, 0x68, 0x9d, 0x40, 0xc8,
0xa5, 0x1e, 0x99, 0x40, 0xc8, 0xc8, 0xe8, 0xe0, 0x04, 0x90, 0xe8, 0x60, 0xb0, 0xb1, 0xb2, 0xb3,
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0x00, 0x00, 0x00
]
# Write val as a 16 bit integer into array data[], starting at index start
def write16(data, start, val):
data[start] = val & 0x00ff
@ -95,7 +132,7 @@ def print_part_tbl():
# Write partition table in parttab to file f
# Writes 256 blocks (ie 128K)
def write_part_tbl(f):
magic = 0xcacc
magic = 0xccac
if ((parttab['cyls'] == -1)
or (parttab['heads'] == -1)
or (parttab['sectors'] == -1)
@ -119,12 +156,14 @@ def write_part_tbl(f):
for i in range(parttab['numparts2']):
write32(b, 0x80 + i * 4, parttab['start2'][i])
write32(b, 0xa0 + i * 4, parttab['len2'][i])
block = bytes(b)
with open(f, 'wb') as outfile:
block = bytes(b)
outfile.write(block)
blanks = bytes([0] * blocksz)
for i in range(255):
outfile.write(blanks)
block = bytes(code_200)
outfile.write(block)
block = bytes([0] * blocksz)
for i in range(254):
outfile.write(block)
# Extract partition n from file f and write it to outputfile
def extract_partition(f, n, outputfile):