summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-05-17 01:39:50 +0300
committerOxore <oxore@protonmail.com>2023-05-17 01:39:50 +0300
commitc121b8d97b7927b677db5bd5119f9f6184875c0b (patch)
tree22ada0ecf4397ec07b951e31dfe9f4c6ca6829dc
parent1cda51bbea62c61fff3f8ff6225faa8e270cabd7 (diff)
Do not add zeros after the code, but check if size is even
-rw-r--r--main.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/main.cpp b/main.cpp
index 79c8b00..4a51090 100644
--- a/main.cpp
+++ b/main.cpp
@@ -328,11 +328,11 @@ static int M68kDisasmByTrace(FILE *input_stream, FILE *output_stream, FILE *trac
fprintf(stderr, "ReadFromStream(code, input_stream): Error: No data has been read\n");
return EXIT_FAILURE;
}
- // Expand a little just in case there is truncated instruction in the end of
- // the buffer so it will not fall out of buffer trying to fetch arguments
- // from additional extension words.
- if (code.occupied_size + 100 > code.buffer_size) {
- code.Expand(code.occupied_size + 100);
+ // It just not worth it to check this somewhere while disassebling or
+ // emitting. Odd size is just not supported.
+ if (code.occupied_size % 2) {
+ fprintf(stderr, "Error: code blob must be of even size\n");
+ return EXIT_FAILURE;
}
// Read trace file into buffer
DataBuffer trace_data{};
@@ -362,11 +362,11 @@ static int M68kDisasmAll(FILE *input_stream, FILE *output_stream, const Settings
fprintf(stderr, "ReadFromStream(code, input_stream): Error: No data has been read\n");
return EXIT_FAILURE;
}
- // Expand a little just in case there is truncated instruction in the end of
- // the buffer so it will not fall out of buffer trying to fetch arguments
- // from additional extension words.
- if (code.occupied_size + 100 > code.buffer_size) {
- code.Expand(code.occupied_size + 100);
+ // It just not worth it to check this somewhere while disassebling or
+ // emitting. Odd size is just not supported.
+ if (code.occupied_size % 2) {
+ fprintf(stderr, "Error: code blob must be of even size\n");
+ return EXIT_FAILURE;
}
// Create the map and disasseble
DisasmMap *disasm_map = new DisasmMap{DisasmMapType::kRaw};