Index: misc/gen-x.py
===================================================================
--- misc/gen-x.py	(revision 526a9931ecf963fd88914bbf92cee82eb60a80bd)
+++ misc/gen-x.py	(revision 4a17aeb071c8dfe3aaa4c73be9382677986d0ef8)
@@ -3,4 +3,5 @@
 from sys import stdout
 from pycparser import c_ast, parse_file, c_generator
+from re import escape, subn, search
 
 cross_gcc = "/opt/cross-m68k/bin/m68k-none-elf-gcc"
@@ -77,4 +78,39 @@
     def get_typs(self):
         return self.typs
+
+def fix(text, path):
+    with open(path, "r") as f:
+        cont = f.read()
+
+    (pat, n) = subn(r"\[[0-9]+\]", "[@]", text[7:])
+
+    if n == 0:
+        return text
+
+    rex = escape(pat). \
+         replace("\@", "([0-9A-Z_]+)"). \
+         replace("\ ", "[\t\n ]+")
+
+    m = search(rex, cont)
+
+    if not m:
+        raise Exception("error while matching {}".format(re))
+
+    pats = pat.split("@")
+    vals = m.groups()
+
+    if len(pats) != len(vals) + 1:
+        raise Exception("length mismatch: {} vs. {}". \
+                        format(len(pats), len(vals)))
+
+    out = pats[0]
+    pats = pats[1:]
+
+    while len(pats) > 0:
+        out += vals[0] + pats[0]
+        vals = vals[1:]
+        pats = pats[1:]
+
+    return "extern " + out
 
 gen = c_generator.CGenerator()
@@ -130,5 +166,8 @@
             decl.init = None
 
-            toks = gen.visit(decl).split(" ")
+            text = gen.visit(decl)
+            text = fix(text, decl.coord.file)
+
+            toks = text.split(" ")
             alig = ""
 
Index: misc/proto.x
===================================================================
--- misc/proto.x	(revision 526a9931ecf963fd88914bbf92cee82eb60a80bd)
+++ misc/proto.x	(revision 4a17aeb071c8dfe3aaa4c73be9382677986d0ef8)
@@ -11,4 +11,5 @@
 #include "slice.h"
 #include "stdint.h"
+#include "timers.h"
 #include "vsdd.h"
 
@@ -42,5 +43,5 @@
 extern	void		(*pulse1)(void);
 extern	void		(*pulse2)(void);
-extern	int16_t		timers[8];
+extern	int16_t		timers[NTIMERS];
 extern	int32_t		uldivr;
 extern	uint16_t	vi_sadr;
