From c63f527ddea569b413b7817ba168efe873881f19 Mon Sep 17 00:00:00 2001 From: carl Date: Tue, 12 Feb 2019 00:46:09 +0800 Subject: [PATCH 1/2] Fix compilation issue on C90 compilers (gcc 4.8 was failing to compile with default flags). --- plat/cpm/emu/biosbdos.c | 3 ++- plat/cpm/emu/emulator.c | 29 ++++++++++++++++++----------- plat/cpm/emu/fileio.c | 13 ++++++++----- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/plat/cpm/emu/biosbdos.c b/plat/cpm/emu/biosbdos.c index 0e0a4890e..4eb87aca4 100644 --- a/plat/cpm/emu/biosbdos.c +++ b/plat/cpm/emu/biosbdos.c @@ -114,7 +114,8 @@ static void bios_warmboot(void) close(fd); int offset = 1; - for (int word = 1; user_command_line[word]; word++) + int word; + for (word = 1; user_command_line[word]; word++) { if (word > 1) { diff --git a/plat/cpm/emu/emulator.c b/plat/cpm/emu/emulator.c index 09d58e18b..63a40a671 100644 --- a/plat/cpm/emu/emulator.c +++ b/plat/cpm/emu/emulator.c @@ -104,11 +104,12 @@ static void cmd_register(void) static void cmd_break(void) { + int i; char* w1 = strtok(NULL, delimiters); if (w1) { uint16_t breakpc = strtoul(w1, NULL, 16); - for (int i=0; ienabled) @@ -149,7 +151,7 @@ static void cmd_watch(void) } else { - for (int i=0; ienabled) @@ -160,11 +162,12 @@ static void cmd_watch(void) static void cmd_delete_breakpoint(void) { + int i; char* w1 = strtok(NULL, delimiters); if (w1) { uint16_t breakpc = strtoul(w1, NULL, 16); - for (int i=0; ienabled && (w->address == address)) @@ -197,6 +201,7 @@ static void cmd_delete_watchpoint(void) static void cmd_memory(void) { + int i; char* w1 = strtok(NULL, delimiters); char* w2 = strtok(NULL, delimiters); @@ -215,7 +220,7 @@ static void cmd_memory(void) while (p < endrounded) { printf("%04x : ", p); - for (int i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { uint16_t pp = p + i; if ((pp >= startaddr) && (pp < endaddr)) @@ -224,7 +229,7 @@ static void cmd_memory(void) printf(" "); } printf(": "); - for (int i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { uint16_t pp = p + i; if ((pp >= startaddr) && (pp < endaddr)) @@ -359,7 +364,8 @@ static void sigusr1_cb(int number) void emulator_init(void) { - for (int i=0; ienabled && (ram[w->address] != w->value)) diff --git a/plat/cpm/emu/fileio.c b/plat/cpm/emu/fileio.c index 2b338cd66..a193805eb 100644 --- a/plat/cpm/emu/fileio.c +++ b/plat/cpm/emu/fileio.c @@ -37,11 +37,12 @@ static DIR* currentdir; void files_init(void) { - for (int i=0; ibytes; char* pout = unixfilename; - for (int i=0; i<8; i++) + for (i=0; i<8; i++) { char c = *pin++; if (c != ' ') *pout++ = tolower(c); } *pout++ = '.'; - for (int i=0; i<3; i++) + for (i=0; i<3; i++) { char c = *pin++; if (c != ' ') @@ -169,10 +171,11 @@ static bool unix_filename_to_cpm(const char* unixfilename, cpm_filename_t* cpmfi static bool match_filenames(cpm_filename_t* pattern, cpm_filename_t* filename) { + int i; if (pattern->drive != filename->drive) return false; - for (int i=0; ibytes); i++) + for (i=0; ibytes); i++) { char p = pattern->bytes[i]; if (p == '?') From 664338aa494a5f57aef2d3ae94476b2d7727bd14 Mon Sep 17 00:00:00 2001 From: carl Date: Wed, 13 Feb 2019 00:17:45 +0800 Subject: [PATCH 2/2] Fix compilation issue on C90 compilers (gcc 4.8 was failing to compile with default flags) - updated following comment. --- plat/cpm/emu/biosbdos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plat/cpm/emu/biosbdos.c b/plat/cpm/emu/biosbdos.c index 4eb87aca4..91cb16638 100644 --- a/plat/cpm/emu/biosbdos.c +++ b/plat/cpm/emu/biosbdos.c @@ -88,6 +88,8 @@ void bios_coldboot(void) static void bios_warmboot(void) { + int word; + int offset = 1; dma = 0x0080; if (!user_command_line[0]) @@ -113,8 +115,6 @@ static void bios_warmboot(void) read(fd, &ram[0x0100], 0xFE00); close(fd); - int offset = 1; - int word; for (word = 1; user_command_line[word]; word++) { if (word > 1)