From 1820418c62b8bea0048637a691c5e70c8bc0c458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Fri, 20 Jan 2017 23:23:25 +0100 Subject: [PATCH] Adjust C header generation to take CSV header into account. --- src/65c02isa.awk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/65c02isa.awk b/src/65c02isa.awk index 8c71bd5..fdfb7c1 100755 --- a/src/65c02isa.awk +++ b/src/65c02isa.awk @@ -7,14 +7,16 @@ BEGIN { print "#include \"emulation.h\"" print "const struct instrdef instrs[] = {" + opcode = 0 } -{ - printf "#define %s 0x%X\n", $1, NR-1 - if (NR < 256) +/^OP_/{ + printf "#define %s 0x%X\n", $1, opcode + if (opcode < 0xFF) printf "\t{ %s, %s, %s, %d, %s },\n", $1, $2, $3, $4, $5 else printf "\t{ %s, %s, %s, %d, %s }\n", $1, $2, $3, $4, $5 + opcode++ }