-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathamigaXfer.py
executable file
·150 lines (150 loc) · 5.34 KB
/
amigaXfer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/env python3
import wx
import wx.adv
from SetupDialog import SetupDialog
from MenuFrame import MenuFrame
from FloppyFrame import FloppyFrame
from BootblockFrame import BootblockFrame
from DosFrame import DosFrame
from RomFrame import RomFrame
class AmigaXfer(wx.App):
def __init__(self):
super().__init__(redirect=False)
self.floppyframe = None
self.bootblockframe = None
self.dosframe = None
self.romframe = None
return
def OnInit(self):
self.debugger = None
self.version = "1.1.3-dev"
self.toolmenu = MenuFrame(self.MenuDone, self.version)
self.setupframe = SetupDialog(self.SetupDialogDone, self.version)
self.setupframe.Show()
return True
def ShowAboutDialog(self):
info = wx.adv.AboutDialogInfo()
info.SetName("amigaXfer")
info.SetVersion(self.version)
info.SetDescription("Data transfer and tools for an Amiga on the serial port.")
info.SetCopyright("(C) 2021, 2022 Roc Vallès i Domènech")
wx.adv.AboutBox(info)
return
def SetupDialogDone(self, ser, amiga, execlib, snip, resetfirst, crashentry, regs):
self.setupframe.Hide()
self.ser = ser
self.amiga = amiga
self.execlib = execlib
self.snip = snip
self.resetfirst = resetfirst
self.crashentry = crashentry
self.savedregs = regs
wx.CallAfter(self.menutool)
return
def FloppyToolDone(self):
self.floppyframe.Hide()
wx.CallAfter(self.menutool)
return
def BootblockToolDone(self):
self.bootblockframe.Hide()
wx.CallAfter(self.menutool)
return
def DosToolDone(self):
self.dosframe.Hide()
wx.CallAfter(self.menutool)
return
def RomToolDone(self):
self.romframe.Hide()
wx.CallAfter(self.menutool)
return
def MenuDone(self, choice):
self.toolmenu.Hide()
if choice == "exitresume":
print(f"Exit method: {choice}.")
print("Freeing snippets.")
self.snip.freeall()
print("Restoring non-scratch registers.")
self.amiga.setregs(self.savedregs)
print("Enable.")
self.execlib.Enable()
if self.amiga.debugger == "SAD":
self.execlib.exitdebugloop()
self.amiga.setreg("d0", 0)
self.amiga.resume()
wx.Exit()
elif choice == "exitreset":
print(f"Exit method: {choice}.")
self.amiga.reboot()
wx.Exit()
elif choice == "exithardreset":
print(f"Exit method: {choice}.")
self.amiga.poke32(self.execlib.base+self.execlib.ColdCapture, 0)
self.amiga.poke32(self.execlib.base+self.execlib.WarmCapture, 0xFFFFFFFF)
self.amiga.reboot()
wx.Exit()
elif choice == "exitdebug":
print(f"Exit method: {choice}.")
print("Freeing snippets.")
self.snip.freeall()
print("Restoring non-scratch registers.")
self.amiga.setregs(self.savedregs)
self.amiga.setreg("d0", 0)
print("Enable.")
self.execlib.Enable()
if self.amiga.debugger == "SAD":
self.execlib.exitdebugloop()
wx.Exit()
elif choice == "floppytool":
print(f"Tool selected: {choice}.")
wx.CallAfter(self.floppytool)
elif choice == "bootblocktool":
print(f"Tool selected: {choice}.")
wx.CallAfter(self.bootblocktool)
elif choice == "dostool":
print(f"Tool selected: {choice}.")
wx.CallAfter(self.dostool)
elif choice == "romtool":
print(f"Tool selected: {choice}.")
wx.CallAfter(self.romtool)
else:
print(f"Choice {choice} isn't implemented.")
return
def menutool(self):
self.toolmenu.Show()
print(f"Main Menu. Version: {self.version}, resetfirst: {self.resetfirst}.")
wx.CallAfter(self.toolmenu.MenuSetup, self.execlib.is_process(), self.resetfirst)
return
def floppytool(self):
if not self.floppyframe:
self.floppyframe = FloppyFrame()
self.floppyframe.Show()
wx.CallAfter(self.floppyframe.XferSetup, self.FloppyToolDone, self.ser, self.amiga, self.execlib, self.snip)
return
def bootblocktool(self):
if not self.bootblockframe:
self.bootblockframe = BootblockFrame()
self.bootblockframe.Show()
wx.CallAfter(self.bootblockframe.BootblockSetup, self.BootblockToolDone, self.ser, self.amiga, self.execlib, self.snip)
return
def dostool(self):
if not self.dosframe:
self.dosframe = DosFrame()
self.dosframe.Show()
wx.CallAfter(self.dosframe.DosSetup, self.DosToolDone, self.ser, self.amiga, self.execlib, self.snip)
return
def romtool(self):
if not self.romframe:
self.romframe = RomFrame()
self.romframe.Show()
wx.CallAfter(self.romframe.RomSetup, self.RomToolDone, self.ser, self.amiga, self.execlib, self.snip)
return
def UglyExit(self):
wx.Exit()
return
def main():
app = AmigaXfer()
app.SetExitOnFrameDelete(False)
app.MainLoop()
return
if __name__ == "__main__":
main()