annotate fteeprom/ftee-mkblank.c @ 85:b57cf64ece29

fc-simtool project started
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 Jan 2021 00:32:10 +0000
parents e5d89313bc00
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
46
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <stdio.h>
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <stdlib.h>
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <string.h>
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include <strings.h>
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 main(argc, argv)
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 char **argv;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 {
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 unsigned size;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 unsigned n, col;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 if (argc == 1)
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 size = 64;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 else if (argc == 2 && !strcmp(argv[1], "-b"))
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 size = 128;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 else if (argc == 2 && !strcmp(argv[1], "-B"))
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 size = 256;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 else {
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 fprintf(stderr, "usage: %s [-b|-B]\n", argv[0]);
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 exit(1);
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 for (n = 0; n < size; n++) {
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 col = n & 7;
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if (col == 0)
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 printf("%02X:", n * 2);
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 printf(" %04X", 0xFFFF);
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (col == 7)
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 putchar('\n');
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 exit(0);
e5d89313bc00 ftee-mkblank written to replace fteeprom-prog -e
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 }