changeset 1677:b1ad6339de4f

Old changes to OLP analyzer script for analyzing Z80 memory requests
author Michael Pavone <pavone@retrodev.com>
date Fri, 04 Jan 2019 19:13:47 -0800
parents 9c90c79953cc
children d377d6037dd9 5dacaef602a7
files analyze_olp.py
diffstat 1 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/analyze_olp.py	Fri Jan 04 19:13:23 2019 -0800
+++ b/analyze_olp.py	Fri Jan 04 19:13:47 2019 -0800
@@ -148,6 +148,30 @@
 						print 'refresh @ {0}'.format(num)
 						state = 'begin'
 			last = sample
+			
+def analyze_z80_mreq(chanmap, datafile):
+	m1 = chanmap['!M1']
+	mreq = chanmap['!MREQ']
+	addressMask = 0x3FF
+	last = None
+	lastWasM1 = False
+	for line in datafile.readlines():
+		line = line.strip()
+		if line and not line.startswith(';'):
+			sample,_,num = line.partition('@')
+			sample = int(sample, 16)
+			if not (last is None):
+				if detect_rise(last, sample, mreq):
+					address = last & addressMask
+					if detect_low(last, m1):
+						print 'M1 read {0:02X} @ {1}'.format(address, num)
+						lastWasM1 = True
+					elif lastWasM1:
+						print 'Refresh {0:02X} @ {1}'.format(address, num)
+						lastWasM1 = False
+					else:
+						print 'Access {0:02X} @ {1}'.format(address, num)
+			last = sample
 
 def main(args):
 	if len(args) < 2:
@@ -163,10 +187,11 @@
 		chanmap[channels[i]] = i
 	datafile = olpfile.open('data.ols')
 	#analyze_delays(chanmap, datafile)
-	analyze_vram(chanmap, datafile)
+	#analyze_vram(chanmap, datafile)
+	#analyze_refresh(chanmap, datafile)
+	analyze_z80_mreq(chanmap, datafile)
 	datafile.close()
-	#datafile = olpfile.open('data.ols')
-	#analyze_refresh(chanmap, datafile)
+	
 
 if __name__ == '__main__':
 	main(argv)