mirror of
https://github.com/rzzzwilson/pymlac.git
synced 2025-06-10 09:32:41 +00:00
Got save asm/project working
This commit is contained in:
@@ -40,7 +40,8 @@ def doblockloader(f, word, mymem):
|
||||
mymem.add(ldaddr, word)
|
||||
while numwords > 0:
|
||||
word = readword(f)
|
||||
mymem.add(ldaddr, word)
|
||||
#JUST SKIP OVER, DON'T PUT INTO MEMORY
|
||||
# mymem.add(ldaddr, word)
|
||||
ldaddr += 1
|
||||
numwords = numwords - 1
|
||||
|
||||
@@ -92,26 +93,19 @@ def dobody(f, mymem):
|
||||
while True:
|
||||
# negative load address is end-of-file
|
||||
ldaddr = readword(f)
|
||||
print('read: ldaddr=%06o' % ldaddr)
|
||||
print('ldaddr=%s' % str(ldaddr))
|
||||
if ldaddr & 0x8000:
|
||||
print('End load: ldaddr=%06o' % ldaddr)
|
||||
break
|
||||
|
||||
# read data block, calculating checksum
|
||||
csum = ldaddr # start checksum with base address
|
||||
print('BLOCK: ldaddr=%06o, csum=%06o' % (ldaddr, csum))
|
||||
count = pyword(readword(f))
|
||||
neg_count = pyword(count)
|
||||
csum = (csum + count) & 0xffff # add neg word count
|
||||
print(' neg_count=%06o, csum=%06o' % (neg_count&0xffff, csum))
|
||||
csum_word = readword(f)
|
||||
csum = (csum + csum_word) & 0xffff # add checksum word
|
||||
print(' csum_word=%06o, csum=%06o' % (csum_word, csum))
|
||||
while neg_count < 0:
|
||||
word = readword(f)
|
||||
csum = (csum + word) & 0xffff
|
||||
print(' word=%06o, csum=%06o' % (word, csum))
|
||||
mymem.add(ldaddr, word)
|
||||
(op, fld) = disasmdata.disasmdata(word)
|
||||
mymem.putOp(ldaddr, op)
|
||||
@@ -120,8 +114,6 @@ def dobody(f, mymem):
|
||||
neg_count += 1
|
||||
csum &= 0xffff
|
||||
if csum != 0:
|
||||
#wx.MessageBox('Checksum error', 'Error', wx.OK | wx.ICON_ERROR)
|
||||
print('Checksum error, csum=%06o, expected 0' % csum)
|
||||
wx.MessageBox('Checksum error, got %06o, expected 0' % csum, 'Warning', wx.OK | wx.ICON_WARNING)
|
||||
|
||||
# check for real start address
|
||||
|
||||
23
idasm/idasm
23
idasm/idasm
@@ -431,7 +431,7 @@ class MyFrame(wx.Frame):
|
||||
wildcard=projwildcard,
|
||||
style=wx.OPEN | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
filename = dlg.GetPaths()[0]
|
||||
filename = dlg.GetPath()
|
||||
self.grid.ClearGrid()
|
||||
mem = loadProject(filename)
|
||||
fillGrid(self.grid, mem)
|
||||
@@ -453,7 +453,7 @@ class MyFrame(wx.Frame):
|
||||
wildcard=projwildcard,
|
||||
style=wx.SAVE | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
filename = dlg.GetPaths()[0]
|
||||
filename = dlg.GetPath()
|
||||
if not filename.endswith(DEFPROJSUFFIX):
|
||||
filename = filename + DEFPROJSUFFIX
|
||||
projectName = os.path.basename(filename)
|
||||
@@ -464,13 +464,14 @@ class MyFrame(wx.Frame):
|
||||
|
||||
def Menu102(self, event):
|
||||
global mem, projectName
|
||||
|
||||
dlg = wx.FileDialog(self,
|
||||
message="Choose a project file to save as",
|
||||
defaultDir=os.getcwd(), defaultFile="",
|
||||
message='Choose a project file to save as',
|
||||
defaultDir='.', defaultFile='',
|
||||
wildcard=projwildcard,
|
||||
style=wx.SAVE | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
filename = dlg.GetPaths()[0]
|
||||
filename = dlg.GetPath()
|
||||
saveProject(filename)
|
||||
projectName = os.path.basename(filename)
|
||||
if projectName.endswith(DEFPROJSUFFIX):
|
||||
@@ -479,13 +480,14 @@ class MyFrame(wx.Frame):
|
||||
|
||||
def Menu103(self, event):
|
||||
global grid, mem, projectName
|
||||
|
||||
filename = None
|
||||
dlg = wx.FileDialog(self, message="Choose an IMLAC object file to load",
|
||||
defaultDir=os.getcwd(), defaultFile="",
|
||||
wildcard=objwildcard,
|
||||
style=wx.OPEN | wx.CHANGE_DIR)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
filename = dlg.GetPaths()[0]
|
||||
filename = dlg.GetPath()
|
||||
self.grid.ClearGrid()
|
||||
result = binimport.ptpimport(filename)
|
||||
if result is not None:
|
||||
@@ -497,9 +499,9 @@ class MyFrame(wx.Frame):
|
||||
self.enableSaveWrite(True)
|
||||
mem.clearUndo()
|
||||
self.enableUndo(False)
|
||||
if start is not None:
|
||||
if start:
|
||||
# mark start address as MAIN instructions
|
||||
self.do_main_start(start)
|
||||
self.do_main_start(start & 077777)
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
@@ -512,9 +514,10 @@ class MyFrame(wx.Frame):
|
||||
defaultFile=projectName + DEFASMSUFFIX,
|
||||
wildcard=objwildcard,
|
||||
style=wx.SAVE | wx.CHANGE_DIR)
|
||||
|
||||
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
print('dlg.GetPaths()=%s' % str(dlg.GetPaths()))
|
||||
filename = dlg.GetPaths()[0]
|
||||
filename = dlg.GetPath()
|
||||
writeASM(filename)
|
||||
projectName = os.path.basename(filename)
|
||||
if projectName.endswith(DEFASMSUFFIX):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; a test comment on the first line
|
||||
org 0100
|
||||
|
||||
start law 10
|
||||
start law fred
|
||||
lac *start2 ; comment
|
||||
lac .-2
|
||||
hlt
|
||||
@@ -19,4 +19,4 @@ offset data start - 3
|
||||
tom bss 4
|
||||
end hlt
|
||||
|
||||
end
|
||||
end start
|
||||
|
||||
Reference in New Issue
Block a user