BEGIN {
}

{
        cnt++
        names[cnt] = $1
        colors[cnt] = $2
}

END {
        printf "; Autogenerated from colors.txt, do not edit this file!\n"
        printf "; gawk -f colors.gawk colors.txt > colors.asm\n\n"
        printf "colors dd "
        printf colors[1]
        for (i=2; i<=cnt; i++) {
                printf ", %s", colors[i]
        }

        printf "\n\n"

        printf "names dw "
        printf names[1]
        for (i=2; i<=cnt; i++) {
                printf ", %s", names[i]
        }

        printf "\n\n"

        for (i=1; i<=cnt; i++) {
                printf "%s db %d,'%s'\n", names[i], length(names[i]), names[i]
        }
}