diff options
| author | 2020-05-17 09:04:31 -0700 | |
|---|---|---|
| committer | 2020-05-17 12:04:31 -0400 | |
| commit | eb2db91c65645c8a1479950684bbf0ddbeeb7ef0 (patch) | |
| tree | 4465b6a30552c82b124b07b6cffb826e007094d1 /src/tools/imgtool/filtbas.cpp | |
| parent | f4a7525acdd5690d6277e0dd16a8a75f0b277382 (diff) | |
IMGTOOL: Added Dragon DOS module [tlindner]
Diffstat (limited to 'src/tools/imgtool/filtbas.cpp')
| -rw-r--r-- | src/tools/imgtool/filtbas.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/tools/imgtool/filtbas.cpp b/src/tools/imgtool/filtbas.cpp index 4cffd0a34c3..2854a2efcab 100644 --- a/src/tools/imgtool/filtbas.cpp +++ b/src/tools/imgtool/filtbas.cpp @@ -51,7 +51,9 @@ struct basictoken_tableent struct basictokens { uint16_t baseaddress; + uint8_t size_pos; unsigned int skip_bytes : 15; + unsigned char bytes[20]; unsigned int be : 1; const basictoken_tableent *entries; int num_entries; @@ -181,7 +183,7 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, int i, j, pos, in_quotes; uint16_t line_number; uint8_t line_header[4]; - uint8_t file_header[3]; + uint8_t file_size[2]; const basictoken_tableent *token_table; const char *token; uint8_t token_shift, token_value; @@ -192,9 +194,8 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, if (!mem_stream) return IMGTOOLERR_OUTOFMEMORY; - /* skip first few bytes */ - mem_stream->fill(0x00, tokens->skip_bytes); - + /* write header */ + mem_stream->write(tokens->bytes, tokens->skip_bytes); /* loop until the file is complete */ while(!eof) { @@ -320,22 +321,20 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens, mem_stream->fill(0x00, 2); /* reset stream */ - mem_stream->seek(0, SEEK_SET); + mem_stream->seek(tokens->size_pos, SEEK_SET); /* this is somewhat gross */ if (tokens->skip_bytes >= 3) { if (tokens->be) { - place_integer_be(file_header, 0, 1, 0xFF); - place_integer_be(file_header, 1, 2, mem_stream->size()); + place_integer_be(file_size, 0, 2, mem_stream->size()); } else { - place_integer_le(file_header, 0, 1, 0xFF); - place_integer_le(file_header, 1, 2, mem_stream->size()); + place_integer_le(file_size, 0, 2, mem_stream->size()); } - mem_stream->write(file_header, 3); + mem_stream->write(file_size, 2); mem_stream->seek(0, SEEK_SET); } @@ -2942,7 +2941,9 @@ static const basictoken_tableent cocobas_tokenents[] = static const basictokens cocobas_tokens = { 0x2600, + 1, 3, + {0xFF, 0x00, 0x00}, true, cocobas_tokenents, ARRAY_LENGTH(cocobas_tokenents) @@ -2985,8 +2986,10 @@ static const basictoken_tableent dragonbas_tokenents[] = static const basictokens dragonbas_tokens = { - 0x2600, + 0x2415, 4, + 9, + {0x55, 0x01, 0x24, 0x01, 0x00, 0x2A, 0x8B, 0x8D, 0xAA}, true, dragonbas_tokenents, ARRAY_LENGTH(dragonbas_tokenents) @@ -3032,6 +3035,8 @@ static const basictokens vzbas_tokens = { 0x7ae9, 0, + 0, + {0x00}, false, vzbas_tokenents, ARRAY_LENGTH(vzbas_tokenents) @@ -3075,7 +3080,9 @@ static const basictoken_tableent bml3bas_tokenents[] = static const basictokens bml3bas_tokens = { 0x2600, + 1, 3, + {0xFF, 0x00, 0x00}, true, bml3bas_tokenents, ARRAY_LENGTH(bml3bas_tokenents) |
