mirror of
https://github.com/KrisKennaway/ii-vision.git
synced 2024-12-22 12:29:31 +00:00
90f696b8e4
simulating the W5100). This will hopefully be useful for troubleshooting and testing player behaviour more precisely, e.g. - trapping read/write access to unexpected memory areas - asserting invariants on the processor state across loops - measuring cycle timing - tracing program execution This already gets as far as negotiating the TCP connect. The major remaining piece seems to be the TCP buffer management on the W5100 side.
52 lines
1.1 KiB
Python
52 lines
1.1 KiB
Python
import subprocess
|
|
import sys
|
|
|
|
|
|
import apple2
|
|
import uthernet
|
|
|
|
def main():
|
|
stream = open("out.bin", "rb").read()
|
|
uth = uthernet.Uthernet(stream)
|
|
a2 = apple2.AppleII(uth)
|
|
|
|
# Read in Apple IIE ROM image
|
|
rom = open("simulator/APPLE2E.ROM", "rb").read()
|
|
|
|
# TODO: other slot ROMs; alternate Cx ROMs
|
|
|
|
# Slot 6 ROM
|
|
a2.memory.write(0xc600, rom[0x0600:0x6ff])
|
|
|
|
# Main ROM
|
|
a2.memory.write(0xd000, rom[0x5000:0x7fff])
|
|
|
|
# Load video player
|
|
|
|
# Extract ethernet.bin from disk image
|
|
cmd = "java -jar ethernet/ethernet/make/AppleCommander.jar -g " \
|
|
"ethernet/ethernet/ethernet.dsk ethernet " \
|
|
"ethernet/ethernet/ethernet.bin"
|
|
p = subprocess.run(cmd.split())
|
|
if p.returncode:
|
|
sys.exit(1)
|
|
|
|
load_addr = 0x8000
|
|
with open("ethernet/ethernet/ethernet.bin", "rb") as f:
|
|
code = f.read()
|
|
a2.memory.write(load_addr, code)
|
|
|
|
# COUT vector
|
|
a2.memory[0x36] = 0xf0
|
|
a2.memory[0x37] = 0xfd
|
|
|
|
a2.memory_manager.enable()
|
|
|
|
# TODO: why does this not use the 6502 reset vector?
|
|
a2.cpu.reset()
|
|
|
|
a2.Run(load_addr, trace=True)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|