1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-13 01:29:57 +00:00

Adjust C header generation to take CSV header into account.

This commit is contained in:
Radosław Kujawa 2017-01-20 23:23:25 +01:00
parent d2dc51cbd3
commit 1820418c62

View File

@ -7,14 +7,16 @@ BEGIN {
print "#include \"emulation.h\"" print "#include \"emulation.h\""
print "const struct instrdef instrs[] = {" print "const struct instrdef instrs[] = {"
opcode = 0
} }
{ /^OP_/{
printf "#define %s 0x%X\n", $1, NR-1 printf "#define %s 0x%X\n", $1, opcode
if (NR < 256) if (opcode < 0xFF)
printf "\t{ %s, %s, %s, %d, %s },\n", $1, $2, $3, $4, $5 printf "\t{ %s, %s, %s, %d, %s },\n", $1, $2, $3, $4, $5
else else
printf "\t{ %s, %s, %s, %d, %s }\n", $1, $2, $3, $4, $5 printf "\t{ %s, %s, %s, %d, %s }\n", $1, $2, $3, $4, $5
opcode++
} }