text stringlengths 1 93.6k |
|---|
self.m_drive.EnableItem(i, i < self.drives)
|
return
|
def UpdateStatus(self, status):
|
self.m_status.ChangeValue(status)
|
return
|
def UpdateProgressValue(self, value):
|
self.m_progress.SetValue(value)
|
return
|
def UpdateProgressRange(self, value):
|
self.m_progress.SetRange(value)
|
return
|
def UpdateProgressPulse(self):
|
self.m_progress.Pulse()
|
return
|
def UpdateProgressDone(self):
|
maxval = self.m_progress.GetRange()
|
self.m_progress.SetValue(maxval)
|
return
|
def UpdateTrack(self, cyl, side, status):
|
self.m_status.ChangeValue(status)
|
self.m_cyl.ChangeValue(f'{cyl:02}')
|
self.m_side.ChangeValue(str(side))
|
return
|
def UpdateCrc(self, crc):
|
self.m_crc.ChangeValue(f'{crc:08x}')
|
return
|
def XferSetup(self, endcallback, ser, amiga, execlib, snip):
|
self.Bind(wx.EVT_CLOSE, self.onCloseSetup)
|
self.endcallback = endcallback
|
self.ser = ser
|
self.amiga = amiga
|
self.execlib = execlib
|
self.snip = snip
|
self.wantclose = False
|
self.timer = wx.Timer(self)
|
self.Bind(wx.EVT_TIMER, self.onTimer, self.timer)
|
self.Enablement(False)
|
self.m_status.ChangeValue(u'Setup')
|
threading.Thread(target=self.XferSetupWorker).start()
|
return
|
def XferSetupWorker(self):
|
wx.CallAfter(self.UpdateProgressValue, 0)
|
wx.CallAfter(self.UpdateStatus, "Buffer")
|
self.trackbuffer = self._getbuffer(self.tracksize)
|
self.drives = self._initdrives(self.drives)
|
if self.drives == 0:
|
print("Couldn't open DF0. Aborting.")
|
wx.CallAfter(self.UpdateStatus, "NoDrives")
|
wx.CallAfter(self.CleanUp)
|
return
|
wx.CallAfter(self.UpdateStatus, "DOSInhibit")
|
if self.execlib.is_process():
|
dosname = self.snip.getaddrstr("dos.library")
|
self.dosbase = self.execlib.OldOpenLibrary(dosname)
|
else:
|
print("DOSInhibit skipped, as current task is not a process.")
|
self.dosbase = None
|
if self.dosbase:
|
self.doslib = DosLibrary(debugger=self.amiga, base=self.dosbase)
|
self.dosutil = DosUtils(debugger=self.amiga, execlib=self.execlib, doslib=self.doslib, snippets=self.snip)
|
for drive in range(0, self.drives):
|
if not self.dosutil.inhibit(f"DF{drive}:", self.doslib.DOSTRUE):
|
self.drives = drive
|
break
|
wx.CallAfter(self.UpdateStatus, "Call")
|
self.fxio = FloppyXferIO(self.snip) #from here, floppyxfer is running exclusively.
|
wx.CallAfter(self.UpdateStatus, "Test")
|
self.fxio.setbuffer(self.trackbuffer)
|
testdata = b"123456789"
|
self.fxio.setlength(len(testdata))
|
self.fxio.setusr(self.snip.amigacrc)
|
self.fxio.sendbuffer(testdata)
|
amigacrc = self.fxio.callusr()
|
wx.CallAfter(self.UpdateCrc, amigacrc)
|
if amigacrc != self.snip.keysum(testdata):
|
print("CRC Test Failed.")
|
wx.CallAfter(self.UpdateStatus, "TestFail")
|
wx.CallAfter(self.CleanUp)
|
return
|
print("CRC Test Successful.")
|
self.fxio.setlength(self.tracksize)
|
wx.CallAfter(self.XferSetupDone)
|
return
|
def XferSetupDone(self):
|
wx.CallAfter(self.UpdateStatus, "Ready.")
|
wx.CallAfter(self.Enablement, True)
|
self.Unbind(wx.EVT_CLOSE, handler=self.onCloseSetup)
|
self.Bind(wx.EVT_CLOSE, self.onClose)
|
return
|
def _getbuffer(self, size):
|
if self.execlib.version >= 36:
|
bufaddr = self.execlib.AllocMem(size, self.execlib.MEMF_PUBLIC)
|
else:
|
bufaddr = self.execlib.AllocMem(size, self.execlib.MEMF_CHIP | self.execlib.MEMF_PUBLIC)
|
print(f'Allocated {hex(size)} bytes buffer @ {hex(bufaddr)}')
|
return bufaddr
|
def getioreq(self, unit):
|
(ioreq, msgport) = self._ioreq[unit]
|
return ioreq
|
def _getioreq(self, devname, unit):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.