summaryrefslogtreecommitdiff
path: root/src/satmkboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/satmkboot.c')
-rw-r--r--src/satmkboot.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/satmkboot.c b/src/satmkboot.c
index a3e4d7e..b86a769 100644
--- a/src/satmkboot.c
+++ b/src/satmkboot.c
@@ -28,14 +28,12 @@ static char *ipfile, *outfile;
static void serialize_region_code(char *out, const struct symbolname *region)
{
- size_t namelen = strlen(region->name);
- char *tmp = out;
- char *end = out+32;
-
- memcpy(tmp, "\xa0\x0e\x00\x09" "For ", 8); tmp += 8;
- memcpy(tmp, region->name, namelen); tmp += namelen;
- *tmp++ = '.';
- memset(tmp, ' ', end - tmp);
+ static const char defcode[32] = "\xa0\x0e\x00\x09" "For ";
+ size_t namelen = region ? strlen(region->name) : 0;
+
+ memcpy(out, defcode, sizeof defcode);
+ if (namelen) memcpy(out+8, region->name, namelen);
+ out[8+namelen] = '.';
}
#define WRITE(f,p,s) fwrite(p,s,1,f)
@@ -304,13 +302,10 @@ int main(int argc, char **argv)
if (sysid.regions[0] == ' ') strcpy(sysid.regions, "JTUBKAEL");
if (sysid.peripherals[0] == ' ') sysid.peripherals[0] = 'J';
- for (int i = 0; i < 10 && sysid.regions[i] != ' '; i++) {
- const struct symbolname *region = find_symbol(regiondefs, sysid.regions[i]);
- if (region) {
- serialize_region_code(ipout, region);
- ipout += 32;
- sysid.bootsize += 32;
- }
+ for (int i = 0; i < 8; i++) {
+ serialize_region_code(ipout, find_symbol(regiondefs, sysid.regions[i]));
+ ipout += 32;
+ sysid.bootsize += 32;
}
ipsize = ipfile