]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/z80/pd.py
Use consistent __init__() format across all PDs.
[libsigrokdecode.git] / decoders / z80 / pd.py
index 130b147de718711c737bf00c744a30f5836855c7..a8acf53c3aab2e327d544a7c4a765d7504db1afb 100644 (file)
@@ -56,7 +56,7 @@ ann_data_cycle_map = {
 
 def reduce_bus(bus):
     if 0xFF in bus:
-        return None # unassigned bus probes
+        return None # unassigned bus channels
     else:
         return reduce(lambda a, b: (a << 1) | b, reversed(bus))
 
@@ -64,40 +64,44 @@ def signed_byte(byte):
     return byte if byte < 128 else byte - 256
 
 class Decoder(srd.Decoder):
-    api_version = 1
+    api_version = 2
     id       = 'z80'
     name     = 'Z80'
     longname = 'Zilog Z80 CPU'
     desc     = 'Zilog Z80 microprocessor disassembly.'
-    license  = 'gplv2+'
+    license  = 'gplv3+'
     inputs   = ['logic']
     outputs  = ['z80']
-    probes = [
-        {'id': 'd%d' % i, 'name': 'D%d' % i, 'desc': 'Data bus line %d' % i}
-            for i in range(8)
-    ] + [
+    channels = tuple({
+            'id': 'd%d' % i,
+            'name': 'D%d' % i,
+            'desc': 'Data bus line %d' % i
+            } for i in range(8)
+    ) + (
         {'id': 'm1', 'name': '/M1', 'desc': 'Machine cycle 1'},
         {'id': 'rd', 'name': '/RD', 'desc': 'Memory or I/O read'},
         {'id': 'wr', 'name': '/WR', 'desc': 'Memory or I/O write'},
-    ]
-    optional_probes = [
+    )
+    optional_channels = (
         {'id': 'mreq', 'name': '/MREQ', 'desc': 'Memory request'},
         {'id': 'iorq', 'name': '/IORQ', 'desc': 'I/O request'},
-    ] + [
-        {'id': 'a%d' % i, 'name': 'A%d' % i, 'desc': 'Address bus line %d' % i}
-            for i in range(16)
-    ]
-    annotations = [
-        ['addr',  'Memory or I/O address'],
-        ['memrd', 'Byte read from memory'],
-        ['memwr', 'Byte written to memory'],
-        ['iord',  'Byte read from I/O port'],
-        ['iowr',  'Byte written to I/O port'],
-        ['instr', 'Z80 CPU instruction'],
-        ['rop',   'Value of input operand'],
-        ['wop',   'Value of output operand'],
-        ['warn',  'Warning message'],
-    ]
+    ) + tuple({
+        'id': 'a%d' % i,
+        'name': 'A%d' % i,
+        'desc': 'Address bus line %d' % i
+        } for i in range(16)
+    )
+    annotations = (
+        ('addr',  'Memory or I/O address'),
+        ('memrd', 'Byte read from memory'),
+        ('memwr', 'Byte written to memory'),
+        ('iord',  'Byte read from I/O port'),
+        ('iowr',  'Byte written to I/O port'),
+        ('instr', 'Z80 CPU instruction'),
+        ('rop',   'Value of input operand'),
+        ('wop',   'Value of output operand'),
+        ('warn',  'Warning message'),
+    )
     annotation_rows = (
         ('addrbus', 'Address bus', (Ann.ADDR,)),
         ('databus', 'Data bus', (Ann.MEMRD, Ann.MEMWR, Ann.IORD, Ann.IOWR)),
@@ -106,7 +110,7 @@ class Decoder(srd.Decoder):
         ('warnings', 'Warnings', (Ann.WARN,))
     )
 
-    def __init__(self, **kwargs):
+    def __init__(self):
         self.prev_cycle = Cycle.NONE
         self.op_state   = self.state_IDLE