summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/tools
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2013-01-11 07:32:46 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2013-01-11 07:32:46 +0000
commit0e19f641d3186cdbf51f8ca857e2b07ab95779c2 (patch)
tree234109de1123b13f217494af4b3f8efad346d5cc /src/mess/tools
parent111157ca09a9ff60fe4a9ba49173c315e94314fa (diff)
Cleanups and version bumpmame0148
Diffstat (limited to 'src/mess/tools')
-rw-r--r--src/mess/tools/castool/main.c4
-rw-r--r--src/mess/tools/floptool/main.c4
-rw-r--r--src/mess/tools/imgtool/filtbas.c1032
-rw-r--r--src/mess/tools/imgtool/filteoln.c8
-rw-r--r--src/mess/tools/imgtool/filter.c1
-rw-r--r--src/mess/tools/imgtool/iflopimg.c27
-rw-r--r--src/mess/tools/imgtool/imghd.c16
-rw-r--r--src/mess/tools/imgtool/imgterrs.h18
-rw-r--r--src/mess/tools/imgtool/imgtool.c126
-rw-r--r--src/mess/tools/imgtool/imgtool.h8
-rw-r--r--src/mess/tools/imgtool/imgtool.mak60
-rw-r--r--src/mess/tools/imgtool/library.c49
-rw-r--r--src/mess/tools/imgtool/library.h116
-rw-r--r--src/mess/tools/imgtool/main.c34
-rw-r--r--src/mess/tools/imgtool/modules.c4
-rw-r--r--src/mess/tools/imgtool/modules/amiga.c56
-rw-r--r--src/mess/tools/imgtool/modules/concept.c76
-rw-r--r--src/mess/tools/imgtool/modules/cybiko.c2
-rw-r--r--src/mess/tools/imgtool/modules/cybikoxt.c2
-rw-r--r--src/mess/tools/imgtool/modules/fat.c146
-rw-r--r--src/mess/tools/imgtool/modules/mac.c872
-rw-r--r--src/mess/tools/imgtool/modules/macbin.c12
-rw-r--r--src/mess/tools/imgtool/modules/macutil.c1
-rw-r--r--src/mess/tools/imgtool/modules/os9.c124
-rw-r--r--src/mess/tools/imgtool/modules/pc_flop.c24
-rw-r--r--src/mess/tools/imgtool/modules/pc_hard.c110
-rw-r--r--src/mess/tools/imgtool/modules/prodos.c148
-rw-r--r--src/mess/tools/imgtool/modules/psion.c6
-rw-r--r--src/mess/tools/imgtool/modules/rsdos.c68
-rw-r--r--src/mess/tools/imgtool/modules/thomson.c2368
-rw-r--r--src/mess/tools/imgtool/modules/ti99.c488
-rw-r--r--src/mess/tools/imgtool/modules/ti990hd.c378
-rw-r--r--src/mess/tools/imgtool/modules/vzdos.c64
-rw-r--r--src/mess/tools/imgtool/stream.c4
-rw-r--r--src/mess/tools/imgtool/stream.h2
35 files changed, 3225 insertions, 3233 deletions
diff --git a/src/mess/tools/castool/main.c b/src/mess/tools/castool/main.c
index 7e458d804ac..6b6baefa8f1 100644
--- a/src/mess/tools/castool/main.c
+++ b/src/mess/tools/castool/main.c
@@ -116,7 +116,7 @@ static const char *get_extension(const char *name)
static void display_usage(void)
{
fprintf(stderr, "Usage: \n");
- fprintf(stderr, " castool.exe convert <format> <inputfile> <outputfile.wav>\n");
+ fprintf(stderr, " castool.exe convert <format> <inputfile> <outputfile.wav>\n");
}
static void display_formats(void)
@@ -169,7 +169,7 @@ int CLIB_DECL main(int argc, char *argv[])
return -1;
}
- if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette)) {
+ if (cassette_open_choices(f, &stdio_ioprocs, get_extension(argv[3]), selected_formats, CASSETTE_FLAG_READONLY, &cassette)) {
fprintf(stderr, "Invalid format of input file.\n");
fclose(f);
return -1;
diff --git a/src/mess/tools/floptool/main.c b/src/mess/tools/floptool/main.c
index ea6089d5874..9c55ffc6647 100644
--- a/src/mess/tools/floptool/main.c
+++ b/src/mess/tools/floptool/main.c
@@ -103,8 +103,8 @@ static floppy_image_format_t *find_format_by_identify(io_generic *image)
static void display_usage()
{
fprintf(stderr, "Usage: \n");
- fprintf(stderr, " floptool.exe identify <inputfile> [<inputfile> ...]\n");
- fprintf(stderr, " floptool.exe convert [input_format|auto] output_format <inputfile> <outputfile>\n");
+ fprintf(stderr, " floptool.exe identify <inputfile> [<inputfile> ...]\n");
+ fprintf(stderr, " floptool.exe convert [input_format|auto] output_format <inputfile> <outputfile>\n");
}
static void display_formats()
diff --git a/src/mess/tools/imgtool/filtbas.c b/src/mess/tools/imgtool/filtbas.c
index 43a7e106067..af20e1e4b8d 100644
--- a/src/mess/tools/imgtool/filtbas.c
+++ b/src/mess/tools/imgtool/filtbas.c
@@ -103,13 +103,13 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens,
if (tokens->be)
{
//address = (UINT16)
- pick_integer_be(line_header, 0, 2);
+ pick_integer_be(line_header, 0, 2);
line_number = (UINT16) pick_integer_be(line_header, 2, 2);
}
else
{
//address = (UINT16)
- pick_integer_le(line_header, 0, 2);
+ pick_integer_le(line_header, 0, 2);
line_number = (UINT16) pick_integer_le(line_header, 2, 2);
}
@@ -359,452 +359,452 @@ done:
static const char *const cocobas_statements[] =
{
- "FOR", /* 0x80 */
- "GO", /* 0x81 */
- "REM", /* 0x82 */
- "'", /* 0x83 */
- "ELSE", /* 0x84 */
- "IF", /* 0x85 */
- "DATA", /* 0x86 */
- "PRINT", /* 0x87 */
- "ON", /* 0x88 */
- "INPUT", /* 0x89 */
- "END", /* 0x8a */
- "NEXT", /* 0x8b */
- "DIM", /* 0x8c */
- "READ", /* 0x8d */
- "RUN", /* 0x8e */
- "RESTORE", /* 0x8f */
- "RETURN", /* 0x90 */
- "STOP", /* 0x91 */
- "POKE", /* 0x92 */
- "CONT", /* 0x93 */
- "LIST", /* 0x94 */
- "CLEAR", /* 0x95 */
- "NEW", /* 0x96 */
- "CLOAD", /* 0x97 */
- "CSAVE", /* 0x98 */
- "OPEN", /* 0x99 */
- "CLOSE", /* 0x9a */
- "LLIST", /* 0x9b */
- "SET", /* 0x9c */
- "RESET", /* 0x9d */
- "CLS", /* 0x9e */
- "MOTOR", /* 0x9f */
- "SOUND", /* 0xa0 */
- "AUDIO", /* 0xa1 */
- "EXEC", /* 0xa2 */
- "SKIPF", /* 0xa3 */
- "TAB(", /* 0xa4 */
- "TO", /* 0xa5 */
- "SUB", /* 0xa6 */
- "THEN", /* 0xa7 */
- "NOT", /* 0xa8 */
- "STEP", /* 0xa9 */
- "OFF", /* 0xaa */
- "+", /* 0xab */
- "-", /* 0xac */
- "*", /* 0xad */
- "/", /* 0xae */
- "^", /* 0xaf */
- "AND", /* 0xb0 */
- "OR", /* 0xb1 */
- ">", /* 0xb2 */
- "=", /* 0xb3 */
- "<", /* 0xb4 */
- "DEL", /* 0xb5 */
- "EDIT", /* 0xb6 */
- "TRON", /* 0xb7 */
- "TROFF", /* 0xb8 */
- "DEF", /* 0xb9 */
- "LET", /* 0xba */
- "LINE", /* 0xbb */
- "PCLS", /* 0xbc */
- "PSET", /* 0xbd */
- "PRESET", /* 0xbe */
- "SCREEN", /* 0xbf */
- "PCLEAR", /* 0xc0 */
- "COLOR", /* 0xc1 */
- "CIRCLE", /* 0xc2 */
- "PAINT", /* 0xc3 */
- "GET", /* 0xc4 */
- "PUT", /* 0xc5 */
- "DRAW", /* 0xc6 */
- "PCOPY", /* 0xc7 */
- "PMODE", /* 0xc8 */
- "PLAY", /* 0xc9 */
- "DLOAD", /* 0xca */
- "RENUM", /* 0xcb */
- "FN", /* 0xcc */
- "USING", /* 0xcd */
- "DIR", /* 0xce */
- "DRIVE", /* 0xcf */
- "FIELD", /* 0xd0 */
- "FILES", /* 0xd1 */
- "KILL", /* 0xd2 */
- "LOAD", /* 0xd3 */
- "LSET", /* 0xd4 */
- "MERGE", /* 0xd5 */
- "RENAME", /* 0xd6 */
- "RSET", /* 0xd7 */
- "SAVE", /* 0xd8 */
- "WRITE", /* 0xd9 */
- "VERIFY", /* 0xda */
- "UNLOAD", /* 0xdb */
- "DSKINI", /* 0xdc */
- "BACKUP", /* 0xdd */
- "COPY", /* 0xde */
- "DSKI$", /* 0xdf */
- "DSKO$", /* 0xe0 */
- "DOS", /* 0xe1 */
- "WIDTH", /* 0xe2 */
- "PALETTE", /* 0xe3 */
- "HSCREEN", /* 0xe4 */
- "LPOKE", /* 0xe5 */
- "HCLS", /* 0xe6 */
- "HCOLOR", /* 0xe7 */
- "HPAINT", /* 0xe8 */
- "HCIRCLE", /* 0xe9 */
- "HLINE", /* 0xea */
- "HGET", /* 0xeb */
- "HPUT", /* 0xec */
- "HBUFF", /* 0xed */
- "HPRINT", /* 0xee */
- "ERR", /* 0xef */
- "BRK", /* 0xf0 */
- "LOCATE", /* 0xf1 */
- "HSTAT", /* 0xf2 */
- "HSET", /* 0xf3 */
- "HRESET", /* 0xf4 */
- "HDRAW", /* 0xf5 */
- "CMP", /* 0xf6 */
- "RGB", /* 0xf7 */
- "ATTR" /* 0xf8 */
+ "FOR", /* 0x80 */
+ "GO", /* 0x81 */
+ "REM", /* 0x82 */
+ "'", /* 0x83 */
+ "ELSE", /* 0x84 */
+ "IF", /* 0x85 */
+ "DATA", /* 0x86 */
+ "PRINT", /* 0x87 */
+ "ON", /* 0x88 */
+ "INPUT", /* 0x89 */
+ "END", /* 0x8a */
+ "NEXT", /* 0x8b */
+ "DIM", /* 0x8c */
+ "READ", /* 0x8d */
+ "RUN", /* 0x8e */
+ "RESTORE", /* 0x8f */
+ "RETURN", /* 0x90 */
+ "STOP", /* 0x91 */
+ "POKE", /* 0x92 */
+ "CONT", /* 0x93 */
+ "LIST", /* 0x94 */
+ "CLEAR", /* 0x95 */
+ "NEW", /* 0x96 */
+ "CLOAD", /* 0x97 */
+ "CSAVE", /* 0x98 */
+ "OPEN", /* 0x99 */
+ "CLOSE", /* 0x9a */
+ "LLIST", /* 0x9b */
+ "SET", /* 0x9c */
+ "RESET", /* 0x9d */
+ "CLS", /* 0x9e */
+ "MOTOR", /* 0x9f */
+ "SOUND", /* 0xa0 */
+ "AUDIO", /* 0xa1 */
+ "EXEC", /* 0xa2 */
+ "SKIPF", /* 0xa3 */
+ "TAB(", /* 0xa4 */
+ "TO", /* 0xa5 */
+ "SUB", /* 0xa6 */
+ "THEN", /* 0xa7 */
+ "NOT", /* 0xa8 */
+ "STEP", /* 0xa9 */
+ "OFF", /* 0xaa */
+ "+", /* 0xab */
+ "-", /* 0xac */
+ "*", /* 0xad */
+ "/", /* 0xae */
+ "^", /* 0xaf */
+ "AND", /* 0xb0 */
+ "OR", /* 0xb1 */
+ ">", /* 0xb2 */
+ "=", /* 0xb3 */
+ "<", /* 0xb4 */
+ "DEL", /* 0xb5 */
+ "EDIT", /* 0xb6 */
+ "TRON", /* 0xb7 */
+ "TROFF", /* 0xb8 */
+ "DEF", /* 0xb9 */
+ "LET", /* 0xba */
+ "LINE", /* 0xbb */
+ "PCLS", /* 0xbc */
+ "PSET", /* 0xbd */
+ "PRESET", /* 0xbe */
+ "SCREEN", /* 0xbf */
+ "PCLEAR", /* 0xc0 */
+ "COLOR", /* 0xc1 */
+ "CIRCLE", /* 0xc2 */
+ "PAINT", /* 0xc3 */
+ "GET", /* 0xc4 */
+ "PUT", /* 0xc5 */
+ "DRAW", /* 0xc6 */
+ "PCOPY", /* 0xc7 */
+ "PMODE", /* 0xc8 */
+ "PLAY", /* 0xc9 */
+ "DLOAD", /* 0xca */
+ "RENUM", /* 0xcb */
+ "FN", /* 0xcc */
+ "USING", /* 0xcd */
+ "DIR", /* 0xce */
+ "DRIVE", /* 0xcf */
+ "FIELD", /* 0xd0 */
+ "FILES", /* 0xd1 */
+ "KILL", /* 0xd2 */
+ "LOAD", /* 0xd3 */
+ "LSET", /* 0xd4 */
+ "MERGE", /* 0xd5 */
+ "RENAME", /* 0xd6 */
+ "RSET", /* 0xd7 */
+ "SAVE", /* 0xd8 */
+ "WRITE", /* 0xd9 */
+ "VERIFY", /* 0xda */
+ "UNLOAD", /* 0xdb */
+ "DSKINI", /* 0xdc */
+ "BACKUP", /* 0xdd */
+ "COPY", /* 0xde */
+ "DSKI$", /* 0xdf */
+ "DSKO$", /* 0xe0 */
+ "DOS", /* 0xe1 */
+ "WIDTH", /* 0xe2 */
+ "PALETTE", /* 0xe3 */
+ "HSCREEN", /* 0xe4 */
+ "LPOKE", /* 0xe5 */
+ "HCLS", /* 0xe6 */
+ "HCOLOR", /* 0xe7 */
+ "HPAINT", /* 0xe8 */
+ "HCIRCLE", /* 0xe9 */
+ "HLINE", /* 0xea */
+ "HGET", /* 0xeb */
+ "HPUT", /* 0xec */
+ "HBUFF", /* 0xed */
+ "HPRINT", /* 0xee */
+ "ERR", /* 0xef */
+ "BRK", /* 0xf0 */
+ "LOCATE", /* 0xf1 */
+ "HSTAT", /* 0xf2 */
+ "HSET", /* 0xf3 */
+ "HRESET", /* 0xf4 */
+ "HDRAW", /* 0xf5 */
+ "CMP", /* 0xf6 */
+ "RGB", /* 0xf7 */
+ "ATTR" /* 0xf8 */
};
static const char *const cocobas_functions[] =
{
- "SGN", /* 0xff80 */
- "INT", /* 0xff81 */
- "ABS", /* 0xff82 */
- "USR", /* 0xff83 */
- "RND", /* 0xff84 */
- "SIN", /* 0xff85 */
- "PEEK", /* 0xff86 */
- "LEN", /* 0xff87 */
- "STR$", /* 0xff88 */
- "VAL", /* 0xff89 */
- "ASC", /* 0xff8a */
- "CHR$", /* 0xff8b */
- "EOF", /* 0xff8c */
- "JOYSTK", /* 0xff8d */
- "LEFT$", /* 0xff8e */
- "RIGHT$", /* 0xff8f */
- "MID$", /* 0xff90 */
- "POINT", /* 0xff91 */
- "INKEY$", /* 0xff92 */
- "MEM", /* 0xff93 */
- "ATN", /* 0xff94 */
- "COS", /* 0xff95 */
- "TAN", /* 0xff96 */
- "EXP", /* 0xff97 */
- "FIX", /* 0xff98 */
- "LOG", /* 0xff99 */
- "POS", /* 0xff9a */
- "SQR", /* 0xff9b */
- "HEX$", /* 0xff9c */
- "VARPTR", /* 0xff9d */
- "INSTR", /* 0xff9e */
- "TIMER", /* 0xff9f */
- "PPOINT", /* 0xffa0 */
- "STRING$", /* 0xffa1 */
- "CVN", /* 0xffa2 */
- "FREE", /* 0xffa3 */
- "LOC", /* 0xffa4 */
- "LOF", /* 0xffa5 */
- "MKN$", /* 0xffa6 */
- "AS", /* 0xffa7 */
- "LPEEK", /* 0xffa8 */
- "BUTTON", /* 0xffa9 */
- "HPOINT", /* 0xffaa */
- "ERNO", /* 0xffab */
- "ERLIN" /* 0xffac */
+ "SGN", /* 0xff80 */
+ "INT", /* 0xff81 */
+ "ABS", /* 0xff82 */
+ "USR", /* 0xff83 */
+ "RND", /* 0xff84 */
+ "SIN", /* 0xff85 */
+ "PEEK", /* 0xff86 */
+ "LEN", /* 0xff87 */
+ "STR$", /* 0xff88 */
+ "VAL", /* 0xff89 */
+ "ASC", /* 0xff8a */
+ "CHR$", /* 0xff8b */
+ "EOF", /* 0xff8c */
+ "JOYSTK", /* 0xff8d */
+ "LEFT$", /* 0xff8e */
+ "RIGHT$", /* 0xff8f */
+ "MID$", /* 0xff90 */
+ "POINT", /* 0xff91 */
+ "INKEY$", /* 0xff92 */
+ "MEM", /* 0xff93 */
+ "ATN", /* 0xff94 */
+ "COS", /* 0xff95 */
+ "TAN", /* 0xff96 */
+ "EXP", /* 0xff97 */
+ "FIX", /* 0xff98 */
+ "LOG", /* 0xff99 */
+ "POS", /* 0xff9a */
+ "SQR", /* 0xff9b */
+ "HEX$", /* 0xff9c */
+ "VARPTR", /* 0xff9d */
+ "INSTR", /* 0xff9e */
+ "TIMER", /* 0xff9f */
+ "PPOINT", /* 0xffa0 */
+ "STRING$", /* 0xffa1 */
+ "CVN", /* 0xffa2 */
+ "FREE", /* 0xffa3 */
+ "LOC", /* 0xffa4 */
+ "LOF", /* 0xffa5 */
+ "MKN$", /* 0xffa6 */
+ "AS", /* 0xffa7 */
+ "LPEEK", /* 0xffa8 */
+ "BUTTON", /* 0xffa9 */
+ "HPOINT", /* 0xffaa */
+ "ERNO", /* 0xffab */
+ "ERLIN" /* 0xffac */
};
static const char *const dragonbas_statements[] =
{
- "FOR", /* 0x80 */
- "GO", /* 0x81 */
- "REM", /* 0x82 */
- "'", /* 0x83 */
- "ELSE", /* 0x84 */
- "IF", /* 0x85 */
- "DATA", /* 0x86 */
- "PRINT", /* 0x87 */
- "ON", /* 0x88 */
- "INPUT", /* 0x89 */
- "END", /* 0x8a */
- "NEXT", /* 0x8b */
- "DIM", /* 0x8c */
- "READ", /* 0x8d */
- "LET", /* 0x8e */
- "RUN", /* 0x8f */
- "RESTORE", /* 0x90 */
- "RETURN", /* 0x91 */
- "STOP", /* 0x92 */
- "POKE", /* 0x93 */
- "CONT", /* 0x94 */
- "LIST", /* 0x95 */
- "CLEAR", /* 0x96 */
- "NEW", /* 0x97 */
- "DEF", /* 0x98 */
- "CLOAD", /* 0x99 */
- "CSAVE", /* 0x9a */
- "OPEN", /* 0x9b */
- "CLOSE", /* 0x9c */
- "LLIST", /* 0x9d */
- "SET", /* 0x9e */
- "RESET", /* 0x9f */
- "CLS", /* 0xa0 */
- "MOTOR", /* 0xa1 */
- "SOUND", /* 0xa2 */
- "AUDIO", /* 0xa3 */
- "EXEC", /* 0xa4 */
- "SKIPF", /* 0xa5 */
- "DEL", /* 0xa6 */
- "EDIT", /* 0xa7 */
- "TRON", /* 0xa8 */
- "TROFF", /* 0xa9 */
- "LINE", /* 0xaa */
- "PCLS", /* 0xab */
- "PSET", /* 0xac */
- "PRESET", /* 0xad */
- "SCREEN", /* 0xae */
- "PCLEAR", /* 0xaf */
- "COLOR", /* 0xb0 */
- "CIRCLE", /* 0xb1 */
- "PAINT", /* 0xb2 */
- "GET", /* 0xb3 */
- "PUT", /* 0xb4 */
- "DRAW", /* 0xb5 */
- "PCOPY", /* 0xb6 */
- "PMODE", /* 0xb7 */
- "PLAY", /* 0xb8 */
- "DLOAD", /* 0xb9 */
- "RENUM", /* 0xba */
- "TAB(", /* 0xbb */
- "TO", /* 0xbc */
- "SUB", /* 0xbd */
- "FN", /* 0xbe */
- "THEN", /* 0xbf */
- "NOT", /* 0xc0 */
- "STEP", /* 0xc1 */
- "OFF", /* 0xc2 */
- "+", /* 0xc3 */
- "-", /* 0xc4 */
- "*", /* 0xc5 */
- "/", /* 0xc6 */
- "^", /* 0xc7 */
- "AND", /* 0xc8 */
- "OR", /* 0xc9 */
- ">", /* 0xca */
- "=", /* 0xcb */
- "<", /* 0xcc */
- "USING", /* 0xcd */
- "DIR", /* 0xce */
- "DRIVE", /* 0xcf */
- "FIELD", /* 0xd0 */
- "FILES", /* 0xd1 */
- "KILL", /* 0xd2 */
- "LOAD", /* 0xd3 */
- "LSET", /* 0xd4 */
- "MERGE", /* 0xd5 */
- "RENAME", /* 0xd6 */
- "RSET", /* 0xd7 */
- "SAVE", /* 0xd8 */
- "WRITE", /* 0xd9 */
- "VERIFY", /* 0xda */
- "UNLOAD", /* 0xdb */
- "DSKINI", /* 0xdc */
- "BACKUP", /* 0xdd */
- "COPY", /* 0xde */
- "DSKI$", /* 0xdf */
- "DSKO$" /* 0xe0 */
+ "FOR", /* 0x80 */
+ "GO", /* 0x81 */
+ "REM", /* 0x82 */
+ "'", /* 0x83 */
+ "ELSE", /* 0x84 */
+ "IF", /* 0x85 */
+ "DATA", /* 0x86 */
+ "PRINT", /* 0x87 */
+ "ON", /* 0x88 */
+ "INPUT", /* 0x89 */
+ "END", /* 0x8a */
+ "NEXT", /* 0x8b */
+ "DIM", /* 0x8c */
+ "READ", /* 0x8d */
+ "LET", /* 0x8e */
+ "RUN", /* 0x8f */
+ "RESTORE", /* 0x90 */
+ "RETURN", /* 0x91 */
+ "STOP", /* 0x92 */
+ "POKE", /* 0x93 */
+ "CONT", /* 0x94 */
+ "LIST", /* 0x95 */
+ "CLEAR", /* 0x96 */
+ "NEW", /* 0x97 */
+ "DEF", /* 0x98 */
+ "CLOAD", /* 0x99 */
+ "CSAVE", /* 0x9a */
+ "OPEN", /* 0x9b */
+ "CLOSE", /* 0x9c */
+ "LLIST", /* 0x9d */
+ "SET", /* 0x9e */
+ "RESET", /* 0x9f */
+ "CLS", /* 0xa0 */
+ "MOTOR", /* 0xa1 */
+ "SOUND", /* 0xa2 */
+ "AUDIO", /* 0xa3 */
+ "EXEC", /* 0xa4 */
+ "SKIPF", /* 0xa5 */
+ "DEL", /* 0xa6 */
+ "EDIT", /* 0xa7 */
+ "TRON", /* 0xa8 */
+ "TROFF", /* 0xa9 */
+ "LINE", /* 0xaa */
+ "PCLS", /* 0xab */
+ "PSET", /* 0xac */
+ "PRESET", /* 0xad */
+ "SCREEN", /* 0xae */
+ "PCLEAR", /* 0xaf */
+ "COLOR", /* 0xb0 */
+ "CIRCLE", /* 0xb1 */
+ "PAINT", /* 0xb2 */
+ "GET", /* 0xb3 */
+ "PUT", /* 0xb4 */
+ "DRAW", /* 0xb5 */
+ "PCOPY", /* 0xb6 */
+ "PMODE", /* 0xb7 */
+ "PLAY", /* 0xb8 */
+ "DLOAD", /* 0xb9 */
+ "RENUM", /* 0xba */
+ "TAB(", /* 0xbb */
+ "TO", /* 0xbc */
+ "SUB", /* 0xbd */
+ "FN", /* 0xbe */
+ "THEN", /* 0xbf */
+ "NOT", /* 0xc0 */
+ "STEP", /* 0xc1 */
+ "OFF", /* 0xc2 */
+ "+", /* 0xc3 */
+ "-", /* 0xc4 */
+ "*", /* 0xc5 */
+ "/", /* 0xc6 */
+ "^", /* 0xc7 */
+ "AND", /* 0xc8 */
+ "OR", /* 0xc9 */
+ ">", /* 0xca */
+ "=", /* 0xcb */
+ "<", /* 0xcc */
+ "USING", /* 0xcd */
+ "DIR", /* 0xce */
+ "DRIVE", /* 0xcf */
+ "FIELD", /* 0xd0 */
+ "FILES", /* 0xd1 */
+ "KILL", /* 0xd2 */
+ "LOAD", /* 0xd3 */
+ "LSET", /* 0xd4 */
+ "MERGE", /* 0xd5 */
+ "RENAME", /* 0xd6 */
+ "RSET", /* 0xd7 */
+ "SAVE", /* 0xd8 */
+ "WRITE", /* 0xd9 */
+ "VERIFY", /* 0xda */
+ "UNLOAD", /* 0xdb */
+ "DSKINI", /* 0xdc */
+ "BACKUP", /* 0xdd */
+ "COPY", /* 0xde */
+ "DSKI$", /* 0xdf */
+ "DSKO$" /* 0xe0 */
};
static const char *const dragonbas_functions[] =
{
- "SGN", /* 0xff80 */
- "INT", /* 0xff81 */
- "ABS", /* 0xff82 */
- "POS", /* 0xff83 */
- "RND", /* 0xff84 */
- "SQR", /* 0xff85 */
- "LOG", /* 0xff86 */
- "EXP", /* 0xff87 */
- "SIN", /* 0xff88 */
- "COS", /* 0xff89 */
- "TAN", /* 0xff8a */
- "ATN", /* 0xff8b */
- "PEEK", /* 0xff8c */
- "LEN", /* 0xff8d */
- "STR$", /* 0xff8e */
- "VAL", /* 0xff8f */
- "ASC", /* 0xff90 */
- "CHR$", /* 0xff91 */
- "EOF", /* 0xff92 */
- "JOYSTK", /* 0xff93 */
- "FIX", /* 0xff94 */
- "HEX$", /* 0xff95 */
- "LEFT$", /* 0xff96 */
- "RIGHT$", /* 0xff97 */
- "MID$", /* 0xff98 */
- "POINT", /* 0xff99 */
- "INKEY$", /* 0xff9a */
- "MEM", /* 0xff9b */
- "VARPTR", /* 0xff9c */
- "INSTR", /* 0xff9d */
- "TIMER", /* 0xff9e */
- "PPOINT", /* 0xff9f */
- "STRING$", /* 0xffa0 */
- "USR" /* 0xffa1 */
- "CVN", /* 0xffa2 */
- "FREE", /* 0xffa3 */
- "LOC", /* 0xffa4 */
- "LOF", /* 0xffa5 */
- "MKN$" /* 0xffa6 */
+ "SGN", /* 0xff80 */
+ "INT", /* 0xff81 */
+ "ABS", /* 0xff82 */
+ "POS", /* 0xff83 */
+ "RND", /* 0xff84 */
+ "SQR", /* 0xff85 */
+ "LOG", /* 0xff86 */
+ "EXP", /* 0xff87 */
+ "SIN", /* 0xff88 */
+ "COS", /* 0xff89 */
+ "TAN", /* 0xff8a */
+ "ATN", /* 0xff8b */
+ "PEEK", /* 0xff8c */
+ "LEN", /* 0xff8d */
+ "STR$", /* 0xff8e */
+ "VAL", /* 0xff8f */
+ "ASC", /* 0xff90 */
+ "CHR$", /* 0xff91 */
+ "EOF", /* 0xff92 */
+ "JOYSTK", /* 0xff93 */
+ "FIX", /* 0xff94 */
+ "HEX$", /* 0xff95 */
+ "LEFT$", /* 0xff96 */
+ "RIGHT$", /* 0xff97 */
+ "MID$", /* 0xff98 */
+ "POINT", /* 0xff99 */
+ "INKEY$", /* 0xff9a */
+ "MEM", /* 0xff9b */
+ "VARPTR", /* 0xff9c */
+ "INSTR", /* 0xff9d */
+ "TIMER", /* 0xff9e */
+ "PPOINT", /* 0xff9f */
+ "STRING$", /* 0xffa0 */
+ "USR" /* 0xffa1 */
+ "CVN", /* 0xffa2 */
+ "FREE", /* 0xffa3 */
+ "LOC", /* 0xffa4 */
+ "LOF", /* 0xffa5 */
+ "MKN$" /* 0xffa6 */
};
static const char *const vzbas[] =
{
- "END", /* 0x80 */
- "FOR", /* 0x81 */
- "RESET", /* 0x82 */
- "SET", /* 0x83 */
- "CLS", /* 0x84 */
- NULL, /* 0x85 */
- "RANDOM", /* 0x86 */
- "NEXT", /* 0x87 */
- "DATA", /* 0x88 */
- "INPUT", /* 0x89 */
- "DIM", /* 0x8a */
- "READ", /* 0x8b */
- "LET", /* 0x8c */
- "GOTO", /* 0x8d */
- "RUN", /* 0x8e */
- "IF", /* 0x8f */
- "RESTORE", /* 0x90 */
- "GOSUB", /* 0x91 */
- "RETURN", /* 0x92 */
- "'", /* 0x93 */
- "STOP", /* 0x94 */
- "ELSE", /* 0x95 */
- "COPY", /* 0x96 */
- "COLOR", /* 0x97 */
- "VERIFY", /* 0x98 */
- "DEFINT", /* 0x99 */
- "DEFSNG", /* 0x9a */
- "DEFDBL", /* 0x9b */
- "CRUN", /* 0x9c */
- "MODE", /* 0x9d */
- "ERROR", /* 0x9e */
- "RESUME", /* 0x9f */
- "OUT", /* 0xa0 */
- "IN", /* 0xa1 */
- NULL, /* 0xa2 */
- NULL, /* 0xa3 */
- NULL, /* 0xa4 */
- NULL, /* 0xa5 */
- NULL, /* 0xa6 */
- NULL, /* 0xa7 */
- NULL, /* 0xa8 */
- NULL, /* 0xa9 */
- NULL, /* 0xaa */
- NULL, /* 0xab */
- NULL, /* 0xac */
- NULL, /* 0xad */
- "(RESET)", /* 0xae */
- "LPRINT", /* 0xaf */
- NULL, /* 0xb0 */
- "POKE", /* 0xb1 */
- "PRINT", /* 0xb2 */
- "CONT", /* 0xb3 */
- "LIST", /* 0xb4 */
- "LLIST", /* 0xb5 */
- "DELETE", /* 0xb6 */
- "AUTO", /* 0xb7 */
- "CLEAR", /* 0xb8 */
- "CLOAD", /* 0xb9 */
- "CSAVE", /* 0xba */
- "NEW", /* 0xbb */
- "TAB(", /* 0xbc */
- "TO", /* 0xbd */
- NULL, /* 0xbe */
- "USING", /* 0xbf */
- "VARPTR", /* 0xc0 */
- "USR", /* 0xc1 */
- "ERL", /* 0xc2 */
- "ERR", /* 0xc3 */
- "STRING$", /* 0xc4 */
- NULL, /* 0xc5 */
- "POINT", /* 0xc6 */
- NULL, /* 0xc7 */
- "MEM", /* 0xc8 */
- "INKEY$", /* 0xc9 */
- "THEN", /* 0xca */
- "NOT", /* 0xcb */
- "STEP", /* 0xcc */
- "+", /* 0xcd */
- "-", /* 0xce */
- "*", /* 0xcf */
- "/", /* 0xd0 */
- "^", /* 0xd1 */
- "AND", /* 0xd2 */
- "OR", /* 0xd3 */
- ">", /* 0xd4 */
- "=", /* 0xd5 */
- "<", /* 0xd6 */
- "SGN", /* 0xd7 */
- "INT", /* 0xd8 */
- "ABS", /* 0xd9 */
- "FRE", /* 0xda */
- "INP", /* 0xdb */
- "POS", /* 0xdc */
- "SQR", /* 0xdd */
- "AND", /* 0xde */
- "LOG", /* 0xdf */
- "EXP", /* 0xe0 */
- "COS", /* 0xe1 */
- "SIN", /* 0xe2 */
- "TAN", /* 0xe3 */
- "ATN", /* 0xe4 */
- "PEEK", /* 0xe5 */
- NULL, /* 0xe6 */
- NULL, /* 0xe7 */
- NULL, /* 0xe8 */
- NULL, /* 0xe9 */
- NULL, /* 0xea */
- NULL, /* 0xeb */
- NULL, /* 0xec */
- NULL, /* 0xed */
- NULL, /* 0xee */
- "CINT", /* 0xef */
- "CSNG", /* 0xf0 */
- "CDBL", /* 0xf1 */
- "FIX", /* 0xf2 */
- "LEN", /* 0xf3 */
- "STR$", /* 0xf4 */
- "VAL", /* 0xf5 */
- "ASC", /* 0xf6 */
- "CHR$", /* 0xf7 */
- "LEFT$", /* 0xf8 */
- "RIGHT$", /* 0xf9 */
- "MID$", /* 0xfa */
- NULL, /* 0xfb */
- NULL, /* 0xfc */
- NULL, /* 0xfd */
- NULL, /* 0xfe */
- NULL /* 0xff */
+ "END", /* 0x80 */
+ "FOR", /* 0x81 */
+ "RESET", /* 0x82 */
+ "SET", /* 0x83 */
+ "CLS", /* 0x84 */
+ NULL, /* 0x85 */
+ "RANDOM", /* 0x86 */
+ "NEXT", /* 0x87 */
+ "DATA", /* 0x88 */
+ "INPUT", /* 0x89 */
+ "DIM", /* 0x8a */
+ "READ", /* 0x8b */
+ "LET", /* 0x8c */
+ "GOTO", /* 0x8d */
+ "RUN", /* 0x8e */
+ "IF", /* 0x8f */
+ "RESTORE", /* 0x90 */
+ "GOSUB", /* 0x91 */
+ "RETURN", /* 0x92 */
+ "'", /* 0x93 */
+ "STOP", /* 0x94 */
+ "ELSE", /* 0x95 */
+ "COPY", /* 0x96 */
+ "COLOR", /* 0x97 */
+ "VERIFY", /* 0x98 */
+ "DEFINT", /* 0x99 */
+ "DEFSNG", /* 0x9a */
+ "DEFDBL", /* 0x9b */
+ "CRUN", /* 0x9c */
+ "MODE", /* 0x9d */
+ "ERROR", /* 0x9e */
+ "RESUME", /* 0x9f */
+ "OUT", /* 0xa0 */
+ "IN", /* 0xa1 */
+ NULL, /* 0xa2 */
+ NULL, /* 0xa3 */
+ NULL, /* 0xa4 */
+ NULL, /* 0xa5 */
+ NULL, /* 0xa6 */
+ NULL, /* 0xa7 */
+ NULL, /* 0xa8 */
+ NULL, /* 0xa9 */
+ NULL, /* 0xaa */
+ NULL, /* 0xab */
+ NULL, /* 0xac */
+ NULL, /* 0xad */
+ "(RESET)", /* 0xae */
+ "LPRINT", /* 0xaf */
+ NULL, /* 0xb0 */
+ "POKE", /* 0xb1 */
+ "PRINT", /* 0xb2 */
+ "CONT", /* 0xb3 */
+ "LIST", /* 0xb4 */
+ "LLIST", /* 0xb5 */
+ "DELETE", /* 0xb6 */
+ "AUTO", /* 0xb7 */
+ "CLEAR", /* 0xb8 */
+ "CLOAD", /* 0xb9 */
+ "CSAVE", /* 0xba */
+ "NEW", /* 0xbb */
+ "TAB(", /* 0xbc */
+ "TO", /* 0xbd */
+ NULL, /* 0xbe */
+ "USING", /* 0xbf */
+ "VARPTR", /* 0xc0 */
+ "USR", /* 0xc1 */
+ "ERL", /* 0xc2 */
+ "ERR", /* 0xc3 */
+ "STRING$", /* 0xc4 */
+ NULL, /* 0xc5 */
+ "POINT", /* 0xc6 */
+ NULL, /* 0xc7 */
+ "MEM", /* 0xc8 */
+ "INKEY$", /* 0xc9 */
+ "THEN", /* 0xca */
+ "NOT", /* 0xcb */
+ "STEP", /* 0xcc */
+ "+", /* 0xcd */
+ "-", /* 0xce */
+ "*", /* 0xcf */
+ "/", /* 0xd0 */
+ "^", /* 0xd1 */
+ "AND", /* 0xd2 */
+ "OR", /* 0xd3 */
+ ">", /* 0xd4 */
+ "=", /* 0xd5 */
+ "<", /* 0xd6 */
+ "SGN", /* 0xd7 */
+ "INT", /* 0xd8 */
+ "ABS", /* 0xd9 */
+ "FRE", /* 0xda */
+ "INP", /* 0xdb */
+ "POS", /* 0xdc */
+ "SQR", /* 0xdd */
+ "AND", /* 0xde */
+ "LOG", /* 0xdf */
+ "EXP", /* 0xe0 */
+ "COS", /* 0xe1 */
+ "SIN", /* 0xe2 */
+ "TAN", /* 0xe3 */
+ "ATN", /* 0xe4 */
+ "PEEK", /* 0xe5 */
+ NULL, /* 0xe6 */
+ NULL, /* 0xe7 */
+ NULL, /* 0xe8 */
+ NULL, /* 0xe9 */
+ NULL, /* 0xea */
+ NULL, /* 0xeb */
+ NULL, /* 0xec */
+ NULL, /* 0xed */
+ NULL, /* 0xee */
+ "CINT", /* 0xef */
+ "CSNG", /* 0xf0 */
+ "CDBL", /* 0xf1 */
+ "FIX", /* 0xf2 */
+ "LEN", /* 0xf3 */
+ "STR$", /* 0xf4 */
+ "VAL", /* 0xf5 */
+ "ASC", /* 0xf6 */
+ "CHR$", /* 0xf7 */
+ "LEFT$", /* 0xf8 */
+ "RIGHT$", /* 0xf9 */
+ "MID$", /* 0xfa */
+ NULL, /* 0xfb */
+ NULL, /* 0xfc */
+ NULL, /* 0xfd */
+ NULL, /* 0xfe */
+ NULL /* 0xff */
};
#ifdef BASIC_
@@ -1155,22 +1155,22 @@ static const char *const basic_20_super_expander_vic[] = /* "BASIC 2.0 with Supe
"GO", /* 0xcb */
"KEY", /* 0xcc */
"GRAPHIC", /* 0xcd */
- "SCNCLR", /* 0xce */
- "CIRCLE", /* 0xcf */
- "DRAW", /* 0xd0 */
- "REGION", /* 0xd1 */
- "COLOR", /* 0xd2 */
- "POINT", /* 0xd3 */
- "SOUND", /* 0xd4 */
- "CHAR", /* 0xd5 */
- "PAINT", /* 0xd6 */
- "RPOT", /* 0xd7 */
- "RPEN", /* 0xd8 */
- "RSND", /* 0xd9 */
- "RCOLR", /* 0xda */
- "RGR", /* 0xdb */
- "RJOY", /* 0xdc */
- "RDOT", /* 0xdd */
+ "SCNCLR", /* 0xce */
+ "CIRCLE", /* 0xcf */
+ "DRAW", /* 0xd0 */
+ "REGION", /* 0xd1 */
+ "COLOR", /* 0xd2 */
+ "POINT", /* 0xd3 */
+ "SOUND", /* 0xd4 */
+ "CHAR", /* 0xd5 */
+ "PAINT", /* 0xd6 */
+ "RPOT", /* 0xd7 */
+ "RPEN", /* 0xd8 */
+ "RSND", /* 0xd9 */
+ "RCOLR", /* 0xda */
+ "RGR", /* 0xdb */
+ "RJOY", /* 0xdc */
+ "RDOT", /* 0xdd */
NULL, /* 0xde */
NULL, /* 0xdf */
NULL, /* 0xe0 */
@@ -1418,32 +1418,32 @@ static const char *const basic_20_speech_basic_27[] = /* "BASIC 2.0 with Speech
"MID$", /* 0xca */
"GO", /* 0xcb */
"RESET", /* 0xcc */
- "BASIC", /* 0xcd */
- "HELP", /* 0xce */
- "KEY", /* 0xcf */
- "HIMEM", /* 0xd0 */
- "DISK", /* 0xd1 */
- "DIR", /* 0xd2 */
- "BLOAD", /* 0xd3 */
- "BSAVE", /* 0xd4 */
- "MAP", /* 0xd5 */
- "MEM", /* 0xd6 */
- "PAUSE", /* 0xd7 */
- "BLOCK", /* 0xd8 */
- "HEAR", /* 0xd9 */
- "RECORD", /* 0xda */
- "PLAY", /* 0xdb */
- "VOLDEF", /* 0xdc */
- "COLDEF", /* 0xdd */
- "HEX", /* 0xde */
- "DEZ", /* 0xdf */
- "SCREEN", /* 0xe0 */
- "EXEC", /* 0xe1 */
- "MON", /* 0xe2 */
+ "BASIC", /* 0xcd */
+ "HELP", /* 0xce */
+ "KEY", /* 0xcf */
+ "HIMEM", /* 0xd0 */
+ "DISK", /* 0xd1 */
+ "DIR", /* 0xd2 */
+ "BLOAD", /* 0xd3 */
+ "BSAVE", /* 0xd4 */
+ "MAP", /* 0xd5 */
+ "MEM", /* 0xd6 */
+ "PAUSE", /* 0xd7 */
+ "BLOCK", /* 0xd8 */
+ "HEAR", /* 0xd9 */
+ "RECORD", /* 0xda */
+ "PLAY", /* 0xdb */
+ "VOLDEF", /* 0xdc */
+ "COLDEF", /* 0xdd */
+ "HEX", /* 0xde */
+ "DEZ", /* 0xdf */
+ "SCREEN", /* 0xe0 */
+ "EXEC", /* 0xe1 */
+ "MON", /* 0xe2 */
"{LEFT ARROW}", /* 0xe3 - A single character shaped as a left pointing arrow */
- "FROM", /* 0xe4 */
- "SPEED", /* 0xe5 */
- "OFF", /* 0xe6 */
+ "FROM", /* 0xe4 */
+ "SPEED", /* 0xe5 */
+ "OFF", /* 0xe6 */
NULL, /* 0xe7 */
NULL, /* 0xe8 */
NULL, /* 0xe9 */
@@ -1941,19 +1941,19 @@ static const char *const basic_20_exp_40[] = /* "BASIC 2.0 with BASIC 4.0 Expans
"RIGHT$", /* 0xc9 */
"MID$", /* 0xca */
"GO", /* 0xcb */
- "CONCAT", /* 0xcc */
- "DOPEN", /* 0xcd */
- "DCLOSE", /* 0xce */
- "RECORD", /* 0xcf */
- "HEADER", /* 0xd0 */
- "COLLECT", /* 0xd1 */
- "BACKUP", /* 0xd2 */
- "COPY", /* 0xd3 */
- "APPEND", /* 0xd4 */
- "DSAVE", /* 0xd5 */
- "DLOAD", /* 0xd6 */
- "CATALOG", /* 0xd7 */
- "RENAME", /* 0xd8 */
+ "CONCAT", /* 0xcc */
+ "DOPEN", /* 0xcd */
+ "DCLOSE", /* 0xce */
+ "RECORD", /* 0xcf */
+ "HEADER", /* 0xd0 */
+ "COLLECT", /* 0xd1 */
+ "BACKUP", /* 0xd2 */
+ "COPY", /* 0xd3 */
+ "APPEND", /* 0xd4 */
+ "DSAVE", /* 0xd5 */
+ "DLOAD", /* 0xd6 */
+ "CATALOG", /* 0xd7 */
+ "RENAME", /* 0xd8 */
"SCRATCH", /* 0xd9 */
"DIRECTORY", /* 0xda */
"COLOR", /* 0xdb */
@@ -2348,19 +2348,19 @@ static const char *const basic_40[] = /* "BASIC 4.0" - supported by cbm40xx & cb
"RIGHT$", /* 0xc9 */
"MID$", /* 0xca */
"GO", /* 0xcb */
- "CONCAT", /* 0xcc */
- "DOPEN", /* 0xcd */
- "DCLOSE", /* 0xce */
- "RECORD", /* 0xcf */
- "HEADER", /* 0xd0 */
- "COLLECT", /* 0xd1 */
- "BACKUP", /* 0xd2 */
- "COPY", /* 0xd3 */
- "APPEND", /* 0xd4 */
- "DSAVE", /* 0xd5 */
- "DLOAD", /* 0xd6 */
- "CATALOG", /* 0xd7 */
- "RENAME", /* 0xd8 */
+ "CONCAT", /* 0xcc */
+ "DOPEN", /* 0xcd */
+ "DCLOSE", /* 0xce */
+ "RECORD", /* 0xcf */
+ "HEADER", /* 0xd0 */
+ "COLLECT", /* 0xd1 */
+ "BACKUP", /* 0xd2 */
+ "COPY", /* 0xd3 */
+ "APPEND", /* 0xd4 */
+ "DSAVE", /* 0xd5 */
+ "DLOAD", /* 0xd6 */
+ "CATALOG", /* 0xd7 */
+ "RENAME", /* 0xd8 */
"SCRATCH", /* 0xd9 */
"DIRECTORY", /* 0xda */
NULL, /* 0xdb */
@@ -2799,8 +2799,8 @@ static const char *const basic_100[] = /* "BASIC 10.0" - supported by c65 & clon
static const basictoken_tableent cocobas_tokenents[] =
{
- { 0x00, 0x80, cocobas_statements, ARRAY_LENGTH(cocobas_statements) },
- { 0xff, 0x80, cocobas_functions, ARRAY_LENGTH(cocobas_functions) }
+ { 0x00, 0x80, cocobas_statements, ARRAY_LENGTH(cocobas_statements) },
+ { 0xff, 0x80, cocobas_functions, ARRAY_LENGTH(cocobas_functions) }
};
static const basictokens cocobas_tokens =
@@ -2828,10 +2828,10 @@ void filter_cocobas_getinfo(UINT32 state, union filterinfo *info)
{
switch(state)
{
- case FILTINFO_STR_NAME: info->s = "cocobas"; break;
- case FILTINFO_STR_HUMANNAME: info->s = "CoCo Tokenized Basic Files"; break;
- case FILTINFO_PTR_READFILE: info->read_file = cocobas_readfile; break;
- case FILTINFO_PTR_WRITEFILE: info->write_file = cocobas_writefile; break;
+ case FILTINFO_STR_NAME: info->s = "cocobas"; break;
+ case FILTINFO_STR_HUMANNAME: info->s = "CoCo Tokenized Basic Files"; break;
+ case FILTINFO_PTR_READFILE: info->read_file = cocobas_readfile; break;
+ case FILTINFO_PTR_WRITEFILE: info->write_file = cocobas_writefile; break;
}
}
@@ -2843,8 +2843,8 @@ void filter_cocobas_getinfo(UINT32 state, union filterinfo *info)
static const basictoken_tableent dragonbas_tokenents[] =
{
- { 0x00, 0x80, dragonbas_statements, ARRAY_LENGTH(dragonbas_statements) },
- { 0xff, 0x80, dragonbas_functions, ARRAY_LENGTH(dragonbas_functions) }
+ { 0x00, 0x80, dragonbas_statements, ARRAY_LENGTH(dragonbas_statements) },
+ { 0xff, 0x80, dragonbas_functions, ARRAY_LENGTH(dragonbas_functions) }
};
static const basictokens dragonbas_tokens =
@@ -2872,10 +2872,10 @@ void filter_dragonbas_getinfo(UINT32 state, union filterinfo *info)
{
switch(state)
{
- case FILTINFO_STR_NAME: info->s = "dragonbas"; break;
- case FILTINFO_STR_HUMANNAME: info->s = "Dragon Tokenized Basic Files"; break;
- case FILTINFO_PTR_READFILE: info->read_file = dragonbas_readfile; break;
- case FILTINFO_PTR_WRITEFILE: info->write_file = dragonbas_writefile; break;
+ case FILTINFO_STR_NAME: info->s = "dragonbas"; break;
+ case FILTINFO_STR_HUMANNAME: info->s = "Dragon Tokenized Basic Files"; break;
+ case FILTINFO_PTR_READFILE: info->read_file = dragonbas_readfile; break;
+ case FILTINFO_PTR_WRITEFILE: info->write_file = dragonbas_writefile; break;
}
}
@@ -2887,7 +2887,7 @@ void filter_dragonbas_getinfo(UINT32 state, union filterinfo *info)
static const basictoken_tableent vzbas_tokenents[] =
{
- { 0x00, 0x80, vzbas, ARRAY_LENGTH(vzbas) }
+ { 0x00, 0x80, vzbas, ARRAY_LENGTH(vzbas) }
};
@@ -2917,9 +2917,9 @@ void filter_vzbas_getinfo(UINT32 state, union filterinfo *info)
{
switch(state)
{
- case FILTINFO_STR_NAME: info->s = "vzbas"; break;
- case FILTINFO_STR_HUMANNAME: info->s = "Laser/VZ Tokenized Basic Files"; break;
- case FILTINFO_PTR_READFILE: info->read_file = vzbas_readfile; break;
- case FILTINFO_PTR_WRITEFILE: info->write_file = vzbas_writefile; break;
+ case FILTINFO_STR_NAME: info->s = "vzbas"; break;
+ case FILTINFO_STR_HUMANNAME: info->s = "Laser/VZ Tokenized Basic Files"; break;
+ case FILTINFO_PTR_READFILE: info->read_file = vzbas_readfile; break;
+ case FILTINFO_PTR_WRITEFILE: info->write_file = vzbas_writefile; break;
}
}
diff --git a/src/mess/tools/imgtool/filteoln.c b/src/mess/tools/imgtool/filteoln.c
index 64bfc27cec1..190514228e2 100644
--- a/src/mess/tools/imgtool/filteoln.c
+++ b/src/mess/tools/imgtool/filteoln.c
@@ -117,9 +117,9 @@ void filter_eoln_getinfo(UINT32 state, union filterinfo *info)
{
switch(state)
{
- case FILTINFO_STR_NAME: info->s = "ascii"; break;
- case FILTINFO_STR_HUMANNAME: info->s = "Ascii"; break;
- case FILTINFO_PTR_READFILE: info->read_file = ascii_readfile; break;
- case FILTINFO_PTR_WRITEFILE: info->write_file = ascii_writefile; break;
+ case FILTINFO_STR_NAME: info->s = "ascii"; break;
+ case FILTINFO_STR_HUMANNAME: info->s = "Ascii"; break;
+ case FILTINFO_PTR_READFILE: info->read_file = ascii_readfile; break;
+ case FILTINFO_PTR_WRITEFILE: info->write_file = ascii_writefile; break;
}
}
diff --git a/src/mess/tools/imgtool/filter.c b/src/mess/tools/imgtool/filter.c
index c04a722cb48..863db9e2b83 100644
--- a/src/mess/tools/imgtool/filter.c
+++ b/src/mess/tools/imgtool/filter.c
@@ -77,4 +77,3 @@ filter_getinfoproc filter_lookup(const char *name)
return NULL;
}
-
diff --git a/src/mess/tools/imgtool/iflopimg.c b/src/mess/tools/imgtool/iflopimg.c
index c795d81f602..8933a44bcda 100644
--- a/src/mess/tools/imgtool/iflopimg.c
+++ b/src/mess/tools/imgtool/iflopimg.c
@@ -260,19 +260,19 @@ static void imgtool_floppy_get_info(const imgtool_class *imgclass, UINT32 state,
sprintf(info->s = imgtool_temp_str(), "%s (%s)", format->description,
imgtool_get_info_string(&derived_class, IMGTOOLINFO_STR_DESCRIPTION));
break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), format->extensions); break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: info->p = (void*)format->param_guidelines; break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), format->extensions); break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: info->p = (void*)format->param_guidelines; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_OPEN: info->open = imgtool_floppy_open; break;
- case IMGTOOLINFO_PTR_CREATE: info->create = imgtool_floppy_create; break;
- case IMGTOOLINFO_PTR_CLOSE: info->close = imgtool_floppy_close; break;
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? floppy_option_guide : NULL; break;
- case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = imgtool_floppy_get_sector_size; break;
- case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = imgtool_floppy_read_sector; break;
- case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = imgtool_floppy_write_sector; break;
-
- default: imgclass->derived_get_info(imgclass, state, info); break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = imgtool_floppy_open; break;
+ case IMGTOOLINFO_PTR_CREATE: info->create = imgtool_floppy_create; break;
+ case IMGTOOLINFO_PTR_CLOSE: info->close = imgtool_floppy_close; break;
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = format->param_guidelines ? floppy_option_guide : NULL; break;
+ case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = imgtool_floppy_get_sector_size; break;
+ case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = imgtool_floppy_read_sector; break;
+ case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = imgtool_floppy_write_sector; break;
+
+ default: imgclass->derived_get_info(imgclass, state, info); break;
}
}
@@ -331,7 +331,7 @@ static imgtoolerr_t imgtool_floppy_transfer_sector_tofrom_stream(imgtool_image *
else
{
stream_read(f, buffer, length);
- err = floppy_write_sector(floppy, head, track, sector, offset, buffer, length, 0); /* TODO: pass ddam argument from imgtool */
+ err = floppy_write_sector(floppy, head, track, sector, offset, buffer, length, 0); /* TODO: pass ddam argument from imgtool */
if (err)
goto done;
}
@@ -366,6 +366,3 @@ void *imgtool_floppy_extrabytes(imgtool_image *img)
fimg = (struct imgtool_floppy_image *) imgtool_image_extra_bytes(img);
return fimg + 1;
}
-
-
-
diff --git a/src/mess/tools/imgtool/imghd.c b/src/mess/tools/imgtool/imghd.c
index f2ea0091278..1d66b05196c 100644
--- a/src/mess/tools/imgtool/imghd.c
+++ b/src/mess/tools/imgtool/imghd.c
@@ -62,7 +62,7 @@ imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylind
goto done;
}
if (hunksize <= 0)
- hunksize = 1024; /* default value */
+ hunksize = 1024; /* default value */
/* bail if we are read only */
if (stream_isreadonly(stream))
@@ -239,7 +239,7 @@ enum
static OPTION_GUIDE_START( mess_hd_create_optionguide )
OPTION_INT(mess_hd_createopts_blocksize, "blocksize", "Sectors Per Block" )
OPTION_INT(mess_hd_createopts_cylinders, "cylinders", "Cylinders" )
- OPTION_INT(mess_hd_createopts_heads, "heads", "Heads" )
+ OPTION_INT(mess_hd_createopts_heads, "heads", "Heads" )
OPTION_INT(mess_hd_createopts_sectors, "sectors", "Total Sectors" )
OPTION_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" )
OPTION_GUIDE_END
@@ -251,14 +251,14 @@ void hd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mess_hd"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "MESS hard disk image"); break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mess_hd"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "MESS hard disk image"); break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
- case IMGTOOLINFO_PTR_CREATE: info->create = mess_hd_image_create; break;
+ case IMGTOOLINFO_PTR_CREATE: info->create = mess_hd_image_create; break;
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = mess_hd_create_optionguide; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), mess_hd_create_optionspecs); break;
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = mess_hd_create_optionguide; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), mess_hd_create_optionspecs); break;
}
}
diff --git a/src/mess/tools/imgtool/imgterrs.h b/src/mess/tools/imgtool/imgterrs.h
index 6b17631c5fc..918468cbccf 100644
--- a/src/mess/tools/imgtool/imgterrs.h
+++ b/src/mess/tools/imgtool/imgterrs.h
@@ -50,17 +50,17 @@ enum imgtoolerr_t
*
* Note - drivers should not use these modifiers
*/
-#define IMGTOOLERR_SRC_MODULE 0x1000
-#define IMGTOOLERR_SRC_FUNCTIONALITY 0x2000
-#define IMGTOOLERR_SRC_IMAGEFILE 0x3000
-#define IMGTOOLERR_SRC_FILEONIMAGE 0x4000
-#define IMGTOOLERR_SRC_NATIVEFILE 0x5000
+#define IMGTOOLERR_SRC_MODULE 0x1000
+#define IMGTOOLERR_SRC_FUNCTIONALITY 0x2000
+#define IMGTOOLERR_SRC_IMAGEFILE 0x3000
+#define IMGTOOLERR_SRC_FILEONIMAGE 0x4000
+#define IMGTOOLERR_SRC_NATIVEFILE 0x5000
-#define ERRORCODE(err) ((err) & 0x0fff)
-#define ERRORSOURCE(err) ((err) & 0xf000)
-#define ERRORPARAM(err) (((err) & 0xf0000) / 0x10000)
+#define ERRORCODE(err) ((err) & 0x0fff)
+#define ERRORSOURCE(err) ((err) & 0xf000)
+#define ERRORPARAM(err) (((err) & 0xf0000) / 0x10000)
-#define PARAM_TO_ERROR(errcode, param) ((errcode) | ((param) * 0x10000))
+#define PARAM_TO_ERROR(errcode, param) ((errcode) | ((param) * 0x10000))
const char *imgtool_error(imgtoolerr_t err);
diff --git a/src/mess/tools/imgtool/imgtool.c b/src/mess/tools/imgtool/imgtool.c
index ce958f67f2a..d9db3212d00 100644
--- a/src/mess/tools/imgtool/imgtool.c
+++ b/src/mess/tools/imgtool/imgtool.c
@@ -44,25 +44,25 @@ struct imgtool_partition
unsigned int prefer_ucase : 1;
unsigned int supports_creation_time : 1;
unsigned int supports_lastmodified_time : 1;
- unsigned int supports_bootblock : 1; /* this module supports loading/storing the boot block */
-
- imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path);
- imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent);
- void (*close_enum) (imgtool_directory *enumeration);
- imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size);
- imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
- imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts);
- imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename);
- imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len);
- imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path);
- imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path);
- imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len);
- imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
- imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
- imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
- imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo);
- imgtoolerr_t (*suggest_transfer)(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
- imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
+ unsigned int supports_bootblock : 1; /* this module supports loading/storing the boot block */
+
+ imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path);
+ imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent);
+ void (*close_enum) (imgtool_directory *enumeration);
+ imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size);
+ imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
+ imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts);
+ imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename);
+ imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len);
+ imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path);
+ imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path);
+ imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len);
+ imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
+ imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
+ imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
+ imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo);
+ imgtoolerr_t (*suggest_transfer)(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
+ imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
const option_guide *writefile_optguide;
const char *writefile_optspec;
@@ -401,7 +401,7 @@ imgtoolerr_t imgtool_identify_file(const char *fname, imgtool_module **modules,
for (i = 0; i < count; i++)
modules[i] = NULL;
if (count > 1)
- count--; /* null terminate */
+ count--; /* null terminate */
values = (float *) malloc(count * sizeof(*values));
if (!values)
@@ -769,37 +769,37 @@ imgtoolerr_t imgtool_partition_open(imgtool_image *image, int partition_index, i
p->pool = pool;
/* fill out the structure */
- p->image = image;
- p->partition_index = partition_index;
- p->base_block = base_block;
- p->block_count = block_count;
- p->imgclass = imgclass;
- p->partition_extra_bytes = partition_extra_bytes;
- p->directory_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES);
- p->path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PATH_SEPARATOR);
- p->alternate_path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR);
- p->prefer_ucase = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PREFER_UCASE) ? 1 : 0;
- p->supports_creation_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME) ? 1 : 0;
- p->supports_lastmodified_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME) ? 1 : 0;
- p->supports_bootblock = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK) ? 1 : 0;
- p->begin_enum = (imgtoolerr_t (*)(imgtool_directory *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_BEGIN_ENUM);
- p->next_enum = (imgtoolerr_t (*)(imgtool_directory *, imgtool_dirent *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_NEXT_ENUM);
- p->free_space = (imgtoolerr_t (*)(imgtool_partition *, UINT64 *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_FREE_SPACE);
- p->read_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_READ_FILE);
- p->write_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_WRITE_FILE);
- p->delete_file = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_FILE);
- p->list_forks = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_forkent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_FORKS);
- p->create_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_DIR);
- p->delete_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_DIR);
- p->list_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, UINT32 *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_ATTRS);
- p->get_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ATTRS);
- p->set_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, const imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SET_ATTRS);
- p->attr_name = (imgtoolerr_t (*)(UINT32, const imgtool_attribute *, char *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_ATTR_NAME);
- p->get_iconinfo = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_iconinfo *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ICON_INFO);
- p->suggest_transfer = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_transfer_suggestion *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SUGGEST_TRANSFER);
- p->get_chain = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_chainent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_CHAIN);
- p->writefile_optguide = (const option_guide *) imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE);
- p->writefile_optspec = pool_strdup_allow_null(p->pool, (char*)imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC));
+ p->image = image;
+ p->partition_index = partition_index;
+ p->base_block = base_block;
+ p->block_count = block_count;
+ p->imgclass = imgclass;
+ p->partition_extra_bytes = partition_extra_bytes;
+ p->directory_extra_bytes = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES);
+ p->path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PATH_SEPARATOR);
+ p->alternate_path_separator = (char) imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR);
+ p->prefer_ucase = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_PREFER_UCASE) ? 1 : 0;
+ p->supports_creation_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME) ? 1 : 0;
+ p->supports_lastmodified_time = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME) ? 1 : 0;
+ p->supports_bootblock = imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK) ? 1 : 0;
+ p->begin_enum = (imgtoolerr_t (*)(imgtool_directory *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_BEGIN_ENUM);
+ p->next_enum = (imgtoolerr_t (*)(imgtool_directory *, imgtool_dirent *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_NEXT_ENUM);
+ p->free_space = (imgtoolerr_t (*)(imgtool_partition *, UINT64 *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_FREE_SPACE);
+ p->read_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_READ_FILE);
+ p->write_file = (imgtoolerr_t (*)(imgtool_partition *, const char *, const char *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_WRITE_FILE);
+ p->delete_file = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_FILE);
+ p->list_forks = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_forkent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_FORKS);
+ p->create_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_CREATE_DIR);
+ p->delete_dir = (imgtoolerr_t (*)(imgtool_partition *, const char *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_DELETE_DIR);
+ p->list_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, UINT32 *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_LIST_ATTRS);
+ p->get_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ATTRS);
+ p->set_attrs = (imgtoolerr_t (*)(imgtool_partition *, const char *, const UINT32 *, const imgtool_attribute *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SET_ATTRS);
+ p->attr_name = (imgtoolerr_t (*)(UINT32, const imgtool_attribute *, char *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_ATTR_NAME);
+ p->get_iconinfo = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_iconinfo *)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_ICON_INFO);
+ p->suggest_transfer = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_transfer_suggestion *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_SUGGEST_TRANSFER);
+ p->get_chain = (imgtoolerr_t (*)(imgtool_partition *, const char *, imgtool_chainent *, size_t)) imgtool_get_info_fct(&imgclass, IMGTOOLINFO_PTR_GET_CHAIN);
+ p->writefile_optguide = (const option_guide *) imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE);
+ p->writefile_optspec = pool_strdup_allow_null(p->pool, (char*)imgtool_get_info_ptr(&imgclass, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC));
/* mask out if writing is untested */
if (global_omit_untested && imgtool_get_info_int(&imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED))
@@ -1276,9 +1276,9 @@ imgtoolerr_t imgtool_image_info(imgtool_image *image, char *string, size_t len)
-#define PATH_MUSTBEDIR 0x00000001
-#define PATH_LEAVENULLALONE 0x00000002
-#define PATH_CANBEBOOTBLOCK 0x00000004
+#define PATH_MUSTBEDIR 0x00000001
+#define PATH_LEAVENULLALONE 0x00000002
+#define PATH_CANBEBOOTBLOCK 0x00000004
/*-------------------------------------------------
cannonicalize_path - normalizes a path string
@@ -1321,7 +1321,7 @@ static imgtoolerr_t cannonicalize_path(imgtool_partition *partition, UINT32 flag
err = (imgtoolerr_t)(IMGTOOLERR_CANNOTUSEPATH | IMGTOOLERR_SRC_FUNCTIONALITY);
goto done;
}
- *path = NULL; /* normalize empty path */
+ *path = NULL; /* normalize empty path */
}
}
else
@@ -1441,7 +1441,7 @@ imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const
imgtool_dirent ent;
const char *path;
- path = NULL; /* TODO: Need to parse off the path */
+ path = NULL; /* TODO: Need to parse off the path */
*filesize = -1;
memset(&ent, 0, sizeof(ent));
@@ -1710,9 +1710,9 @@ imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition
goto done;
/* Loop on resulting suggestions, and do the following:
- * 1. Call check_stream if present, and remove disqualified streams
- * 2. Fill in missing descriptions
- */
+ * 1. Call check_stream if present, and remove disqualified streams
+ * 2. Fill in missing descriptions
+ */
i = j = 0;
while(suggestions[i].viability)
{
@@ -2705,8 +2705,8 @@ imgtoolerr_t imgtool_directory_get_next(imgtool_directory *directory, imgtool_di
partition = imgtool_directory_partition(directory);
/* This makes it so that drivers don't have to take care of clearing
- * the attributes if they don't apply
- */
+ * the attributes if they don't apply
+ */
memset(ent, 0, sizeof(*ent));
err = partition->next_enum(directory, ent);
@@ -2806,7 +2806,7 @@ void unknown_partition_get_info(const imgtool_class *imgclass, UINT32 state, uni
switch(state)
{
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "unknown"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Unknown partition type"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "unknown"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Unknown partition type"); break;
}
}
diff --git a/src/mess/tools/imgtool/imgtool.h b/src/mess/tools/imgtool/imgtool.h
index 7a010e6fb5f..459712fbed5 100644
--- a/src/mess/tools/imgtool/imgtool.h
+++ b/src/mess/tools/imgtool/imgtool.h
@@ -21,11 +21,11 @@
/* ----------------------------------------------------------------------- */
-#define EOLN_CR "\x0d"
-#define EOLN_LF "\x0a"
-#define EOLN_CRLF "\x0d\x0a"
+#define EOLN_CR "\x0d"
+#define EOLN_LF "\x0a"
+#define EOLN_CRLF "\x0d\x0a"
-#define FILENAME_BOOTBLOCK ((const char *) 1)
+#define FILENAME_BOOTBLOCK ((const char *) 1)
enum
{
diff --git a/src/mess/tools/imgtool/imgtool.mak b/src/mess/tools/imgtool/imgtool.mak
index 70a67dd8b1b..3d6968d621a 100644
--- a/src/mess/tools/imgtool/imgtool.mak
+++ b/src/mess/tools/imgtool/imgtool.mak
@@ -30,36 +30,36 @@ OBJDIRS += \
LIBIMGTOOL = $(OBJ)/libimgtool.a
# imgtool lib objects
-IMGTOOL_LIB_OBJS = \
- $(IMGTOOLOBJ)/stream.o \
- $(IMGTOOLOBJ)/library.o \
- $(IMGTOOLOBJ)/modules.o \
- $(IMGTOOLOBJ)/iflopimg.o \
- $(IMGTOOLOBJ)/filter.o \
- $(IMGTOOLOBJ)/filteoln.o \
- $(IMGTOOLOBJ)/filtbas.o \
- $(IMGTOOLOBJ)/imgtool.o \
- $(IMGTOOLOBJ)/imgterrs.o \
- $(IMGTOOLOBJ)/imghd.o \
- $(IMGTOOLOBJ)/charconv.o \
- $(IMGTOOL_MODULES)/amiga.o \
- $(IMGTOOL_MODULES)/macbin.o \
- $(IMGTOOL_MODULES)/rsdos.o \
- $(IMGTOOL_MODULES)/os9.o \
- $(IMGTOOL_MODULES)/mac.o \
- $(IMGTOOL_MODULES)/ti99.o \
- $(IMGTOOL_MODULES)/ti990hd.o \
- $(IMGTOOL_MODULES)/concept.o \
- $(IMGTOOL_MODULES)/fat.o \
- $(IMGTOOL_MODULES)/pc_flop.o \
- $(IMGTOOL_MODULES)/pc_hard.o \
- $(IMGTOOL_MODULES)/prodos.o \
- $(IMGTOOL_MODULES)/vzdos.o \
- $(IMGTOOL_MODULES)/thomson.o \
- $(IMGTOOL_MODULES)/macutil.o \
- $(IMGTOOL_MODULES)/cybiko.o \
- $(IMGTOOL_MODULES)/cybikoxt.o \
- $(IMGTOOL_MODULES)/psion.o \
+IMGTOOL_LIB_OBJS = \
+ $(IMGTOOLOBJ)/stream.o \
+ $(IMGTOOLOBJ)/library.o \
+ $(IMGTOOLOBJ)/modules.o \
+ $(IMGTOOLOBJ)/iflopimg.o \
+ $(IMGTOOLOBJ)/filter.o \
+ $(IMGTOOLOBJ)/filteoln.o \
+ $(IMGTOOLOBJ)/filtbas.o \
+ $(IMGTOOLOBJ)/imgtool.o \
+ $(IMGTOOLOBJ)/imgterrs.o \
+ $(IMGTOOLOBJ)/imghd.o \
+ $(IMGTOOLOBJ)/charconv.o \
+ $(IMGTOOL_MODULES)/amiga.o \
+ $(IMGTOOL_MODULES)/macbin.o \
+ $(IMGTOOL_MODULES)/rsdos.o \
+ $(IMGTOOL_MODULES)/os9.o \
+ $(IMGTOOL_MODULES)/mac.o \
+ $(IMGTOOL_MODULES)/ti99.o \
+ $(IMGTOOL_MODULES)/ti990hd.o \
+ $(IMGTOOL_MODULES)/concept.o \
+ $(IMGTOOL_MODULES)/fat.o \
+ $(IMGTOOL_MODULES)/pc_flop.o \
+ $(IMGTOOL_MODULES)/pc_hard.o \
+ $(IMGTOOL_MODULES)/prodos.o \
+ $(IMGTOOL_MODULES)/vzdos.o \
+ $(IMGTOOL_MODULES)/thomson.o \
+ $(IMGTOOL_MODULES)/macutil.o \
+ $(IMGTOOL_MODULES)/cybiko.o \
+ $(IMGTOOL_MODULES)/cybikoxt.o \
+ $(IMGTOOL_MODULES)/psion.o \
$(LIBIMGTOOL): $(IMGTOOL_LIB_OBJS)
diff --git a/src/mess/tools/imgtool/library.c b/src/mess/tools/imgtool/library.c
index b0fa99d648d..fd15243edfe 100644
--- a/src/mess/tools/imgtool/library.c
+++ b/src/mess/tools/imgtool/library.c
@@ -78,30 +78,30 @@ static void imgtool_library_add_class(imgtool_library *library, const imgtool_cl
strcpy(s2, s1);
module->extensions = s2;
- module->imgclass = *imgclass;
- module->name = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_NAME));
- module->description = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_DESCRIPTION));
- module->eoln = imgtool_library_strdup_allow_null(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_EOLN));
- module->initial_path_separator = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? 1 : 0;
- module->open_is_strict = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_OPEN_IS_STRICT) ? 1 : 0;
- module->tracks_are_called_cylinders = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS) ? 1 : 0;
- module->writing_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED) ? 1 : 0;
- module->creation_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_CREATION_UNTESTED) ? 1 : 0;
- module->open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_OPEN);
- module->create = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CREATE);
- module->close = (void (*)(imgtool_image *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CLOSE);
- module->info = (void (*)(imgtool_image *, char *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_INFO);
- module->read_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_SECTOR);
- module->write_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, const void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_SECTOR);
- module->get_geometry = (imgtoolerr_t (*)(imgtool_image *, UINT32 *, UINT32 *, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_GEOMETRY);
- module->get_sector_size = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_SECTOR_SIZE);
- module->read_block = (imgtoolerr_t (*)(imgtool_image *, void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_BLOCK);
- module->write_block = (imgtoolerr_t (*)(imgtool_image *, const void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_BLOCK);
- module->list_partitions = (imgtoolerr_t (*)(imgtool_image *, imgtool_partition_info *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_LIST_PARTITIONS);
- module->block_size = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_BLOCK_SIZE);
- module->createimage_optguide = (const option_guide *) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE);
- module->createimage_optspec = imgtool_library_strdup_allow_null(library, (const char*)imgtool_get_info_ptr(imgclass, IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC));
- module->image_extra_bytes += imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES);
+ module->imgclass = *imgclass;
+ module->name = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_NAME));
+ module->description = imgtool_library_strdup(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_DESCRIPTION));
+ module->eoln = imgtool_library_strdup_allow_null(library, imgtool_get_info_string(imgclass, IMGTOOLINFO_STR_EOLN));
+ module->initial_path_separator = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR) ? 1 : 0;
+ module->open_is_strict = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_OPEN_IS_STRICT) ? 1 : 0;
+ module->tracks_are_called_cylinders = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS) ? 1 : 0;
+ module->writing_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_WRITING_UNTESTED) ? 1 : 0;
+ module->creation_untested = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_CREATION_UNTESTED) ? 1 : 0;
+ module->open = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_OPEN);
+ module->create = (imgtoolerr_t (*)(imgtool_image *, imgtool_stream *, option_resolution *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CREATE);
+ module->close = (void (*)(imgtool_image *)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_CLOSE);
+ module->info = (void (*)(imgtool_image *, char *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_INFO);
+ module->read_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_SECTOR);
+ module->write_sector = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, const void *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_SECTOR);
+ module->get_geometry = (imgtoolerr_t (*)(imgtool_image *, UINT32 *, UINT32 *, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_GEOMETRY);
+ module->get_sector_size = (imgtoolerr_t (*)(imgtool_image *, UINT32, UINT32, UINT32, UINT32 *))imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_GET_SECTOR_SIZE);
+ module->read_block = (imgtoolerr_t (*)(imgtool_image *, void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_READ_BLOCK);
+ module->write_block = (imgtoolerr_t (*)(imgtool_image *, const void *, UINT64)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_WRITE_BLOCK);
+ module->list_partitions = (imgtoolerr_t (*)(imgtool_image *, imgtool_partition_info *, size_t)) imgtool_get_info_fct(imgclass, IMGTOOLINFO_PTR_LIST_PARTITIONS);
+ module->block_size = imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_BLOCK_SIZE);
+ module->createimage_optguide = (const option_guide *) imgtool_get_info_ptr(imgclass, IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE);
+ module->createimage_optspec = imgtool_library_strdup_allow_null(library, (const char*)imgtool_get_info_ptr(imgclass, IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC));
+ module->image_extra_bytes += imgtool_get_info_int(imgclass, IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES);
}
@@ -277,4 +277,3 @@ char *imgtool_library_strdup_allow_null(imgtool_library *library, const char *s)
{
return s ? imgtool_library_strdup(library, s) : NULL;
}
-
diff --git a/src/mess/tools/imgtool/library.h b/src/mess/tools/imgtool/library.h
index f46344ce578..dde2d57ed18 100644
--- a/src/mess/tools/imgtool/library.h
+++ b/src/mess/tools/imgtool/library.h
@@ -39,10 +39,10 @@ enum imgtool_suggestion_viability_t
union filterinfo
{
- INT64 i; /* generic integers */
- void * p; /* generic pointers */
- void * f; /* generic function pointers */
- const char *s; /* generic strings */
+ INT64 i; /* generic integers */
+ void * p; /* generic pointers */
+ void * f; /* generic function pointers */
+ const char *s; /* generic strings */
imgtoolerr_t (*read_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
imgtoolerr_t (*write_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts);
@@ -136,8 +136,8 @@ enum
union imgtool_attribute
{
- INT64 i;
- time_t t;
+ INT64 i;
+ time_t t;
};
struct imgtool_iconinfo
@@ -252,43 +252,43 @@ struct imgtool_partition_info
union imgtoolinfo
{
- INT64 i; /* generic integers */
- void * p; /* generic pointers */
- void * f; /* generic function pointers */
- char * s; /* generic strings */
-
- imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *stream);
- void (*close) (imgtool_image *image);
- imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *stream, option_resolution *opts);
- imgtoolerr_t (*create_partition) (imgtool_image *image, UINT64 first_block, UINT64 block_count);
- void (*info) (imgtool_image *image, char *string, size_t len);
- imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path);
- imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent);
- void (*close_enum) (imgtool_directory *enumeration);
- imgtoolerr_t (*open_partition) (imgtool_partition *partition, UINT64 first_block, UINT64 block_count);
- imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size);
- imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
- imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts);
- imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename);
- imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len);
- imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path);
- imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path);
- imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len);
- imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
- imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
- imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
- imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo);
- imgtoolerr_t (*suggest_transfer) (imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
- imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
- imgtoolerr_t (*get_sector_size) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size);
- imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors);
- imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len);
- imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam);
- imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block);
- imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block);
- imgtoolerr_t (*list_partitions) (imgtool_image *image, imgtool_partition_info *partitions, size_t len);
- int (*approve_filename_char)(unicode_char ch);
- int (*make_class)(int index, imgtool_class *imgclass);
+ INT64 i; /* generic integers */
+ void * p; /* generic pointers */
+ void * f; /* generic function pointers */
+ char * s; /* generic strings */
+
+ imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *stream);
+ void (*close) (imgtool_image *image);
+ imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *stream, option_resolution *opts);
+ imgtoolerr_t (*create_partition) (imgtool_image *image, UINT64 first_block, UINT64 block_count);
+ void (*info) (imgtool_image *image, char *string, size_t len);
+ imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path);
+ imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent);
+ void (*close_enum) (imgtool_directory *enumeration);
+ imgtoolerr_t (*open_partition) (imgtool_partition *partition, UINT64 first_block, UINT64 block_count);
+ imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size);
+ imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
+ imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, option_resolution *opts);
+ imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename);
+ imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len);
+ imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path);
+ imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path);
+ imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len);
+ imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
+ imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
+ imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
+ imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo);
+ imgtoolerr_t (*suggest_transfer) (imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
+ imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
+ imgtoolerr_t (*get_sector_size) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size);
+ imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors);
+ imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len);
+ imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam);
+ imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block);
+ imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block);
+ imgtoolerr_t (*list_partitions) (imgtool_image *image, imgtool_partition_info *partitions, size_t len);
+ int (*approve_filename_char)(unicode_char ch);
+ int (*make_class)(int index, imgtool_class *imgclass);
const option_guide *createimage_optguide;
const option_guide *writefile_optguide;
@@ -350,21 +350,21 @@ struct imgtool_module
/* flags */
unsigned int initial_path_separator : 1;
unsigned int open_is_strict : 1;
- unsigned int tracks_are_called_cylinders : 1; /* used for hard drivers */
- unsigned int writing_untested : 1; /* used when we support writing, but not in main build */
- unsigned int creation_untested : 1; /* used when we support creation, but not in main build */
-
- imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *f);
- void (*close) (imgtool_image *image);
- void (*info) (imgtool_image *image, char *string, size_t len);
- imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *f, option_resolution *opts);
- imgtoolerr_t (*get_sector_size)(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size);
- imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *track, UINT32 *heads, UINT32 *sectors);
- imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len);
- imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len);
- imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block);
- imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block);
- imgtoolerr_t (*list_partitions)(imgtool_image *image, imgtool_partition_info *partitions, size_t len);
+ unsigned int tracks_are_called_cylinders : 1; /* used for hard drivers */
+ unsigned int writing_untested : 1; /* used when we support writing, but not in main build */
+ unsigned int creation_untested : 1; /* used when we support creation, but not in main build */
+
+ imgtoolerr_t (*open) (imgtool_image *image, imgtool_stream *f);
+ void (*close) (imgtool_image *image);
+ void (*info) (imgtool_image *image, char *string, size_t len);
+ imgtoolerr_t (*create) (imgtool_image *image, imgtool_stream *f, option_resolution *opts);
+ imgtoolerr_t (*get_sector_size)(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size);
+ imgtoolerr_t (*get_geometry) (imgtool_image *image, UINT32 *track, UINT32 *heads, UINT32 *sectors);
+ imgtoolerr_t (*read_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len);
+ imgtoolerr_t (*write_sector) (imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len);
+ imgtoolerr_t (*read_block) (imgtool_image *image, void *buffer, UINT64 block);
+ imgtoolerr_t (*write_block) (imgtool_image *image, const void *buffer, UINT64 block);
+ imgtoolerr_t (*list_partitions)(imgtool_image *image, imgtool_partition_info *partitions, size_t len);
UINT32 block_size;
diff --git a/src/mess/tools/imgtool/main.c b/src/mess/tools/imgtool/main.c
index e71c713a87f..056542c0646 100644
--- a/src/mess/tools/imgtool/main.c
+++ b/src/mess/tools/imgtool/main.c
@@ -53,7 +53,7 @@ static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed,
{
/* Unnamed */
if (i >= maxunnamed)
- goto error; /* Too many unnamed */
+ goto error; /* Too many unnamed */
lastunnamed = i + 1;
}
else
@@ -337,8 +337,8 @@ static int cmd_put(const struct command *c, int argc, char *argv[])
}
/* ugh I hate the way this function is set up, this is because the
- * arguments depend on the partition; something that requires some
- * rudimentary parsing */
+ * arguments depend on the partition; something that requires some
+ * rudimentary parsing */
if (argc >= 2)
{
/* open up the image */
@@ -887,20 +887,20 @@ error:
static const struct command cmds[] =
{
- { "create", cmd_create, "<format> <imagename> [--(createoption)=value]", 2, 8, 0},
- { "dir", cmd_dir, "<format> <imagename> [path]", 2, 3, 0 },
- { "get", cmd_get, "<format> <imagename> <filename> [newname] [--filter=filter] [--fork=fork]", 3, 4, 0 },
- { "put", cmd_put, "<format> <imagename> <filename>... <destname> [--(fileoption)==value] [--filter=filter] [--fork=fork]", 3, 0xffff, 0 },
- { "getall", cmd_getall, "<format> <imagename> [path] [--filter=filter]", 2, 3, 0 },
- { "del", cmd_del, "<format> <imagename> <filename>...", 3, 3, 1 },
- { "mkdir", cmd_mkdir, "<format> <imagename> <dirname>", 3, 3, 0 },
- { "rmdir", cmd_rmdir, "<format> <imagename> <dirname>...", 3, 3, 1 },
- { "readsector", cmd_readsector, "<format> <imagename> <track> <head> <sector> <filename>", 6, 6, 0 },
- { "writesector", cmd_writesector, "<format> <imagename> <track> <head> <sector> <filename>", 6, 6, 0 },
- { "identify", cmd_identify, "<imagename>", 1, 1 },
- { "listformats", cmd_listformats, NULL, 0, 0, 0 },
- { "listfilters", cmd_listfilters, NULL, 0, 0, 0 },
- { "listdriveroptions", cmd_listdriveroptions, "<format>", 1, 1, 0 }
+ { "create", cmd_create, "<format> <imagename> [--(createoption)=value]", 2, 8, 0},
+ { "dir", cmd_dir, "<format> <imagename> [path]", 2, 3, 0 },
+ { "get", cmd_get, "<format> <imagename> <filename> [newname] [--filter=filter] [--fork=fork]", 3, 4, 0 },
+ { "put", cmd_put, "<format> <imagename> <filename>... <destname> [--(fileoption)==value] [--filter=filter] [--fork=fork]", 3, 0xffff, 0 },
+ { "getall", cmd_getall, "<format> <imagename> [path] [--filter=filter]", 2, 3, 0 },
+ { "del", cmd_del, "<format> <imagename> <filename>...", 3, 3, 1 },
+ { "mkdir", cmd_mkdir, "<format> <imagename> <dirname>", 3, 3, 0 },
+ { "rmdir", cmd_rmdir, "<format> <imagename> <dirname>...", 3, 3, 1 },
+ { "readsector", cmd_readsector, "<format> <imagename> <track> <head> <sector> <filename>", 6, 6, 0 },
+ { "writesector", cmd_writesector, "<format> <imagename> <track> <head> <sector> <filename>", 6, 6, 0 },
+ { "identify", cmd_identify, "<imagename>", 1, 1 },
+ { "listformats", cmd_listformats, NULL, 0, 0, 0 },
+ { "listfilters", cmd_listfilters, NULL, 0, 0, 0 },
+ { "listdriveroptions", cmd_listdriveroptions, "<format>", 1, 1, 0 }
};
int CLIB_DECL main(int argc, char *argv[])
diff --git a/src/mess/tools/imgtool/modules.c b/src/mess/tools/imgtool/modules.c
index 472273001ae..46a15db745b 100644
--- a/src/mess/tools/imgtool/modules.c
+++ b/src/mess/tools/imgtool/modules.c
@@ -12,12 +12,12 @@
#define MODULES_RECURSIVE
/* step 1: declare all external references */
-#define MODULE(name) extern void name##_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info);
+#define MODULE(name) extern void name##_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info);
#include "modules.c"
#undef MODULE
/* step 2: define the modules[] array */
-#define MODULE(name) name##_get_info,
+#define MODULE(name) name##_get_info,
static void (*const modules[])(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info) =
{
#include "modules.c"
diff --git a/src/mess/tools/imgtool/modules/amiga.c b/src/mess/tools/imgtool/modules/amiga.c
index 40670767f46..e71f3bf5e77 100644
--- a/src/mess/tools/imgtool/modules/amiga.c
+++ b/src/mess/tools/imgtool/modules/amiga.c
@@ -244,7 +244,7 @@ static imgtoolerr_t amiga_image_write_sector(imgtool_image* img,
/* Amiga version of the toupper function */
static int intl_toupper(int c)
{
- return (c>='a' && c<='z') || (c>=224 && c<=254 && c!=247) ? c - ('a'-'A') : c ;
+ return (c>='a' && c<='z') || (c>=224 && c<=254 && c!=247) ? c - ('a'-'A') : c ;
}
@@ -282,7 +282,7 @@ static int hash_name(const char *name, int intl)
/* Returns TRUE if year is a leap year */
static int is_leap(int year)
{
- return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
+ return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
}
@@ -297,27 +297,27 @@ static time_t amiga_crack_time(amiga_date *date)
/* initialize struct */
memset(&t, 0, sizeof(t));
- /* first calculate the year */
- while (day >= year_days)
- {
- day -= year_days;
- year_days = is_leap(++year) ? 366 : 365;
- }
-
- /* then the month */
- while(day >= month_days[month-1])
- {
- day -= month_days[month-1];
- if (month == 2 && is_leap(year))
- day -= 1;
- month++;
- }
+ /* first calculate the year */
+ while (day >= year_days)
+ {
+ day -= year_days;
+ year_days = is_leap(++year) ? 366 : 365;
+ }
+
+ /* then the month */
+ while(day >= month_days[month-1])
+ {
+ day -= month_days[month-1];
+ if (month == 2 && is_leap(year))
+ day -= 1;
+ month++;
+ }
/* fill the struct with our calculated values */
- t.tm_year = year - 1900;
- t.tm_mon = month - 1;
- t.tm_mday = day + 1;
- t.tm_hour = date->mins / 60;
+ t.tm_year = year - 1900;
+ t.tm_mon = month - 1;
+ t.tm_mday = day + 1;
+ t.tm_hour = date->mins / 60;
t.tm_min = date->mins % 60;
t.tm_sec = date->ticks / 50;
@@ -814,8 +814,8 @@ static int is_ffs(imgtool_image *img)
disk_type t = get_disk_type(img);
return ((t == DT_FFS ||
- t == DT_FFS_INTL ||
- t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
+ t == DT_FFS_INTL ||
+ t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
}
@@ -825,9 +825,9 @@ static int is_intl(imgtool_image *img)
disk_type t = get_disk_type(img);
return ((t == DT_OFS_INTL ||
- t == DT_FFS_INTL ||
- t == DT_OFS_INTL_DIRC ||
- t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
+ t == DT_FFS_INTL ||
+ t == DT_OFS_INTL_DIRC ||
+ t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
}
#ifdef UNUSED_FUNCTION
@@ -837,7 +837,7 @@ static int is_dirc(imgtool_image *img)
disk_type t = get_disk_type(img);
return ((t == DT_OFS_INTL_DIRC ||
- t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
+ t == DT_FFS_INTL_DIRC) ? TRUE : FALSE);
}
#endif
@@ -1040,7 +1040,7 @@ static imgtoolerr_t walk_hash_chain(imgtool_image *img, const char *path, int st
}
/* if we haven't found the right filename but there are linked entries,
- * walk up the chain */
+ * walk up the chain */
if ((*cmp)(name, path) != 0 && hash_chain != 0)
{
*prev_block = start_block;
diff --git a/src/mess/tools/imgtool/modules/concept.c b/src/mess/tools/imgtool/modules/concept.c
index 94dcd3b38cc..c29eaeadb33 100644
--- a/src/mess/tools/imgtool/modules/concept.c
+++ b/src/mess/tools/imgtool/modules/concept.c
@@ -71,29 +71,29 @@ INLINE void set_UINT16xE(int little_endian, UINT16xE *word, UINT16 data)
struct concept_vol_hdr_entry
{
- UINT16xE first_block;
- UINT16xE next_block;
- UINT16xE ftype;
-
- unsigned char volname[8];
- UINT16xE last_block;
- UINT16xE num_files;
- UINT16xE last_boot;
- UINT16xE last_access;
- char mem_flipped;
- char disk_flipped;
- UINT16xE unused;
+ UINT16xE first_block;
+ UINT16xE next_block;
+ UINT16xE ftype;
+
+ unsigned char volname[8];
+ UINT16xE last_block;
+ UINT16xE num_files;
+ UINT16xE last_boot;
+ UINT16xE last_access;
+ char mem_flipped;
+ char disk_flipped;
+ UINT16xE unused;
};
struct concept_file_dir_entry
{
- UINT16xE first_block;
- UINT16xE next_block;
- UINT16xE ftype;
+ UINT16xE first_block;
+ UINT16xE next_block;
+ UINT16xE ftype;
- unsigned char filename[16];
- UINT16xE last_byte;
- UINT16xE last_access;
+ unsigned char filename[16];
+ UINT16xE last_byte;
+ UINT16xE last_access;
};
struct concept_dev_dir
@@ -108,8 +108,8 @@ struct concept_dev_dir
*/
struct concept_image
{
- imgtool_stream *file_handle; /* imgtool file handle */
- concept_dev_dir dev_dir; /* cached copy of device directory */
+ imgtool_stream *file_handle; /* imgtool file handle */
+ concept_dev_dir dev_dir; /* cached copy of device directory */
};
/*
@@ -118,7 +118,7 @@ struct concept_image
struct concept_iterator
{
concept_image *image;
- int index; /* current index */
+ int index; /* current index */
};
@@ -141,27 +141,27 @@ void concept_get_info(const imgtool_class *imgclass, UINT32 state, union imgtool
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(concept_image); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(concept_iterator); break;
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(concept_image); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(concept_iterator); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "concept"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Concept floppy disk image"); break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "img"); break;
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "concept"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Concept floppy disk image"); break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "img"); break;
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_OPEN: info->open = concept_image_init; break;
- case IMGTOOLINFO_PTR_CLOSE: info->close = concept_image_exit; break;
- case IMGTOOLINFO_PTR_INFO: info->info = concept_image_info; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = concept_image_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = concept_image_nextenum; break;
- case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = concept_image_closeenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = concept_image_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = concept_image_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = concept_image_writefile */; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = concept_image_deletefile */; break;
- case IMGTOOLINFO_PTR_CREATE: /* info->create = concept_image_create */; break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = concept_image_init; break;
+ case IMGTOOLINFO_PTR_CLOSE: info->close = concept_image_exit; break;
+ case IMGTOOLINFO_PTR_INFO: info->info = concept_image_info; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = concept_image_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = concept_image_nextenum; break;
+ case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = concept_image_closeenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = concept_image_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = concept_image_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = concept_image_writefile */; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = concept_image_deletefile */; break;
+ case IMGTOOLINFO_PTR_CREATE: /* info->create = concept_image_create */; break;
}
}
diff --git a/src/mess/tools/imgtool/modules/cybiko.c b/src/mess/tools/imgtool/modules/cybiko.c
index ec4ef2504b2..8979c4fcd02 100644
--- a/src/mess/tools/imgtool/modules/cybiko.c
+++ b/src/mess/tools/imgtool/modules/cybiko.c
@@ -37,7 +37,7 @@ enum
BLOCK_TYPE_FILE
};
-#define MAX_PAGE_SIZE (264 * 2)
+#define MAX_PAGE_SIZE (264 * 2)
#define INVALID_FILE_ID 0xFFFF
diff --git a/src/mess/tools/imgtool/modules/cybikoxt.c b/src/mess/tools/imgtool/modules/cybikoxt.c
index c4649a46475..bf1dedfcc30 100644
--- a/src/mess/tools/imgtool/modules/cybikoxt.c
+++ b/src/mess/tools/imgtool/modules/cybikoxt.c
@@ -37,7 +37,7 @@ enum
BLOCK_TYPE_FILE
};
-#define MAX_PAGE_SIZE (264 * 2)
+#define MAX_PAGE_SIZE (264 * 2)
#define INVALID_FILE_ID 0xFFFF
diff --git a/src/mess/tools/imgtool/modules/fat.c b/src/mess/tools/imgtool/modules/fat.c
index 90768a9a537..660a5a890ae 100644
--- a/src/mess/tools/imgtool/modules/fat.c
+++ b/src/mess/tools/imgtool/modules/fat.c
@@ -139,8 +139,8 @@
#include "unicode.h"
#include "fat.h"
-#define FAT_DIRENT_SIZE 32
-#define FAT_SECLEN 512
+#define FAT_DIRENT_SIZE 32
+#define FAT_SECLEN 512
#define LOG(x)
@@ -407,15 +407,15 @@ static imgtoolerr_t fat_partition_open(imgtool_partition *partition, UINT64 firs
//has_extended_bios_param_block = FALSE;
}
- info->fat_bits = fat_bits;
- sector_size = pick_integer_le(header, 11, 2);
- info->sectors_per_cluster = pick_integer_le(header, 13, 1);
- info->reserved_sectors = pick_integer_le(header, 14, 2);
- info->fat_count = pick_integer_le(header, 16, 1);
- info->root_entries = pick_integer_le(header, 17, 2);
- total_sectors_l = pick_integer_le(header, 19, 2);
- info->sectors_per_fat = pick_integer_le(header, 22, 2);
- total_sectors_h = pick_integer_le(header, 32, 4);
+ info->fat_bits = fat_bits;
+ sector_size = pick_integer_le(header, 11, 2);
+ info->sectors_per_cluster = pick_integer_le(header, 13, 1);
+ info->reserved_sectors = pick_integer_le(header, 14, 2);
+ info->fat_count = pick_integer_le(header, 16, 1);
+ info->root_entries = pick_integer_le(header, 17, 2);
+ total_sectors_l = pick_integer_le(header, 19, 2);
+ info->sectors_per_fat = pick_integer_le(header, 22, 2);
+ total_sectors_h = pick_integer_le(header, 32, 4);
if (info->sectors_per_cluster == 0)
return IMGTOOLERR_CORRUPTIMAGE;
@@ -539,21 +539,21 @@ static imgtoolerr_t fat_partition_create(imgtool_image *image, UINT64 first_bloc
/* store boot code */
boot_sector_offset = sizeof(header) - sizeof(boot_sector_code);
if (boot_sector_offset < 62)
- return IMGTOOLERR_UNEXPECTED; /* sanity check */
+ return IMGTOOLERR_UNEXPECTED; /* sanity check */
if (boot_sector_offset > 510)
- return IMGTOOLERR_UNEXPECTED; /* sanity check */
+ return IMGTOOLERR_UNEXPECTED; /* sanity check */
memcpy(&header[boot_sector_offset], boot_sector_code, sizeof(boot_sector_code));
/* specify jump instruction */
if (boot_sector_offset <= 129)
{
- header[0] = 0xEB; /* JMP rel8 */
- header[1] = (UINT8) (boot_sector_offset - 2); /* (offset) */
- header[2] = 0x90; /* NOP */
+ header[0] = 0xEB; /* JMP rel8 */
+ header[1] = (UINT8) (boot_sector_offset - 2); /* (offset) */
+ header[2] = 0x90; /* NOP */
}
else
{
- header[0] = 0xE9; /* JMP rel16 */
+ header[0] = 0xE9; /* JMP rel16 */
header[1] = (UINT8) ((boot_sector_offset - 2) >> 0); /* (offset) */
header[2] = (UINT8) ((boot_sector_offset - 2) >> 8); /* (offset) */
}
@@ -703,7 +703,7 @@ static UINT32 fat_get_fat_entry(imgtool_partition *partition, const UINT8 *fat_t
if (i == 0)
last_entry = (UINT32) entry;
else if (last_entry != (UINT32) entry)
- return 1; /* if the FATs disagree; mark this as reserved */
+ return 1; /* if the FATs disagree; mark this as reserved */
}
/* normalize special clusters */
@@ -881,7 +881,7 @@ static imgtoolerr_t fat_readwrite_file(imgtool_partition *partition, fat_file *f
size_t len;
// disk_info =
- fat_get_partition_info(partition);
+ fat_get_partition_info(partition);
if (bytes_read)
*bytes_read = 0;
if (!file->directory)
@@ -1244,12 +1244,12 @@ static time_t fat_crack_time(UINT32 fat_time)
time(&now);
t = *localtime(&now);
- t.tm_sec = ((fat_time >> 0) & 0x001F) * 2;
- t.tm_min = ((fat_time >> 5) & 0x003F);
- t.tm_hour = ((fat_time >> 11) & 0x001F);
- t.tm_mday = ((fat_time >> 16) & 0x001F);
- t.tm_mon = ((fat_time >> 21) & 0x000F);
- t.tm_year = ((fat_time >> 25) & 0x007F) + 1980 - 1900;
+ t.tm_sec = ((fat_time >> 0) & 0x001F) * 2;
+ t.tm_min = ((fat_time >> 5) & 0x003F);
+ t.tm_hour = ((fat_time >> 11) & 0x001F);
+ t.tm_mday = ((fat_time >> 16) & 0x001F);
+ t.tm_mon = ((fat_time >> 21) & 0x000F);
+ t.tm_year = ((fat_time >> 25) & 0x007F) + 1980 - 1900;
return mktime(&t);
}
@@ -1263,12 +1263,12 @@ static UINT32 fat_setup_time(time_t ansi_time)
t = *localtime(&ansi_time);
- result |= (((UINT32) (t.tm_sec / 2)) & 0x001F) << 0;
- result |= (((UINT32) t.tm_min) & 0x003F) << 5;
- result |= (((UINT32) t.tm_hour) & 0x001F) << 11;
- result |= (((UINT32) t.tm_mday) & 0x001F) << 16;
- result |= (((UINT32) t.tm_mon) & 0x000F) << 21;
- result |= (((UINT32) (t.tm_year + 1900 - 1980)) & 0x007F) << 25;
+ result |= (((UINT32) (t.tm_sec / 2)) & 0x001F) << 0;
+ result |= (((UINT32) t.tm_min) & 0x003F) << 5;
+ result |= (((UINT32) t.tm_hour) & 0x001F) << 11;
+ result |= (((UINT32) t.tm_mday) & 0x001F) << 16;
+ result |= (((UINT32) t.tm_mon) & 0x000F) << 21;
+ result |= (((UINT32) (t.tm_year + 1900 - 1980)) & 0x007F) << 25;
return result;
}
@@ -1296,15 +1296,15 @@ static imgtoolerr_t fat_read_dirent(imgtool_partition *partition, fat_file *file
//disk_info = fat_get_partition_info(partition);
/* The first eight bytes of a FAT directory entry is a blank padded name
- *
- * The first byte can be special:
- * 0x00 - entry is available and no further entry is used
- * 0x05 - first character is actually 0xe5
- * 0x2E - dot entry; either '.' or '..'
- * 0xE5 - entry has been erased and is available
- *
- * Byte 11 is the attributes; and 0x0F denotes a LFN entry
- */
+ *
+ * The first byte can be special:
+ * 0x00 - entry is available and no further entry is used
+ * 0x05 - first character is actually 0xe5
+ * 0x2E - dot entry; either '.' or '..'
+ * 0xE5 - entry has been erased and is available
+ *
+ * Byte 11 is the attributes; and 0x0F denotes a LFN entry
+ */
do
{
entry_index = file->index;
@@ -1383,13 +1383,13 @@ static imgtoolerr_t fat_read_dirent(imgtool_partition *partition, fat_file *file
}
/* other attributes */
- ent->filesize = pick_integer_le(entry, 28, 4);
- ent->directory = (entry[11] & 0x10) ? 1 : 0;
- ent->first_cluster = pick_integer_le(entry, 26, 2);
- ent->dirent_sector_index = entry_sector_index;
- ent->dirent_sector_offset = entry_sector_offset;
- ent->creation_time = fat_crack_time(pick_integer_le(entry, 14, 4));
- ent->lastmodified_time = fat_crack_time(pick_integer_le(entry, 22, 4));
+ ent->filesize = pick_integer_le(entry, 28, 4);
+ ent->directory = (entry[11] & 0x10) ? 1 : 0;
+ ent->first_cluster = pick_integer_le(entry, 26, 2);
+ ent->dirent_sector_index = entry_sector_index;
+ ent->dirent_sector_offset = entry_sector_offset;
+ ent->creation_time = fat_crack_time(pick_integer_le(entry, 14, 4));
+ ent->lastmodified_time = fat_crack_time(pick_integer_le(entry, 22, 4));
return IMGTOOLERR_SUCCESS;
}
@@ -1397,9 +1397,9 @@ static imgtoolerr_t fat_read_dirent(imgtool_partition *partition, fat_file *file
enum sfn_disposition_t
{
- SFN_SUFFICIENT, /* name fully representable in short file name */
- SFN_DERIVATIVE, /* name not fully representable in short file name, but no need to tildize */
- SFN_MANGLED /* name not representable in short file name; must tildize */
+ SFN_SUFFICIENT, /* name fully representable in short file name */
+ SFN_DERIVATIVE, /* name not fully representable in short file name, but no need to tildize */
+ SFN_MANGLED /* name not representable in short file name; must tildize */
};
static imgtoolerr_t fat_construct_dirent(const char *filename, creation_policy_t create,
@@ -1459,7 +1459,7 @@ static imgtoolerr_t fat_construct_dirent(const char *filename, creation_policy_t
else if (strchr(".!#$%^()-@^_`{}~", (char) ch))
short_char = (char) ch;
else
- short_char = '\0'; /* illegal SFN char */
+ short_char = '\0'; /* illegal SFN char */
cannonical_short_char = fat_cannonicalize_sfn_char((char) ch);
if (!short_char || (short_char != cannonical_short_char))
{
@@ -1653,7 +1653,7 @@ static void fat_bump_dirent(imgtool_partition *partition, UINT8 *entry, size_t e
}
/* since we changed the short file name, we need to recalc the checksums
- * in the LFN entries */
+ * in the LFN entries */
fat_calc_dirent_lfnchecksum(entry, entry_len);
}
@@ -2080,30 +2080,30 @@ void fat_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break;
- case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
- case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break;
- case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break;
- case IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK: info->i = 1; break;
- case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '\\'; break;
- case IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR: info->i = '/'; break;
- case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: info->i = sizeof(fat_partition_info); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(fat_file); break;
+ case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break;
+ case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
+ case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break;
+ case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break;
+ case IMGTOOLINFO_INT_SUPPORTS_BOOTBLOCK: info->i = 1; break;
+ case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '\\'; break;
+ case IMGTOOLINFO_INT_ALTERNATE_PATH_SEPARATOR: info->i = '/'; break;
+ case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES: info->i = sizeof(fat_partition_info); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(fat_file); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r\n"); break;
+ case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r\n"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_CREATE_PARTITION: info->create_partition = fat_partition_create; break;
- case IMGTOOLINFO_PTR_OPEN_PARTITION: info->open_partition = fat_partition_open; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = fat_partition_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = fat_partition_nextenum; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = fat_partition_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = fat_partition_writefile; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = fat_partition_deletefile; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = fat_partition_freespace; break;
- case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = fat_partition_createdir; break;
- case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = fat_partition_deletedir; break;
+ case IMGTOOLINFO_PTR_CREATE_PARTITION: info->create_partition = fat_partition_create; break;
+ case IMGTOOLINFO_PTR_OPEN_PARTITION: info->open_partition = fat_partition_open; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = fat_partition_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = fat_partition_nextenum; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = fat_partition_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = fat_partition_writefile; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = fat_partition_deletefile; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = fat_partition_freespace; break;
+ case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = fat_partition_createdir; break;
+ case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = fat_partition_deletedir; break;
}
}
diff --git a/src/mess/tools/imgtool/modules/mac.c b/src/mess/tools/imgtool/modules/mac.c
index 24a9421cc74..b507fb9e390 100644
--- a/src/mess/tools/imgtool/modules/mac.c
+++ b/src/mess/tools/imgtool/modules/mac.c
@@ -183,8 +183,8 @@ typedef UINT32BE mac_type;
*/
struct mac_point
{
- UINT16BE v; /* actually signed */
- UINT16BE h; /* actually signed */
+ UINT16BE v; /* actually signed */
+ UINT16BE h; /* actually signed */
};
/*
@@ -192,10 +192,10 @@ struct mac_point
*/
struct mac_rect
{
- UINT16BE top; /* actually signed */
- UINT16BE left; /* actually signed */
+ UINT16BE top; /* actually signed */
+ UINT16BE left; /* actually signed */
UINT16BE bottom;/* actually signed */
- UINT16BE right; /* actually signed */
+ UINT16BE right; /* actually signed */
};
/*
@@ -203,24 +203,24 @@ struct mac_rect
*/
struct mac_FInfo
{
- mac_type type; /* file type */
- mac_type creator; /* file creator */
- UINT16BE flags; /* Finder flags */
- mac_point location; /* file's location in window */
+ mac_type type; /* file type */
+ mac_type creator; /* file creator */
+ UINT16BE flags; /* Finder flags */
+ mac_point location; /* file's location in window */
/* If set to {0, 0}, and the inited flag is
- clear, the Finder will place the item
- automatically */
- UINT16BE fldr; /* MFS: window that contains file */
+ clear, the Finder will place the item
+ automatically */
+ UINT16BE fldr; /* MFS: window that contains file */
/* -3: trash */
/* -2: desktop */
/* -1: new folder template?????? */
/* 0: disk window ("root") */
/* > 0: specific folder, index of FOBJ resource??? */
/* The FOBJ resource contains some folder info;
- the name of the resource is the folder name. */
+ the name of the resource is the folder name. */
/* HFS & HFS+:
- System 7: The window in which the file???s icon appears
- System 8: reserved (set to 0) */
+ System 7: The window in which the file???s icon appears
+ System 8: reserved (set to 0) */
};
/*
@@ -228,18 +228,18 @@ struct mac_FInfo
*/
struct mac_FXInfo
{
- UINT16BE iconID; /* System 7: An ID number for the file???s icon; the
+ UINT16BE iconID; /* System 7: An ID number for the file???s icon; the
numbers that identify icons are assigned by the
Finder */
/* System 8: Reserved (set to 0) */
- UINT16BE reserved[3]; /* Reserved (set to 0) */
- UINT8 script; /* System 7: if high-bit is set, the script code
+ UINT16BE reserved[3]; /* Reserved (set to 0) */
+ UINT8 script; /* System 7: if high-bit is set, the script code
for displaying the file name; ignored otherwise */
/* System 8: Extended flags MSB(?) */
- UINT8 XFlags; /* Extended flags */
- UINT16BE comment; /* System 7: Comment ID if high-bit is clear */
+ UINT8 XFlags; /* Extended flags */
+ UINT16BE comment; /* System 7: Comment ID if high-bit is clear */
/* System 8: Reserved (set to 0) */
- UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the
+ UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the
file onto the desktop, the directory ID of the
folder from which the user moves the file is
saved here) */
@@ -250,13 +250,13 @@ struct mac_FXInfo
*/
struct mac_DInfo
{
- mac_rect rect; /* Folder's window bounds */
- UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */
- mac_point location; /* Location of the folder in parent window */
+ mac_rect rect; /* Folder's window bounds */
+ UINT16BE flags; /* Finder flags, e.g. kIsInvisible, kNameLocked, etc */
+ mac_point location; /* Location of the folder in parent window */
/* If set to {0, 0}, and the initied flag is
- clear, the Finder will place the item
- automatically */
- UINT16BE view; /* System 7: The manner in which folders are
+ clear, the Finder will place the item
+ automatically */
+ UINT16BE view; /* System 7: The manner in which folders are
displayed */
/* System 8: reserved (set to 0) */
};
@@ -266,16 +266,16 @@ struct mac_DInfo
*/
struct mac_DXInfo
{
- mac_point scroll; /* Scroll position */
- UINT32BE openChain; /* System 7: chain of directory IDs for open folders */
+ mac_point scroll; /* Scroll position */
+ UINT32BE openChain; /* System 7: chain of directory IDs for open folders */
/* System 8: reserved (set to 0) */
- UINT8 script; /* System 7: if high-bit is set, the script code
+ UINT8 script; /* System 7: if high-bit is set, the script code
for displaying the folder name; ignored otherwise */
/* System 8: Extended flags MSB(?) */
- UINT8 XFlags; /* Extended flags */
- UINT16BE comment; /* System 7: Comment ID if high-bit is clear */
+ UINT8 XFlags; /* Extended flags */
+ UINT16BE comment; /* System 7: Comment ID if high-bit is clear */
/* System 8: Reserved (set to 0) */
- UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the
+ UINT32BE putAway; /* Put away folder ID (i.e. if the user moves the
folder onto the desktop, the directory ID of
the folder from which the user moves it is
saved here) */
@@ -286,22 +286,22 @@ struct mac_DXInfo
*/
enum
{
- fif_isOnDesk = 0x0001, /* System 6: set if item is located on desktop (files and folders) */
+ fif_isOnDesk = 0x0001, /* System 6: set if item is located on desktop (files and folders) */
/* System 7: Unused (set to 0) */
- fif_color = 0x000E, /* color coding (files and folders) */
- fif_colorReserved = 0x0010, /* System 6: reserved??? */
+ fif_color = 0x000E, /* color coding (files and folders) */
+ fif_colorReserved = 0x0010, /* System 6: reserved??? */
/* System 7: Unused (set to 0) */
- fif_requiresSwitchLaunch= 0x0020, /* System 6: ??? */
+ fif_requiresSwitchLaunch= 0x0020, /* System 6: ??? */
/* System 7: Unused (set to 0) */
- fif_isShared = 0x0040, /* Applications files: if set, the */
+ fif_isShared = 0x0040, /* Applications files: if set, the */
/* application can be executed by */
/* multiple users simultaneously. */
/* Otherwise, set to 0. */
- fif_hasNoINITs = 0x0080, /* Extensions/Control Panels: if set(?), */
+ fif_hasNoINITs = 0x0080, /* Extensions/Control Panels: if set(?), */
/* this file contains no INIT */
/* resource */
/* Otherwise, set to 0. */
- fif_hasBeenInited = 0x0100, /* System 6: The Finder has recorded information from
+ fif_hasBeenInited = 0x0100, /* System 6: The Finder has recorded information from
the file???s bundle resource into the desktop
database and given the file or folder a
position on the desktop. */
@@ -311,15 +311,15 @@ enum
/* Reserved for folders - make sure this bit is cleared for folders */
/* bit 0x0200 was at a point (AOCE for system 7.x?) the letter bit for
- AOCE, but was reserved before and it is reserved again in recent MacOS
- releases. */
-
- fif_hasCustomIcon = 0x0400, /* (files and folders) */
- fif_isStationery = 0x0800, /* System 7: (files only) */
- fif_nameLocked = 0x1000, /* (files and folders) */
- fif_hasBundle = 0x2000, /* Files only */
- fif_isInvisible = 0x4000, /* (files and folders) */
- fif_isAlias = 0x8000 /* System 7: (files only) */
+ AOCE, but was reserved before and it is reserved again in recent MacOS
+ releases. */
+
+ fif_hasCustomIcon = 0x0400, /* (files and folders) */
+ fif_isStationery = 0x0800, /* System 7: (files only) */
+ fif_nameLocked = 0x1000, /* (files and folders) */
+ fif_hasBundle = 0x2000, /* Files only */
+ fif_isInvisible = 0x4000, /* (files and folders) */
+ fif_isAlias = 0x8000 /* System 7: (files only) */
};
/*
@@ -434,11 +434,11 @@ exit:
#ifdef UNUSED_FUNCTION
static int mac_strcmp(const UINT8 *s1, const UINT8 *s2)
{
- size_t common_len;
+ size_t common_len;
- common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0];
+ common_len = (s1[0] <= s2[0]) ? s1[0] : s2[0];
- return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]);
+ return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]);
}
#endif
@@ -486,69 +486,69 @@ static int mac_stricmp(const UINT8 *s1, const UINT8 *s2)
static const unsigned char mac_char_sort_table[256] =
{
/* \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 */
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
/* \x08 \x09 \x0a \x0b \x0c \x0d \x0e \x0f */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
/* \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
/* \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
/* \x20 \x21 \x22 \x23 \x24 \x25 \x26 \x27 */
- 0x20, 0x21, 0x22, 0x27, 0x28, 0x29, 0x2a, 0x2b,
+ 0x20, 0x21, 0x22, 0x27, 0x28, 0x29, 0x2a, 0x2b,
/* \x28 \x29 \x2a \x2b \x2c \x2d \x2e \x2f */
- 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
+ 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
/* \x30 \x31 \x32 \x33 \x34 \x35 \x36 \x37 */
- 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d,
+ 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d,
/* \x38 \x39 \x3a \x3b \x3c \x3d \x3e \x3f */
- 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
+ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
/* \x40 \x41 \x42 \x43 \x44 \x45 \x46 \x47 */
- 0x46, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b,
+ 0x46, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b,
/* \x48 \x49 \x4a \x4b \x4c \x4d \x4e \x4f */
- 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68,
+ 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68,
/* \x50 \x51 \x52 \x53 \x54 \x55 \x56 \x57 */
- 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d,
+ 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d,
/* \x58 \x59 \x5a \x5b \x5c \x5d \x5e \x5f */
- 0x7e, 0x7f, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,
+ 0x7e, 0x7f, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,
/* \x60 \x61 \x62 \x63 \x64 \x65 \x66 \x67 */
- 0x4d, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b,
+ 0x4d, 0x47, 0x51, 0x52, 0x54, 0x55, 0x5a, 0x5b,
/* \x68 \x69 \x6a \x6b \x6c \x6d \x6e \x6f */
- 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68,
+ 0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x68,
/* \x70 \x71 \x72 \x73 \x74 \x75 \x76 \x77 */
- 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d,
+ 0x71, 0x72, 0x73, 0x74, 0x76, 0x77, 0x7c, 0x7d,
/* \x78 \x79 \x7a \x7b \x7c \x7d \x7e \x7f */
- 0x7e, 0x7f, 0x81, 0x87, 0x88, 0x89, 0x8a, 0x8b,
+ 0x7e, 0x7f, 0x81, 0x87, 0x88, 0x89, 0x8a, 0x8b,
/* \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 */
- 0x49, 0x4b, 0x53, 0x56, 0x67, 0x69, 0x78, 0x4e,
+ 0x49, 0x4b, 0x53, 0x56, 0x67, 0x69, 0x78, 0x4e,
/* \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f */
- 0x48, 0x4f, 0x49, 0x4a, 0x4b, 0x53, 0x56, 0x57,
+ 0x48, 0x4f, 0x49, 0x4a, 0x4b, 0x53, 0x56, 0x57,
/* \x90 \x91 \x92 \x93 \x94 \x95 \x96 \x97 */
- 0x58, 0x59, 0x5e, 0x5f, 0x60, 0x61, 0x67, 0x6d,
+ 0x58, 0x59, 0x5e, 0x5f, 0x60, 0x61, 0x67, 0x6d,
/* \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f */
- 0x6e, 0x6f, 0x69, 0x6a, 0x79, 0x7a, 0x7b, 0x78,
+ 0x6e, 0x6f, 0x69, 0x6a, 0x79, 0x7a, 0x7b, 0x78,
/* \xa0 \xa1 \xa2 \xa3 \xa4 \xa5 \xa6 \xa7 */
- 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x75,
+ 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x75,
/* \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf */
- 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x4c, 0x6b,
+ 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x4c, 0x6b,
/* \xb0 \xb1 \xb2 \xb3 \xb4 \xb5 \xb6 \xb7 */
- 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0,
+ 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0,
/* \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf */
- 0xa1, 0xa2, 0xa3, 0x50, 0x70, 0xa4, 0x4c, 0x6b,
+ 0xa1, 0xa2, 0xa3, 0x50, 0x70, 0xa4, 0x4c, 0x6b,
/* \xc0 \xc1 \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 */
- 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0x25,
+ 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0x25,
/* \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf */
- 0x26, 0xac, 0x20, 0x48, 0x4a, 0x6a, 0x6c, 0x6c,
+ 0x26, 0xac, 0x20, 0x48, 0x4a, 0x6a, 0x6c, 0x6c,
/* \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 */
- 0xad, 0xae, 0x23, 0x24, 0x2c, 0x2d, 0xaf, 0xb0,
+ 0xad, 0xae, 0x23, 0x24, 0x2c, 0x2d, 0xaf, 0xb0,
/* \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf */
- 0x80, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+ 0x80, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
/* \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 */
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
/* \xe8 \xe9 \xea \xeb \xec \xed \xee \xef */
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
/* \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
/* \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff */
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7
+ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7
};
size_t common_len;
@@ -684,7 +684,7 @@ static imgtoolerr_t image_write_block(mac_l1_imgref *image, UINT32 block, const
if (err)
return err;
- ferr = floppy_write_sector(imgtool_floppy(image->image), head, track, sector, 0, src, 512, 0); /* TODO: pass ddam argument from imgtool */
+ ferr = floppy_write_sector(imgtool_floppy(image->image), head, track, sector, 0, src, 512, 0); /* TODO: pass ddam argument from imgtool */
if (ferr)
return imgtool_floppy_error(ferr);
@@ -765,7 +765,7 @@ struct mfs_l2_imgref
mac_str27 volname;
- unsigned char ABlink_dirty[13]; /* dirty flag for each disk block in the ABlink array */
+ unsigned char ABlink_dirty[13]; /* dirty flag for each disk block in the ABlink array */
UINT8 ABlink[6141];
};
@@ -774,8 +774,8 @@ struct mfs_l2_imgref
*/
struct hfs_extent
{
- UINT16BE stABN; /* first allocation block */
- UINT16BE numABlks; /* number of allocation blocks */
+ UINT16BE stABN; /* first allocation block */
+ UINT16BE numABlks; /* number of allocation blocks */
};
/*
@@ -789,7 +789,7 @@ typedef hfs_extent hfs_extent_3[3];
*/
struct mfs_fileref
{
- UINT16 stBlk; /* first allocation block of file */
+ UINT16 stBlk; /* first allocation block of file */
};
/*
@@ -797,10 +797,10 @@ struct mfs_fileref
*/
struct hfs_fileref
{
- hfs_extent_3 extents; /* first 3 file extents */
+ hfs_extent_3 extents; /* first 3 file extents */
- UINT32 parID; /* CNID of parent directory (undefined for extent & catalog files) */
- mac_str31 filename; /* file name (undefined for extent & catalog files) */
+ UINT32 parID; /* CNID of parent directory (undefined for extent & catalog files) */
+ mac_str31 filename; /* file name (undefined for extent & catalog files) */
};
struct mac_l2_imgref;
@@ -810,19 +810,19 @@ struct mac_l2_imgref;
*/
struct mac_fileref
{
- struct mac_l2_imgref *l2_img; /* image pointer */
+ struct mac_l2_imgref *l2_img; /* image pointer */
- UINT32 fileID; /* file ID (a.k.a. CNID in HFS/HFS+) */
+ UINT32 fileID; /* file ID (a.k.a. CNID in HFS/HFS+) */
- mac_forkID forkType; /* 0x00 for data, 0xff for resource */
+ mac_forkID forkType; /* 0x00 for data, 0xff for resource */
- UINT32 eof; /* logical end-of-file */
- UINT32 pLen; /* physical end-of-file */
+ UINT32 eof; /* logical end-of-file */
+ UINT32 pLen; /* physical end-of-file */
- UINT32 crPs; /* current position in file */
+ UINT32 crPs; /* current position in file */
UINT8 reload_buf;
- UINT8 block_buffer[512]; /* buffer with current file block */
+ UINT8 block_buffer[512]; /* buffer with current file block */
union
{
@@ -836,19 +836,19 @@ struct mac_fileref
*/
struct mac_BTref
{
- struct mac_fileref fileref; /* open B-tree file ref */
+ struct mac_fileref fileref; /* open B-tree file ref */
- UINT16 nodeSize; /* size of a node, in bytes */
- UINT32 rootNode; /* node number of root node */
- UINT32 firstLeafNode; /* node number of first leaf node */
- UINT32 attributes; /* persistent attributes about the tree */
- UINT16 treeDepth; /* maximum height (usually leaf nodes) */
- UINT16 maxKeyLength; /* maximum key length */
+ UINT16 nodeSize; /* size of a node, in bytes */
+ UINT32 rootNode; /* node number of root node */
+ UINT32 firstLeafNode; /* node number of first leaf node */
+ UINT32 attributes; /* persistent attributes about the tree */
+ UINT16 treeDepth; /* maximum height (usually leaf nodes) */
+ UINT16 maxKeyLength; /* maximum key length */
/* function to compare keys during tree searches */
int (*key_compare_func)(const void *key1, const void *key2);
- void *node_buf; /* current node buffer */
+ void *node_buf; /* current node buffer */
};
/*
@@ -856,9 +856,9 @@ struct mac_BTref
*/
enum
{
- btha_badCloseMask = 0x00000001, /* reserved */
- btha_bigKeysMask = 0x00000002, /* key length field is 16 bits */
- btha_variableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */
+ btha_badCloseMask = 0x00000001, /* reserved */
+ btha_bigKeysMask = 0x00000002, /* key length field is 16 bits */
+ btha_variableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */
};
/*
@@ -890,7 +890,7 @@ struct mac_l2_imgref
UINT16 freeABs;
- UINT32 nxtCNID; /* nxtFNum in MFS, nxtCNID in HFS */
+ UINT32 nxtCNID; /* nxtFNum in MFS, nxtCNID in HFS */
mac_format format;
union
@@ -905,25 +905,25 @@ struct mac_l2_imgref
*/
struct mfs_mdb
{
- UINT8 sigWord[2]; /* volume signature - always $D2D7 */
- UINT32BE crDate; /* date and time of volume creation */
+ UINT8 sigWord[2]; /* volume signature - always $D2D7 */
+ UINT32BE crDate; /* date and time of volume creation */
UINT32BE lsMod/*lsBkUp???*/;/* date and time of last modification (backup???) */
- UINT16BE atrb; /* volume attributes (0x0000) */
+ UINT16BE atrb; /* volume attributes (0x0000) */
/* bit 15 is set if volume is locked by software */
- UINT16BE nmFls; /* number of files in directory */
- UINT16BE dirSt; /* first block of directory */
+ UINT16BE nmFls; /* number of files in directory */
+ UINT16BE dirSt; /* first block of directory */
- UINT16BE blLn; /* length of directory in blocks (0x000C) */
- UINT16BE nmAlBlks; /* number of allocation blocks in volume (0x0187) */
- UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks (0x00000400) */
- UINT32BE clpSiz; /* default clump size - number of bytes to allocate
+ UINT16BE blLn; /* length of directory in blocks (0x000C) */
+ UINT16BE nmAlBlks; /* number of allocation blocks in volume (0x0187) */
+ UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks (0x00000400) */
+ UINT32BE clpSiz; /* default clump size - number of bytes to allocate
when a file grows (0x00002000) */
- UINT16BE alBlSt; /* first allocation block in volume (0x0010) */
+ UINT16BE alBlSt; /* first allocation block in volume (0x0010) */
- UINT32BE nxtFNum; /* next unused file number */
- UINT16BE freeABs; /* number of unused allocation blocks */
+ UINT32BE nxtFNum; /* next unused file number */
+ UINT16BE freeABs; /* number of unused allocation blocks */
- mac_str27 VN; /* volume name */
+ mac_str27 VN; /* volume name */
UINT8 ABlink[512-64];/* Link array for file ABs. Array of nmAlBlks
12-bit-long entries, indexed by AB address. If an
@@ -946,55 +946,55 @@ struct mfs_mdb
struct hfs_mdb
{
/* First fields are similar to MFS, though several fields have a different meaning */
- UINT8 sigWord[2]; /* volume signature - always $D2D7 */
- UINT32BE crDate; /* date and time of volume creation */
- UINT32BE lsMod; /* date and time of last modification */
- UINT16BE atrb; /* volume attributes (0x0000) */
+ UINT8 sigWord[2]; /* volume signature - always $D2D7 */
+ UINT32BE crDate; /* date and time of volume creation */
+ UINT32BE lsMod; /* date and time of last modification */
+ UINT16BE atrb; /* volume attributes (0x0000) */
/* bit 15 is set if volume is locked by software */
- UINT16BE nmFls; /* number of files in root folder */
- UINT16BE VBMSt; /* first block of volume bitmap */
- UINT16BE allocPtr; /* start of next allocation search */
+ UINT16BE nmFls; /* number of files in root folder */
+ UINT16BE VBMSt; /* first block of volume bitmap */
+ UINT16BE allocPtr; /* start of next allocation search */
- UINT16BE nmAlBlks; /* number of allocation blocks in volume */
- UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks */
- UINT32BE clpSiz; /* default clump size - number of bytes to allocate
+ UINT16BE nmAlBlks; /* number of allocation blocks in volume */
+ UINT32BE alBlkSiz; /* size (in bytes) of allocation blocks */
+ UINT32BE clpSiz; /* default clump size - number of bytes to allocate
when a file grows */
- UINT16BE alBlSt; /* first allocation block in volume (0x0010) */
- UINT32BE nxtCNID; /* next unused catalog node ID */
- UINT16BE freeABs; /* number of unused allocation blocks */
- mac_str27 VN; /* volume name */
+ UINT16BE alBlSt; /* first allocation block in volume (0x0010) */
+ UINT32BE nxtCNID; /* next unused catalog node ID */
+ UINT16BE freeABs; /* number of unused allocation blocks */
+ mac_str27 VN; /* volume name */
/* next fields are HFS-specific */
- UINT32BE volBkUp; /* date and time of last backup */
- UINT16BE vSeqNum; /* volume backup sequence number */
- UINT32BE wrCnt; /* volume write count */
- UINT32BE xtClpSiz; /* clump size for extents overflow file */
- UINT32BE ctClpSiz; /* clump size for catalog file */
- UINT16BE nmRtDirs; /* number of directories in root folder */
- UINT32BE filCnt; /* number of files in volume */
- UINT32BE dirCnt; /* number of directories in volume */
- UINT8 fndrInfo[32]; /* information used by the Finder */
+ UINT32BE volBkUp; /* date and time of last backup */
+ UINT16BE vSeqNum; /* volume backup sequence number */
+ UINT32BE wrCnt; /* volume write count */
+ UINT32BE xtClpSiz; /* clump size for extents overflow file */
+ UINT32BE ctClpSiz; /* clump size for catalog file */
+ UINT16BE nmRtDirs; /* number of directories in root folder */
+ UINT32BE filCnt; /* number of files in volume */
+ UINT32BE dirCnt; /* number of directories in volume */
+ UINT8 fndrInfo[32]; /* information used by the Finder */
union
{
struct
{
- UINT16BE VCSize; /* size (in blocks) of volume cache */
- UINT16BE VBMCSize; /* size (in blocks) of volume bitmap cache */
- UINT16BE ctlCSize; /* size (in blocks) of common volume cache */
+ UINT16BE VCSize; /* size (in blocks) of volume cache */
+ UINT16BE VBMCSize; /* size (in blocks) of volume bitmap cache */
+ UINT16BE ctlCSize; /* size (in blocks) of common volume cache */
};
struct
{
- UINT16BE embedSigWord; /* embedded volume signature */
- hfs_extent embedExtent; /* embedded volume location and size */
+ UINT16BE embedSigWord; /* embedded volume signature */
+ hfs_extent embedExtent; /* embedded volume location and size */
} v2;
} u;
- UINT32BE xtFlSize; /* size (in bytes) of extents overflow file */
- hfs_extent_3 xtExtRec; /* extent record for extents overflow file */
- UINT32BE ctFlSize; /* size (in bytes) of catalog file */
- hfs_extent_3 ctExtRec; /* extent record for catalog file */
+ UINT32BE xtFlSize; /* size (in bytes) of extents overflow file */
+ hfs_extent_3 xtExtRec; /* extent record for extents overflow file */
+ UINT32BE ctFlSize; /* size (in bytes) of catalog file */
+ hfs_extent_3 ctExtRec; /* extent record for catalog file */
};
/* to save a little stack space, we use the same buffer for MDB and next blocks */
@@ -1010,22 +1010,22 @@ union img_open_buf
*/
struct mac_dirent
{
- UINT16 dataRecType; /* type of data record */
+ UINT16 dataRecType; /* type of data record */
- mac_FInfo flFinderInfo; /* information used by the Finder */
- mac_FXInfo flXFinderInfo; /* information used by the Finder */
+ mac_FInfo flFinderInfo; /* information used by the Finder */
+ mac_FXInfo flXFinderInfo; /* information used by the Finder */
- UINT8 flags; /* bit 0=1 if file locked */
+ UINT8 flags; /* bit 0=1 if file locked */
- UINT32 fileID; /* file ID in directory/catalog */
+ UINT32 fileID; /* file ID in directory/catalog */
- UINT32 dataLogicalSize; /* logical EOF of data fork */
- UINT32 dataPhysicalSize; /* physical EOF of data fork */
- UINT32 rsrcLogicalSize; /* logical EOF of resource fork */
- UINT32 rsrcPhysicalSize; /* physical EOF of resource fork */
+ UINT32 dataLogicalSize; /* logical EOF of data fork */
+ UINT32 dataPhysicalSize; /* physical EOF of data fork */
+ UINT32 rsrcLogicalSize; /* logical EOF of resource fork */
+ UINT32 rsrcPhysicalSize; /* physical EOF of resource fork */
- UINT32 createDate; /* date and time of creation */
- UINT32 modifyDate; /* date and time of last modification */
+ UINT32 createDate; /* date and time of creation */
+ UINT32 modifyDate; /* date and time of last modification */
};
/*
@@ -1035,21 +1035,21 @@ struct mac_dirent
*/
struct floppy_tag_record
{
- UINT32BE fileID; /* a.k.a. CNID */
+ UINT32BE fileID; /* a.k.a. CNID */
/* a value of 1 seems to be the default for non-AB blocks, but this is not consistent */
- UINT8 ftype; /* bit 1 = 1 if resource fork */
+ UINT8 ftype; /* bit 1 = 1 if resource fork */
/* bit 0 = 1 if block is allocated to user file (i.e. it is not
- in HFS extent & catalog, and not in non-AB blocks such
- as MDB and MFS directory)??? */
+ in HFS extent & catalog, and not in non-AB blocks such
+ as MDB and MFS directory)??? */
/* bit 7 seems to be used, but I don't know what it means */
/* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */
- UINT8 fattr; /* bit 0 = 1 if locked(?) */
+ UINT8 fattr; /* bit 0 = 1 if locked(?) */
/* a value of $FF seems to be the default for non-AB blocks, but this is not consistent */
- UINT16BE fblock; /* relative file block number (enough for any volume up to 32 MBytes in size) */
- UINT32BE wrCnt; /* MFS: date and time of last write */
+ UINT16BE fblock; /* relative file block number (enough for any volume up to 32 MBytes in size) */
+ UINT32BE wrCnt; /* MFS: date and time of last write */
/* HFS: seems related to the wrCnt field in the mdb, i.e.
- each time a volume is written to, the current value of
- wrCnt is written in the tag field, then it is incremented */
+ each time a volume is written to, the current value of
+ wrCnt is written in the tag field, then it is incremented */
/* (DV17 says "disk block number", but it cannot be true) */
};
@@ -1322,7 +1322,7 @@ static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, UINT32 len, cons
break;
case L2I_HFS:
- /*set_UINT32BE(&tag.wrCnt, ++fileref->l2_img.u.hfs.wrCnt);*/ /* ***TODO*** */
+ /*set_UINT32BE(&tag.wrCnt, ++fileref->l2_img.u.hfs.wrCnt);*/ /* ***TODO*** */
break;
}
@@ -1454,30 +1454,30 @@ static imgtoolerr_t mac_file_seteof(struct mac_fileref *fileref, UINT32 newEof)
*/
struct mfs_dir_entry
{
- UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */
+ UINT8 flags; /* bit 7=1 if entry used, bit 0=1 if file locked */
/* 0x00 means end of block: if we are not done
- with reading the directory, the remnants will
- be read from next block */
- UINT8 flVersNum; /* version number (usually 0x00, but I don't
+ with reading the directory, the remnants will
+ be read from next block */
+ UINT8 flVersNum; /* version number (usually 0x00, but I don't
have the IM volume that describes it) */
- mac_FInfo flFinderInfo; /* information used by the Finder */
+ mac_FInfo flFinderInfo; /* information used by the Finder */
- UINT32BE fileID; /* file ID */
+ UINT32BE fileID; /* file ID */
- UINT16BE dataStartBlock; /* first allocation block of data fork */
- UINT32BE dataLogicalSize; /* logical EOF of data fork */
- UINT32BE dataPhysicalSize; /* physical EOF of data fork */
- UINT16BE rsrcStartBlock; /* first allocation block of resource fork */
- UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */
- UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */
+ UINT16BE dataStartBlock; /* first allocation block of data fork */
+ UINT32BE dataLogicalSize; /* logical EOF of data fork */
+ UINT32BE dataPhysicalSize; /* physical EOF of data fork */
+ UINT16BE rsrcStartBlock; /* first allocation block of resource fork */
+ UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */
+ UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */
- UINT32BE createDate; /* date and time of creation */
- UINT32BE modifyDate; /* date and time of last modification */
+ UINT32BE createDate; /* date and time of creation */
+ UINT32BE modifyDate; /* date and time of last modification */
- UINT8 name[1]; /* first char is length of file name */
+ UINT8 name[1]; /* first char is length of file name */
/* next chars are file name - 255 chars at most */
/* IIRC, Finder 7 only supports 31 chars,
- wheareas earlier versions support 63 chars */
+ wheareas earlier versions support 63 chars */
};
/*
@@ -1489,37 +1489,37 @@ struct mfs_dir_entry
*/
struct mfs_FOBJ
{
- UINT8 unknown0[2]; /* $00: $0004 for disk, $0008 for folder??? */
- mac_point location; /* $02: location in parent window */
- UINT8 unknown1[4]; /* $06: ??? */
- UINT8 view; /* $0A: manner in which folders are displayed??? */
- UINT8 unknown2; /* $0B: ??? */
- UINT16BE par_fldr; /* $0C: parent folder ID */
- UINT8 unknown3[10]; /* $0E: ??? */
- UINT16BE unknown4; /* $18: ??? */
- UINT32BE createDate; /* $1A: date and time of creation */
- UINT32BE modifyDate; /* $1E: date and time of last modification */
- UINT16BE unknown5; /* $22: put-away folder ID?????? */
- UINT8 unknown6[8]; /* $24: ??? */
- mac_rect bounds; /* $2C: window bounds */
- mac_point scroll; /* $34: current scroll offset??? */
+ UINT8 unknown0[2]; /* $00: $0004 for disk, $0008 for folder??? */
+ mac_point location; /* $02: location in parent window */
+ UINT8 unknown1[4]; /* $06: ??? */
+ UINT8 view; /* $0A: manner in which folders are displayed??? */
+ UINT8 unknown2; /* $0B: ??? */
+ UINT16BE par_fldr; /* $0C: parent folder ID */
+ UINT8 unknown3[10]; /* $0E: ??? */
+ UINT16BE unknown4; /* $18: ??? */
+ UINT32BE createDate; /* $1A: date and time of creation */
+ UINT32BE modifyDate; /* $1E: date and time of last modification */
+ UINT16BE unknown5; /* $22: put-away folder ID?????? */
+ UINT8 unknown6[8]; /* $24: ??? */
+ mac_rect bounds; /* $2C: window bounds */
+ mac_point scroll; /* $34: current scroll offset??? */
union
- { /* I think there are two versions of the structure */
+ { /* I think there are two versions of the structure */
struct
{
- UINT16BE item_count; /* number of items (folders and files) in
+ UINT16BE item_count; /* number of items (folders and files) in
this folder */
- UINT32BE item_descs[1]; /* this variable-length array has
+ UINT32BE item_descs[1]; /* this variable-length array has
item_count entries - meaning of entry is unknown */
} v1;
struct
{
- UINT16BE zerofill; /* always 0? */
- UINT16BE unknown0; /* always 0??? */
- UINT16BE item_count; /* number of items (folders and files) in
+ UINT16BE zerofill; /* always 0? */
+ UINT16BE unknown0; /* always 0??? */
+ UINT16BE item_count; /* number of items (folders and files) in
this folder */
- UINT8 unknown1[20]; /* ??? */
- UINT8 name[1]; /* variable-length macintosh string */
+ UINT8 unknown1[20]; /* ??? */
+ UINT8 name[1]; /* variable-length macintosh string */
} v2;
} u;
};
@@ -1529,11 +1529,11 @@ struct mfs_FOBJ
*/
struct mfs_dirref
{
- struct mac_l2_imgref *l2_img; /* image pointer */
- UINT16 index; /* current file index in the disk directory */
- UINT16 cur_block; /* current block offset in directory file */
- UINT16 cur_offset; /* current byte offset in current block of directory file */
- UINT8 block_buffer[512]; /* buffer with current directory block */
+ struct mac_l2_imgref *l2_img; /* image pointer */
+ UINT16 index; /* current file index in the disk directory */
+ UINT16 cur_block; /* current block offset in directory file */
+ UINT16 cur_offset; /* current byte offset in current block of directory file */
+ UINT8 block_buffer[512]; /* buffer with current directory block */
};
@@ -1566,20 +1566,20 @@ static imgtoolerr_t mfs_image_create(imgtool_image *image, imgtool_stream *strea
/* write master directory block */
memset(buffer, 0, sizeof(buffer));
- place_integer_be(buffer, 0, 2, 0xd2d7); /* signature */
- place_integer_be(buffer, 2, 4, mac_time_now()); /* creation date */
- place_integer_be(buffer, 6, 4, mac_time_now()); /* last modified date */
- place_integer_be(buffer, 10, 2, 0); /* volume attributes */
- place_integer_be(buffer, 12, 2, 0); /* number of files in directory */
- place_integer_be(buffer, 14, 2, 4); /* first block of directory */
- place_integer_be(buffer, 16, 2, 12); /* length of directory in blocks */
- place_integer_be(buffer, 18, 2, total_allocation_blocks); /* allocation blocks on volume count */
- place_integer_be(buffer, 20, 4, allocation_block_size); /* allocation block size */
- place_integer_be(buffer, 24, 4, 8192); /* default clumping size */
- place_integer_be(buffer, 28, 2, 16); /* first allocation block on volume */
- place_integer_be(buffer, 30, 4, 2); /* next unused catalog node */
- place_integer_be(buffer, 34, 2, free_allocation_blocks); /* free allocation block count */
- pascal_from_c_string(&buffer[36], 28, "Untitled"); /* volume title */
+ place_integer_be(buffer, 0, 2, 0xd2d7); /* signature */
+ place_integer_be(buffer, 2, 4, mac_time_now()); /* creation date */
+ place_integer_be(buffer, 6, 4, mac_time_now()); /* last modified date */
+ place_integer_be(buffer, 10, 2, 0); /* volume attributes */
+ place_integer_be(buffer, 12, 2, 0); /* number of files in directory */
+ place_integer_be(buffer, 14, 2, 4); /* first block of directory */
+ place_integer_be(buffer, 16, 2, 12); /* length of directory in blocks */
+ place_integer_be(buffer, 18, 2, total_allocation_blocks); /* allocation blocks on volume count */
+ place_integer_be(buffer, 20, 4, allocation_block_size); /* allocation block size */
+ place_integer_be(buffer, 24, 4, 8192); /* default clumping size */
+ place_integer_be(buffer, 28, 2, 16); /* first allocation block on volume */
+ place_integer_be(buffer, 30, 4, 2); /* next unused catalog node */
+ place_integer_be(buffer, 34, 2, free_allocation_blocks); /* free allocation block count */
+ pascal_from_c_string(&buffer[36], 28, "Untitled"); /* volume title */
err = image_write_block(&get_imgref(image)->l1_img, 2, buffer);
if (err)
@@ -1711,7 +1711,7 @@ static imgtoolerr_t mfs_update_mdb(struct mac_l2_imgref *l2_img)
return err;
set_UINT16BE(&buf.mfs_mdb.nmFls, l2_img->u.mfs.dir_num_files);
-#if 0 /* these fields are never changed */
+#if 0 /* these fields are never changed */
set_UINT16BE(&buf.mfs_mdb.dirSt, l2_img->u.mfs.dir_start);
set_UINT16BE(&buf.mfs_mdb.blLn, l2_img->u.mfs.dir_blk_len);
@@ -1724,7 +1724,7 @@ static imgtoolerr_t mfs_update_mdb(struct mac_l2_imgref *l2_img)
set_UINT16BE(&buf.mfs_mdb.freeABs, l2_img->freeABs);
-#if 0 /* these fields are never changed */
+#if 0 /* these fields are never changed */
mac_strcpy(buf.mfs_mdb.VN, l2_img->u.mfs.volname);
#endif
@@ -1908,7 +1908,7 @@ static imgtoolerr_t mfs_dir_insert(struct mac_l2_imgref *l2_img, mfs_dirref *dir
dirref->cur_offset = 0;
cur_dir_entry = (mfs_dir_entry *) (dirref->block_buffer + dirref->cur_offset);
while ((dirref->cur_offset < 512) && (cur_dir_entry->flags & 0x80))
- { /* skip cur_dir_entry */
+ { /* skip cur_dir_entry */
cur_dir_entry_len = offsetof(mfs_dir_entry, name) + cur_dir_entry->name[0] + 1;
/* update offset in block */
dirref->cur_offset += cur_dir_entry_len;
@@ -1997,7 +1997,7 @@ static imgtoolerr_t mfs_dir_update(struct mac_fileref *fileref)
while ((cur_offset < 512) && (cur_dir_entry->flags & 0x80))
{
if (get_UINT32BE(cur_dir_entry->fileID) == fileref->fileID)
- { /* found it: update directory entry */
+ { /* found it: update directory entry */
switch (fileref->forkType)
{
case data_fork:
@@ -2063,7 +2063,7 @@ static imgtoolerr_t mfs_find_dir_entry(mfs_dirref *dirref, const mac_str255 file
/* EOF */
break;
if ((! mac_stricmp(filename, cur_dir_entry->name)) && (cur_dir_entry->flVersNum == 0))
- { /* file found */
+ { /* file found */
if (dir_entry)
*dir_entry = cur_dir_entry;
@@ -2322,7 +2322,7 @@ static imgtoolerr_t mfs_file_get_nth_block_address(struct mac_fileref *fileref,
AB_address = mfs_get_ABlink(fileref->l2_img, AB_address);
if ((AB_address == 0) || (AB_address >= fileref->l2_img->numABs+2))
/* 0 -> empty block: there is no way an empty block could make it
- into the link chain!!! */
+ into the link chain!!! */
return IMGTOOLERR_CORRUPTIMAGE;
if (AB_address == 1)
/* EOF */
@@ -2402,7 +2402,7 @@ corrupt_free_block:
return IMGTOOLERR_NOSPACE;
if (fileref->mfs.stBlk != 1)
- { /* try to extend last file extent */
+ { /* try to extend last file extent */
/* append free ABs after last AB */
for (i=lastAB+1; (mfs_get_ABlink(fileref->l2_img, i) == 0) && (allocABs > 0) && (i < numABs); i++)
{
@@ -2437,7 +2437,7 @@ corrupt_free_block2:
{
mfs_set_ABlink(fileref->l2_img, lastAB, 1);
fileref->l2_img->freeABs = free_ABs;
- return IMGTOOLERR_SUCCESS; /* done */
+ return IMGTOOLERR_SUCCESS; /* done */
}
}
@@ -2449,7 +2449,7 @@ corrupt_free_block2:
for (i=0; i<numABs; i++)
{
if (mfs_get_ABlink(fileref->l2_img, i) == 0)
- { /* found one free block */
+ { /* found one free block */
/* compute its length */
extentBaseAB = i;
extentABlen = 0;
@@ -2497,7 +2497,7 @@ corrupt_free_block3:
}
if (firstBestExtentABlen != INT_MAX)
- { /* found one contiguous block which can hold it all */
+ { /* found one contiguous block which can hold it all */
extentABlen = allocABs;
for (i=0; i<allocABs; i++)
{
@@ -2514,7 +2514,7 @@ corrupt_free_block3:
tag.ftype = 1;
if ((fileref->forkType) == rsrc_fork)
tag.ftype |= 2;
- tag.fattr = /*fattr*/ 0; /* ***TODO*** */
+ tag.fattr = /*fattr*/ 0; /* ***TODO*** */
for (j=0; j<fileref->l2_img->blocksperAB; j++)
{
set_UINT16BE(&tag.fblock, fblock & 0xffff);
@@ -2533,10 +2533,10 @@ corrupt_free_block3:
allocABs = 0;
mfs_set_ABlink(fileref->l2_img, lastAB, 1);
fileref->l2_img->freeABs = free_ABs;
- /*return IMGTOOLERR_SUCCESS;*/ /* done */
+ /*return IMGTOOLERR_SUCCESS;*/ /* done */
}
else if (secondBestExtentABlen != 0)
- { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
+ { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
for (i=0; i<secondBestExtentABlen; i++)
{
if (fileref->mfs.stBlk != 1)
@@ -2552,7 +2552,7 @@ corrupt_free_block3:
tag.ftype = 1;
if ((fileref->forkType) == rsrc_fork)
tag.ftype |= 2;
- tag.fattr = /*fattr*/ 0; /* ***TODO*** */
+ tag.fattr = /*fattr*/ 0; /* ***TODO*** */
for (j=0; j<fileref->l2_img->blocksperAB; j++)
{
set_UINT16BE(&tag.fblock, fblock & 0xffff);
@@ -2573,7 +2573,7 @@ corrupt_free_block3:
else
{
mfs_set_ABlink(fileref->l2_img, lastAB, 1);
- return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
+ return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
}
}
@@ -2613,7 +2613,7 @@ static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABe
AB_link = mfs_get_ABlink(fileref->l2_img, AB_address);
if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2))
/* 0 -> empty block: there is no way an empty block could make it
- into the link chain!!! */
+ into the link chain!!! */
return IMGTOOLERR_CORRUPTIMAGE;
if (TAG_CHECKS)
@@ -2639,7 +2639,7 @@ static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABe
}
if (i == newABeof)
- { /* new EOF is shorter than old one */
+ { /* new EOF is shorter than old one */
/* mark new eof */
if (i==0)
fileref->mfs.stBlk = 1;
@@ -2655,10 +2655,10 @@ static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABe
AB_address = AB_link - 2;
AB_link = mfs_get_ABlink(fileref->l2_img, AB_address);
if ((AB_link == 0) || (AB_link >= fileref->l2_img->numABs+2))
- { /* 0 -> empty block: there is no way an empty block could make
+ { /* 0 -> empty block: there is no way an empty block could make
it into the link chain!!! */
if (MDB_dirty)
- { /* update MDB (freeABs field) and ABLink array */
+ { /* update MDB (freeABs field) and ABLink array */
err = mfs_update_mdb(fileref->l2_img);
if (err)
return err;
@@ -2705,7 +2705,7 @@ static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABe
}
}
else
- { /* new EOF is larger than old one */
+ { /* new EOF is larger than old one */
err = mfs_file_allocABs(fileref, AB_address, newABeof - i, i * fileref->l2_img->blocksperAB);
if (err)
return err;
@@ -2713,7 +2713,7 @@ static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, UINT32 newABe
}
if (MDB_dirty)
- { /* update MDB (freeABs field) and ABLink array */
+ { /* update MDB (freeABs field) and ABLink array */
err = mfs_update_mdb(fileref->l2_img);
if (err)
return err;
@@ -2772,10 +2772,10 @@ static int mfs_hashString(const mac_str255 string)
*/
struct hfs_extentKey
{
- UINT8 keyLength; /* length of key, excluding this field */
- UINT8 forkType; /* 0 = data fork, FF = resource fork */
- UINT32BE fileID; /* file ID */
- UINT16BE startBlock; /* first file allocation block number in this extent */
+ UINT8 keyLength; /* length of key, excluding this field */
+ UINT8 forkType; /* 0 = data fork, FF = resource fork */
+ UINT32BE fileID; /* file ID */
+ UINT16BE startBlock; /* first file allocation block number in this extent */
};
enum
{
@@ -2787,12 +2787,12 @@ enum
*/
struct hfs_catKey
{
- UINT8 keyLen; /* key length */
- UINT8 resrv1; /* reserved */
- UINT32BE parID; /* parent directory ID */
- mac_str31 cName; /* catalog node name */
+ UINT8 keyLen; /* key length */
+ UINT8 resrv1; /* reserved */
+ UINT32BE parID; /* parent directory ID */
+ mac_str31 cName; /* catalog node name */
/* note that in index nodes, it is a mac_str31, but
- in leaf keys it's a variable-length string */
+ in leaf keys it's a variable-length string */
};
/*
@@ -2800,16 +2800,16 @@ struct hfs_catKey
*/
struct hfs_catFolderData
{
- UINT16BE recordType; /* record type */
- UINT16BE flags; /* folder flags */
- UINT16BE valence; /* folder valence */
- UINT32BE folderID; /* folder ID */
- UINT32BE createDate; /* date and time of creation */
- UINT32BE modifyDate; /* date and time of last modification */
- UINT32BE backupDate; /* date and time of last backup */
- mac_DInfo userInfo; /* Finder information */
- mac_DXInfo finderInfo; /* additional Finder information */
- UINT32BE reserved[4]; /* reserved - set to zero */
+ UINT16BE recordType; /* record type */
+ UINT16BE flags; /* folder flags */
+ UINT16BE valence; /* folder valence */
+ UINT32BE folderID; /* folder ID */
+ UINT32BE createDate; /* date and time of creation */
+ UINT32BE modifyDate; /* date and time of last modification */
+ UINT32BE backupDate; /* date and time of last backup */
+ mac_DInfo userInfo; /* Finder information */
+ mac_DXInfo finderInfo; /* additional Finder information */
+ UINT32BE reserved[4]; /* reserved - set to zero */
};
/*
@@ -2817,25 +2817,25 @@ struct hfs_catFolderData
*/
struct hfs_catFileData
{
- UINT16BE recordType; /* record type */
- UINT8 flags; /* file flags */
- UINT8 fileType; /* file type (reserved, always 0?) */
- mac_FInfo userInfo; /* Finder information */
- UINT32BE fileID; /* file ID */
- UINT16BE dataStartBlock; /* not used - set to zero */
- UINT32BE dataLogicalSize; /* logical EOF of data fork */
- UINT32BE dataPhysicalSize; /* physical EOF of data fork */
- UINT16BE rsrcStartBlock; /* not used - set to zero */
- UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */
- UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */
- UINT32BE createDate; /* date and time of creation */
- UINT32BE modifyDate; /* date and time of last modification */
- UINT32BE backupDate; /* date and time of last backup */
- mac_FXInfo finderInfo; /* additional Finder information */
- UINT16BE clumpSize; /* file clump size (not used) */
- hfs_extent_3 dataExtents; /* first data fork extent record */
- hfs_extent_3 rsrcExtents; /* first resource fork extent record */
- UINT32BE reserved; /* reserved - set to zero */
+ UINT16BE recordType; /* record type */
+ UINT8 flags; /* file flags */
+ UINT8 fileType; /* file type (reserved, always 0?) */
+ mac_FInfo userInfo; /* Finder information */
+ UINT32BE fileID; /* file ID */
+ UINT16BE dataStartBlock; /* not used - set to zero */
+ UINT32BE dataLogicalSize; /* logical EOF of data fork */
+ UINT32BE dataPhysicalSize; /* physical EOF of data fork */
+ UINT16BE rsrcStartBlock; /* not used - set to zero */
+ UINT32BE rsrcLogicalSize; /* logical EOF of resource fork */
+ UINT32BE rsrcPhysicalSize; /* physical EOF of resource fork */
+ UINT32BE createDate; /* date and time of creation */
+ UINT32BE modifyDate; /* date and time of last modification */
+ UINT32BE backupDate; /* date and time of last backup */
+ mac_FXInfo finderInfo; /* additional Finder information */
+ UINT16BE clumpSize; /* file clump size (not used) */
+ hfs_extent_3 dataExtents; /* first data fork extent record */
+ hfs_extent_3 rsrcExtents; /* first resource fork extent record */
+ UINT32BE reserved; /* reserved - set to zero */
};
/*
@@ -2846,10 +2846,10 @@ struct hfs_catFileData
*/
struct hfs_catThreadData
{
- UINT16BE recordType; /* record type */
- UINT32BE reserved[2]; /* reserved - set to zero */
- UINT32BE parID; /* parent ID for this catalog node */
- mac_str31 nodeName; /* name of this catalog node */
+ UINT16BE recordType; /* record type */
+ UINT32BE reserved[2]; /* reserved - set to zero */
+ UINT32BE parID; /* parent ID for this catalog node */
+ mac_str31 nodeName; /* name of this catalog node */
};
/*
@@ -2868,10 +2868,10 @@ union hfs_catData
*/
enum
{
- hcrt_Folder = 0x0100, /* Folder record */
- hcrt_File = 0x0200, /* File record */
- hcrt_FolderThread = 0x0300, /* Folder thread record */
- hcrt_FileThread = 0x0400 /* File thread record */
+ hcrt_Folder = 0x0100, /* Folder record */
+ hcrt_File = 0x0200, /* File record */
+ hcrt_FolderThread = 0x0300, /* Folder thread record */
+ hcrt_FileThread = 0x0400 /* File thread record */
};
/*
@@ -2883,8 +2883,8 @@ enum
*/
enum
{
- cfrf_fileLocked = 0x01, /* file is locked and cannot be written to */
- cfrf_threadExists = 0x02 /* a file thread record exists for this file */
+ cfrf_fileLocked = 0x01, /* file is locked and cannot be written to */
+ cfrf_threadExists = 0x02 /* a file thread record exists for this file */
};
/*
@@ -3076,10 +3076,10 @@ static imgtoolerr_t hfs_image_open(imgtool_image *image, imgtool_stream *stream)
if ((l2_img->u.hfs.extents_BT.attributes & btha_bigKeysMask)
/*|| (l2_img->u.hfs.extents_BT.attributes & kBTVariableIndexKeysMask)*/
|| (l2_img->u.hfs.extents_BT.maxKeyLength != 7))
- { /* This is not supported by the HFS format */
+ { /* This is not supported by the HFS format */
/* Variable Index keys are not supported either, but hopefully it will
- not break this imgtool module if it set (though it would probably break
- a real macintosh) */
+ not break this imgtool module if it set (though it would probably break
+ a real macintosh) */
BT_close(&l2_img->u.hfs.extents_BT);
return IMGTOOLERR_CORRUPTIMAGE;
}
@@ -3097,10 +3097,10 @@ static imgtoolerr_t hfs_image_open(imgtool_image *image, imgtool_stream *stream)
if ((l2_img->u.hfs.cat_BT.attributes & btha_bigKeysMask)
/*|| (l2_img->u.hfs.cat_BT.attributes & kBTVariableIndexKeysMask)*/
|| (l2_img->u.hfs.cat_BT.maxKeyLength != 37))
- { /* This is not supported by the HFS format */
+ { /* This is not supported by the HFS format */
/* Variable Index keys are not supported either, but hopefully it will
- not break this imgtool module if it set (though it would probably break
- a real macintosh) */
+ not break this imgtool module if it set (though it would probably break
+ a real macintosh) */
BT_close(&l2_img->u.hfs.extents_BT);
BT_close(&l2_img->u.hfs.cat_BT);
return IMGTOOLERR_CORRUPTIMAGE;
@@ -3317,7 +3317,7 @@ static imgtoolerr_t hfs_cat_search(struct mac_l2_imgref *l2_img, UINT32 parID, c
return IMGTOOLERR_UNEXPECTED;
/* generate search key */
- search_key.keyLen = search_key.resrv1 = 0; /* these fields do not matter
+ search_key.keyLen = search_key.resrv1 = 0; /* these fields do not matter
to the compare function, so we
don't fill them */
set_UINT32BE(&search_key.parID, parID);
@@ -3366,7 +3366,7 @@ static imgtoolerr_t hfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fp
/* iterate each path element */
element_start = fpath;
//level = 0;
- *parID = 2; /* root parID is 2 */
+ *parID = 2; /* root parID is 2 */
while(*element_start)
{
@@ -3556,8 +3556,8 @@ static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref,
set_UINT16BE(&search_key.startBlock, AB_num);
/* search for the record with the largest key lower than or equal to
- search_key. The keys are constructed in such a way that, if a record
- includes AB_num, it is that one. */
+ search_key. The keys are constructed in such a way that, if a record
+ includes AB_num, it is that one. */
err = BT_search_leaf_rec(&fileref->l2_img->u.hfs.extents_BT, &search_key,
NULL, NULL, &extents_BT_rec, &extents_BT_rec_len,
FALSE, NULL);
@@ -3642,14 +3642,14 @@ static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref,
*/
struct BTNodeHeader
{
- UINT32BE fLink; /* (index of) next node at this level */
- UINT32BE bLink; /* (index of) previous node at this level */
- UINT8 kind; /* kind of node (leaf, index, header, map) */
- UINT8 height; /* zero for header, map; 1 for leaf, 2 through
+ UINT32BE fLink; /* (index of) next node at this level */
+ UINT32BE bLink; /* (index of) previous node at this level */
+ UINT8 kind; /* kind of node (leaf, index, header, map) */
+ UINT8 height; /* zero for header, map; 1 for leaf, 2 through
treeDepth for index (child is one LESS than
parent, whatever IM says) */
- UINT16BE numRecords; /* number of records in this node */
- UINT16BE reserved; /* reserved; set to zero */
+ UINT16BE numRecords; /* number of records in this node */
+ UINT16BE reserved; /* reserved; set to zero */
};
/*
@@ -3657,14 +3657,14 @@ struct BTNodeHeader
*/
enum
{
- btnk_leafNode = 0xff, /* leaf nodes hold the actual user data records
+ btnk_leafNode = 0xff, /* leaf nodes hold the actual user data records
with keys and data */
- btnk_indexNode = 0, /* root and branch node that enable to efficiently
+ btnk_indexNode = 0, /* root and branch node that enable to efficiently
search the leaf nodes for a specific key value */
- btnk_headerNode = 1, /* unique node with b-tree information, pointer to
+ btnk_headerNode = 1, /* unique node with b-tree information, pointer to
root node and start of the node allocation
bitmap */
- btnk_mapNode = 2 /* map nodes are created when the node allocation
+ btnk_mapNode = 2 /* map nodes are created when the node allocation
bitmap outgrows the header node */
};
@@ -3674,25 +3674,25 @@ enum
*/
struct BTHeaderRecord
{
- UINT16BE treeDepth; /* maximum height (usually leaf nodes) */
- UINT32BE rootNode; /* node number of root node */
- UINT32BE leafRecords; /* number of leaf records in all leaf nodes */
- UINT32BE firstLeafNode; /* node number of first leaf node */
- UINT32BE lastLeafNode; /* node number of last leaf node */
- UINT16BE nodeSize; /* size of a node, in bytes */
- UINT16BE maxKeyLength; /* maximum length of data (index + leaf) record keys;
+ UINT16BE treeDepth; /* maximum height (usually leaf nodes) */
+ UINT32BE rootNode; /* node number of root node */
+ UINT32BE leafRecords; /* number of leaf records in all leaf nodes */
+ UINT32BE firstLeafNode; /* node number of first leaf node */
+ UINT32BE lastLeafNode; /* node number of last leaf node */
+ UINT16BE nodeSize; /* size of a node, in bytes */
+ UINT16BE maxKeyLength; /* maximum length of data (index + leaf) record keys;
length of all index record keys if
btha_variableIndexKeysMask attribute flag is not set */
- UINT32BE totalNodes; /* total number of nodes in tree */
- UINT32BE freeNodes; /* number of unused (free) nodes in tree */
+ UINT32BE totalNodes; /* total number of nodes in tree */
+ UINT32BE freeNodes; /* number of unused (free) nodes in tree */
- UINT16BE reserved1; /* unused */
- UINT32BE clumpSize; /* used in some HFS implementations? (reserved in
+ UINT16BE reserved1; /* unused */
+ UINT32BE clumpSize; /* used in some HFS implementations? (reserved in
early HFS implementations, and in HFS Plus) */
- UINT8 btreeType; /* reserved - set to 0 */
- UINT8 reserved2; /* reserved */
- UINT32BE attributes; /* persistent attributes about the tree */
- UINT32BE reserved3[16]; /* reserved */
+ UINT8 btreeType; /* reserved - set to 0 */
+ UINT8 reserved2; /* reserved */
+ UINT32BE attributes; /* persistent attributes about the tree */
+ UINT32BE reserved3[16]; /* reserved */
};
static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent);
@@ -3732,12 +3732,12 @@ static imgtoolerr_t BT_open(mac_BTref *BTref, int (*key_compare_func)(const void
if ((node_header.kind != btnk_headerNode) || (get_UINT16BE(node_header.numRecords) < 3)
|| (node_header.height != 0))
- return IMGTOOLERR_CORRUPTIMAGE; /* right??? */
+ return IMGTOOLERR_CORRUPTIMAGE; /* right??? */
/* CHEESY HACK: we assume that the header record immediately follows the
- node header. This is because we need to know the node length to know where
- the record pointers are located, but we need to read the header record to
- know the node length. */
+ node header. This is because we need to know the node length to know where
+ the record pointers are located, but we need to read the header record to
+ know the node length. */
err = mac_file_read(&BTref->fileref, sizeof(header_rec), &header_rec);
if (err)
return err;
@@ -3983,7 +3983,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
UINT32 run_bit_len;
UINT32 actualFreeNodes;
imgtoolerr_t err;
- UINT32 maxExtentAB = 0, maxExtentNode = 0, extentEOL = 0; /* if is_extent is TRUE */
+ UINT32 maxExtentAB = 0, maxExtentNode = 0, extentEOL = 0; /* if is_extent is TRUE */
if (is_extent)
{
@@ -4070,7 +4070,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
goto bail;
}
for (i=0; i<BTref->treeDepth; i++)
- data_nodes[i].buf = NULL; /* required for function postlog to work should next loop fail */
+ data_nodes[i].buf = NULL; /* required for function postlog to work should next loop fail */
for (i=0; i<BTref->treeDepth; i++)
{
data_nodes[i].buf = malloc(BTref->nodeSize);
@@ -4093,14 +4093,14 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
}
/* check that node has not been used for another purpose */
/* this check is unecessary because the current consistency checks
- that forward and back linking match and that node height is correct
- are enough to detect such errors */
+ that forward and back linking match and that node height is correct
+ are enough to detect such errors */
#if 0
if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7)))
- {
- err = IMGTOOLERR_CORRUPTIMAGE;
- goto bail;
- }
+ {
+ err = IMGTOOLERR_CORRUPTIMAGE;
+ goto bail;
+ }
#endif
/* add node in bitmap */
bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7));
@@ -4152,7 +4152,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
}
/* check that a) the root node has no successor, and b) that we have really
- read the first leaf node */
+ read the first leaf node */
if (get_UINT32BE(((BTNodeHeader *) data_nodes[BTref->treeDepth-1].buf)->fLink)
|| (cur_node != BTref->firstLeafNode))
{
@@ -4210,7 +4210,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
goto bail;
}
/* next test is not necessary because we have checked that
- the root node has no successor */
+ the root node has no successor */
#if 0
if (i < BTref->treeDepth-1)
{
@@ -4231,7 +4231,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
if (is_extent && !extentEOL)
{
/* extract current leaf record and update maxExtentAB and
- maxExtentNode */
+ maxExtentNode */
hfs_extentKey *extentKey;
hfs_extent *extentData;
@@ -4244,11 +4244,11 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
if ((extentKey->keyLength < 7) || (extentKey->forkType != 0) || (get_UINT32BE(extentKey->fileID) != 3)
|| (get_UINT16BE(extentKey->startBlock) != maxExtentAB))
/* the key is corrupt or does not concern the extent
- B-tree: set the extentEOL flag so that we stop looking for
- further extent records for the extent B-tree */
+ B-tree: set the extentEOL flag so that we stop looking for
+ further extent records for the extent B-tree */
extentEOL = TRUE;
else
- { /* this key concerns the extent B-tree: update maxExtentAB
+ { /* this key concerns the extent B-tree: update maxExtentAB
and maxExtentNode */
/* extract record data ptr */
err = BT_get_keyed_record_data(BTref, rec1, rec1_len, &rec1_data, &rec1_data_len);
@@ -4256,8 +4256,8 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
goto bail;
if (rec1_data_len < sizeof(hfs_extent)*3)
/* the record is corrupt: set the extentEOL flag so
- that we stop looking for further extent records for the
- extent B-tree */
+ that we stop looking for further extent records for the
+ extent B-tree */
extentEOL = TRUE;
else
{
@@ -4273,7 +4273,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
{
/* check that the extent B-Tree has been defined entirely */
if (maxExtentNode < totalNodes)
- { /* no good */
+ { /* no good */
err = IMGTOOLERR_CORRUPTIMAGE;
goto bail;
}
@@ -4306,7 +4306,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
{
i--;
if (i>0)
- { /* extract first record of root if it is an index node */
+ { /* extract first record of root if it is an index node */
err = BT_node_get_keyed_record(BTref, data_nodes[i].buf, TRUE, data_nodes[i].cur_rec, &rec1, &rec1_len);
if (err)
goto bail;
@@ -4341,7 +4341,7 @@ static imgtoolerr_t BT_check(mac_BTref *BTref, int is_extent)
cur_node = get_UINT32BE(* (UINT32BE *)rec1_data);
/* compare node index with data of current record of upper
- level */
+ level */
if (cur_node != data_nodes[i].node_num)
{
err = IMGTOOLERR_CORRUPTIMAGE;
@@ -4378,7 +4378,7 @@ end_of_list:
}
/* check map node chain */
- cur_node = 0; /* node 0 is the header node... */
+ cur_node = 0; /* node 0 is the header node... */
bitmap[0] |= 0x80;
/* check back linking */
if (get_UINT32BE(((BTNodeHeader *) BTref->node_buf)->bLink))
@@ -4394,14 +4394,14 @@ end_of_list:
prev_node = cur_node;
/* check that node has not been used for another purpose */
/* this check is unecessary because the current consistency checks that
- forward and back linking match and that node height is correct are
- enough to detect such errors */
+ forward and back linking match and that node height is correct are
+ enough to detect such errors */
#if 0
if (bitmap[cur_node >> 3] & (0x80 >> (cur_node & 7)))
- {
- err = IMGTOOLERR_CORRUPTIMAGE;
- goto bail;
- }
+ {
+ err = IMGTOOLERR_CORRUPTIMAGE;
+ goto bail;
+ }
#endif
/* add node in bitmap */
bitmap[cur_node >> 3] |= (0x80 >> (cur_node & 7));
@@ -4574,7 +4574,7 @@ static imgtoolerr_t BT_search_leaf_rec(mac_BTref *BTref, const void *search_key,
}
if (! last_rec)
- { /* all keys are greater than the search key: the search key is
+ { /* all keys are greater than the search key: the search key is
nowhere in the tree */
if (search_exact_match)
return IMGTOOLERR_FILENOTFOUND;
@@ -4704,7 +4704,7 @@ static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerat
/* iterate to next record */
enumerator->cur_rec++;
if (enumerator->cur_rec >= node_numRecords)
- { /* iterate to next node if last record (not required, but will improve
+ { /* iterate to next node if last record (not required, but will improve
performance on next iteration) */
enumerator->cur_node = get_UINT32BE(((BTNodeHeader *) enumerator->BTref->node_buf)->fLink);
enumerator->cur_rec = 0;
@@ -4844,10 +4844,10 @@ static imgtoolerr_t BT_leaf_rec_enumerator_read(BT_leaf_rec_enumerator *enumerat
*/
struct rsrc_header
{
- UINT32BE data_offs; /* Offset from beginning of resource fork to resource data */
- UINT32BE map_offs; /* Offset from beginning of resource fork to resource map */
- UINT32BE data_len; /* Length of resource data */
- UINT32BE map_len; /* Length of resource map */
+ UINT32BE data_offs; /* Offset from beginning of resource fork to resource data */
+ UINT32BE map_offs; /* Offset from beginning of resource fork to resource map */
+ UINT32BE data_len; /* Length of resource data */
+ UINT32BE map_len; /* Length of resource map */
};
/*
@@ -4860,14 +4860,14 @@ struct rsrc_header
*/
struct rsrc_map_header
{
- rsrc_header reserved0; /* Reserved for copy of resource header */
- UINT32BE reserved1; /* Reserved for handle to next resource map */
- UINT16BE reserved2; /* Reserved for file reference number */
+ rsrc_header reserved0; /* Reserved for copy of resource header */
+ UINT32BE reserved1; /* Reserved for handle to next resource map */
+ UINT16BE reserved2; /* Reserved for file reference number */
- UINT16BE attr; /* Resource fork attributes */
- UINT16BE typelist_offs; /* Offset from beginning of map to resource type list */
- UINT16BE namelist_offs; /* Offset from beginning of map to resource name list */
- UINT16BE type_count; /* Number of types in the map minus 1 */
+ UINT16BE attr; /* Resource fork attributes */
+ UINT16BE typelist_offs; /* Offset from beginning of map to resource type list */
+ UINT16BE namelist_offs; /* Offset from beginning of map to resource name list */
+ UINT16BE type_count; /* Number of types in the map minus 1 */
/* This is actually part of the type list, which matters for offsets */
};
@@ -4876,9 +4876,9 @@ struct rsrc_map_header
*/
struct rsrc_type_entry
{
- UINT32BE type; /* Resource type */
- UINT16BE ref_count; /* Number of resources of this type in map minus 1 */
- UINT16BE ref_offs; /* Offset from beginning of resource type list to reference list for this type */
+ UINT32BE type; /* Resource type */
+ UINT16BE ref_count; /* Number of resources of this type in map minus 1 */
+ UINT16BE ref_offs; /* Offset from beginning of resource type list to reference list for this type */
};
/*
@@ -4886,12 +4886,12 @@ struct rsrc_type_entry
*/
struct rsrc_ref_entry
{
- UINT16BE id; /* Resource ID */
- UINT16BE name_offs; /* Offset from beginning of resource name list to resource name */
+ UINT16BE id; /* Resource ID */
+ UINT16BE name_offs; /* Offset from beginning of resource name list to resource name */
/* (-1 if none) */
- UINT8 attr; /* Resource attributes */
- UINT24BE data_offs; /* Offset from beginning of resource data to data for this resource */
- UINT32BE reserved; /* Reserved for handle to resource */
+ UINT8 attr; /* Resource attributes */
+ UINT24BE data_offs; /* Offset from beginning of resource data to data for this resource */
+ UINT32BE reserved; /* Reserved for handle to resource */
};
/*
@@ -4900,16 +4900,16 @@ struct rsrc_ref_entry
struct mac_resfileref
{
- mac_fileref fileref; /* open resource fork ref (you may open resources
+ mac_fileref fileref; /* open resource fork ref (you may open resources
files in data fork, too, if you ever need to,
but Classic MacOS never does such a thing
(MacOS X often does so, though)) */
- UINT32 data_offs; /* Offset from beginning of resource file to resource data */
- UINT32 map_offs; /* Offset from beginning of resource file to resource data */
+ UINT32 data_offs; /* Offset from beginning of resource file to resource data */
+ UINT32 map_offs; /* Offset from beginning of resource file to resource data */
- UINT16 typelist_offs; /* Offset from beginning of map to resource type list */
- UINT16 namelist_offs; /* Offset from beginning of map to resource name list */
- UINT16 type_count; /* Number of types in the map minus 1 */
+ UINT16 typelist_offs; /* Offset from beginning of map to resource type list */
+ UINT16 namelist_offs; /* Offset from beginning of map to resource name list */
+ UINT16 type_count; /* Number of types in the map minus 1 */
/* This is actually part of the type list, which matters for offsets */
};
@@ -5144,7 +5144,7 @@ static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_r
return IMGTOOLERR_UNEXPECTED;
if (offset)
- { /* seek to resource data offset in resource data section */
+ { /* seek to resource data offset in resource data section */
err = mac_file_seek(&resfileref->fileref, resfileref->data_offs+data_offs+4+offset);
if (err)
return err;
@@ -5246,8 +5246,8 @@ static imgtoolerr_t get_comment(struct mac_l2_imgref *l2_img, UINT16 id, mac_str
/* hurk */
/*return IMGTOOLERR_CORRUPTIMAGE;*/
/* people willing to extend the MFM comment field (you know, the kind
- of masochists that try to support 20-year-old OSes) might append extra
- fields, so we just truncate the resource */
+ of masochists that try to support 20-year-old OSes) might append extra
+ fields, so we just truncate the resource */
reslen = 256;
/* extract comment data */
@@ -5319,11 +5319,11 @@ struct mac_iterator
{
struct
{
- mfs_dirref dirref; /* open directory reference */
+ mfs_dirref dirref; /* open directory reference */
} mfs;
struct
{
- hfs_cat_enumerator catref; /* catalog file enumerator */
+ hfs_cat_enumerator catref; /* catalog file enumerator */
} hfs;
} u;
};
@@ -5407,7 +5407,7 @@ static imgtoolerr_t mfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
static void concat_fname(char *dest, int *dest_cur_pos, int dest_max_len, const char *src)
{
static const char ellipsis[] = { '.', '.', '.' };
- int src_len = strlen(src); /* number of chars from src to insert */
+ int src_len = strlen(src); /* number of chars from src to insert */
if (src_len <= *dest_cur_pos)
{
@@ -5435,7 +5435,7 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
UINT16 dataRecType;
imgtoolerr_t err;
/* currently, the mac->C conversion transcodes one mac char with at most 3
- C chars */
+ C chars */
int cur_name_head;
assert(iter->format == L2I_HFS);
@@ -5494,7 +5494,7 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
parID = get_UINT32BE(catrec_key->parID);
/* looping while (parID != 1) will display the volume name; looping while
- (parID != 2) won't */
+ (parID != 2) won't */
while (parID != /*1*/2)
{
/* search catalog for folder thread */
@@ -5524,7 +5524,7 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
}
/* got folder thread record: insert the folder name at the start of
- file path, then iterate */
+ file path, then iterate */
mac_to_c_strncpy(buf, sizeof(buf), catrec_data->thread.nodeName);
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, ":");
concat_fname(ent->filename, &cur_name_head, ARRAY_LENGTH(ent->filename) - 1, buf);
@@ -5591,7 +5591,7 @@ static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 file
case L2I_HFS:
/* This is the way to get Finder comments in system <= 7. Attached
- comments use another method, and Finder 8 uses yet another one. */
+ comments use another method, and Finder 8 uses yet another one. */
commentID = get_UINT16BE(cat_info->flXFinderInfo.comment);
if (commentID)
err = get_comment(image, commentID, comment);
@@ -5690,10 +5690,10 @@ static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char
set_UINT32BE(&cat_info.flFinderInfo.type, 0x3F3F3F3F);
set_UINT32BE(&cat_info.flFinderInfo.creator, 0x3F3F3F3F);
fork_len = stream_size(sourcef);
- /*comment[0] = get_UINT16BE(header.comment_len);*/ /* comment length */
+ /*comment[0] = get_UINT16BE(header.comment_len);*/ /* comment length */
/* Next two fields are set to 0 with MFS volumes. IIRC, 0 normally
- means system script: I don't think MFS stores the file name script code
- anywhere on disk, so it should be a reasonable approximation. */
+ means system script: I don't think MFS stores the file name script code
+ anywhere on disk, so it should be a reasonable approximation. */
/* create file */
/* clear inited flag and file location in window */
@@ -6196,7 +6196,7 @@ static imgtoolerr_t mac_image_geticoninfo(imgtool_partition *partition, const ch
finder_flags = (UINT32) attr_values[2].i;
/* check the bundle bit; if clear (and the type is not 'APPL'), use the
- * desktop file */
+ * desktop file */
if (!(finder_flags & 0x2000) && (type_code != /* APPL */ 0x4150504C))
path = "Desktop\0";
@@ -6351,29 +6351,29 @@ static void generic_mac_get_info(const imgtool_class *imgclass, UINT32 state, un
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(struct mac_l2_imgref); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct mac_iterator); break;
- case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = ':'; break;
+ case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(struct mac_l2_imgref); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct mac_iterator); break;
+ case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = ':'; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
+ case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
- case IMGTOOLINFO_PTR_CLOSE: /* info->close = mac_image_exit */; break;
- case IMGTOOLINFO_PTR_INFO: info->info = mac_image_info; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = mac_image_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = mac_image_nextenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = mac_image_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = mac_image_readfile; break;
- case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = mac_image_listforks; break;
- case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = mac_image_getattrs; break;
- case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = mac_image_setattrs; break;
- case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = mac_image_geticoninfo; break;
- case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = mac_image_suggesttransfer; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_mac; break;
+ case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
+ case IMGTOOLINFO_PTR_CLOSE: /* info->close = mac_image_exit */; break;
+ case IMGTOOLINFO_PTR_INFO: info->info = mac_image_info; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = mac_image_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = mac_image_nextenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = mac_image_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = mac_image_readfile; break;
+ case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = mac_image_listforks; break;
+ case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = mac_image_getattrs; break;
+ case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = mac_image_setattrs; break;
+ case IMGTOOLINFO_PTR_GET_ICON_INFO: info->get_iconinfo = mac_image_geticoninfo; break;
+ case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = mac_image_suggesttransfer; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_mac; break;
}
}
@@ -6384,13 +6384,13 @@ void mac_mfs_get_info(const imgtool_class *imgclass, UINT32 state, union imgtool
switch(state)
{
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_mfs"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac MFS Floppy"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_mfs"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac MFS Floppy"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = mfs_image_create; break;
- case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = mfs_image_open; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = mac_image_writefile; break;
+ case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = mfs_image_create; break;
+ case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = mfs_image_open; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = mac_image_writefile; break;
default: generic_mac_get_info(imgclass, state, info); break;
}
@@ -6403,11 +6403,11 @@ void mac_hfs_get_info(const imgtool_class *imgclass, UINT32 state, union imgtool
switch(state)
{
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_hfs"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac HFS Floppy"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mac_hfs"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "Mac HFS Floppy"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = hfs_image_open; break;
+ case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = hfs_image_open; break;
default: generic_mac_get_info(imgclass, state, info); break;
}
diff --git a/src/mess/tools/imgtool/modules/macbin.c b/src/mess/tools/imgtool/modules/macbin.c
index 73282fde6ee..e8035c1a480 100644
--- a/src/mess/tools/imgtool/modules/macbin.c
+++ b/src/mess/tools/imgtool/modules/macbin.c
@@ -365,11 +365,11 @@ void filter_macbinary_getinfo(UINT32 state, union filterinfo *info)
{
switch(state)
{
- case FILTINFO_STR_NAME: info->s = "macbinary"; break;
- case FILTINFO_STR_HUMANNAME: info->s = "MacBinary"; break;
- case FILTINFO_STR_EXTENSION: info->s = "bin"; break;
- case FILTINFO_PTR_READFILE: info->read_file = macbinary_readfile; break;
- case FILTINFO_PTR_WRITEFILE: info->write_file = macbinary_writefile; break;
- case FILTINFO_PTR_CHECKSTREAM: info->check_stream = macbinary_checkstream; break;
+ case FILTINFO_STR_NAME: info->s = "macbinary"; break;
+ case FILTINFO_STR_HUMANNAME: info->s = "MacBinary"; break;
+ case FILTINFO_STR_EXTENSION: info->s = "bin"; break;
+ case FILTINFO_PTR_READFILE: info->read_file = macbinary_readfile; break;
+ case FILTINFO_PTR_WRITEFILE: info->write_file = macbinary_writefile; break;
+ case FILTINFO_PTR_CHECKSTREAM: info->check_stream = macbinary_checkstream; break;
}
}
diff --git a/src/mess/tools/imgtool/modules/macutil.c b/src/mess/tools/imgtool/modules/macutil.c
index 3e88760301d..a752b54c639 100644
--- a/src/mess/tools/imgtool/modules/macutil.c
+++ b/src/mess/tools/imgtool/modules/macutil.c
@@ -85,4 +85,3 @@ void pascal_from_c_string(unsigned char *pstring, size_t pstring_len, const char
while(i < pstring_len - 1)
pstring[1 + i++] = '\0';
}
-
diff --git a/src/mess/tools/imgtool/modules/os9.c b/src/mess/tools/imgtool/modules/os9.c
index 1e4bc27e554..c0254d1a0c2 100644
--- a/src/mess/tools/imgtool/modules/os9.c
+++ b/src/mess/tools/imgtool/modules/os9.c
@@ -175,7 +175,7 @@ static imgtoolerr_t os9_write_lsn(imgtool_image *img, UINT32 lsn, int offset, co
if (err)
return err;
- ferr = floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buffer, buffer_len, 0); /* TODO: pass ddam argument from imgtool */
+ ferr = floppy_write_sector(imgtool_floppy(img), head, track, sector, offset, buffer, buffer_len, 0); /* TODO: pass ddam argument from imgtool */
if (ferr)
return imgtool_floppy_error(ferr);
@@ -254,19 +254,19 @@ static imgtoolerr_t os9_decode_file_header(imgtool_image *image,
if (err)
return err;
- info->lsn = lsn;
- attributes = pick_integer_be(header, 0, 1);
- info->owner_id = pick_integer_be(header, 1, 2);
- info->link_count = pick_integer_be(header, 8, 1);
- info->file_size = pick_integer_be(header, 9, 4);
- info->directory = (attributes & 0x80) ? 1 : 0;
- info->non_sharable = (attributes & 0x40) ? 1 : 0;
- info->public_execute = (attributes & 0x20) ? 1 : 0;
- info->public_write = (attributes & 0x10) ? 1 : 0;
- info->public_read = (attributes & 0x08) ? 1 : 0;
- info->user_execute = (attributes & 0x04) ? 1 : 0;
- info->user_write = (attributes & 0x02) ? 1 : 0;
- info->user_read = (attributes & 0x01) ? 1 : 0;
+ info->lsn = lsn;
+ attributes = pick_integer_be(header, 0, 1);
+ info->owner_id = pick_integer_be(header, 1, 2);
+ info->link_count = pick_integer_be(header, 8, 1);
+ info->file_size = pick_integer_be(header, 9, 4);
+ info->directory = (attributes & 0x80) ? 1 : 0;
+ info->non_sharable = (attributes & 0x40) ? 1 : 0;
+ info->public_execute = (attributes & 0x20) ? 1 : 0;
+ info->public_write = (attributes & 0x10) ? 1 : 0;
+ info->public_read = (attributes & 0x08) ? 1 : 0;
+ info->user_execute = (attributes & 0x04) ? 1 : 0;
+ info->user_write = (attributes & 0x02) ? 1 : 0;
+ info->user_read = (attributes & 0x01) ? 1 : 0;
if (info->directory && (info->file_size % 32 != 0))
return IMGTOOLERR_CORRUPTIMAGE;
@@ -401,7 +401,7 @@ static imgtoolerr_t os9_set_file_size(imgtool_image *image,
}
/* keep in mind that the sector_map might not parallel our expected
- * current LSN count; we should tolerate this abnormality */
+ * current LSN count; we should tolerate this abnormality */
current_lsn_count = lsn;
while(current_lsn_count > new_lsn_count)
@@ -551,7 +551,7 @@ static imgtoolerr_t os9_lookup_path(imgtool_image *img, const char *path,
if (index >= dir_size)
{
/* if we're not creating, or we are creating but we have not fully
- * transversed the directory, error out */
+ * transversed the directory, error out */
if (!create || path[strlen(path) + 1])
{
err = IMGTOOLERR_PATHNOTFOUND;
@@ -636,26 +636,26 @@ static imgtoolerr_t os9_diskimage_open(imgtool_image *image, imgtool_stream *str
if (ferr)
return imgtool_floppy_error(ferr);
- info->total_sectors = pick_integer_be(header, 0, 3);
- track_size_in_sectors = pick_integer_be(header, 3, 1);
- info->allocation_bitmap_bytes = pick_integer_be(header, 4, 2);
- info->cluster_size = pick_integer_be(header, 6, 2);
- info->root_dir_lsn = pick_integer_be(header, 8, 3);
- info->owner_id = pick_integer_be(header, 11, 2);
+ info->total_sectors = pick_integer_be(header, 0, 3);
+ track_size_in_sectors = pick_integer_be(header, 3, 1);
+ info->allocation_bitmap_bytes = pick_integer_be(header, 4, 2);
+ info->cluster_size = pick_integer_be(header, 6, 2);
+ info->root_dir_lsn = pick_integer_be(header, 8, 3);
+ info->owner_id = pick_integer_be(header, 11, 2);
// attributes =
- pick_integer_be(header, 13, 1);
- info->disk_id = pick_integer_be(header, 14, 2);
- info->format_flags = pick_integer_be(header, 16, 1);
- info->sectors_per_track = pick_integer_be(header, 17, 2);
- info->bootstrap_lsn = pick_integer_be(header, 21, 3);
- info->bootstrap_size = pick_integer_be(header, 24, 2);
- info->sector_size = pick_integer_be(header, 104, 2);
-
- info->sides = (info->format_flags & 0x01) ? 2 : 1;
- info->double_density = (info->format_flags & 0x02) ? 1 : 0;
- info->double_track = (info->format_flags & 0x04) ? 1 : 0;
- info->quad_track_density = (info->format_flags & 0x08) ? 1 : 0;
- info->octal_track_density = (info->format_flags & 0x10) ? 1 : 0;
+ pick_integer_be(header, 13, 1);
+ info->disk_id = pick_integer_be(header, 14, 2);
+ info->format_flags = pick_integer_be(header, 16, 1);
+ info->sectors_per_track = pick_integer_be(header, 17, 2);
+ info->bootstrap_lsn = pick_integer_be(header, 21, 3);
+ info->bootstrap_size = pick_integer_be(header, 24, 2);
+ info->sector_size = pick_integer_be(header, 104, 2);
+
+ info->sides = (info->format_flags & 0x01) ? 2 : 1;
+ info->double_density = (info->format_flags & 0x02) ? 1 : 0;
+ info->double_track = (info->format_flags & 0x04) ? 1 : 0;
+ info->quad_track_density = (info->format_flags & 0x08) ? 1 : 0;
+ info->octal_track_density = (info->format_flags & 0x10) ? 1 : 0;
pick_string(header, 31, 32, info->name);
@@ -775,7 +775,7 @@ static imgtoolerr_t os9_diskimage_create(imgtool_image *img, imgtool_stream *str
place_integer_be(header, 0x3f+0x0d, 1, 3); /* sector interleave factor */
place_integer_be(header, 0x3f+0x0e, 1, 8); /* default sectors per allocation */
- err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id, 0, header, sector_bytes, 0); /* TODO: pass ddam argument from imgtool */
+ err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id, 0, header, sector_bytes, 0); /* TODO: pass ddam argument from imgtool */
if (err)
goto done;
@@ -805,7 +805,7 @@ static imgtoolerr_t os9_diskimage_create(imgtool_image *img, imgtool_stream *str
}
}
- err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + i, 0, header, sector_bytes, 0); /* TODO: pass ddam argument from imgtool */
+ err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + i, 0, header, sector_bytes, 0); /* TODO: pass ddam argument from imgtool */
if (err)
goto done;
}
@@ -830,7 +830,7 @@ static imgtoolerr_t os9_diskimage_create(imgtool_image *img, imgtool_stream *str
place_integer_be(header, 0x10, 3, 1 + allocation_bitmap_lsns + 1);
place_integer_be(header, 0x13, 2, 8);
- err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + allocation_bitmap_lsns, 0, header, sector_bytes, 0); /* TODO: pass ddam argument from imgtool */
+ err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 1 + allocation_bitmap_lsns, 0, header, sector_bytes, 0); /* TODO: pass ddam argument from imgtool */
if (err)
goto done;
@@ -840,7 +840,7 @@ static imgtoolerr_t os9_diskimage_create(imgtool_image *img, imgtool_stream *str
header[0x1F] = 1 + allocation_bitmap_lsns;
header[0x20] = 0xAE;
header[0x3F] = 1 + allocation_bitmap_lsns;
- err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 2 + allocation_bitmap_lsns, 0, header, sector_bytes, 0); /* TOOD: pass ddam argument from imgtool */
+ err = (imgtoolerr_t)floppy_write_sector(imgtool_floppy(img), 0, 0, first_sector_id + 2 + allocation_bitmap_lsns, 0, header, sector_bytes, 0); /* TOOD: pass ddam argument from imgtool */
if (err)
goto done;
@@ -915,8 +915,8 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgto
pick_string(dir_entry, 0, 28, filename);
/* we have certain expectations of the directory contents; the
- * first directory entry should be "..", the second ".", and
- * subsequent entries should never be "." or ".." */
+ * first directory entry should be "..", the second ".", and
+ * subsequent entries should never be "." or ".." */
switch(os9enum->index)
{
case 0:
@@ -1227,30 +1227,30 @@ void os9_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break;
- case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(os9_diskinfo); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct os9_direnum); break;
- case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break;
+ case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break;
+ case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(os9_diskinfo); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct os9_direnum); break;
+ case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "os9"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "OS-9 format"); break;
- case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "os9"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "OS-9 format"); break;
+ case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
- case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = os9_diskimage_create; break;
- case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = os9_diskimage_open; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = os9_diskimage_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = os9_diskimage_nextenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = os9_diskimage_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = os9_diskimage_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = os9_diskimage_writefile; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = os9_diskimage_deletefile; break;
- case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = os9_diskimage_createdir; break;
- case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = os9_diskimage_deletedir; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break;
+ case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
+ case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = os9_diskimage_create; break;
+ case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = os9_diskimage_open; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = os9_diskimage_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = os9_diskimage_nextenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = os9_diskimage_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = os9_diskimage_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = os9_diskimage_writefile; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = os9_diskimage_deletefile; break;
+ case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = os9_diskimage_createdir; break;
+ case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = os9_diskimage_deletedir; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break;
}
}
diff --git a/src/mess/tools/imgtool/modules/pc_flop.c b/src/mess/tools/imgtool/modules/pc_flop.c
index e3a9e282881..57602fd4452 100644
--- a/src/mess/tools/imgtool/modules/pc_flop.c
+++ b/src/mess/tools/imgtool/modules/pc_flop.c
@@ -12,7 +12,7 @@
#include "fat.h"
#include "iflopimg.h"
-#define FAT_SECLEN 512
+#define FAT_SECLEN 512
static imgtoolerr_t fat_image_create(imgtool_image *image, imgtool_stream *stream, option_resolution *opts)
@@ -52,7 +52,7 @@ done:
-static imgtoolerr_t fat_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors)
+static imgtoolerr_t fat_image_get_geometry(imgtool_image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors)
{
imgtoolerr_t err;
UINT64 total_sectors;
@@ -139,7 +139,7 @@ static imgtoolerr_t fat_image_writeblock(imgtool_image *image, const void *buffe
if (err)
return err;
- ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, block_size, 0); /* TODO: pass ddam argument from imgtool */
+ ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, block_size, 0); /* TODO: pass ddam argument from imgtool */
if (ferr)
return imgtool_floppy_error(ferr);
return IMGTOOLERR_SUCCESS;
@@ -152,19 +152,19 @@ void pc_floppy_get_info(const imgtool_class *imgclass, UINT32 state, union imgto
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break;
+ case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "fat"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "FAT format"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "fat"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "FAT format"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
- case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = fat_image_create; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_pc; break;
- case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = fat_image_readblock; break;
- case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = fat_image_writeblock; break;
- case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = fat_image_get_geometry; break;
+ case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
+ case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = fat_image_create; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_pc; break;
+ case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = fat_image_readblock; break;
+ case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = fat_image_writeblock; break;
+ case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = fat_image_get_geometry; break;
default: fat_get_info(imgclass, state, info); break;
}
diff --git a/src/mess/tools/imgtool/modules/pc_hard.c b/src/mess/tools/imgtool/modules/pc_hard.c
index e271b1f24be..90e985817b3 100644
--- a/src/mess/tools/imgtool/modules/pc_hard.c
+++ b/src/mess/tools/imgtool/modules/pc_hard.c
@@ -51,12 +51,12 @@
#include "formats/imageutl.h"
#include "imghd.h"
-#define FAT_SECLEN 512
+#define FAT_SECLEN 512
static OPTION_GUIDE_START( pc_chd_create_optionguide )
- OPTION_INT('T', "cylinders", "Cylinders" )
- OPTION_INT('H', "heads", "Heads" )
- OPTION_INT('S', "sectors", "Sectors" )
+ OPTION_INT('T', "cylinders", "Cylinders" )
+ OPTION_INT('H', "heads", "Heads" )
+ OPTION_INT('S', "sectors", "Sectors" )
OPTION_GUIDE_END
static const char pc_chd_create_optionspec[] = "H1-[16]S1-[32]-63T10/20/30/40/50/60/70/80/90/[100]/110/120/130/140/150/160/170/180/190/200";
@@ -211,16 +211,16 @@ static imgtoolerr_t pc_chd_read_partition_header(imgtool_image *image)
{
partition_info = &buffer[446 + i * 16];
- info->partitions[i].partition_type = partition_info[4];
- info->partitions[i].starting_head = partition_info[1];
- info->partitions[i].starting_track = ((partition_info[2] << 2) & 0xFF00) | partition_info[3];
- info->partitions[i].starting_sector = partition_info[2] & 0x3F;
- info->partitions[i].ending_head = partition_info[5];
- info->partitions[i].ending_track = ((partition_info[6] << 2) & 0xFF00) | partition_info[7];
- info->partitions[i].ending_sector = partition_info[6] & 0x3F;
+ info->partitions[i].partition_type = partition_info[4];
+ info->partitions[i].starting_head = partition_info[1];
+ info->partitions[i].starting_track = ((partition_info[2] << 2) & 0xFF00) | partition_info[3];
+ info->partitions[i].starting_sector = partition_info[2] & 0x3F;
+ info->partitions[i].ending_head = partition_info[5];
+ info->partitions[i].ending_track = ((partition_info[6] << 2) & 0xFF00) | partition_info[7];
+ info->partitions[i].ending_sector = partition_info[6] & 0x3F;
- info->partitions[i].sector_index = pick_integer_le(partition_info, 8, 4);
- info->partitions[i].total_sectors = pick_integer_le(partition_info, 12, 4);
+ info->partitions[i].sector_index = pick_integer_le(partition_info, 8, 4);
+ info->partitions[i].total_sectors = pick_integer_le(partition_info, 12, 4);
if (info->partitions[i].starting_track > info->partitions[i].ending_track)
return IMGTOOLERR_CORRUPTIMAGE;
@@ -322,7 +322,7 @@ static imgtoolerr_t pc_chd_image_get_geometry(imgtool_image *image, UINT32 *trac
-static imgtoolerr_t pc_chd_image_getsectorsize(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size)
+static imgtoolerr_t pc_chd_image_getsectorsize(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, UINT32 *sector_size)
{
pc_chd_image_info *info;
info = pc_chd_get_image_info(image);
@@ -348,7 +348,7 @@ static UINT32 pc_chd_calc_lbasector(pc_chd_image_info *info, UINT32 track, UINT3
-static imgtoolerr_t pc_chd_image_readsector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len)
+static imgtoolerr_t pc_chd_image_readsector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, void *buffer, size_t len)
{
pc_chd_image_info *info;
info = pc_chd_get_image_info(image);
@@ -359,7 +359,7 @@ static imgtoolerr_t pc_chd_image_readsector(imgtool_image *image, UINT32 track,
-static imgtoolerr_t pc_chd_image_writesector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam)
+static imgtoolerr_t pc_chd_image_writesector(imgtool_image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam)
{
pc_chd_image_info *info;
info = pc_chd_get_image_info(image);
@@ -397,33 +397,33 @@ static imgtoolerr_t pc_chd_list_partitions(imgtool_image *image, imgtool_partiti
for (i = 0; i < MIN(4, len); i++)
{
- partitions[i].base_block = info->partitions[i].sector_index;
- partitions[i].block_count = info->partitions[i].total_sectors;
+ partitions[i].base_block = info->partitions[i].sector_index;
+ partitions[i].block_count = info->partitions[i].total_sectors;
switch(info->partitions[i].partition_type)
{
- case 0x00: /* Empty Partition */
+ case 0x00: /* Empty Partition */
partitions[i].get_info = NULL;
break;
- case 0x01: /* FAT12 */
- case 0x04: /* FAT16 (-32 MB) */
- case 0x06: /* FAT16 (32+ MB) */
- case 0x0B: /* FAT32 */
- case 0x0C: /* FAT32 (LBA Mapped) */
- case 0x0E: /* FAT16 (LBA Mapped) */
- case 0x11: /* OS/2 FAT12 */
- case 0x14: /* OS/2 FAT16 (-32 MB) */
- case 0x16: /* OS/2 FAT16 (32+ MB) */
- case 0x1B: /* Hidden Win95 FAT32 */
- case 0x1C: /* Hidden Win95 FAT32 (LBA Mapped) */
- case 0x1D: /* Hidden Win95 FAT16 (LBA Mapped) */
- case 0xC1: /* DR-DOS FAT12 */
- case 0xC4: /* DR-DOS FAT16 (-32 MB) */
- case 0xC6: /* DR-DOS FAT16 (32+ MB) */
- case 0xD1: /* Old Multiuser DOS FAT12 */
- case 0xD4: /* Old Multiuser DOS FAT16 (-32 MB) */
- case 0xD6: /* Old Multiuser DOS FAT16 (32+ MB) */
+ case 0x01: /* FAT12 */
+ case 0x04: /* FAT16 (-32 MB) */
+ case 0x06: /* FAT16 (32+ MB) */
+ case 0x0B: /* FAT32 */
+ case 0x0C: /* FAT32 (LBA Mapped) */
+ case 0x0E: /* FAT16 (LBA Mapped) */
+ case 0x11: /* OS/2 FAT12 */
+ case 0x14: /* OS/2 FAT16 (-32 MB) */
+ case 0x16: /* OS/2 FAT16 (32+ MB) */
+ case 0x1B: /* Hidden Win95 FAT32 */
+ case 0x1C: /* Hidden Win95 FAT32 (LBA Mapped) */
+ case 0x1D: /* Hidden Win95 FAT16 (LBA Mapped) */
+ case 0xC1: /* DR-DOS FAT12 */
+ case 0xC4: /* DR-DOS FAT16 (-32 MB) */
+ case 0xC6: /* DR-DOS FAT16 (32+ MB) */
+ case 0xD1: /* Old Multiuser DOS FAT12 */
+ case 0xD4: /* Old Multiuser DOS FAT16 (-32 MB) */
+ case 0xD6: /* Old Multiuser DOS FAT16 (32+ MB) */
partitions[i].get_info = fat_get_info;
break;
@@ -442,27 +442,27 @@ void pc_chd_get_info(const imgtool_class *imgclass, UINT32 state, union imgtooli
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break;
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(pc_chd_image_info); break;
- case IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS: info->i = 1; break;
+ case IMGTOOLINFO_INT_BLOCK_SIZE: info->i = FAT_SECLEN; break;
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(pc_chd_image_info); break;
+ case IMGTOOLINFO_INT_TRACKS_ARE_CALLED_CYLINDERS: info->i = 1; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc_chd"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "PC CHD disk image"); break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "chd"); break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), pc_chd_create_optionspec); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc_chd"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "PC CHD disk image"); break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "chd"); break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), pc_chd_create_optionspec); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_CREATE: info->create = pc_chd_image_create; break;
- case IMGTOOLINFO_PTR_OPEN: info->open = pc_chd_image_open; break;
- case IMGTOOLINFO_PTR_CLOSE: info->close = pc_chd_image_close; break;
- case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = pc_chd_image_readsector; break;
- case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = pc_chd_image_writesector; break;
- case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = pc_chd_image_readblock; break;
- case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = pc_chd_image_writeblock; break;
- case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = pc_chd_image_getsectorsize; break;
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = pc_chd_create_optionguide; break;
- case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = pc_chd_image_get_geometry; break;
- case IMGTOOLINFO_PTR_LIST_PARTITIONS: info->list_partitions = pc_chd_list_partitions; break;
+ case IMGTOOLINFO_PTR_CREATE: info->create = pc_chd_image_create; break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = pc_chd_image_open; break;
+ case IMGTOOLINFO_PTR_CLOSE: info->close = pc_chd_image_close; break;
+ case IMGTOOLINFO_PTR_READ_SECTOR: info->read_sector = pc_chd_image_readsector; break;
+ case IMGTOOLINFO_PTR_WRITE_SECTOR: info->write_sector = pc_chd_image_writesector; break;
+ case IMGTOOLINFO_PTR_READ_BLOCK: info->read_block = pc_chd_image_readblock; break;
+ case IMGTOOLINFO_PTR_WRITE_BLOCK: info->write_block = pc_chd_image_writeblock; break;
+ case IMGTOOLINFO_PTR_GET_SECTOR_SIZE: info->get_sector_size = pc_chd_image_getsectorsize; break;
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = pc_chd_create_optionguide; break;
+ case IMGTOOLINFO_PTR_GET_GEOMETRY: info->get_geometry = pc_chd_image_get_geometry; break;
+ case IMGTOOLINFO_PTR_LIST_PARTITIONS: info->list_partitions = pc_chd_list_partitions; break;
}
}
diff --git a/src/mess/tools/imgtool/modules/prodos.c b/src/mess/tools/imgtool/modules/prodos.c
index d15d9f615a4..7f1244e4b8c 100644
--- a/src/mess/tools/imgtool/modules/prodos.c
+++ b/src/mess/tools/imgtool/modules/prodos.c
@@ -128,8 +128,8 @@
#include "iflopimg.h"
#include "macutil.h"
-#define ROOTDIR_BLOCK 2
-#define BLOCK_SIZE 512
+#define ROOTDIR_BLOCK 2
+#define BLOCK_SIZE 512
struct prodos_diskinfo
{
@@ -192,12 +192,12 @@ static time_t prodos_crack_time(UINT32 prodos_time)
time(&now);
t = *localtime(&now);
- t.tm_sec = 0;
- t.tm_min = (prodos_time >> 16) & 0x3F;
- t.tm_hour = (prodos_time >> 24) & 0x1F;
- t.tm_mday = (prodos_time >> 0) & 0x1F;
- t.tm_mon = (prodos_time >> 5) & 0x0F;
- t.tm_year = (prodos_time >> 9) & 0x7F;
+ t.tm_sec = 0;
+ t.tm_min = (prodos_time >> 16) & 0x3F;
+ t.tm_hour = (prodos_time >> 24) & 0x1F;
+ t.tm_mday = (prodos_time >> 0) & 0x1F;
+ t.tm_mon = (prodos_time >> 5) & 0x0F;
+ t.tm_year = (prodos_time >> 9) & 0x7F;
if (t.tm_year <= 49)
t.tm_year += 100;
@@ -215,11 +215,11 @@ static UINT32 prodos_setup_time(time_t ansi_time)
if ((t.tm_year >= 100) && (t.tm_year <= 149))
t.tm_year -= 100;
- result |= (((UINT32) t.tm_min) & 0x003F) << 16;
- result |= (((UINT32) t.tm_hour) & 0x001F) << 24;
- result |= (((UINT32) t.tm_mday) & 0x001F) << 0;
- result |= (((UINT32) t.tm_mon) & 0x000F) << 5;
- result |= (((UINT32) t.tm_year) & 0x007F) << 9;
+ result |= (((UINT32) t.tm_min) & 0x003F) << 16;
+ result |= (((UINT32) t.tm_hour) & 0x001F) << 24;
+ result |= (((UINT32) t.tm_mday) & 0x001F) << 0;
+ result |= (((UINT32) t.tm_mon) & 0x000F) << 5;
+ result |= (((UINT32) t.tm_year) & 0x007F) << 9;
return result;
}
@@ -328,13 +328,13 @@ static imgtoolerr_t prodos_save_block_525(imgtool_image *image,
/* read first sector */
ferr = floppy_write_sector(imgtool_floppy(image), head, track,
- sector1, 0, ((const UINT8 *) buffer) + 0, 256, 0); /* TODO: pass ddam argument from imgtool */
+ sector1, 0, ((const UINT8 *) buffer) + 0, 256, 0); /* TODO: pass ddam argument from imgtool */
if (ferr)
return imgtool_floppy_error(ferr);
/* read second sector */
ferr = floppy_write_sector(imgtool_floppy(image), head, track,
- sector2, 0, ((const UINT8 *) buffer) + 256, 256, 0); /* TODO: pass ddam argument from imgtool */
+ sector2, 0, ((const UINT8 *) buffer) + 256, 256, 0); /* TODO: pass ddam argument from imgtool */
if (ferr)
return imgtool_floppy_error(ferr);
@@ -406,7 +406,7 @@ static imgtoolerr_t prodos_save_block_35(imgtool_image *image,
if (err)
return err;
- ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, 512, 0); /* TODO: pass ddam argument from imgtool */
+ ferr = floppy_write_sector(imgtool_floppy(image), head, track, sector, 0, buffer, 512, 0); /* TODO: pass ddam argument from imgtool */
if (ferr)
return imgtool_floppy_error(ferr);
@@ -481,10 +481,10 @@ static imgtoolerr_t prodos_diskimage_open(imgtool_image *image)
/* did we find the volume header? */
if ((ent[0] & 0xF0) == 0xF0)
{
- di->dirent_size = pick_integer_le(ent, 31, 1);
- di->dirents_per_block = pick_integer_le(ent, 32, 1);
- di->volume_bitmap_block = pick_integer_le(ent, 35, 2);
- di->total_blocks = pick_integer_le(ent, 37, 2);
+ di->dirent_size = pick_integer_le(ent, 31, 1);
+ di->dirents_per_block = pick_integer_le(ent, 32, 1);
+ di->volume_bitmap_block = pick_integer_le(ent, 35, 2);
+ di->total_blocks = pick_integer_le(ent, 37, 2);
}
/* sanity check these values */
@@ -820,8 +820,8 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image,
ent->storage_type = appleenum->block_data[offset + 0];
memcpy(ent->filename, &appleenum->block_data[offset + 1], 15);
ent->filename[15] = '\0';
- ent->creation_time = pick_integer_le(appleenum->block_data, offset + 24, 4);
- ent->lastmodified_time = pick_integer_le(appleenum->block_data, offset + 33, 4);
+ ent->creation_time = pick_integer_le(appleenum->block_data, offset + 24, 4);
+ ent->lastmodified_time = pick_integer_le(appleenum->block_data, offset + 33, 4);
ent->file_type = 0x3F3F3F3F;
ent->file_creator = 0x3F3F3F3F;
ent->finder_flags = 0;
@@ -837,8 +837,8 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image,
if (is_extendedfile_storagetype(ent->storage_type))
{
/* this is a ProDOS extended file; we need to get the extended info
- * block */
- ent->extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2);
+ * block */
+ ent->extkey_pointer = pick_integer_le(appleenum->block_data, offset + 17, 2);
err = prodos_load_block(image, ent->extkey_pointer, buffer);
if (err)
@@ -846,9 +846,9 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image,
for (fork_num = 0; fork_num <= 1; fork_num++)
{
- ent->key_pointer[fork_num] = pick_integer_le(buffer, 1 + (fork_num * 256), 2);
- ent->filesize[fork_num] = pick_integer_le(buffer, 5 + (fork_num * 256), 3);
- ent->depth[fork_num] = buffer[fork_num * 256] & 0x0F;
+ ent->key_pointer[fork_num] = pick_integer_le(buffer, 1 + (fork_num * 256), 2);
+ ent->filesize[fork_num] = pick_integer_le(buffer, 5 + (fork_num * 256), 3);
+ ent->depth[fork_num] = buffer[fork_num * 256] & 0x0F;
}
finfo_offset = 0;
@@ -858,7 +858,7 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image,
{
switch(*(info_ptr++))
{
- case 1: /* FInfo */
+ case 1: /* FInfo */
ent->file_type = pick_integer_be(info_ptr, 0, 4);
ent->file_creator = pick_integer_be(info_ptr, 4, 4);
ent->finder_flags = pick_integer_be(info_ptr, 8, 2);
@@ -867,7 +867,7 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image,
ent->finder_folder = pick_integer_be(info_ptr, 14, 4);
break;
- case 2: /* xFInfo */
+ case 2: /* xFInfo */
ent->icon_id = pick_integer_be(info_ptr, 0, 2);
ent->script_code = pick_integer_be(info_ptr, 8, 1);
ent->extended_flags = pick_integer_be(info_ptr, 9, 1);
@@ -881,9 +881,9 @@ static imgtoolerr_t prodos_get_next_dirent(imgtool_image *image,
else
{
/* normal ProDOS files have all of the info right here */
- ent->key_pointer[0] = pick_integer_le(appleenum->block_data, offset + 17, 2);
- ent->filesize[0] = pick_integer_le(appleenum->block_data, offset + 21, 3);
- ent->depth[0] = ent->storage_type >> 4;
+ ent->key_pointer[0] = pick_integer_le(appleenum->block_data, offset + 17, 2);
+ ent->filesize[0] = pick_integer_le(appleenum->block_data, offset + 21, 3);
+ ent->depth[0] = ent->storage_type >> 4;
}
/* identify next entry */
@@ -1005,11 +1005,11 @@ static imgtoolerr_t prodos_put_dirent(imgtool_image *image,
{
switch(*(info_ptr++))
{
- case 1: /* FInfo */
+ case 1: /* FInfo */
finfo = info_ptr;
break;
- case 2: /* xFInfo */
+ case 2: /* xFInfo */
xfinfo = info_ptr;
break;
}
@@ -1548,9 +1548,9 @@ static imgtoolerr_t prodos_diskimage_nextenum(imgtool_directory *enumeration, im
}
strcpy(ent->filename, pd_ent.filename);
- ent->directory = is_dir_storagetype(pd_ent.storage_type);
- ent->creation_time = prodos_crack_time(pd_ent.creation_time);
- ent->lastmodified_time = prodos_crack_time(pd_ent.lastmodified_time);
+ ent->directory = is_dir_storagetype(pd_ent.storage_type);
+ ent->creation_time = prodos_crack_time(pd_ent.creation_time);
+ ent->lastmodified_time = prodos_crack_time(pd_ent.lastmodified_time);
if (!ent->directory)
{
@@ -1593,7 +1593,7 @@ static imgtoolerr_t prodos_read_file_tree(imgtool_image *image, UINT32 *filesize
for (i = 0; i < 256; i++)
{
/* retrieve the block pointer; the two bytes are on either half
- * of the block */
+ * of the block */
sub_block = buffer[i + 256];
sub_block <<= 8;
sub_block |= buffer[i + 0];
@@ -2151,7 +2151,7 @@ static imgtoolerr_t prodos_diskimage_suggesttransfer(imgtool_partition *partitio
-static imgtoolerr_t prodos_diskimage_getchain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size)
+static imgtoolerr_t prodos_diskimage_getchain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size)
{
imgtoolerr_t err;
imgtool_image *image = imgtool_partition_image(partition);
@@ -2211,35 +2211,35 @@ static void generic_prodos_get_info(const imgtool_class *imgclass, UINT32 state,
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break;
- case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
- case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break;
- case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break;
- case IMGTOOLINFO_INT_WRITING_UNTESTED: info->i = 1; break;
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(prodos_diskinfo); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(prodos_direnum); break;
- case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break;
+ case IMGTOOLINFO_INT_INITIAL_PATH_SEPARATOR: info->i = 1; break;
+ case IMGTOOLINFO_INT_OPEN_IS_STRICT: info->i = 1; break;
+ case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME: info->i = 1; break;
+ case IMGTOOLINFO_INT_SUPPORTS_LASTMODIFIED_TIME: info->i = 1; break;
+ case IMGTOOLINFO_INT_WRITING_UNTESTED: info->i = 1; break;
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(prodos_diskinfo); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(prodos_direnum); break;
+ case IMGTOOLINFO_INT_PATH_SEPARATOR: info->i = '/'; break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "ProDOS format"); break;
- case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "ProDOS format"); break;
+ case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = prodos_diskimage_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = prodos_diskimage_nextenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = prodos_diskimage_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = prodos_diskimage_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = prodos_diskimage_writefile; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = prodos_diskimage_deletefile; break;
- case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = prodos_diskimage_listforks; break;
- case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = prodos_diskimage_createdir; break;
- case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = prodos_diskimage_deletedir; break;
- case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = prodos_diskimage_getattrs; break;
- case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = prodos_diskimage_setattrs; break;
- case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = prodos_diskimage_suggesttransfer; break;
- case IMGTOOLINFO_PTR_GET_CHAIN: info->get_chain = prodos_diskimage_getchain; break;
+ case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = prodos_diskimage_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = prodos_diskimage_nextenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = prodos_diskimage_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = prodos_diskimage_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = prodos_diskimage_writefile; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = prodos_diskimage_deletefile; break;
+ case IMGTOOLINFO_PTR_LIST_FORKS: info->list_forks = prodos_diskimage_listforks; break;
+ case IMGTOOLINFO_PTR_CREATE_DIR: info->create_dir = prodos_diskimage_createdir; break;
+ case IMGTOOLINFO_PTR_DELETE_DIR: info->delete_dir = prodos_diskimage_deletedir; break;
+ case IMGTOOLINFO_PTR_GET_ATTRS: info->get_attrs = prodos_diskimage_getattrs; break;
+ case IMGTOOLINFO_PTR_SET_ATTRS: info->set_attrs = prodos_diskimage_setattrs; break;
+ case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = prodos_diskimage_suggesttransfer; break;
+ case IMGTOOLINFO_PTR_GET_CHAIN: info->get_chain = prodos_diskimage_getchain; break;
}
}
@@ -2250,14 +2250,14 @@ void prodos_525_get_info(const imgtool_class *imgclass, UINT32 state, union imgt
switch(state)
{
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_525"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_525"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_525; break;
- case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_525; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple2; break;
+ case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_525; break;
+ case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_525; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple2; break;
- default: generic_prodos_get_info(imgclass, state, info); break;
+ default: generic_prodos_get_info(imgclass, state, info); break;
}
}
@@ -2268,13 +2268,13 @@ void prodos_35_get_info(const imgtool_class *imgclass, UINT32 state, union imgto
switch(state)
{
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_35"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "prodos_35"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_35; break;
- case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_35; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_iigs; break;
+ case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = prodos_diskimage_create_35; break;
+ case IMGTOOLINFO_PTR_FLOPPY_OPEN: info->open = prodos_diskimage_open_35; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_apple35_iigs; break;
- default: generic_prodos_get_info(imgclass, state, info); break;
+ default: generic_prodos_get_info(imgclass, state, info); break;
}
}
diff --git a/src/mess/tools/imgtool/modules/psion.c b/src/mess/tools/imgtool/modules/psion.c
index f4b8566612e..d6a25f0481e 100644
--- a/src/mess/tools/imgtool/modules/psion.c
+++ b/src/mess/tools/imgtool/modules/psion.c
@@ -574,17 +574,17 @@ static imgtoolerr_t datapack_write_file( imgtool_partition *partition, const cha
switch (type)
{
- case 1: //OB3 file
+ case 1: //OB3 file
put_name_record(pack->stream, filename, 0x83, file_id);
stream_write(pack->stream, data_head, 4);
size = put_ob3(sourcef, pack->stream);
break;
- case 2: //OPL file
+ case 2: //OPL file
put_name_record(pack->stream, filename, 0x83, file_id);
stream_write(pack->stream, data_head, 4);
size = put_opl(sourcef, pack->stream);
break;
- case 3: //ODB file
+ case 3: //ODB file
put_name_record(pack->stream, filename, 0x81, file_id);
size = put_odb(sourcef, pack->stream, file_id);
break;
diff --git a/src/mess/tools/imgtool/modules/rsdos.c b/src/mess/tools/imgtool/modules/rsdos.c
index 542804303a0..7e24bdf35e9 100644
--- a/src/mess/tools/imgtool/modules/rsdos.c
+++ b/src/mess/tools/imgtool/modules/rsdos.c
@@ -32,8 +32,8 @@ struct rsdos_direnum
int eof;
};
-#define RSDOS_OPTIONS_FTYPE 'T'
-#define RSDOS_OPTIONS_ASCII 'M'
+#define RSDOS_OPTIONS_FTYPE 'T'
+#define RSDOS_OPTIONS_ASCII 'M'
@@ -41,7 +41,7 @@ struct rsdos_direnum
Imgtool module code
*********************************************************************/
-#define MAX_DIRENTS ((18-2)*(256/32))
+#define MAX_DIRENTS ((18-2)*(256/32))
static floperr_t get_rsdos_dirent(imgtool_image *f, int index_loc, struct rsdos_dirent *ent)
{
return floppy_read_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent));
@@ -53,7 +53,7 @@ static floperr_t put_rsdos_dirent(imgtool_image *f, int index_loc, const struct
{
if (index_loc >= MAX_DIRENTS)
return (floperr_t)IMGTOOLERR_FILENOTFOUND;
- return floppy_write_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent), 0); /* TODO: pass ddam argument from imgtool */
+ return floppy_write_sector(imgtool_floppy(f), 0, 17, 3, index_loc * 32, (void *) ent, sizeof(*ent), 0); /* TODO: pass ddam argument from imgtool */
}
@@ -123,7 +123,7 @@ static UINT8 get_granule_count(imgtool_image *img)
return (granules > 255) ? 255 : (UINT8) granules;
}
-#define MAX_GRANULEMAP_SIZE 256
+#define MAX_GRANULEMAP_SIZE 256
/* granule_map must be an array of MAX_GRANULEMAP_SIZE bytes */
static floperr_t get_granule_map(imgtool_image *img, UINT8 *granule_map, UINT8 *granule_count)
@@ -141,7 +141,7 @@ static floperr_t get_granule_map(imgtool_image *img, UINT8 *granule_map, UINT8 *
static floperr_t put_granule_map(imgtool_image *img, const UINT8 *granule_map, UINT8 granule_count)
{
- return floppy_write_sector(imgtool_floppy(img), 0, 17, 2, 0, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */
+ return floppy_write_sector(imgtool_floppy(img), 0, 17, 2, 0, granule_map, granule_count, 0); /* TODO: pass ddam argument from imgtool */
}
@@ -185,7 +185,7 @@ static imgtoolerr_t process_rsdos_file(struct rsdos_dirent *ent, imgtool_image *
size_t s, lastgransize;
UINT8 granule_count;
unsigned char i = 0, granule;
- UINT8 usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */
+ UINT8 usedmap[MAX_GRANULEMAP_SIZE]; /* Used to detect infinite loops */
UINT8 granule_map[MAX_GRANULEMAP_SIZE];
ferr = get_granule_map(img, granule_map, &granule_count);
@@ -457,7 +457,7 @@ static imgtoolerr_t rsdos_diskimage_writefile(imgtool_partition *partition, cons
{
g++;
if ((g >= granule_count) || (g == 0))
- return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */
+ return IMGTOOLERR_UNEXPECTED; /* We should have already verified that there is enough space */
}
*gptr = g;
gptr = &granule_map[g];
@@ -476,8 +476,8 @@ static imgtoolerr_t rsdos_diskimage_writefile(imgtool_partition *partition, cons
while(sz > 0);
/* Now that we are done with the file, we need to specify the final entry
- * in the file allocation table
- */
+ * in the file allocation table
+ */
*gptr = 0xc0 + ((i + 255) / 256);
/* Now we need to find an empty directory entry */
@@ -578,15 +578,15 @@ static imgtoolerr_t rsdos_diskimage_suggesttransfer(imgtool_partition *partition
*********************************************************************/
static OPTION_GUIDE_START( coco_rsdos_writefile_optionguide )
- OPTION_ENUM_START( RSDOS_OPTIONS_FTYPE, "ftype", "File type" )
- OPTION_ENUM( 0, "basic", "Basic" )
- OPTION_ENUM( 1, "data", "Data" )
- OPTION_ENUM( 2, "binary", "Binary" )
- OPTION_ENUM( 3, "assembler", "Assembler Source" )
+ OPTION_ENUM_START( RSDOS_OPTIONS_FTYPE, "ftype", "File type" )
+ OPTION_ENUM( 0, "basic", "Basic" )
+ OPTION_ENUM( 1, "data", "Data" )
+ OPTION_ENUM( 2, "binary", "Binary" )
+ OPTION_ENUM( 3, "assembler", "Assembler Source" )
OPTION_ENUM_END
- OPTION_ENUM_START( RSDOS_OPTIONS_ASCII, "ascii", "Ascii flag" )
- OPTION_ENUM( 0, "ascii", "Ascii" )
- OPTION_ENUM( 1, "binary", "Binary" )
+ OPTION_ENUM_START( RSDOS_OPTIONS_ASCII, "ascii", "Ascii flag" )
+ OPTION_ENUM( 0, "ascii", "Ascii" )
+ OPTION_ENUM( 1, "binary", "Binary" )
OPTION_ENUM_END
OPTION_GUIDE_END
@@ -597,25 +597,25 @@ void rsdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolin
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct rsdos_direnum); break;
+ case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(struct rsdos_direnum); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "rsdos"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "RS-DOS format"); break;
- case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
- case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "rsdos"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "RS-DOS format"); break;
+ case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
+ case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T0-[2]-3;M0-[1]"); break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = rsdos_diskimage_nextenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = rsdos_diskimage_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = rsdos_diskimage_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = rsdos_diskimage_writefile; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = rsdos_diskimage_deletefile; break;
- case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = rsdos_diskimage_suggesttransfer; break;
- case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = coco_rsdos_writefile_optionguide; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break;
+ case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = rsdos_diskimage_nextenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = rsdos_diskimage_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = rsdos_diskimage_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = rsdos_diskimage_writefile; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = rsdos_diskimage_deletefile; break;
+ case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = rsdos_diskimage_suggesttransfer; break;
+ case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = coco_rsdos_writefile_optionguide; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_coco; break;
}
}
diff --git a/src/mess/tools/imgtool/modules/thomson.c b/src/mess/tools/imgtool/modules/thomson.c
index 35670cd7c90..6ae29f24155 100644
--- a/src/mess/tools/imgtool/modules/thomson.c
+++ b/src/mess/tools/imgtool/modules/thomson.c
@@ -120,44 +120,44 @@
struct thom_floppy {
- imgtool_stream *stream;
+ imgtool_stream *stream;
- UINT16 sector_size; /* 128 or 256 */
- UINT16 sectuse_size; /* bytes used in sector: 128 or 255 */
- UINT8 tracks; /* 25, 40, or 80 */
- UINT8 heads; /* 1 or 2 */
- UINT8 data[MAXSIZE]; /* image data */
+ UINT16 sector_size; /* 128 or 256 */
+ UINT16 sectuse_size; /* bytes used in sector: 128 or 255 */
+ UINT8 tracks; /* 25, 40, or 80 */
+ UINT8 heads; /* 1 or 2 */
+ UINT8 data[MAXSIZE]; /* image data */
- int modified; /* data need to be copied back to image file */
+ int modified; /* data need to be copied back to image file */
};
enum thom_dirent_type {
- THOM_DIRENT_END,
- THOM_DIRENT_FREE,
- THOM_DIRENT_FILE,
- THOM_DIRENT_INVALID,
+ THOM_DIRENT_END,
+ THOM_DIRENT_FREE,
+ THOM_DIRENT_FILE,
+ THOM_DIRENT_INVALID,
};
struct thom_dirent {
- thom_dirent_type type;
- int index;
+ thom_dirent_type type;
+ int index;
- char name[9];
- char ext[4];
- char comment[9];
- UINT8 ftype;
- UINT8 format;
- UINT8 firstblock;
- UINT16 lastsectsize;
- UINT8 day;
- UINT8 month;
- UINT8 year;
+ char name[9];
+ char ext[4];
+ char comment[9];
+ UINT8 ftype;
+ UINT8 format;
+ UINT8 firstblock;
+ UINT16 lastsectsize;
+ UINT8 day;
+ UINT8 month;
+ UINT8 year;
};
@@ -166,7 +166,7 @@ static void thom_basic_get_info(const imgtool_class *clas, UINT32 param,
union imgtoolinfo *info);
static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
- unsigned track, unsigned sector);
+ unsigned track, unsigned sector);
/*********************** .fd / .qd format ************************/
@@ -181,88 +181,88 @@ static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
static imgtoolerr_t thom_open_fd_qd(imgtool_image *img, imgtool_stream *stream)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- int size = stream_size( stream );
-
- f->stream = stream;
- f->modified = 0;
-
- /* guess format */
- switch ( size ) {
-
- case 81920:
- f->tracks = 40;
- f->sector_size = 128;
- f->sectuse_size = 128;
- f->heads = 1;
- break;
-
- case 163840:
- f->tracks = 40;
- f->sector_size = 256;
- f->sectuse_size = 255;
- f->heads = 1;
- /* could also be: sector_size=128, heads=2 */
- /* maight even be: tracks=80, sector_size=128 */
- break;
-
- case 327680:
- f->tracks = 80;
- f->sector_size = 256;
- f->sectuse_size = 255;
- f->heads = 1;
- /* could also be: tracks=40, heads=2 */
- break;
-
- case 655360:
- f->tracks = 80;
- f->sector_size = 256;
- f->sectuse_size = 255;
- f->heads = 2;
- break;
-
- case 51200:
- f->tracks = 25;
- f->sector_size = 128;
- f->sectuse_size = 128;
- f->heads = 1;
- break;
-
- case 62400:
- f->tracks = 25;
- f->sector_size = 128;
- f->sectuse_size = 128;
- f->heads = 2;
- break;
-
- default:
- return IMGTOOLERR_CORRUPTIMAGE;
- }
-
- assert( size == f->heads * f->tracks * 16 * f->sector_size );
-
- stream_seek( stream, 0, SEEK_SET );
- if ( stream_read( stream, f->data, size ) < size )
- return IMGTOOLERR_READERROR;
-
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ int size = stream_size( stream );
+
+ f->stream = stream;
+ f->modified = 0;
+
+ /* guess format */
+ switch ( size ) {
+
+ case 81920:
+ f->tracks = 40;
+ f->sector_size = 128;
+ f->sectuse_size = 128;
+ f->heads = 1;
+ break;
+
+ case 163840:
+ f->tracks = 40;
+ f->sector_size = 256;
+ f->sectuse_size = 255;
+ f->heads = 1;
+ /* could also be: sector_size=128, heads=2 */
+ /* maight even be: tracks=80, sector_size=128 */
+ break;
+
+ case 327680:
+ f->tracks = 80;
+ f->sector_size = 256;
+ f->sectuse_size = 255;
+ f->heads = 1;
+ /* could also be: tracks=40, heads=2 */
+ break;
+
+ case 655360:
+ f->tracks = 80;
+ f->sector_size = 256;
+ f->sectuse_size = 255;
+ f->heads = 2;
+ break;
+
+ case 51200:
+ f->tracks = 25;
+ f->sector_size = 128;
+ f->sectuse_size = 128;
+ f->heads = 1;
+ break;
+
+ case 62400:
+ f->tracks = 25;
+ f->sector_size = 128;
+ f->sectuse_size = 128;
+ f->heads = 2;
+ break;
+
+ default:
+ return IMGTOOLERR_CORRUPTIMAGE;
+ }
+
+ assert( size == f->heads * f->tracks * 16 * f->sector_size );
+
+ stream_seek( stream, 0, SEEK_SET );
+ if ( stream_read( stream, f->data, size ) < size )
+ return IMGTOOLERR_READERROR;
+
+ return IMGTOOLERR_SUCCESS;
}
static void thom_close_fd_qd(imgtool_image *img)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- /* save image */
- if ( f->modified ) {
- int size = f->heads * f->tracks * 16 * f->sector_size;
- stream_seek( f->stream, 0, SEEK_SET );
- if ( stream_write( f->stream, f->data, size ) < size )
+ /* save image */
+ if ( f->modified ) {
+ int size = f->heads * f->tracks * 16 * f->sector_size;
+ stream_seek( f->stream, 0, SEEK_SET );
+ if ( stream_write( f->stream, f->data, size ) < size )
{
- /* logerror( "thom_diskimage_close_fd_qd: write error\n" ); */
+ /* logerror( "thom_diskimage_close_fd_qd: write error\n" ); */
+ }
}
- }
- stream_close( f->stream );
+ stream_close( f->stream );
}
@@ -292,108 +292,108 @@ static void thom_close_fd_qd(imgtool_image *img)
static const int sap_magic_num = 0xB3; /* simple XOR crypt */
static const char sap_header[]=
- "\001SYSTEME D'ARCHIVAGE PUKALL S.A.P. "
- "(c) Alexandre PUKALL Avril 1998";
+ "\001SYSTEME D'ARCHIVAGE PUKALL S.A.P. "
+ "(c) Alexandre PUKALL Avril 1998";
static const UINT16 sap_crc[] = {
- 0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
- 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f,
+ 0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
+ 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f,
};
static UINT16 thom_sap_crc( UINT8* data, int size )
{
- int i;
- UINT16 crc = 0xffff, crc2;
- for ( i = 0; i < size; i++ ) {
- crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ];
- crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ];
- }
- return crc;
+ int i;
+ UINT16 crc = 0xffff, crc2;
+ for ( i = 0; i < size; i++ ) {
+ crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ];
+ crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ];
+ }
+ return crc;
}
static imgtoolerr_t thom_open_sap(imgtool_image *img, imgtool_stream *stream)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- UINT8 buf[262];
-
- f->stream = stream;
- f->modified = 0;
-
- /* check image header */
- stream_seek( stream, 0, SEEK_SET );
- stream_read( stream, buf, 66 );
- if ( memcmp( buf+1, sap_header+1, 65 ) ) return IMGTOOLERR_CORRUPTIMAGE;
-
- /* guess format */
- stream_read( stream, buf, 1 );
- switch ( buf[0] ) {
- case 1:
- case 3:
- f->heads = 1;
- f->tracks = 40;
- f->sector_size = 128;
- f->sectuse_size = 128;
- break;
- case 0:
- case 2:
- case 4:
- f->heads = 1;
- f->tracks = 80;
- f->sector_size = 256;
- f->sectuse_size = 255;
- break;
- default: return IMGTOOLERR_CORRUPTIMAGE;
- }
-
- stream_seek( stream, 66, SEEK_SET );
- while ( 1) {
- int i, sector, track;
- UINT16 crc;
-
- /* load sector */
- if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size )
- break;
-
- /* parse sector header */
- track = buf[2];
- sector = buf[3];
- if ( sector < 1 || sector > 16 || track >= f->tracks )
- return IMGTOOLERR_CORRUPTIMAGE;
-
- /* decrypt */
- for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num;
- memcpy( thom_get_sector( f, 0, track, sector ), buf + 4, f->sector_size );
-
- /* check CRC */
- crc = thom_sap_crc( buf, f->sector_size + 4 );
- if ( ( (crc >> 8) != buf[ f->sector_size + 4 ] ) ||
- ( (crc & 0xff) != buf[ f->sector_size + 5 ] ) )
- return IMGTOOLERR_CORRUPTIMAGE;
- }
-
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ UINT8 buf[262];
+
+ f->stream = stream;
+ f->modified = 0;
+
+ /* check image header */
+ stream_seek( stream, 0, SEEK_SET );
+ stream_read( stream, buf, 66 );
+ if ( memcmp( buf+1, sap_header+1, 65 ) ) return IMGTOOLERR_CORRUPTIMAGE;
+
+ /* guess format */
+ stream_read( stream, buf, 1 );
+ switch ( buf[0] ) {
+ case 1:
+ case 3:
+ f->heads = 1;
+ f->tracks = 40;
+ f->sector_size = 128;
+ f->sectuse_size = 128;
+ break;
+ case 0:
+ case 2:
+ case 4:
+ f->heads = 1;
+ f->tracks = 80;
+ f->sector_size = 256;
+ f->sectuse_size = 255;
+ break;
+ default: return IMGTOOLERR_CORRUPTIMAGE;
+ }
+
+ stream_seek( stream, 66, SEEK_SET );
+ while ( 1) {
+ int i, sector, track;
+ UINT16 crc;
+
+ /* load sector */
+ if ( stream_read( stream, buf, 6 + f->sector_size ) < 6 + f->sector_size )
+ break;
+
+ /* parse sector header */
+ track = buf[2];
+ sector = buf[3];
+ if ( sector < 1 || sector > 16 || track >= f->tracks )
+ return IMGTOOLERR_CORRUPTIMAGE;
+
+ /* decrypt */
+ for ( i = 0; i < f->sector_size; i++ ) buf[ i + 4 ] ^= sap_magic_num;
+ memcpy( thom_get_sector( f, 0, track, sector ), buf + 4, f->sector_size );
+
+ /* check CRC */
+ crc = thom_sap_crc( buf, f->sector_size + 4 );
+ if ( ( (crc >> 8) != buf[ f->sector_size + 4 ] ) ||
+ ( (crc & 0xff) != buf[ f->sector_size + 5 ] ) )
+ return IMGTOOLERR_CORRUPTIMAGE;
+ }
+
+ return IMGTOOLERR_SUCCESS;
}
static void thom_close_sap(imgtool_image *img)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- if ( f->modified ) {
- int i, sector, track;
- UINT8 buf[262];
- UINT16 crc;
+ if ( f->modified ) {
+ int i, sector, track;
+ UINT8 buf[262];
+ UINT16 crc;
- /* rewind */
- stream_seek( f->stream, 0, SEEK_SET );
+ /* rewind */
+ stream_seek( f->stream, 0, SEEK_SET );
- /* image header */
- if ( stream_write( f->stream, sap_header, 66 ) < 66 ) {
- /* logerror( "thom_diskimage_close_sap: write error\n" ); */
- return;
- }
+ /* image header */
+ if ( stream_write( f->stream, sap_header, 66 ) < 66 ) {
+ /* logerror( "thom_diskimage_close_sap: write error\n" ); */
+ return;
+ }
- for ( track = 0; track < f->tracks; track++ )
- for ( sector = 1; sector <= 16; sector++ ) {
+ for ( track = 0; track < f->tracks; track++ )
+ for ( sector = 1; sector <= 16; sector++ ) {
/* sector header & data */
buf[0] = ( f->tracks == 80 ) ? 2 : 1;
@@ -413,438 +413,438 @@ static void thom_close_sap(imgtool_image *img)
/* save */
if ( stream_write( f->stream, buf, f->sector_size + 6 ) <
- f->sector_size + 6 ) {
- /* logerror( "thom_diskimage_close_sap: write error\n" ); */
- return;
+ f->sector_size + 6 ) {
+ /* logerror( "thom_diskimage_close_sap: write error\n" ); */
+ return;
+ }
+ }
}
- }
- }
- stream_close( f->stream );
+ stream_close( f->stream );
}
/*********************** low-level functions *********************/
static UINT8* thom_get_sector(thom_floppy* f, unsigned head,
- unsigned track, unsigned sector)
+ unsigned track, unsigned sector)
{
- assert( head < f->heads);
- assert( track < f->tracks );
- assert( sector > 0 && sector <= 16 );
- return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) *
- f->sector_size ];
+ assert( head < f->heads);
+ assert( track < f->tracks );
+ assert( sector > 0 && sector <= 16 );
+ return & f->data[ ( (head * f->tracks + track) * 16 + (sector-1) ) *
+ f->sector_size ];
}
static int thom_nb_blocks(thom_floppy* f)
{
- int n1 = f->tracks * 2; /* 2 blocks per track */
- int n2 = f->sector_size - 1; /* FAT entries */
- return (n1 < n2) ? n1 : n2;
+ int n1 = f->tracks * 2; /* 2 blocks per track */
+ int n2 = f->sector_size - 1; /* FAT entries */
+ return (n1 < n2) ? n1 : n2;
}
static int thom_max_dirent(thom_floppy* f)
{
- return 14 * f->sector_size / 32;
+ return 14 * f->sector_size / 32;
}
/* remove trailing spaces */
static void thom_stringify(char* str)
{
- char* s = str + strlen(str) - 1;
- while ( s >= str && *s == ' ' ) { *s = 0; s--; }
- for ( s = str; *s; s++ )
- if ( (UINT8)*s == 0xff ) *s = 0;
- else if ( *s < ' ' || *s >= 127 ) *s = '?';
+ char* s = str + strlen(str) - 1;
+ while ( s >= str && *s == ' ' ) { *s = 0; s--; }
+ for ( s = str; *s; s++ )
+ if ( (UINT8)*s == 0xff ) *s = 0;
+ else if ( *s < ' ' || *s >= 127 ) *s = '?';
}
/* pad with spaces until the length is nb */
static void thom_unstringity(char* str, int nb)
{
- char* s = str;
- while ( s < str + nb && *s ) s++;
- while ( s < str + nb ) { *s = ' '; s++; }
+ char* s = str;
+ while ( s < str + nb && *s ) s++;
+ while ( s < str + nb ) { *s = ' '; s++; }
}
/* get filename and extension & truncate them to 8 + 3 */
static void thom_conv_filename(const char* s, char name[9], char ext[4])
{
- int i;
- memset( name, 0, 9 );
- memset( ext, 0, 4 );
- for ( i = 0; i < 8 && *s && *s != '.'; i++, s++ ) name[i] = *s;
- while ( *s && *s != '.' ) s++;
- if ( *s == '.' ) {
- s++;
- for ( i = 0; i < 3 && *s; i++, s++ ) ext[i] = *s;
- }
+ int i;
+ memset( name, 0, 9 );
+ memset( ext, 0, 4 );
+ for ( i = 0; i < 8 && *s && *s != '.'; i++, s++ ) name[i] = *s;
+ while ( *s && *s != '.' ) s++;
+ if ( *s == '.' ) {
+ s++;
+ for ( i = 0; i < 3 && *s; i++, s++ ) ext[i] = *s;
+ }
}
static time_t thom_crack_time(thom_dirent* d)
{
- struct tm t;
- time_t now;
-
- /* check */
- if ( d->day < 1 || d->day > 31 || d->month < 1 || d->month > 12 ) return 0;
-
- /* converts */
- time( &now );
- t = *localtime( &now );
- t.tm_sec = 0;
- t.tm_min = 0;
- t.tm_hour = 0;
- t.tm_mday = d->day;
- t.tm_mon = d->month - 1;
- t.tm_year = (d->year < 65 ) ? d->year + 100 : d->year;
- return mktime(&t);
+ struct tm t;
+ time_t now;
+
+ /* check */
+ if ( d->day < 1 || d->day > 31 || d->month < 1 || d->month > 12 ) return 0;
+
+ /* converts */
+ time( &now );
+ t = *localtime( &now );
+ t.tm_sec = 0;
+ t.tm_min = 0;
+ t.tm_hour = 0;
+ t.tm_mday = d->day;
+ t.tm_mon = d->month - 1;
+ t.tm_year = (d->year < 65 ) ? d->year + 100 : d->year;
+ return mktime(&t);
}
static void thom_make_time(thom_dirent* d, time_t time)
{
- if ( ! time ) {
- d->day = d->month = d->year = 0;
- }
- else {
- struct tm t = *localtime( &time );
- d->day = t.tm_mday;
- d->month = t.tm_mon + 1;
- d->year = t.tm_year % 100;
- }
+ if ( ! time ) {
+ d->day = d->month = d->year = 0;
+ }
+ else {
+ struct tm t = *localtime( &time );
+ d->day = t.tm_mday;
+ d->month = t.tm_mon + 1;
+ d->year = t.tm_year % 100;
+ }
}
static void thom_make_time_now(thom_dirent* d)
{
- time_t now;
- time( &now );
- thom_make_time( d, now );
+ time_t now;
+ time( &now );
+ thom_make_time( d, now );
}
static void thom_get_dirent(thom_floppy* f, unsigned head,
- unsigned n, thom_dirent* d)
+ unsigned n, thom_dirent* d)
{
- UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32;
- memset( d, 0, sizeof(*d) );
- d->index = n;
- if ( n >= thom_max_dirent( f ) )
- d->type = THOM_DIRENT_END;
- else if ( *base == 0xff )
- d->type = THOM_DIRENT_END;
- else if ( *base == 0 )
- d->type = THOM_DIRENT_FREE;
- else {
- int i;
- /* fill regular entry */
- d->type = THOM_DIRENT_FILE;
- memcpy( d->name, base, 8 );
- memcpy( d->ext, base + 8, 3 );
- memcpy( d->comment, base + 16, 8 );
- thom_stringify( d->name );
- thom_stringify( d->ext );
- thom_stringify( d->comment );
- d->ftype = base[11];
- d->format = base[12];
- d->firstblock = base[13];
- d->lastsectsize = ((int)base[14] << 8) + base[15];
- d->day = base[24];
- d->month = base[25];
- d->year = base[26];
- /* sanity check */
- for ( i = 0; i < 11; i++ )
- if ( base[i] < ' ' || base[i] > 127 ) d->type = THOM_DIRENT_INVALID;
- }
+ UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32;
+ memset( d, 0, sizeof(*d) );
+ d->index = n;
+ if ( n >= thom_max_dirent( f ) )
+ d->type = THOM_DIRENT_END;
+ else if ( *base == 0xff )
+ d->type = THOM_DIRENT_END;
+ else if ( *base == 0 )
+ d->type = THOM_DIRENT_FREE;
+ else {
+ int i;
+ /* fill regular entry */
+ d->type = THOM_DIRENT_FILE;
+ memcpy( d->name, base, 8 );
+ memcpy( d->ext, base + 8, 3 );
+ memcpy( d->comment, base + 16, 8 );
+ thom_stringify( d->name );
+ thom_stringify( d->ext );
+ thom_stringify( d->comment );
+ d->ftype = base[11];
+ d->format = base[12];
+ d->firstblock = base[13];
+ d->lastsectsize = ((int)base[14] << 8) + base[15];
+ d->day = base[24];
+ d->month = base[25];
+ d->year = base[26];
+ /* sanity check */
+ for ( i = 0; i < 11; i++ )
+ if ( base[i] < ' ' || base[i] > 127 ) d->type = THOM_DIRENT_INVALID;
+ }
}
static void thom_set_dirent(thom_floppy* f, unsigned head,
- unsigned n, thom_dirent* d)
+ unsigned n, thom_dirent* d)
{
- UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32;
- if ( n >= thom_max_dirent( f ) ) return;
- memset( base, 0, 32 );
- if ( d->type == THOM_DIRENT_END ) base[ 0 ] = 0xff;
- else if ( d->type == THOM_DIRENT_FREE ) base[ 0 ] = 0;
- else {
- memcpy( base, d->name, 8 );
- memcpy( base + 8, d->ext, 3 );
- memcpy( base + 16, d->comment, 8 );
- thom_unstringity( (char*)base, 8 );
- thom_unstringity( (char*)base + 8, 3 );
- if ( base[16] ) thom_unstringity( (char*)base + 16, 8 );
- base[11] = d->ftype;
- base[12] = d->format;
- base[13] = d->firstblock;
- base[14] = d->lastsectsize >> 8;
- base[15] = d->lastsectsize & 0xff;
- base[24] = d->day;
- base[25] = d->month;
- base[26] = d->year;
- }
- f->modified = 1;
+ UINT8* base = thom_get_sector( f, head, 20, 3 ) + n * 32;
+ if ( n >= thom_max_dirent( f ) ) return;
+ memset( base, 0, 32 );
+ if ( d->type == THOM_DIRENT_END ) base[ 0 ] = 0xff;
+ else if ( d->type == THOM_DIRENT_FREE ) base[ 0 ] = 0;
+ else {
+ memcpy( base, d->name, 8 );
+ memcpy( base + 8, d->ext, 3 );
+ memcpy( base + 16, d->comment, 8 );
+ thom_unstringity( (char*)base, 8 );
+ thom_unstringity( (char*)base + 8, 3 );
+ if ( base[16] ) thom_unstringity( (char*)base + 16, 8 );
+ base[11] = d->ftype;
+ base[12] = d->format;
+ base[13] = d->firstblock;
+ base[14] = d->lastsectsize >> 8;
+ base[15] = d->lastsectsize & 0xff;
+ base[24] = d->day;
+ base[25] = d->month;
+ base[26] = d->year;
+ }
+ f->modified = 1;
}
/* returns 1 if file found, 0 if not */
static int thom_find_dirent(thom_floppy* f, unsigned head,
- const char* name, thom_dirent* d)
+ const char* name, thom_dirent* d)
{
- int n = 0;
- while ( 1 ) {
- thom_get_dirent( f, head, n, d );
- if ( d->type == THOM_DIRENT_END ) return 0;
- if ( d->type == THOM_DIRENT_FILE ) {
- char buf[13];
- sprintf( buf, "%s.%s", d->name, d->ext );
- if ( ! strcmp( buf, name ) ) return 1;
- }
- n++;
- }
+ int n = 0;
+ while ( 1 ) {
+ thom_get_dirent( f, head, n, d );
+ if ( d->type == THOM_DIRENT_END ) return 0;
+ if ( d->type == THOM_DIRENT_FILE ) {
+ char buf[13];
+ sprintf( buf, "%s.%s", d->name, d->ext );
+ if ( ! strcmp( buf, name ) ) return 1;
+ }
+ n++;
+ }
}
/* returns 1 if free entry found, 0 if none available */
static int thom_find_free_dirent(thom_floppy* f, unsigned head, thom_dirent* d)
{
- int n = 0;
- while ( 1 ) {
- thom_get_dirent( f, head, n, d );
- if ( d->type == THOM_DIRENT_FREE ) return 1;
- if ( d->type == THOM_DIRENT_END ) break;
- n++;
- }
- if ( n + 1 >= thom_max_dirent( f ) ) return 0;
- thom_set_dirent( f, head, n+1, d );
- d->type = THOM_DIRENT_FREE;
- return 1;
+ int n = 0;
+ while ( 1 ) {
+ thom_get_dirent( f, head, n, d );
+ if ( d->type == THOM_DIRENT_FREE ) return 1;
+ if ( d->type == THOM_DIRENT_END ) break;
+ n++;
+ }
+ if ( n + 1 >= thom_max_dirent( f ) ) return 0;
+ thom_set_dirent( f, head, n+1, d );
+ d->type = THOM_DIRENT_FREE;
+ return 1;
}
/* returns the file size in bytes, or -1 if error */
static int thom_get_file_size(thom_floppy* f, unsigned head, thom_dirent* d)
{
- UINT8* fat = thom_get_sector( f, head, 20, 2 );
- int nbblocks = thom_nb_blocks(f);
- int block = d->firstblock;
- int size = 0;
- int timeout = nbblocks;
- if ( d->type != THOM_DIRENT_FILE ) return -1;
- if ( block >= nbblocks ) return -1;
- block = fat[ block + 1 ];
- while ( 1 ) {
- if ( block < nbblocks ) {
- /* full block */
- size += 8 * f->sectuse_size;
- block = fat[ block + 1 ];
- }
- else if ( block >= 0xc1 && block <= 0xc8 ) {
- /* last block in file */
- size += (block-0xc1) * f->sectuse_size;
- size += d->lastsectsize;
- return size;
- }
- else return -1;
- timeout--;
- if ( timeout < 0 ) return -1;
- }
+ UINT8* fat = thom_get_sector( f, head, 20, 2 );
+ int nbblocks = thom_nb_blocks(f);
+ int block = d->firstblock;
+ int size = 0;
+ int timeout = nbblocks;
+ if ( d->type != THOM_DIRENT_FILE ) return -1;
+ if ( block >= nbblocks ) return -1;
+ block = fat[ block + 1 ];
+ while ( 1 ) {
+ if ( block < nbblocks ) {
+ /* full block */
+ size += 8 * f->sectuse_size;
+ block = fat[ block + 1 ];
+ }
+ else if ( block >= 0xc1 && block <= 0xc8 ) {
+ /* last block in file */
+ size += (block-0xc1) * f->sectuse_size;
+ size += d->lastsectsize;
+ return size;
+ }
+ else return -1;
+ timeout--;
+ if ( timeout < 0 ) return -1;
+ }
}
/* number of blocks used by file */
static int thom_get_file_blocks(thom_floppy* f, unsigned head, thom_dirent* d)
{
- UINT8* fat = thom_get_sector( f, head, 20, 2 );
- int nbblocks = thom_nb_blocks(f);
- int block = d->firstblock;
- int nb = 0;
- if ( d->type != THOM_DIRENT_FILE ) return 0;
- if ( block >= nbblocks ) return 0;
- block = fat[ block + 1 ];
- while ( 1 ) {
- if ( block < nbblocks ) {
- /* full block */
- nb++;
- block = fat[ block + 1 ];
- }
- else if ( block >= 0xc1 && block <= 0xc8 ) {
- /* last block in file */
- nb++;
- return nb;
- }
- else return nb;
- }
+ UINT8* fat = thom_get_sector( f, head, 20, 2 );
+ int nbblocks = thom_nb_blocks(f);
+ int block = d->firstblock;
+ int nb = 0;
+ if ( d->type != THOM_DIRENT_FILE ) return 0;
+ if ( block >= nbblocks ) return 0;
+ block = fat[ block + 1 ];
+ while ( 1 ) {
+ if ( block < nbblocks ) {
+ /* full block */
+ nb++;
+ block = fat[ block + 1 ];
+ }
+ else if ( block >= 0xc1 && block <= 0xc8 ) {
+ /* last block in file */
+ nb++;
+ return nb;
+ }
+ else return nb;
+ }
}
/* number of free blocks */
static int thom_get_free_blocks(thom_floppy* f, unsigned head)
{
- UINT8* fat = thom_get_sector( f, head, 20, 2 );
- int nbblocks = thom_nb_blocks(f);
- int i, nb = 0;
- for ( i = 1; i <= nbblocks; i++ )
- if ( fat[i] == 0xff ) nb++;
- return nb;
+ UINT8* fat = thom_get_sector( f, head, 20, 2 );
+ int nbblocks = thom_nb_blocks(f);
+ int i, nb = 0;
+ for ( i = 1; i <= nbblocks; i++ )
+ if ( fat[i] == 0xff ) nb++;
+ return nb;
}
/* dump file contents into dst */
static void thom_get_file(thom_floppy* f, unsigned head,
- thom_dirent* d, imgtool_stream *dst)
+ thom_dirent* d, imgtool_stream *dst)
{
- UINT8* fat = thom_get_sector( f, head, 20, 2 );
- int nbblocks = thom_nb_blocks(f);
- int block = d->firstblock;
- if ( block >= nbblocks ) return;
- while ( 1 ) {
- int nextblock = fat[ block + 1 ];
- int track = block / 2;
- int firstsect = (block % 2) ? 9 : 1;
- if ( nextblock < nbblocks ) {
- /* full block */
- int i;
- for ( i = 0; i < 8; i++ ) {
+ UINT8* fat = thom_get_sector( f, head, 20, 2 );
+ int nbblocks = thom_nb_blocks(f);
+ int block = d->firstblock;
+ if ( block >= nbblocks ) return;
+ while ( 1 ) {
+ int nextblock = fat[ block + 1 ];
+ int track = block / 2;
+ int firstsect = (block % 2) ? 9 : 1;
+ if ( nextblock < nbblocks ) {
+ /* full block */
+ int i;
+ for ( i = 0; i < 8; i++ ) {
UINT8* data = thom_get_sector( f, head, track, firstsect + i );
stream_write( dst, data, f->sectuse_size );
- }
- block = fat[ block + 1 ];
- }
- else if ( nextblock >= 0xc1 && nextblock <= 0xc8 ) {
- /* last block in file */
- int i;
- UINT8* data;
- for ( i = 0; i < nextblock - 0xc1; i++ ) {
+ }
+ block = fat[ block + 1 ];
+ }
+ else if ( nextblock >= 0xc1 && nextblock <= 0xc8 ) {
+ /* last block in file */
+ int i;
+ UINT8* data;
+ for ( i = 0; i < nextblock - 0xc1; i++ ) {
data = thom_get_sector( f, head, track, firstsect + i );
stream_write( dst, data, f->sectuse_size );
- }
- data = thom_get_sector( f, head, track, firstsect + i );
- stream_write( dst, data, d->lastsectsize );
- return;
- }
- else {
- /* invalid, assume last block */
- UINT8* data = thom_get_sector( f, head, track, firstsect );
- stream_write( dst, data, d->lastsectsize );
- return;
- }
- block = nextblock;
- }
+ }
+ data = thom_get_sector( f, head, track, firstsect + i );
+ stream_write( dst, data, d->lastsectsize );
+ return;
+ }
+ else {
+ /* invalid, assume last block */
+ UINT8* data = thom_get_sector( f, head, track, firstsect );
+ stream_write( dst, data, d->lastsectsize );
+ return;
+ }
+ block = nextblock;
+ }
}
static void thom_del_file(thom_floppy* f, unsigned head, thom_dirent* d)
{
- UINT8* fat = thom_get_sector( f, head, 20, 2 );
- int nbblocks = thom_nb_blocks(f);
- int block = d->firstblock;
- if ( d->type != THOM_DIRENT_FILE ) return;
- if ( block >= nbblocks ) return;
- while ( 1 ) {
- int nextblock = fat[ block + 1 ];
- fat[ block ] = 0xff;
- if ( nextblock < nbblocks ) block = fat[ block + 1 ];
- else break;
- }
- d->type = THOM_DIRENT_FREE;
- thom_set_dirent( f, head, d->index, d );
- f->modified = 1;
+ UINT8* fat = thom_get_sector( f, head, 20, 2 );
+ int nbblocks = thom_nb_blocks(f);
+ int block = d->firstblock;
+ if ( d->type != THOM_DIRENT_FILE ) return;
+ if ( block >= nbblocks ) return;
+ while ( 1 ) {
+ int nextblock = fat[ block + 1 ];
+ fat[ block ] = 0xff;
+ if ( nextblock < nbblocks ) block = fat[ block + 1 ];
+ else break;
+ }
+ d->type = THOM_DIRENT_FREE;
+ thom_set_dirent( f, head, d->index, d );
+ f->modified = 1;
}
/* create a new file or overwrite an old one, with the contents of src */
static void thom_put_file(thom_floppy* f, unsigned head,
- thom_dirent* d, imgtool_stream *src)
+ thom_dirent* d, imgtool_stream *src)
{
- int size = stream_size( src );
- UINT8* fat = thom_get_sector( f, head, 20, 2 );
- int nbblocks = thom_nb_blocks(f);
- int block;
-
- /* find first free block */
- for ( block = 0; block < nbblocks && fat[ block + 1 ] != 0xff; block++ );
- if ( block >= nbblocks ) return;
- d->firstblock = block;
-
- /* store file */
- while (1) {
- int track = block / 2;
- int firstsect = (block % 2) ? 9 : 1;
- int i;
-
- /* store data, full sectors */
- for ( i = 0; i < 8 && size > f->sectuse_size; i++ ) {
- UINT8* dst = thom_get_sector( f, head, track, firstsect + i );
- stream_read( src, dst, f->sectuse_size );
- size -= f->sectuse_size;
- }
-
- /* store data, last sector */
- if ( i < 8 ) {
- UINT8* dst = thom_get_sector( f, head, track, firstsect + i );
- stream_read( src, dst, size );
- fat[ block + 1 ] = 0xc1 + i;
- d->lastsectsize = size;
- break;
- }
-
- /* find next free block & update fat */
- i = block;
- for ( block++; block < nbblocks && fat[ block + 1 ] != 0xff; block++ );
- if ( block >= nbblocks ) {
- /* out of memory! */
- fat[ i + 1 ] = 0;
- d->lastsectsize = 0;
- break;
- }
- fat[ i + 1 ] = block;
- }
-
- d->type = THOM_DIRENT_FILE;
- thom_set_dirent( f, head, d->index, d );
- f->modified = 1;
+ int size = stream_size( src );
+ UINT8* fat = thom_get_sector( f, head, 20, 2 );
+ int nbblocks = thom_nb_blocks(f);
+ int block;
+
+ /* find first free block */
+ for ( block = 0; block < nbblocks && fat[ block + 1 ] != 0xff; block++ );
+ if ( block >= nbblocks ) return;
+ d->firstblock = block;
+
+ /* store file */
+ while (1) {
+ int track = block / 2;
+ int firstsect = (block % 2) ? 9 : 1;
+ int i;
+
+ /* store data, full sectors */
+ for ( i = 0; i < 8 && size > f->sectuse_size; i++ ) {
+ UINT8* dst = thom_get_sector( f, head, track, firstsect + i );
+ stream_read( src, dst, f->sectuse_size );
+ size -= f->sectuse_size;
+ }
+
+ /* store data, last sector */
+ if ( i < 8 ) {
+ UINT8* dst = thom_get_sector( f, head, track, firstsect + i );
+ stream_read( src, dst, size );
+ fat[ block + 1 ] = 0xc1 + i;
+ d->lastsectsize = size;
+ break;
+ }
+
+ /* find next free block & update fat */
+ i = block;
+ for ( block++; block < nbblocks && fat[ block + 1 ] != 0xff; block++ );
+ if ( block >= nbblocks ) {
+ /* out of memory! */
+ fat[ i + 1 ] = 0;
+ d->lastsectsize = 0;
+ break;
+ }
+ fat[ i + 1 ] = block;
+ }
+
+ d->type = THOM_DIRENT_FILE;
+ thom_set_dirent( f, head, d->index, d );
+ f->modified = 1;
}
/********************** module functions ***********************/
static imgtoolerr_t thom_get_sector_size(imgtool_image* img, UINT32 track,
- UINT32 head, UINT32 sector,
- UINT32 *sector_size)
+ UINT32 head, UINT32 sector,
+ UINT32 *sector_size)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
-
- if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) {
- if ( sector_size ) *sector_size = 0;
- return IMGTOOLERR_SEEKERROR;
- }
- if ( sector_size ) *sector_size = f->sector_size;
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+
+ if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks ) {
+ if ( sector_size ) *sector_size = 0;
+ return IMGTOOLERR_SEEKERROR;
+ }
+ if ( sector_size ) *sector_size = f->sector_size;
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_get_geometry(imgtool_image* img, UINT32* tracks,
- UINT32* heads, UINT32* sectors)
+ UINT32* heads, UINT32* sectors)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- if ( tracks ) *tracks = f->tracks;
- if ( heads ) *heads = f->heads;
- if ( sectors ) *sectors = 16;
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ if ( tracks ) *tracks = f->tracks;
+ if ( heads ) *heads = f->heads;
+ if ( sectors ) *sectors = 16;
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_read_sector(imgtool_image* img, UINT32 track,
- UINT32 head, UINT32 sector, void *buf,
- size_t len)
+ UINT32 head, UINT32 sector, void *buf,
+ size_t len)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks )
- return IMGTOOLERR_SEEKERROR;
- if ( len > f->sector_size) return IMGTOOLERR_READERROR;
- memcpy( buf, thom_get_sector( f, head, track, sector ), len );
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks )
+ return IMGTOOLERR_SEEKERROR;
+ if ( len > f->sector_size) return IMGTOOLERR_READERROR;
+ memcpy( buf, thom_get_sector( f, head, track, sector ), len );
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track,
- UINT32 head, UINT32 sector,
- const void *buf, size_t len, int ddam)
+ UINT32 head, UINT32 sector,
+ const void *buf, size_t len, int ddam)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
- if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks )
- return IMGTOOLERR_SEEKERROR;
- if ( len > f->sector_size) return IMGTOOLERR_WRITEERROR;
- f->modified = 1;
- memcpy( thom_get_sector( f, head, track, sector ), buf, len );
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
+ if ( head >= f->heads || sector < 1 || sector > 16 || track >= f->tracks )
+ return IMGTOOLERR_SEEKERROR;
+ if ( len > f->sector_size) return IMGTOOLERR_WRITEERROR;
+ f->modified = 1;
+ memcpy( thom_get_sector( f, head, track, sector ), buf, len );
+ return IMGTOOLERR_SUCCESS;
}
/* returns floopy name */
@@ -852,333 +852,333 @@ static imgtoolerr_t thom_write_sector(imgtool_image *img, UINT32 track,
*/
static void thom_info(imgtool_image *img, char *string, size_t len)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- UINT8* base = thom_get_sector( f, 0, 20, 1 );
- char buf[9];
- memcpy( buf, base, 8 );
- buf[8] = 0;
- thom_stringify( buf );
- strncpy( string, buf, len );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ UINT8* base = thom_get_sector( f, 0, 20, 1 );
+ char buf[9];
+ memcpy( buf, base, 8 );
+ buf[8] = 0;
+ thom_stringify( buf );
+ strncpy( string, buf, len );
}
/* each side of a floppy has its own filesystem, we treat them as'partitions'
*/
static imgtoolerr_t thom_list_partitions(imgtool_image *img,
- imgtool_partition_info *partitions,
- size_t len)
+ imgtool_partition_info *partitions,
+ size_t len)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- if ( len >= 1 ) {
- partitions[0].get_info = thom_basic_get_info;
- partitions[0].base_block = 0;
- partitions[0].block_count = 1;
- }
- if ( len >= 2 && f->heads >= 2 ) {
- partitions[1].get_info = thom_basic_get_info;
- partitions[1].base_block = 1;
- partitions[1].block_count = 1;
- }
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ if ( len >= 1 ) {
+ partitions[0].get_info = thom_basic_get_info;
+ partitions[0].base_block = 0;
+ partitions[0].block_count = 1;
+ }
+ if ( len >= 2 && f->heads >= 2 ) {
+ partitions[1].get_info = thom_basic_get_info;
+ partitions[1].base_block = 1;
+ partitions[1].block_count = 1;
+ }
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_open_partition(imgtool_partition *part,
UINT64 first_block, UINT64 block_count)
{
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- if ( first_block >= f->heads )
- return IMGTOOLERR_INVALIDPARTITION;
- * ( (int*) imgtool_partition_extra_bytes( part ) ) = first_block;
- return IMGTOOLERR_SUCCESS;
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ if ( first_block >= f->heads )
+ return IMGTOOLERR_INVALIDPARTITION;
+ * ( (int*) imgtool_partition_extra_bytes( part ) ) = first_block;
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration,
- const char *path)
+ const char *path)
{
- int* n = (int*) imgtool_directory_extrabytes( enumeration );
- *n = 0;
- return IMGTOOLERR_SUCCESS;
+ int* n = (int*) imgtool_directory_extrabytes( enumeration );
+ *n = 0;
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration,
- imgtool_dirent *ent)
+ imgtool_dirent *ent)
{
- imgtool_partition *part = imgtool_directory_partition( enumeration);
- int head = *( (int*) imgtool_partition_extra_bytes( part ) );
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- int* n = (int*) imgtool_directory_extrabytes( enumeration );
- thom_dirent d;
-
- do {
- thom_get_dirent( f, head, *n, &d );
- (*n) ++;
- }
- while ( d.type == THOM_DIRENT_FREE );
- if ( d.type == THOM_DIRENT_END ) ent->eof = 1;
- else if ( d.type == THOM_DIRENT_INVALID ) {
- ent->corrupt = 1;
- }
- else {
- int size;
- snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext );
- snprintf( ent->attr, sizeof(ent->attr), "%c %c %s",
- (d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' :
- (d.ftype == 2) ? 'M' : (d.ftype == 3) ? 'A' : '?',
- (d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?',
- d.comment );
- ent->creation_time = thom_crack_time( &d );
- size = thom_get_file_size( f, head, &d );
- if ( size >= 0 ) ent->filesize = size;
- else {
- ent->filesize = 0;
- ent->corrupt = 1;
- }
- }
- return IMGTOOLERR_SUCCESS;
+ imgtool_partition *part = imgtool_directory_partition( enumeration);
+ int head = *( (int*) imgtool_partition_extra_bytes( part ) );
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ int* n = (int*) imgtool_directory_extrabytes( enumeration );
+ thom_dirent d;
+
+ do {
+ thom_get_dirent( f, head, *n, &d );
+ (*n) ++;
+ }
+ while ( d.type == THOM_DIRENT_FREE );
+ if ( d.type == THOM_DIRENT_END ) ent->eof = 1;
+ else if ( d.type == THOM_DIRENT_INVALID ) {
+ ent->corrupt = 1;
+ }
+ else {
+ int size;
+ snprintf( ent->filename, sizeof(ent->filename), "%s.%s", d.name, d.ext );
+ snprintf( ent->attr, sizeof(ent->attr), "%c %c %s",
+ (d.ftype == 0) ? 'B' : (d.ftype == 1) ? 'D' :
+ (d.ftype == 2) ? 'M' : (d.ftype == 3) ? 'A' : '?',
+ (d.format == 0) ? 'B' : (d.format == 0xff) ? 'A' : '?',
+ d.comment );
+ ent->creation_time = thom_crack_time( &d );
+ size = thom_get_file_size( f, head, &d );
+ if ( size >= 0 ) ent->filesize = size;
+ else {
+ ent->filesize = 0;
+ ent->corrupt = 1;
+ }
+ }
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_free_space(imgtool_partition *part, UINT64 *size)
{
- int head = *( (int*) imgtool_partition_extra_bytes( part ) );
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- int nb = thom_get_free_blocks( f, head );
- (*size) = nb * f->sectuse_size * 8;
- return IMGTOOLERR_SUCCESS;
+ int head = *( (int*) imgtool_partition_extra_bytes( part ) );
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ int nb = thom_get_free_blocks( f, head );
+ (*size) = nb * f->sectuse_size * 8;
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_read_file(imgtool_partition *part,
- const char *filename,
- const char *fork,
- imgtool_stream *destf)
+ const char *filename,
+ const char *fork,
+ imgtool_stream *destf)
{
- int head = *( (int*) imgtool_partition_extra_bytes( part ) );
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- thom_dirent d;
- char name[9], ext[4], fname[14];
- int size;
-
- /* convert filename */
- thom_conv_filename( filename, name, ext );
- sprintf( fname, "%s.%s", name, ext );
-
- if ( ! thom_find_dirent( f, head, fname, &d ) )
- return IMGTOOLERR_FILENOTFOUND;
- size = thom_get_file_size( f, head, &d );
- if ( size < 0 ) return IMGTOOLERR_CORRUPTFILE;
- thom_get_file( f, head, &d, destf );
- return IMGTOOLERR_SUCCESS;
+ int head = *( (int*) imgtool_partition_extra_bytes( part ) );
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ thom_dirent d;
+ char name[9], ext[4], fname[14];
+ int size;
+
+ /* convert filename */
+ thom_conv_filename( filename, name, ext );
+ sprintf( fname, "%s.%s", name, ext );
+
+ if ( ! thom_find_dirent( f, head, fname, &d ) )
+ return IMGTOOLERR_FILENOTFOUND;
+ size = thom_get_file_size( f, head, &d );
+ if ( size < 0 ) return IMGTOOLERR_CORRUPTFILE;
+ thom_get_file( f, head, &d, destf );
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_delete_file(imgtool_partition *part,
- const char *filename)
+ const char *filename)
{
- int head = *( (int*) imgtool_partition_extra_bytes( part ) );
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- thom_dirent d;
- char name[9], ext[4], fname[14];
-
- /* convert filename */
- thom_conv_filename( filename, name, ext );
- sprintf( fname, "%s.%s", name, ext );
-
- if ( ! thom_find_dirent( f, head, fname, &d ) )
- return IMGTOOLERR_FILENOTFOUND;
- /*if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;*/
- if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
- thom_del_file( f, head, &d );
- return IMGTOOLERR_SUCCESS;
+ int head = *( (int*) imgtool_partition_extra_bytes( part ) );
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ thom_dirent d;
+ char name[9], ext[4], fname[14];
+
+ /* convert filename */
+ thom_conv_filename( filename, name, ext );
+ sprintf( fname, "%s.%s", name, ext );
+
+ if ( ! thom_find_dirent( f, head, fname, &d ) )
+ return IMGTOOLERR_FILENOTFOUND;
+ /*if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;*/
+ if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
+ thom_del_file( f, head, &d );
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_write_file(imgtool_partition *part,
- const char *filename,
- const char *fork,
- imgtool_stream *sourcef,
- option_resolution *opts)
+ const char *filename,
+ const char *fork,
+ imgtool_stream *sourcef,
+ option_resolution *opts)
{
- int head = *( (int*) imgtool_partition_extra_bytes( part ) );
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- thom_dirent d;
- int size = stream_size( sourcef );
- int blocks = thom_get_free_blocks( f, head );
- char name[9], ext[4], fname[14];
- const char* comment;
- int is_new = 1;
-
- if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
-
- /* convert filename */
- thom_conv_filename( filename, name, ext );
- sprintf( fname, "%s.%s", name, ext );
-
- /* check available space & find dir entry */
- if ( thom_find_dirent( f, head, fname, &d ) ) {
- /* file already exists: delete it */
- if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;
- blocks += thom_get_file_blocks( f, head, &d );
- if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE;
- thom_del_file( f, head, &d );
- is_new = 0;
- }
- else {
- /* new file, need new dir entry */
- if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE;
- if ( ! thom_find_free_dirent( f, head, &d ) ) return IMGTOOLERR_NOSPACE;
- thom_make_time_now( &d );
- }
-
- /* fill-in dir entry */
- memcpy( d.name, name, 9 );
- memcpy( d.ext, ext, 4 );
-
- /* file type */
- switch ( option_resolution_lookup_int( opts, 'T' ) ) {
- case 0:
- if ( ! is_new ) break;
- if ( ! core_stricmp( ext, "BAS" ) ) d.ftype = 0;
- else if ( ! core_stricmp( ext, "BAT" ) ) d.ftype = 0;
- else if ( ! core_stricmp( ext, "DAT" ) ) d.ftype = 1;
- else if ( ! core_stricmp( ext, "ASC" ) ) d.ftype = 1;
- else if ( ! core_stricmp( ext, "BIN" ) ) d.ftype = 2;
- else if ( ! core_stricmp( ext, "MAP" ) ) d.ftype = 2;
- else if ( ! core_stricmp( ext, "CFG" ) ) d.ftype = 2;
- else if ( ! core_stricmp( ext, "ASM" ) ) d.ftype = 3;
- else d.ftype = 2;
- break;
- case 1: d.ftype = 0; break;
- case 2: d.ftype = 1; break;
- case 3: d.ftype = 2; break;
- case 4: d.ftype = 3; break;
- }
-
- /* format flag */
- switch ( option_resolution_lookup_int( opts, 'F' ) ) {
- case 0:
- if ( ! is_new ) break;
- if ( ! core_stricmp( ext, "DAT" ) ) d.format = 0xff;
- else if ( ! core_stricmp( ext, "ASC" ) ) d.format = 0xff;
- else if ( ! core_stricmp( ext, "ASM" ) ) d.format = 0xff;
- else d.format = 0;
- break;
- case 1: d.format = 0; break;
- case 2: d.format = 0xff; break;
- }
-
- /* comment */
- comment = option_resolution_lookup_string( opts, 'C' );
- if ( comment && *comment )
- strncpy( d.comment, comment, 8 );
-
- /* write file */
- thom_put_file( f, head, &d, sourcef );
- return IMGTOOLERR_SUCCESS;
+ int head = *( (int*) imgtool_partition_extra_bytes( part ) );
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ thom_dirent d;
+ int size = stream_size( sourcef );
+ int blocks = thom_get_free_blocks( f, head );
+ char name[9], ext[4], fname[14];
+ const char* comment;
+ int is_new = 1;
+
+ if ( stream_isreadonly( f->stream ) ) return IMGTOOLERR_WRITEERROR;
+
+ /* convert filename */
+ thom_conv_filename( filename, name, ext );
+ sprintf( fname, "%s.%s", name, ext );
+
+ /* check available space & find dir entry */
+ if ( thom_find_dirent( f, head, fname, &d ) ) {
+ /* file already exists: delete it */
+ if ( thom_get_file_size( f, head, &d ) < 0 ) return IMGTOOLERR_CORRUPTFILE;
+ blocks += thom_get_file_blocks( f, head, &d );
+ if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE;
+ thom_del_file( f, head, &d );
+ is_new = 0;
+ }
+ else {
+ /* new file, need new dir entry */
+ if ( blocks * 8 * f->sectuse_size < size ) return IMGTOOLERR_NOSPACE;
+ if ( ! thom_find_free_dirent( f, head, &d ) ) return IMGTOOLERR_NOSPACE;
+ thom_make_time_now( &d );
+ }
+
+ /* fill-in dir entry */
+ memcpy( d.name, name, 9 );
+ memcpy( d.ext, ext, 4 );
+
+ /* file type */
+ switch ( option_resolution_lookup_int( opts, 'T' ) ) {
+ case 0:
+ if ( ! is_new ) break;
+ if ( ! core_stricmp( ext, "BAS" ) ) d.ftype = 0;
+ else if ( ! core_stricmp( ext, "BAT" ) ) d.ftype = 0;
+ else if ( ! core_stricmp( ext, "DAT" ) ) d.ftype = 1;
+ else if ( ! core_stricmp( ext, "ASC" ) ) d.ftype = 1;
+ else if ( ! core_stricmp( ext, "BIN" ) ) d.ftype = 2;
+ else if ( ! core_stricmp( ext, "MAP" ) ) d.ftype = 2;
+ else if ( ! core_stricmp( ext, "CFG" ) ) d.ftype = 2;
+ else if ( ! core_stricmp( ext, "ASM" ) ) d.ftype = 3;
+ else d.ftype = 2;
+ break;
+ case 1: d.ftype = 0; break;
+ case 2: d.ftype = 1; break;
+ case 3: d.ftype = 2; break;
+ case 4: d.ftype = 3; break;
+ }
+
+ /* format flag */
+ switch ( option_resolution_lookup_int( opts, 'F' ) ) {
+ case 0:
+ if ( ! is_new ) break;
+ if ( ! core_stricmp( ext, "DAT" ) ) d.format = 0xff;
+ else if ( ! core_stricmp( ext, "ASC" ) ) d.format = 0xff;
+ else if ( ! core_stricmp( ext, "ASM" ) ) d.format = 0xff;
+ else d.format = 0;
+ break;
+ case 1: d.format = 0; break;
+ case 2: d.format = 0xff; break;
+ }
+
+ /* comment */
+ comment = option_resolution_lookup_string( opts, 'C' );
+ if ( comment && *comment )
+ strncpy( d.comment, comment, 8 );
+
+ /* write file */
+ thom_put_file( f, head, &d, sourcef );
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part,
- const char *fname,
- imgtool_transfer_suggestion *suggestions,
- size_t suggestions_length)
+ const char *fname,
+ imgtool_transfer_suggestion *suggestions,
+ size_t suggestions_length)
{
- int head = *( (int*) imgtool_partition_extra_bytes( part ) );
- imgtool_image* img = imgtool_partition_image( part );
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- thom_dirent d;
- int is_basic = 0;
-
- if ( suggestions_length < 1 ) return IMGTOOLERR_SUCCESS;
-
- if ( fname ) {
- if ( ! thom_find_dirent( f, head, fname, &d ) )
- return IMGTOOLERR_FILENOTFOUND;
- if ( d.ftype == 0 && d.format == 0 ) is_basic = 1;
- }
-
- if ( is_basic ) {
- suggestions[0].viability = SUGGESTION_RECOMMENDED;
- suggestions[0].filter = filter_thombas128_getinfo;
- if ( suggestions_length >= 2 ) {
- suggestions[1].viability = SUGGESTION_POSSIBLE;
- suggestions[1].filter = filter_thombas7_getinfo;
- }
- if ( suggestions_length >= 3 ) {
- suggestions[2].viability = SUGGESTION_POSSIBLE;
- suggestions[2].filter = filter_thombas5_getinfo;
- }
- if ( suggestions_length >= 4 ) {
- suggestions[3].viability = SUGGESTION_POSSIBLE;
- suggestions[3].filter = NULL;
- }
- }
- else {
- suggestions[0].viability = SUGGESTION_RECOMMENDED;
- suggestions[0].filter = NULL;
- }
-
- return IMGTOOLERR_SUCCESS;
+ int head = *( (int*) imgtool_partition_extra_bytes( part ) );
+ imgtool_image* img = imgtool_partition_image( part );
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ thom_dirent d;
+ int is_basic = 0;
+
+ if ( suggestions_length < 1 ) return IMGTOOLERR_SUCCESS;
+
+ if ( fname ) {
+ if ( ! thom_find_dirent( f, head, fname, &d ) )
+ return IMGTOOLERR_FILENOTFOUND;
+ if ( d.ftype == 0 && d.format == 0 ) is_basic = 1;
+ }
+
+ if ( is_basic ) {
+ suggestions[0].viability = SUGGESTION_RECOMMENDED;
+ suggestions[0].filter = filter_thombas128_getinfo;
+ if ( suggestions_length >= 2 ) {
+ suggestions[1].viability = SUGGESTION_POSSIBLE;
+ suggestions[1].filter = filter_thombas7_getinfo;
+ }
+ if ( suggestions_length >= 3 ) {
+ suggestions[2].viability = SUGGESTION_POSSIBLE;
+ suggestions[2].filter = filter_thombas5_getinfo;
+ }
+ if ( suggestions_length >= 4 ) {
+ suggestions[3].viability = SUGGESTION_POSSIBLE;
+ suggestions[3].filter = NULL;
+ }
+ }
+ else {
+ suggestions[0].viability = SUGGESTION_RECOMMENDED;
+ suggestions[0].filter = NULL;
+ }
+
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_create(imgtool_image* img,
imgtool_stream *stream,
option_resolution *opts)
{
- thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
- int i;
- UINT8* buf;
- const char* name;
-
- f->stream = stream;
- f->modified = 0;
-
- /* get parameters */
- f->heads = option_resolution_lookup_int( opts, 'H' );
- f->tracks = option_resolution_lookup_int( opts, 'T' );
- name = option_resolution_lookup_string( opts, 'N' );
- switch ( option_resolution_lookup_int( opts, 'D' ) ) {
- case 0: f->sector_size = 128; f->sectuse_size = 128; break;
- case 1: f->sector_size = 256; f->sectuse_size = 255; break;
- default: return IMGTOOLERR_PARAMCORRUPT;
- }
-
- /* sanity checks */
- switch ( f->tracks ) {
- case 25: if ( f->sector_size != 128 ) return IMGTOOLERR_PARAMCORRUPT; break;
- case 40: break;
- case 80: if ( f->sector_size != 256 ) return IMGTOOLERR_PARAMCORRUPT; break;
- default: return IMGTOOLERR_PARAMCORRUPT;
- }
-
- memset( f->data, 0xe5, sizeof( f->data ) );
-
- for ( i = 0; i < f->heads; i++ ) {
-
- /* disk info */
- buf = thom_get_sector( f, i, 20, 1 );
- memset( buf, 0xff, f->sector_size );
- if ( name ) {
- strncpy( (char*)buf, name, 8 );
- thom_unstringity( (char*)buf, 8 );
- }
- else memset( buf, ' ', 8 );
-
- /* FAT */
- buf = thom_get_sector( f, i, 20, 2 );
- memset( buf, 0, f->sector_size );
- memset( buf + 1, 0xff, thom_nb_blocks( f ) );
- buf[ 41 ] = buf[ 42 ] = 0xfe; /* reserved for FAT */
-
- /* (empty) directory */
- buf = thom_get_sector( f, i, 20, 3 );
- memset( buf, 0xff, 14 * f->sector_size );
- }
-
- f->modified = 1;
-
- return IMGTOOLERR_SUCCESS;
+ thom_floppy* f = (thom_floppy*) imgtool_image_extra_bytes( img );
+ int i;
+ UINT8* buf;
+ const char* name;
+
+ f->stream = stream;
+ f->modified = 0;
+
+ /* get parameters */
+ f->heads = option_resolution_lookup_int( opts, 'H' );
+ f->tracks = option_resolution_lookup_int( opts, 'T' );
+ name = option_resolution_lookup_string( opts, 'N' );
+ switch ( option_resolution_lookup_int( opts, 'D' ) ) {
+ case 0: f->sector_size = 128; f->sectuse_size = 128; break;
+ case 1: f->sector_size = 256; f->sectuse_size = 255; break;
+ default: return IMGTOOLERR_PARAMCORRUPT;
+ }
+
+ /* sanity checks */
+ switch ( f->tracks ) {
+ case 25: if ( f->sector_size != 128 ) return IMGTOOLERR_PARAMCORRUPT; break;
+ case 40: break;
+ case 80: if ( f->sector_size != 256 ) return IMGTOOLERR_PARAMCORRUPT; break;
+ default: return IMGTOOLERR_PARAMCORRUPT;
+ }
+
+ memset( f->data, 0xe5, sizeof( f->data ) );
+
+ for ( i = 0; i < f->heads; i++ ) {
+
+ /* disk info */
+ buf = thom_get_sector( f, i, 20, 1 );
+ memset( buf, 0xff, f->sector_size );
+ if ( name ) {
+ strncpy( (char*)buf, name, 8 );
+ thom_unstringity( (char*)buf, 8 );
+ }
+ else memset( buf, ' ', 8 );
+
+ /* FAT */
+ buf = thom_get_sector( f, i, 20, 2 );
+ memset( buf, 0, f->sector_size );
+ memset( buf + 1, 0xff, thom_nb_blocks( f ) );
+ buf[ 41 ] = buf[ 42 ] = 0xfe; /* reserved for FAT */
+
+ /* (empty) directory */
+ buf = thom_get_sector( f, i, 20, 3 );
+ memset( buf, 0xff, 14 * f->sector_size );
+ }
+
+ f->modified = 1;
+
+ return IMGTOOLERR_SUCCESS;
}
@@ -1187,63 +1187,63 @@ static imgtoolerr_t thom_create(imgtool_image* img,
/* character codes >= 128 are reserved for BASIC keywords */
static const char *const thombas7[2][128] = {
- { /* statements */
- "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF",
- "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
- "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
- "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
- "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT",
- "CONT", "LIST", "CLEAR", "WHILE", "WHEN", "NEW", "SAVE", "LOAD", "MERGE",
- "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
- "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
- "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
- ">", "=", "<",
- /* DOS specific */
- "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
- "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
- "BACKUP", "COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "DENSITY",
- },
- { /* functions: 0xff prefix */
- "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN",
- "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG",
- "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$",
- "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
- "SCREEN", "POS", "PTRIG",
- /* DOS specific */
- "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
- "SPACE$", "STRING$", "DSKI$",
- }
+ { /* statements */
+ "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF",
+ "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
+ "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
+ "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
+ "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT",
+ "CONT", "LIST", "CLEAR", "WHILE", "WHEN", "NEW", "SAVE", "LOAD", "MERGE",
+ "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
+ "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
+ "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
+ ">", "=", "<",
+ /* DOS specific */
+ "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
+ "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
+ "BACKUP", "COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "DENSITY",
+ },
+ { /* functions: 0xff prefix */
+ "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN",
+ "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG",
+ "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$",
+ "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
+ "SCREEN", "POS", "PTRIG",
+ /* DOS specific */
+ "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
+ "SPACE$", "STRING$", "DSKI$",
+ }
};
/* MO5: some keywords ar missing; DOS and TUNE are added */
static const char *const thombas5[2][128] = {
- { /* statements */
- "END", "FOR", "NEXT", "DATA", "DIM", "READ", NULL, "GO", "RUN", "IF",
- "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
- "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO",
- "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
- "BEEP", "COLOR", "LINE", "BOX", NULL, "ATTRB", "DEF", "POKE", "PRINT",
- "CONT", "LIST", "CLEAR", "DOS", NULL, "NEW", "SAVE", "LOAD", "MERGE",
- "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
- "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
- "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
- ">", "=", "<",
- /* DOS specific */
- "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
- "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
- "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH",
- "DENSITY",
- },
- { /* functions: 0xff prefix */
- "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN",
- "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", NULL,
- NULL, "FIX", "HEX$", NULL, "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$",
- "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
- "SCREEN", "POS", "PTRIG",
- /* DOS specific */
- "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
- "SPACE$", "STRING$", "DSKI$",
- }
+ { /* statements */
+ "END", "FOR", "NEXT", "DATA", "DIM", "READ", NULL, "GO", "RUN", "IF",
+ "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
+ "DEFINT", "DEFSNG", NULL, "ON", "TUNE", "ERROR", "RESUME", "AUTO",
+ "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
+ "BEEP", "COLOR", "LINE", "BOX", NULL, "ATTRB", "DEF", "POKE", "PRINT",
+ "CONT", "LIST", "CLEAR", "DOS", NULL, "NEW", "SAVE", "LOAD", "MERGE",
+ "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
+ "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
+ "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
+ ">", "=", "<",
+ /* DOS specific */
+ "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
+ "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
+ "BACKUP","COPY", "CIRCLE", "PAINT", "DRAW", "RENUM", "SWAP", "SEARCH",
+ "DENSITY",
+ },
+ { /* functions: 0xff prefix */
+ "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN",
+ "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", NULL,
+ NULL, "FIX", "HEX$", NULL, "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$",
+ "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
+ "SCREEN", "POS", "PTRIG",
+ /* DOS specific */
+ "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
+ "SPACE$", "STRING$", "DSKI$",
+ }
};
/* BASIC 128 has many new keywords */
@@ -1251,269 +1251,269 @@ static const char *const thombas5[2][128] = {
have the same tokens
*/
static const char *const thombas128[2][128] = {
- { /* statements */
- "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF",
- "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
- "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
- "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
- "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT",
- "CONT", "LIST", "CLEAR", "INTERVAL", "KEY", "NEW", "SAVE", "LOAD", "MERGE",
- "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
- "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
- "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
- ">", "=", "<",
- "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
- "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
- "BACKUP", "COPY", "CIRCLE", "PAINT", "RESET", "RENUM", "SWAP", "DENSITY",
- "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE",
- "COMMON", "SEARCH", "FWD", "TURTLE",
- },
- { /* functions: 0xff prefix */
- "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN",
- "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG",
- "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$",
- "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
- "SCREEN", "POS", "PTRIG",
- "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
- "SPACE$", "STRING$", "DSKI$",
- "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE",
- "BANK", "HEAD", "ROT", "SHOW", "ZOOM", "TRACE",
- }
+ { /* statements */
+ "END", "FOR", "NEXT", "DATA", "DIM", "READ", "LET", "GO", "RUN", "IF",
+ "RESTORE", "RETURN", "REM", "'", "STOP", "ELSE", "TRON", "TROFF", "DEFSTR",
+ "DEFINT", "DEFSNG", "DEFDBL", "ON", "WAIT", "ERROR", "RESUME", "AUTO",
+ "DELETE", "LOCATE", "CLS", "CONSOLE", "PSET", "MOTOR", "SKIP", "EXEC",
+ "BEEP", "COLOR", "LINE", "BOX", "UNMASK", "ATTRB", "DEF", "POKE", "PRINT",
+ "CONT", "LIST", "CLEAR", "INTERVAL", "KEY", "NEW", "SAVE", "LOAD", "MERGE",
+ "OPEN", "CLOSE", "INPEN", "PEN", "PLAY", "TAB(", "TO", "SUB", "FN",
+ "SPC(", "USING", "USR", "ERL", "ERR", "OFF", "THEN", "NOT", "STEP",
+ "+", "-", "*", "/", "^", "AND", "OR", "XOR", "EQV", "IMP", "MOD", "@",
+ ">", "=", "<",
+ "DSKINI", "DSKO$", "KILL", "NAME", "FIELD", "LSET", "RSET",
+ "PUT", "GET", "VERIFY", "DEVICE", "DIR", "FILES", "WRITE", "UNLOAD",
+ "BACKUP", "COPY", "CIRCLE", "PAINT", "RESET", "RENUM", "SWAP", "DENSITY",
+ "WINDOW", "PATTERN", "DO", "LOOP", "EXIT", "INMOUSE", "MOUSE", "CHAINE",
+ "COMMON", "SEARCH", "FWD", "TURTLE",
+ },
+ { /* functions: 0xff prefix */
+ "SGN", "INT", "ABS", "FRE", "SQR", "LOG", "EXP", "COS", "SIN",
+ "TAN", "PEEK", "LEN", "STR$", "VAL", "ASC", "CHR$", "EOF", "CINT", "CSNG",
+ "CDBL", "FIX", "HEX$", "OCT$", "STICK", "STRIG", "GR$", "LEFT$", "RIGHT$",
+ "MID$", "INSTR", "VARPTR", "RND", "INKEY$", "INPUT", "CSRLIN", "POINT",
+ "SCREEN", "POS", "PTRIG",
+ "DSKL", "CVI", "CVS", "CVD", "MKI$", "MKS$", "MKD$", "LOC", "LOF",
+ "SPACE$", "STRING$", "DSKI$",
+ "FKEY$", "MIN(", "MAX(", "ATN", "CRUNCH$", "MTRIG", "EVAL", "PALETTE",
+ "BANK", "HEAD", "ROT", "SHOW", "ZOOM", "TRACE",
+ }
};
/* tables for simple XOR encryption sieve */
static const UINT8 crypt1[11] = {
- 0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1, 0x82, 0x38, 0xAA
+ 0x80, 0x19, 0x56, 0xAA, 0x80, 0x76, 0x22, 0xF1, 0x82, 0x38, 0xAA
};
static const UINT8 crypt2[13] = {
- 0x86, 0x1E, 0xD7, 0xBA, 0x87, 0x99, 0x26, 0x64, 0x87, 0x23, 0x34, 0x58, 0x86
+ 0x86, 0x1E, 0xD7, 0xBA, 0x87, 0x99, 0x26, 0x64, 0x87, 0x23, 0x34, 0x58, 0x86
};
/* decrypt BASIC protected files */
static void thom_decrypt(imgtool_stream* out, imgtool_stream* in)
{
- int i1 = 11, i2 = 13;
- while ( 1 ) {
- UINT8 b;
- if ( stream_read( in, &b, 1) < 1 ) break;
- b = ( (UINT8)(b - i2) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i1;
- stream_putc( out, b );
- i1--; i2--;
- if ( !i1 ) i1 = 11;
- if ( !i2 ) i2 = 13;
- }
+ int i1 = 11, i2 = 13;
+ while ( 1 ) {
+ UINT8 b;
+ if ( stream_read( in, &b, 1) < 1 ) break;
+ b = ( (UINT8)(b - i2) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i1;
+ stream_putc( out, b );
+ i1--; i2--;
+ if ( !i1 ) i1 = 11;
+ if ( !i2 ) i2 = 13;
+ }
}
/* encrypt BASIC protected files */
static void thom_encrypt(imgtool_stream* out, imgtool_stream* in)
{
- int i1 = 11, i2 = 13;
- while ( 1 ) {
- UINT8 b;
- if ( stream_read( in, &b, 1) < 1 ) break;
- b = ( (UINT8)(b - i1) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i2;
- stream_putc( out, b );
- i1--; i2--;
- if ( !i1 ) i1 = 11;
- if ( !i2 ) i2 = 13;
- }
+ int i1 = 11, i2 = 13;
+ while ( 1 ) {
+ UINT8 b;
+ if ( stream_read( in, &b, 1) < 1 ) break;
+ b = ( (UINT8)(b - i1) ^ crypt2[i2-1] ^ crypt1[i1-1] ) + i2;
+ stream_putc( out, b );
+ i1--; i2--;
+ if ( !i1 ) i1 = 11;
+ if ( !i2 ) i2 = 13;
+ }
}
static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part,
const char *name,
const char *fork, imgtool_stream *dst)
{
- UINT8 buf[3];
- imgtool_stream *org = stream_open_mem( NULL, 0 );
- imgtoolerr_t err;
- if ( !org ) return IMGTOOLERR_OUTOFMEMORY;
-
- /* read file */
- err = thom_read_file( part, name, fork, org );
- if ( err ) {
- stream_close( org );
- return err;
- }
-
- stream_seek( org, 0, SEEK_SET );
- if ( stream_read( org, buf, 3 ) < 3 || buf[0] != 0xfe ) {
- /* regular file */
- stream_seek( org, 0, SEEK_SET );
- stream_transfer_all( dst, org );
- }
- else {
- /* encrypted file */
- stream_putc( dst, '\xff' );
- stream_write( dst, buf+1, 2 );
- thom_decrypt( dst, org );
- }
-
- stream_close( org );
- return IMGTOOLERR_SUCCESS;
+ UINT8 buf[3];
+ imgtool_stream *org = stream_open_mem( NULL, 0 );
+ imgtoolerr_t err;
+ if ( !org ) return IMGTOOLERR_OUTOFMEMORY;
+
+ /* read file */
+ err = thom_read_file( part, name, fork, org );
+ if ( err ) {
+ stream_close( org );
+ return err;
+ }
+
+ stream_seek( org, 0, SEEK_SET );
+ if ( stream_read( org, buf, 3 ) < 3 || buf[0] != 0xfe ) {
+ /* regular file */
+ stream_seek( org, 0, SEEK_SET );
+ stream_transfer_all( dst, org );
+ }
+ else {
+ /* encrypted file */
+ stream_putc( dst, '\xff' );
+ stream_write( dst, buf+1, 2 );
+ thom_decrypt( dst, org );
+ }
+
+ stream_close( org );
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part,
- const char *name,
- const char *fork, imgtool_stream *src,
- option_resolution *opts)
+ const char *name,
+ const char *fork, imgtool_stream *src,
+ option_resolution *opts)
{
- UINT8 buf[3];
-
- if ( stream_read( src, buf, 3 ) < 3 || buf[0] == 0xfe ) {
- /* too short or already encrypted file */
- stream_seek( src, 0, SEEK_SET );
- return thom_write_file( part, name, fork, src, opts );
- }
- else {
- /* regular file */
- imgtool_stream *dst = stream_open_mem( NULL, 0 );
- imgtoolerr_t err;
- if ( !dst ) return IMGTOOLERR_OUTOFMEMORY;
- stream_putc( dst, '\xfe' );
- stream_write( dst, buf+1, 2 );
- thom_encrypt( dst, src );
- stream_seek( dst, 0, SEEK_SET );
- err = thom_write_file( part, name, fork, dst, opts );
- stream_close( dst);
- return err;
- }
+ UINT8 buf[3];
+
+ if ( stream_read( src, buf, 3 ) < 3 || buf[0] == 0xfe ) {
+ /* too short or already encrypted file */
+ stream_seek( src, 0, SEEK_SET );
+ return thom_write_file( part, name, fork, src, opts );
+ }
+ else {
+ /* regular file */
+ imgtool_stream *dst = stream_open_mem( NULL, 0 );
+ imgtoolerr_t err;
+ if ( !dst ) return IMGTOOLERR_OUTOFMEMORY;
+ stream_putc( dst, '\xfe' );
+ stream_write( dst, buf+1, 2 );
+ thom_encrypt( dst, src );
+ stream_seek( dst, 0, SEEK_SET );
+ err = thom_write_file( part, name, fork, dst, opts );
+ stream_close( dst);
+ return err;
+ }
}
void filter_thomcrypt_getinfo(UINT32 state, union filterinfo *info)
{
- switch(state) {
- case FILTINFO_STR_NAME:
- info->s = "thomcrypt";
- break;
- case FILTINFO_STR_HUMANNAME:
- info->s = "Thomson BASIC, Protected file encryption (no tokenization)";
- break;
- case FILTINFO_PTR_READFILE:
- info->read_file = thomcrypt_read_file;
- break;
- case FILTINFO_PTR_WRITEFILE:
- info->write_file = thomcrypt_write_file;
- break;
- }
+ switch(state) {
+ case FILTINFO_STR_NAME:
+ info->s = "thomcrypt";
+ break;
+ case FILTINFO_STR_HUMANNAME:
+ info->s = "Thomson BASIC, Protected file encryption (no tokenization)";
+ break;
+ case FILTINFO_PTR_READFILE:
+ info->read_file = thomcrypt_read_file;
+ break;
+ case FILTINFO_PTR_WRITEFILE:
+ info->write_file = thomcrypt_write_file;
+ break;
+ }
}
/* untokenization automatically decrypt protected files */
static imgtoolerr_t thom_basic_read_file(imgtool_partition *part,
- const char *name,
- const char *fork,
- imgtool_stream *dst,
- const char *const table[2][128])
+ const char *name,
+ const char *fork,
+ imgtool_stream *dst,
+ const char *const table[2][128])
{
- imgtool_stream *org = stream_open_mem( NULL, 0 );
- imgtoolerr_t err;
- UINT8 buf[4];
- int i;
-
- if ( !org ) return IMGTOOLERR_OUTOFMEMORY;
-
- err = thomcrypt_read_file( part, name, fork, org );
- if ( err ) {
- stream_close( org );
- return err;
- }
- stream_seek( org, 3, SEEK_SET ); /* skip header */
-
- while ( 1 ) {
- int in_str = 0, in_fun = 0;
- int linelength, linenum;
-
- /* line header: line length and line number */
- /* I am not sure this is 100% correct but it works in many cases */
- if ( stream_read( org, buf, 2 ) < 2 ) goto end;
- linelength = ((int)buf[0] << 8) + (int)buf[1] - 4;
- if ( linelength <= 0 ) goto end;
- if ( stream_read( org, buf, 2 ) < 2 ) goto end;
- linenum = ((int)buf[0] << 8) + buf[1];
- stream_printf( dst, "%u ", linenum );
-
- /* process line */
- for ( i = 0; i < linelength; i++ ) {
- UINT8 c;
- if ( stream_read( org, &c, 1 ) < 1 ) break;
- if ( c == 0 ) {
+ imgtool_stream *org = stream_open_mem( NULL, 0 );
+ imgtoolerr_t err;
+ UINT8 buf[4];
+ int i;
+
+ if ( !org ) return IMGTOOLERR_OUTOFMEMORY;
+
+ err = thomcrypt_read_file( part, name, fork, org );
+ if ( err ) {
+ stream_close( org );
+ return err;
+ }
+ stream_seek( org, 3, SEEK_SET ); /* skip header */
+
+ while ( 1 ) {
+ int in_str = 0, in_fun = 0;
+ int linelength, linenum;
+
+ /* line header: line length and line number */
+ /* I am not sure this is 100% correct but it works in many cases */
+ if ( stream_read( org, buf, 2 ) < 2 ) goto end;
+ linelength = ((int)buf[0] << 8) + (int)buf[1] - 4;
+ if ( linelength <= 0 ) goto end;
+ if ( stream_read( org, buf, 2 ) < 2 ) goto end;
+ linenum = ((int)buf[0] << 8) + buf[1];
+ stream_printf( dst, "%u ", linenum );
+
+ /* process line */
+ for ( i = 0; i < linelength; i++ ) {
+ UINT8 c;
+ if ( stream_read( org, &c, 1 ) < 1 ) break;
+ if ( c == 0 ) {
/* Sometimes, linelength seems wrong and we must rely on the fact that
- BASIC lines are 0-terminated.
- At other times, there are 0 embedded within lines or extra stuff
- between the 0 and the following line, and so, we must rely
- on linelength to cut the line (!)
- */
+ BASIC lines are 0-terminated.
+ At other times, there are 0 embedded within lines or extra stuff
+ between the 0 and the following line, and so, we must rely
+ on linelength to cut the line (!)
+ */
if ( linelength > 256 ) break;
- }
- else if ( c == 0xff && ! in_str ) in_fun = 1; /* function prefix */
- else {
+ }
+ else if ( c == 0xff && ! in_str ) in_fun = 1; /* function prefix */
+ else {
if ( c >= 0x80 && ! in_str ) {
- /* token */
- const char* token = table[ in_fun ][ c - 0x80 ];
- if ( token ) stream_puts( dst, token );
- else stream_puts( dst, "???" );
+ /* token */
+ const char* token = table[ in_fun ][ c - 0x80 ];
+ if ( token ) stream_puts( dst, token );
+ else stream_puts( dst, "???" );
}
else {
- /* regular character */
- if ( c == '"' ) in_str = 1 - in_str;
- stream_putc( dst, c ); /* normal letter */
+ /* regular character */
+ if ( c == '"' ) in_str = 1 - in_str;
+ stream_putc( dst, c ); /* normal letter */
}
in_fun = 0;
- }
- }
- stream_putc( dst, '\n' );
- }
- end:
-
- stream_close( org );
- return IMGTOOLERR_SUCCESS;
+ }
+ }
+ stream_putc( dst, '\n' );
+ }
+ end:
+
+ stream_close( org );
+ return IMGTOOLERR_SUCCESS;
}
static imgtoolerr_t thom_basic_write_file(imgtool_partition *part,
- const char *name,
- const char *fork,
- imgtool_stream *src,
- option_resolution *opts,
- const char *const table[2][128])
+ const char *name,
+ const char *fork,
+ imgtool_stream *src,
+ option_resolution *opts,
+ const char *const table[2][128])
{
- return IMGTOOLERR_UNIMPLEMENTED;
+ return IMGTOOLERR_UNIMPLEMENTED;
}
-#define FILTER(short,long) \
- static imgtoolerr_t short##_read_file(imgtool_partition *part, \
- const char *name, \
- const char *fork, \
- imgtool_stream *dst) \
- { \
- return thom_basic_read_file( part, name, fork, dst, short ); \
- } \
- static imgtoolerr_t short##_write_file(imgtool_partition *part, \
- const char *name, \
- const char *fork, \
- imgtool_stream *src, \
- option_resolution *opts) \
- { \
- return thom_basic_write_file( part, name, fork, src, opts, short ); \
- } \
- void filter_##short##_getinfo(UINT32 state, union filterinfo *info) \
- { \
- switch(state) \
- { \
- case FILTINFO_STR_NAME: \
- info->s = #short; \
- break; \
- case FILTINFO_STR_HUMANNAME: \
- info->s = long; \
- break; \
- case FILTINFO_PTR_READFILE: \
- info->read_file = short##_read_file; \
- break; \
- case FILTINFO_PTR_WRITEFILE: \
- info->write_file = short##_write_file; \
- break; \
- } \
- }
+#define FILTER(short,long) \
+ static imgtoolerr_t short##_read_file(imgtool_partition *part, \
+ const char *name, \
+ const char *fork, \
+ imgtool_stream *dst) \
+ { \
+ return thom_basic_read_file( part, name, fork, dst, short ); \
+ } \
+ static imgtoolerr_t short##_write_file(imgtool_partition *part, \
+ const char *name, \
+ const char *fork, \
+ imgtool_stream *src, \
+ option_resolution *opts) \
+ { \
+ return thom_basic_write_file( part, name, fork, src, opts, short ); \
+ } \
+ void filter_##short##_getinfo(UINT32 state, union filterinfo *info) \
+ { \
+ switch(state) \
+ { \
+ case FILTINFO_STR_NAME: \
+ info->s = #short; \
+ break; \
+ case FILTINFO_STR_HUMANNAME: \
+ info->s = long; \
+ break; \
+ case FILTINFO_PTR_READFILE: \
+ info->read_file = short##_read_file; \
+ break; \
+ case FILTINFO_PTR_WRITEFILE: \
+ info->write_file = short##_write_file; \
+ break; \
+ } \
+ }
FILTER( thombas5,
"Thomson MO5 w/ BASIC 1.0, Tokenized Files (read-only, auto-decrypt)" )
@@ -1526,162 +1526,162 @@ FILTER( thombas128,
/************************* driver ***************************/
static OPTION_GUIDE_START( thom_createimage_optguide )
- OPTION_INT( 'H', "heads", "Heads" )
- OPTION_INT( 'T', "tracks", "Tracks" )
- OPTION_ENUM_START( 'D', "density", "Density" )
- OPTION_ENUM( 0, "SD", "Single density (128 bytes)" )
- OPTION_ENUM( 1, "DD", "Double density (256 bytes)" )
- OPTION_ENUM_END
- OPTION_STRING( 'N', "name", "Floppy name" )
+ OPTION_INT( 'H', "heads", "Heads" )
+ OPTION_INT( 'T', "tracks", "Tracks" )
+ OPTION_ENUM_START( 'D', "density", "Density" )
+ OPTION_ENUM( 0, "SD", "Single density (128 bytes)" )
+ OPTION_ENUM( 1, "DD", "Double density (256 bytes)" )
+ OPTION_ENUM_END
+ OPTION_STRING( 'N', "name", "Floppy name" )
OPTION_GUIDE_END
static OPTION_GUIDE_START( thom_writefile_optguide )
- OPTION_ENUM_START( 'T', "ftype", "File type" )
- OPTION_ENUM( 0, "auto", "Automatic (by extension)" )
- OPTION_ENUM( 1, "B", "Program" )
- OPTION_ENUM( 2, "D", "Data" )
- OPTION_ENUM( 3, "M", "Machine Code" )
- OPTION_ENUM( 4, "A", "Assembler Source" )
- OPTION_ENUM_END
- OPTION_ENUM_START( 'F', "format", "Format flag" )
- OPTION_ENUM( 0, "auto", "Automatic (by extension)" )
- OPTION_ENUM( 1, "B", "Binary, Tokenized BASIC" )
- OPTION_ENUM( 2, "A", "ASCII" )
- OPTION_ENUM_END
- OPTION_STRING( 'C', "comment", "Comment" )
+ OPTION_ENUM_START( 'T', "ftype", "File type" )
+ OPTION_ENUM( 0, "auto", "Automatic (by extension)" )
+ OPTION_ENUM( 1, "B", "Program" )
+ OPTION_ENUM( 2, "D", "Data" )
+ OPTION_ENUM( 3, "M", "Machine Code" )
+ OPTION_ENUM( 4, "A", "Assembler Source" )
+ OPTION_ENUM_END
+ OPTION_ENUM_START( 'F', "format", "Format flag" )
+ OPTION_ENUM( 0, "auto", "Automatic (by extension)" )
+ OPTION_ENUM( 1, "B", "Binary, Tokenized BASIC" )
+ OPTION_ENUM( 2, "A", "ASCII" )
+ OPTION_ENUM_END
+ OPTION_STRING( 'C', "comment", "Comment" )
OPTION_GUIDE_END
static void thom_basic_get_info(const imgtool_class *clas,
UINT32 param,
union imgtoolinfo *info)
{
- switch ( param ) {
-
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES:
- info->i = sizeof(thom_floppy); break;
- case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES:
- info->i = sizeof(int); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES:
- info->i = sizeof(int); break;
- case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME:
- case IMGTOOLINFO_INT_PREFER_UCASE:
- info->i = 1; break;
- case IMGTOOLINFO_INT_PATH_SEPARATOR:
- info->i = 0; break;
- case IMGTOOLINFO_STR_FILE:
- strcpy( info->s = imgtool_temp_str(), __FILE__ ); break;
- case IMGTOOLINFO_STR_NAME:
- strcpy( info->s = imgtool_temp_str(), "thom" ); break;
- case IMGTOOLINFO_STR_DESCRIPTION:
- strcpy( info->s = imgtool_temp_str(), "Thomson BASIC filesystem" );
- break;
- case IMGTOOLINFO_PTR_CREATE:
- info->create = thom_create; break;
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE:
- info->createimage_optguide = thom_createimage_optguide; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM:
- info->begin_enum = thom_begin_enum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM:
- info->next_enum = thom_next_enum; break;
- case IMGTOOLINFO_PTR_READ_FILE:
- info->read_file = thom_read_file; break;
- case IMGTOOLINFO_PTR_WRITE_FILE:
- info->write_file = thom_write_file; break;
- case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE:
- info->writefile_optguide = thom_writefile_optguide; break;
- case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC:
- strcpy( info->s = imgtool_temp_str(), "T[0]-4;F[0]-2;C" ); break;
- case IMGTOOLINFO_PTR_SUGGEST_TRANSFER:
- info->suggest_transfer = thom_suggest_transfer; break;
- case IMGTOOLINFO_PTR_DELETE_FILE:
- info->delete_file = thom_delete_file; break;
- case IMGTOOLINFO_PTR_FREE_SPACE:
- info->free_space = thom_free_space; break;
- case IMGTOOLINFO_PTR_GET_SECTOR_SIZE:
- info->get_sector_size = thom_get_sector_size; break;
- case IMGTOOLINFO_PTR_GET_GEOMETRY:
- info->get_geometry = thom_get_geometry; break;
- case IMGTOOLINFO_PTR_INFO:
- info->info = thom_info; break;
- case IMGTOOLINFO_PTR_READ_SECTOR:
- info->read_sector = thom_read_sector; break;
- case IMGTOOLINFO_PTR_WRITE_SECTOR:
- info->write_sector = thom_write_sector; break;
- case IMGTOOLINFO_PTR_LIST_PARTITIONS:
- info->list_partitions = thom_list_partitions; break;
- case IMGTOOLINFO_PTR_OPEN_PARTITION:
- info->open_partition = thom_open_partition; break;
- }
+ switch ( param ) {
+
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES:
+ info->i = sizeof(thom_floppy); break;
+ case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES:
+ info->i = sizeof(int); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES:
+ info->i = sizeof(int); break;
+ case IMGTOOLINFO_INT_SUPPORTS_CREATION_TIME:
+ case IMGTOOLINFO_INT_PREFER_UCASE:
+ info->i = 1; break;
+ case IMGTOOLINFO_INT_PATH_SEPARATOR:
+ info->i = 0; break;
+ case IMGTOOLINFO_STR_FILE:
+ strcpy( info->s = imgtool_temp_str(), __FILE__ ); break;
+ case IMGTOOLINFO_STR_NAME:
+ strcpy( info->s = imgtool_temp_str(), "thom" ); break;
+ case IMGTOOLINFO_STR_DESCRIPTION:
+ strcpy( info->s = imgtool_temp_str(), "Thomson BASIC filesystem" );
+ break;
+ case IMGTOOLINFO_PTR_CREATE:
+ info->create = thom_create; break;
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE:
+ info->createimage_optguide = thom_createimage_optguide; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM:
+ info->begin_enum = thom_begin_enum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM:
+ info->next_enum = thom_next_enum; break;
+ case IMGTOOLINFO_PTR_READ_FILE:
+ info->read_file = thom_read_file; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE:
+ info->write_file = thom_write_file; break;
+ case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE:
+ info->writefile_optguide = thom_writefile_optguide; break;
+ case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC:
+ strcpy( info->s = imgtool_temp_str(), "T[0]-4;F[0]-2;C" ); break;
+ case IMGTOOLINFO_PTR_SUGGEST_TRANSFER:
+ info->suggest_transfer = thom_suggest_transfer; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE:
+ info->delete_file = thom_delete_file; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE:
+ info->free_space = thom_free_space; break;
+ case IMGTOOLINFO_PTR_GET_SECTOR_SIZE:
+ info->get_sector_size = thom_get_sector_size; break;
+ case IMGTOOLINFO_PTR_GET_GEOMETRY:
+ info->get_geometry = thom_get_geometry; break;
+ case IMGTOOLINFO_PTR_INFO:
+ info->info = thom_info; break;
+ case IMGTOOLINFO_PTR_READ_SECTOR:
+ info->read_sector = thom_read_sector; break;
+ case IMGTOOLINFO_PTR_WRITE_SECTOR:
+ info->write_sector = thom_write_sector; break;
+ case IMGTOOLINFO_PTR_LIST_PARTITIONS:
+ info->list_partitions = thom_list_partitions; break;
+ case IMGTOOLINFO_PTR_OPEN_PARTITION:
+ info->open_partition = thom_open_partition; break;
+ }
}
void thom_fd_basic_get_info(const imgtool_class *clas,
- UINT32 param,
- union imgtoolinfo *info)
+ UINT32 param,
+ union imgtoolinfo *info)
{
- switch ( param ) {
- case IMGTOOLINFO_STR_NAME:
- strcpy( info->s = imgtool_temp_str(), "thom_fd" ); break;
- case IMGTOOLINFO_STR_DESCRIPTION:
- strcpy( info->s = imgtool_temp_str(),
- "Thomson .fd disk image, BASIC format" );
- break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS:
- strcpy( info->s = imgtool_temp_str(), "fd" ); break;
- case IMGTOOLINFO_PTR_OPEN:
- info->open = thom_open_fd_qd; break;
- case IMGTOOLINFO_PTR_CLOSE:
- info->close = thom_close_fd_qd; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC:
- strcpy( info->s = imgtool_temp_str(), "H[1]-2;T40/[80];D0-[1];N" ); break;
- default:
- thom_basic_get_info( clas, param, info );
- }
+ switch ( param ) {
+ case IMGTOOLINFO_STR_NAME:
+ strcpy( info->s = imgtool_temp_str(), "thom_fd" ); break;
+ case IMGTOOLINFO_STR_DESCRIPTION:
+ strcpy( info->s = imgtool_temp_str(),
+ "Thomson .fd disk image, BASIC format" );
+ break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS:
+ strcpy( info->s = imgtool_temp_str(), "fd" ); break;
+ case IMGTOOLINFO_PTR_OPEN:
+ info->open = thom_open_fd_qd; break;
+ case IMGTOOLINFO_PTR_CLOSE:
+ info->close = thom_close_fd_qd; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC:
+ strcpy( info->s = imgtool_temp_str(), "H[1]-2;T40/[80];D0-[1];N" ); break;
+ default:
+ thom_basic_get_info( clas, param, info );
+ }
}
void thom_qd_basic_get_info(const imgtool_class *clas,
- UINT32 param,
- union imgtoolinfo *info)
+ UINT32 param,
+ union imgtoolinfo *info)
{
- switch ( param ) {
- case IMGTOOLINFO_STR_NAME:
- strcpy( info->s = imgtool_temp_str(), "thom_qd" ); break;
- case IMGTOOLINFO_STR_DESCRIPTION:
- strcpy( info->s = imgtool_temp_str(),
- "Thomson .qd disk image, BASIC format" );
- break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS:
- strcpy( info->s = imgtool_temp_str(), "qd" ); break;
- case IMGTOOLINFO_PTR_OPEN:
- info->open = thom_open_fd_qd; break;
- case IMGTOOLINFO_PTR_CLOSE:
- info->close = thom_close_fd_qd; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC:
- strcpy( info->s = imgtool_temp_str(), "H[1]-2;T[25];D[0];N" ); break;
- default:
- thom_basic_get_info( clas, param, info );
- }
+ switch ( param ) {
+ case IMGTOOLINFO_STR_NAME:
+ strcpy( info->s = imgtool_temp_str(), "thom_qd" ); break;
+ case IMGTOOLINFO_STR_DESCRIPTION:
+ strcpy( info->s = imgtool_temp_str(),
+ "Thomson .qd disk image, BASIC format" );
+ break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS:
+ strcpy( info->s = imgtool_temp_str(), "qd" ); break;
+ case IMGTOOLINFO_PTR_OPEN:
+ info->open = thom_open_fd_qd; break;
+ case IMGTOOLINFO_PTR_CLOSE:
+ info->close = thom_close_fd_qd; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC:
+ strcpy( info->s = imgtool_temp_str(), "H[1]-2;T[25];D[0];N" ); break;
+ default:
+ thom_basic_get_info( clas, param, info );
+ }
}
void thom_sap_basic_get_info(const imgtool_class *clas,
- UINT32 param,
- union imgtoolinfo *info)
+ UINT32 param,
+ union imgtoolinfo *info)
{
- switch ( param ) {
- case IMGTOOLINFO_STR_NAME:
- strcpy( info->s = imgtool_temp_str(), "thom_sap" ); break;
- case IMGTOOLINFO_STR_DESCRIPTION:
- strcpy( info->s = imgtool_temp_str(),
- "Thomson .sap disk image, BASIC format" );
- break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS:
- strcpy( info->s = imgtool_temp_str(), "sap" ); break;
- case IMGTOOLINFO_PTR_OPEN:
- info->open = thom_open_sap; break;
- case IMGTOOLINFO_PTR_CLOSE:
- info->close = thom_close_sap; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC:
- strcpy( info->s = imgtool_temp_str(), "H[1];T40/[80];D0-[1];N" ); break;
- default:
- thom_basic_get_info( clas, param, info );
- }
+ switch ( param ) {
+ case IMGTOOLINFO_STR_NAME:
+ strcpy( info->s = imgtool_temp_str(), "thom_sap" ); break;
+ case IMGTOOLINFO_STR_DESCRIPTION:
+ strcpy( info->s = imgtool_temp_str(),
+ "Thomson .sap disk image, BASIC format" );
+ break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS:
+ strcpy( info->s = imgtool_temp_str(), "sap" ); break;
+ case IMGTOOLINFO_PTR_OPEN:
+ info->open = thom_open_sap; break;
+ case IMGTOOLINFO_PTR_CLOSE:
+ info->close = thom_close_sap; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC:
+ strcpy( info->s = imgtool_temp_str(), "H[1];T40/[80];D0-[1];N" ); break;
+ default:
+ thom_basic_get_info( clas, param, info );
+ }
}
diff --git a/src/mess/tools/imgtool/modules/ti99.c b/src/mess/tools/imgtool/modules/ti99.c
index 514e5aa7344..04363533066 100644
--- a/src/mess/tools/imgtool/modules/ti99.c
+++ b/src/mess/tools/imgtool/modules/ti99.c
@@ -255,7 +255,7 @@ will accept paths of such length). */
#define MAX_PATH_LEN 253
#define MAX_SAFE_PATH_LEN 250
-#define MAX_DIR_LEVEL 125 /* We need to put a recursion limit to avoid endless recursion hazard */
+#define MAX_DIR_LEVEL 125 /* We need to put a recursion limit to avoid endless recursion hazard */
#if 0
@@ -385,13 +385,13 @@ static int check_fname(const char filename[10])
return 1;
case ' ':
/* illegal in a file name, but file names shorter than 10
- characters are padded with spaces */
+ characters are padded with spaces */
space_found_flag = TRUE;
break;
default:
/* all other characters are legal (though non-ASCII characters,
- control characters and even lower-case characters are not
- recommended) */
+ control characters and even lower-case characters are not
+ recommended) */
if (space_found_flag)
return 1;
break;
@@ -415,7 +415,7 @@ static int check_fpath(const char *fpath)
/* first check that the path is not too long and that there is no space
- character */
+ character */
if ((strlen(fpath) > MAX_PATH_LEN) || strchr(fpath, ' '))
return 1;
@@ -489,8 +489,8 @@ struct ti99_date_time
*/
struct dsk_subdir
{
- char name[10]; /* subdirectory name (10 characters, pad with spaces) */
- UINT16BE fdir_aphysrec; /* aphysrec address of fdir record for this subdirectory */
+ char name[10]; /* subdirectory name (10 characters, pad with spaces) */
+ UINT16BE fdir_aphysrec; /* aphysrec address of fdir record for this subdirectory */
};
/*
@@ -501,23 +501,23 @@ struct dsk_subdir
*/
struct dsk_vib
{
- char name[10]; /* disk volume name (10 characters, pad with spaces) */
- UINT16BE totphysrecs; /* total number of physrecs on disk (usually 360, */
+ char name[10]; /* disk volume name (10 characters, pad with spaces) */
+ UINT16BE totphysrecs; /* total number of physrecs on disk (usually 360, */
/* 720, 640, 1280 or 1440). (TI originally */
/* said it should be the total number of AUs, */
/* but, in practice, DSRs that supports disks */
/* over 400kbytes (e.g. HFDC) write the total */
/* number of physrecs.) */
- UINT8 secspertrack; /* sectors per track (usually 9 (FM SD), */
+ UINT8 secspertrack; /* sectors per track (usually 9 (FM SD), */
/* 16 or 18 (MFM DD), or 36 (MFM HD) */
- UINT8 id[3]; /* 'DSK' */
- UINT8 protection; /* 'P' if disk is protected, ' ' otherwise. */
- UINT8 cylinders; /* tracks per side (usually 40) */
- UINT8 heads; /* sides (1 or 2) */
- UINT8 density; /* density: 1 (FM SD), 2 (MFM DD), or 3 (MFM HD) */
- dsk_subdir subdir[3]; /* descriptor for up to 3 subdirectories (HFDC only) */
+ UINT8 id[3]; /* 'DSK' */
+ UINT8 protection; /* 'P' if disk is protected, ' ' otherwise. */
+ UINT8 cylinders; /* tracks per side (usually 40) */
+ UINT8 heads; /* sides (1 or 2) */
+ UINT8 density; /* density: 1 (FM SD), 2 (MFM DD), or 3 (MFM HD) */
+ dsk_subdir subdir[3]; /* descriptor for up to 3 subdirectories (HFDC only) */
/* reserved by TI */
- UINT8 abm[200]; /* allocation bitmap: there is one bit per AU. */
+ UINT8 abm[200]; /* allocation bitmap: there is one bit per AU. */
/* A binary 1 in a bit position indicates that */
/* the allocation unit associated with that */
/* bit has been allocated. */
@@ -542,12 +542,12 @@ enum ti99_img_format
*/
struct ti99_lvl1_imgref
{
- ti99_img_format img_format; /* tells the image format */
- imgtool_stream *file_handle; /* imgtool file handle */
- struct mess_hard_disk_file harddisk_handle; /* MAME harddisk handle (harddisk format) */
- ti99_geometry geometry; /* geometry */
- unsigned pc99_track_len; /* unformatted track length (pc99 format) */
- UINT32 *pc99_data_offset_array; /* offset for each sector (pc99 format) */
+ ti99_img_format img_format; /* tells the image format */
+ imgtool_stream *file_handle; /* imgtool file handle */
+ struct mess_hard_disk_file harddisk_handle; /* MAME harddisk handle (harddisk format) */
+ ti99_geometry geometry; /* geometry */
+ unsigned pc99_track_len; /* unformatted track length (pc99 format) */
+ UINT32 *pc99_data_offset_array; /* offset for each sector (pc99 format) */
};
/*
@@ -597,7 +597,7 @@ static void calc_crc(UINT16 *crc, UINT8 value)
#define DATA_OFFSET_NONE 0xffffffff
static int parse_pc99_image(imgtool_stream *file_handle, int fm_format, int pass, dsk_vib *vib, const ti99_geometry *geometry, UINT32 *data_offset_array, unsigned *out_track_len)
{
- int track_len, num_tracks; /* length of a track in bytes, and number of tracks */
+ int track_len, num_tracks; /* length of a track in bytes, and number of tracks */
int phys_track;
int expected_cylinder, expected_head;
int track_start_pos, track_pos;
@@ -989,7 +989,7 @@ static imgtoolerr_t open_image_lvl1(imgtool_stream *file_handle, ti99_img_format
if (info->sectorbytes != 256)
{
imghd_close(&l1_img->harddisk_handle);
- return IMGTOOLERR_CORRUPTIMAGE; /* TODO: support 512-byte sectors */
+ return IMGTOOLERR_CORRUPTIMAGE; /* TODO: support 512-byte sectors */
}
#if 0
@@ -1012,17 +1012,17 @@ static imgtoolerr_t open_image_lvl1(imgtool_stream *file_handle, ti99_img_format
l1_img->geometry.secspertrack = vib->secspertrack;
if (l1_img->geometry.secspertrack == 0)
/* Some images might be like this, because the original SSSD TI
- controller always assumes 9. */
+ controller always assumes 9. */
l1_img->geometry.secspertrack = 9;
l1_img->geometry.cylinders = vib->cylinders;
if (l1_img->geometry.cylinders == 0)
/* Some images are like this, because the original SSSD TI
- controller always assumes 40. */
+ controller always assumes 40. */
l1_img->geometry.cylinders = 40;
l1_img->geometry.heads = vib->heads;
if (l1_img->geometry.heads == 0)
/* Some images are like this, because the original SSSD TI
- controller always assumes that tracks beyond 40 are on side 2. */
+ controller always assumes that tracks beyond 40 are on side 2. */
l1_img->geometry.heads = totphysrecs / (l1_img->geometry.secspertrack * l1_img->geometry.cylinders);
/* check information */
@@ -1104,7 +1104,7 @@ INLINE int sector_address_to_image_offset(const ti99_lvl1_imgref *l1_img, const
/* pc99 format */
case if_harddisk:
/* harddisk format */
- assert(1); /* not implemented */
+ assert(1); /* not implemented */
break;
}
@@ -1301,10 +1301,10 @@ static void dsk_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *ge
#ifdef UNUSED_FUNCTION
static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address)
{
- address.sector = aphysrec % l1_img->geometry.secspertrack;
- aphysrec /= l1_img->geometry.secspertrack;
- address.side = aphysrec % l1_img->geometry.heads;
- address.cylinder = aphysrec / l1_img->geometry.heads;
+ address.sector = aphysrec % l1_img->geometry.secspertrack;
+ aphysrec /= l1_img->geometry.secspertrack;
+ address.side = aphysrec % l1_img->geometry.heads;
+ address.cylinder = aphysrec / l1_img->geometry.heads;
}
#endif
@@ -1386,21 +1386,21 @@ static int write_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, c
*/
struct win_vib_ddr
{
- char name[10]; /* disk volume name (10 characters, pad with spaces) */
- UINT16BE totAUs; /* total number of AUs */
- UINT8 secspertrack; /* HFDC: sectors per track (typically 32) */
+ char name[10]; /* disk volume name (10 characters, pad with spaces) */
+ UINT16BE totAUs; /* total number of AUs */
+ UINT8 secspertrack; /* HFDC: sectors per track (typically 32) */
/* SCSI: reserved */
union
{
struct
{
- UINT8 id[3]; /* V1 VIB: 'WIN' */
+ UINT8 id[3]; /* V1 VIB: 'WIN' */
} vib_v1;
- struct /* V2 VIB: extra params */
+ struct /* V2 VIB: extra params */
{
- UINT8 res_AUs; /* # AUs reserved for vib, bitmap, ddr, fdir and fdr, divided by 64 */
- UINT8 step_spd; /* HFDC: step speed (0-7) */
+ UINT8 res_AUs; /* # AUs reserved for vib, bitmap, ddr, fdir and fdr, divided by 64 */
+ UINT8 step_spd; /* HFDC: step speed (0-7) */
/* SCSI: reserved */
UINT8 red_w_cur;/* HFDC: reduced write current cylinder, divided by 8 */
/* SCSI: reserved */
@@ -1408,10 +1408,10 @@ struct win_vib_ddr
struct
{
- UINT8 id[3]; /* DDR: 'DIR' */
+ UINT8 id[3]; /* DDR: 'DIR' */
} ddr;
} u;
- UINT16BE params; /* bits 0-3: sectors/AU - 1 */
+ UINT16BE params; /* bits 0-3: sectors/AU - 1 */
/* HFDC: */
/* bits 4-7: # heads - 1 */
/* bit 8: V1: buffered head stepping flag */
@@ -1420,20 +1420,20 @@ struct win_vib_ddr
/* SCSI: */
/* bits 4-15: reserved */
ti99_date_time creation;/* date and time of creation */
- UINT8 num_files; /* number of files in directory */
- UINT8 num_subdirs; /* number of subdirectories in directory */
- UINT16BE fdir_AU; /* points to root directory fdir */
+ UINT8 num_files; /* number of files in directory */
+ UINT8 num_subdirs; /* number of subdirectories in directory */
+ UINT16BE fdir_AU; /* points to root directory fdir */
union
{
struct
{
- UINT16BE dsk1_AU; /* HFDC: points to current dsk1 emulation image (0 if none) */
+ UINT16BE dsk1_AU; /* HFDC: points to current dsk1 emulation image (0 if none) */
/* SCSI: reserved */
} vib;
struct
{
- UINT16BE parent_ddr_AU; /* points to parent directory DDR */
+ UINT16BE parent_ddr_AU; /* points to parent directory DDR */
} ddr;
} u2;
UINT16BE subdir_AU[114];/* points to all subdirectory DDRs */
@@ -1444,8 +1444,8 @@ struct win_vib_ddr
*/
struct ti99_AUformat
{
- int totAUs; /* total number of AUs */
- int physrecsperAU; /* number of 256-byte physical records per AU */
+ int totAUs; /* total number of AUs */
+ int physrecsperAU; /* number of 256-byte physical records per AU */
};
/*
@@ -1459,24 +1459,24 @@ struct ti99_AUformat
*/
struct dir_entry
{
- UINT16 dir_ptr; /* DSK: unused */
+ UINT16 dir_ptr; /* DSK: unused */
/* WIN: AU address of the DDR for this directory */
- char name[10]; /* name of this directory (copied from the VIB for DSK, DDR for WIN) */
+ char name[10]; /* name of this directory (copied from the VIB for DSK, DDR for WIN) */
};
struct file_entry
{
- UINT16 fdr_ptr; /* DSK: aphysrec address of the FDR for this file */
+ UINT16 fdr_ptr; /* DSK: aphysrec address of the FDR for this file */
/* WIN: AU address of the FDR for this file */
- char name[10]; /* name of this file (copied from FDR) */
+ char name[10]; /* name of this file (copied from FDR) */
};
struct ti99_catalog
{
- int num_subdirs; /* number of subdirectories */
- int num_files; /* number of files */
- dir_entry subdirs[114]; /* description of each subdir */
- file_entry files[128]; /* description of each file */
+ int num_subdirs; /* number of subdirectories */
+ int num_files; /* number of files */
+ dir_entry subdirs[114]; /* description of each subdir */
+ file_entry files[128]; /* description of each file */
};
/*
@@ -1484,9 +1484,9 @@ struct ti99_catalog
*/
struct ti99_lvl2_imgref_dsk
{
- UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */
- ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */
- UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory
+ UINT16 totphysrecs; /* total number of aphysrecs (extracted from vib record in aphysrec 0) */
+ ti99_catalog catalogs[4]; /* catalog of root directory and up to 3 subdirectories */
+ UINT16 fdir_aphysrec[4]; /* fdir aphysrec address for root directory
and up to 3 subdirectories */
};
@@ -1497,7 +1497,7 @@ enum win_vib_t
};
struct ti99_lvl2_imgref_win
{
- win_vib_t vib_version; /* version of the vib record in aphysrec 0 (see win_vib_ddr) */
+ win_vib_t vib_version; /* version of the vib record in aphysrec 0 (see win_vib_ddr) */
};
enum l2i_t
@@ -1509,34 +1509,34 @@ enum l2i_t
struct ti99_lvl2_imgref
{
ti99_lvl1_imgref l1_img;/* image format, imgtool image handle, image geometry */
- ti99_AUformat AUformat; /* AU format */
- int data_offset; /* In order to reduce seek times when searching the
+ ti99_AUformat AUformat; /* AU format */
+ int data_offset; /* In order to reduce seek times when searching the
disk for a given file name, fdr (and ddr, and
fdir) records are preferentially allocated in
AUs n to data_offset, whereas data records are
preferentially allocated in AUs starting at
data_offset. */
/* With the DSK disk structure, n is always 2 (if 1
- physrec per AU) or 1 (if 2 physrecs per AU or
- more), and data_offset is arbitrarily chosen as
- 34. */
+ physrec per AU) or 1 (if 2 physrecs per AU or
+ more), and data_offset is arbitrarily chosen as
+ 34. */
/* With the WIN disk structure, n depends on the
- size of the volume bitmap, which itself depends
- on the number of AUs on disk (we always have n
- <= 33), and data_offset is read from the vib
- record (except with the obsolete v1 VIB, where
- we use a default value of 64). */
- char vol_name[10]; /* cached volume name (extracted from vib record in aphysrec 0) */
+ size of the volume bitmap, which itself depends
+ on the number of AUs on disk (we always have n
+ <= 33), and data_offset is read from the vib
+ record (except with the obsolete v1 VIB, where
+ we use a default value of 64). */
+ char vol_name[10]; /* cached volume name (extracted from vib record in aphysrec 0) */
- UINT8 abm[8192]; /* allocation bitmap */
+ UINT8 abm[8192]; /* allocation bitmap */
- l2i_t type; /* structure format */
+ l2i_t type; /* structure format */
union
{
ti99_lvl2_imgref_dsk dsk;
ti99_lvl2_imgref_win win;
- }; /* structure-specific info */
+ }; /* structure-specific info */
};
/*
@@ -1544,12 +1544,12 @@ struct ti99_lvl2_imgref
*/
enum
{
- fdr99_f_program = 0x01, /* set for program files */
- fdr99_f_int = 0x02, /* set for binary files */
- fdr99_f_wp = 0x08, /* set if file is write-protected */
- /*fdr99_f_backup = 0x10,*/ /* set if file has been modified since last backup */
- /*fdr99_f_dskimg = 0x20,*/ /* set if file is a DSK image (HFDC HD only) */
- fdr99_f_var = 0x80 /* set if file uses variable-length records*/
+ fdr99_f_program = 0x01, /* set for program files */
+ fdr99_f_int = 0x02, /* set for binary files */
+ fdr99_f_wp = 0x08, /* set if file is write-protected */
+ /*fdr99_f_backup = 0x10,*/ /* set if file has been modified since last backup */
+ /*fdr99_f_dskimg = 0x20,*/ /* set if file is a DSK image (HFDC HD only) */
+ fdr99_f_var = 0x80 /* set if file uses variable-length records*/
};
/*
@@ -1557,17 +1557,17 @@ enum
*/
struct dsk_fdr
{
- char name[10]; /* file name (10 characters, pad with spaces) */
- UINT16BE xreclen; /* extended record len: if record len is >= 256, */
+ char name[10]; /* file name (10 characters, pad with spaces) */
+ UINT16BE xreclen; /* extended record len: if record len is >= 256, */
/* reclen is set to 0 and the actual reclen is */
/* stored here (Myarc HFDC only). TI reserved */
/* this field for data chain pointer extension, */
/* but this was never implemented. */
- UINT8 flags; /* file status flags (see enum above) */
- UINT8 recsperphysrec; /* logical records per physrec */
+ UINT8 flags; /* file status flags (see enum above) */
+ UINT8 recsperphysrec; /* logical records per physrec */
/* ignored for variable length record files and */
/* program files */
- UINT16BE fphysrecs; /* file length in physrecs */
+ UINT16BE fphysrecs; /* file length in physrecs */
/* Note that the HFDC defines this field as the */
/* number of allocated physrecs in the cluster */
/* chain (i.e. rounded on the next AU */
@@ -1578,21 +1578,21 @@ struct dsk_fdr
/* program files do not define the fixrecs field */
/* field, so program field saved by the HFDC */
/* DSR may be larger whan they should. */
- UINT8 eof; /* EOF offset in last physrec for variable length */
+ UINT8 eof; /* EOF offset in last physrec for variable length */
/* record files and program files (0->256)*/
- UINT8 reclen; /* logical record size in bytes ([1,255] 0->256) */
+ UINT8 reclen; /* logical record size in bytes ([1,255] 0->256) */
/* Maximum allowable record size for variable */
/* length record files. Reserved for program */
/* files (set to 0). Set to 0 if reclen >=256 */
/* (HFDC only). */
- UINT16LE fixrecs; /* file length in logical records */
+ UINT16LE fixrecs; /* file length in logical records */
/* For variable length record files, number of */
/* 256-byte records actually used. */
ti99_date_time creation;/* date and time of creation (HFDC and BwG only; */
/* reserved in TI) */
- ti99_date_time update; /* date and time of last write to file (HFDC and */
+ ti99_date_time update; /* date and time of last write to file (HFDC and */
/* BwG only; reserved in TI) */
- UINT8 clusters[76][3]; /* data cluster table: 0 through 76 entries (3 */
+ UINT8 clusters[76][3]; /* data cluster table: 0 through 76 entries (3 */
/* bytes each), one entry for each file cluster. */
/* 12 bits: address of first AU of cluster */
/* 12 bits: offset of last 256-byte record in cluster */
@@ -1603,17 +1603,17 @@ struct dsk_fdr
*/
struct win_fdr
{
- char name[10]; /* file name (10 characters, pad with spaces) */
- UINT16BE xreclen; /* extended record len: if record len is >= 256, */
+ char name[10]; /* file name (10 characters, pad with spaces) */
+ UINT16BE xreclen; /* extended record len: if record len is >= 256, */
/* reclen is set to 0 and the actual reclen is */
/* stored here (Myarc HFDC only). TI reserved */
/* this field for data chain pointer extension, */
/* but this was never implemented. */
- UINT8 flags; /* file status flags (see enum above) */
- UINT8 recsperphysrec; /* logical records per physrec */
+ UINT8 flags; /* file status flags (see enum above) */
+ UINT8 recsperphysrec; /* logical records per physrec */
/* ignored for variable length record files and */
/* program files */
- UINT16BE fphysrecs_LSW; /* eldest FDR: file length in physrecs */
+ UINT16BE fphysrecs_LSW; /* eldest FDR: file length in physrecs */
/* Note that the HFDC defines this field as the */
/* number of allocated physrecs in the cluster */
/* chain (i.e. rounded on the next AU */
@@ -1626,30 +1626,30 @@ struct win_fdr
/* DSR may be larger whan they should. */
/* other sibling FDRs: index of the first file */
/* physrec in this particular sibling FDR */
- UINT8 eof; /* EOF offset in last physrec for variable length */
+ UINT8 eof; /* EOF offset in last physrec for variable length */
/* record files and program files (0->256)*/
- UINT8 reclen; /* logical record size in bytes ([1,255]) */
+ UINT8 reclen; /* logical record size in bytes ([1,255]) */
/* Maximum allowable record size for variable */
/* length record files. Reserved for program */
/* files (set to 0). Set to 0 if reclen >=256 */
/* (HFDC only). */
- UINT16LE fixrecs_LSW; /* file length in logical records */
+ UINT16LE fixrecs_LSW; /* file length in logical records */
/* For variable length record files, number of */
/* 256-byte records actually used. */
ti99_date_time creation;/* date and time of creation */
- ti99_date_time update; /* date and time of last write to file */
+ ti99_date_time update; /* date and time of last write to file */
- char id[2]; /* 'FI' */
- UINT16BE prevsibFDR_AU; /* address of the AU where previous sibling FDR is */
+ char id[2]; /* 'FI' */
+ UINT16BE prevsibFDR_AU; /* address of the AU where previous sibling FDR is */
/* (see also xinfo_LSB) */
- UINT16BE nextsibFDR_AU; /* address of the AU where next sibling FDR is */
+ UINT16BE nextsibFDR_AU; /* address of the AU where next sibling FDR is */
/* (see also xinfo_LSB) */
- UINT16BE sibFDR_AUlen; /* total number of data AUs allocated in this particular sibling FDR */
+ UINT16BE sibFDR_AUlen; /* total number of data AUs allocated in this particular sibling FDR */
UINT16BE parent_FDIR_AU;/* FDIR the file is listed in */
- UINT8 xinfo_MSB; /* extended information (MSByte) */
+ UINT8 xinfo_MSB; /* extended information (MSByte) */
/* bits 0-3: MSN of fphysrecs */
/* bits 4-7: MSN of fixrecs */
- UINT8 xinfo_LSB; /* extended information (LSByte) */
+ UINT8 xinfo_LSB; /* extended information (LSByte) */
/* bits 8-11: physrec offset within AU for */
/* previous sibling FDR (see prevsibFDR_AU) */
/* bits 12-15: physrec offset within AU for */
@@ -1665,14 +1665,14 @@ struct win_fdr
*/
struct tifile_header
{
- char tifiles[8]; /* always '\7TIFILES' */
- UINT16BE fphysrecs; /* file length in physrecs */
- UINT8 flags; /* see enum above */
- UINT8 recsperphysrec; /* records per physrec */
- UINT8 eof; /* current position of eof in last physrec (0->255)*/
- UINT8 reclen; /* bytes per record ([1,255] 0->256) */
- UINT16BE fixrecs; /* file length in records */
- UINT8 res[128-16]; /* reserved */
+ char tifiles[8]; /* always '\7TIFILES' */
+ UINT16BE fphysrecs; /* file length in physrecs */
+ UINT8 flags; /* see enum above */
+ UINT8 recsperphysrec; /* records per physrec */
+ UINT8 eof; /* current position of eof in last physrec (0->255)*/
+ UINT8 reclen; /* bytes per record ([1,255] 0->256) */
+ UINT16BE fixrecs; /* file length in records */
+ UINT8 res[128-16]; /* reserved */
/* * variant a: */
/* 112 chars: 0xCA53 repeated 56 times */
/* * variant b: */
@@ -1713,10 +1713,10 @@ struct ti99_lvl2_fileref_dsk
struct ti99_lvl2_fileref_win
{
struct ti99_lvl2_imgref *l2_img;
- unsigned fphysrecs; /* copy of field in the eldest FDR */
- unsigned eldestfdr_aphysrec; /* aphysrec address of the eldest FDR */
- unsigned curfdr_aphysrec; /* aphysrec address of the currently open sibling FDR */
- win_fdr curfdr; /* buffer with currently open sibling FDR */
+ unsigned fphysrecs; /* copy of field in the eldest FDR */
+ unsigned eldestfdr_aphysrec; /* aphysrec address of the eldest FDR */
+ unsigned curfdr_aphysrec; /* aphysrec address of the currently open sibling FDR */
+ win_fdr curfdr; /* buffer with currently open sibling FDR */
};
struct ti99_lvl2_fileref_tifiles
@@ -2342,12 +2342,12 @@ static int win_alloc_sibFDR(ti99_lvl2_fileref_win *win_file)
oldfdr_physrecinAU = win_file->curfdr_aphysrec % win_file->l2_img->AUformat.physrecsperAU;
if (oldfdr_physrecinAU != (win_file->l2_img->AUformat.physrecsperAU - 1))
- { /* current AU is not full */
+ { /* current AU is not full */
newfdr_AU = oldfdr_AU;
newfdr_physrecinAU = oldfdr_physrecinAU + 1;
}
else
- { /* current AU is full: allocate another */
+ { /* current AU is full: allocate another */
errorcode = alloc_fdr_AU(win_file->l2_img, &newfdr_AU);
if (errorcode)
return errorcode;
@@ -2423,11 +2423,11 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
fphysrecs = get_UINT16BE(dsk_file->fdr.fphysrecs);
if (fphysrecs == 0)
- { /* cluster array must be empty */
+ { /* cluster array must be empty */
cluster_index = 0;
}
else
- { /* try to extend last block */
+ { /* try to extend last block */
last_sec = -1;
for (cluster_index=0; cluster_index<76; cluster_index++)
{
@@ -2441,7 +2441,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
return IMGTOOLERR_CORRUPTIMAGE;
if (last_sec > (fphysrecs-1))
- { /* some extra space has already been allocated */
+ { /* some extra space has already been allocated */
cur_block_seclen = last_sec - (fphysrecs-1);
if (cur_block_seclen > nb_alloc_physrecs)
cur_block_seclen = nb_alloc_physrecs;
@@ -2450,14 +2450,14 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs);
nb_alloc_physrecs -= cur_block_seclen;
if (! nb_alloc_physrecs)
- return 0; /* done */
+ return 0; /* done */
}
/* round up to next AU boundary */
last_sec = last_sec + dsk_file->l2_img->AUformat.physrecsperAU - (last_sec % dsk_file->l2_img->AUformat.physrecsperAU) - 1;
if (last_sec > (fphysrecs-1))
- { /* some extra space has already been allocated */
+ { /* some extra space has already been allocated */
cur_block_seclen = last_sec - (fphysrecs-1);
if (cur_block_seclen > nb_alloc_physrecs)
cur_block_seclen = nb_alloc_physrecs;
@@ -2467,7 +2467,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
set_dsk_fdr_cluster_lastfphysrec(&dsk_file->fdr, cluster_index, fphysrecs-1);
nb_alloc_physrecs -= cur_block_seclen;
if (! nb_alloc_physrecs)
- return 0; /* done */
+ return 0; /* done */
}
/* read base AU address for this cluster */
@@ -2479,7 +2479,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
for (i=cluster_baseAU; (! (dsk_file->l2_img->abm[i >> 3] & (1 << (i & 7)))) && (cur_block_seclen < nb_alloc_physrecs) && (i < totAUs); i++)
cur_block_seclen += dsk_file->l2_img->AUformat.physrecsperAU;
if (cur_block_seclen)
- { /* extend last block */
+ { /* extend last block */
if (cur_block_seclen > nb_alloc_physrecs)
cur_block_seclen = nb_alloc_physrecs;
@@ -2492,7 +2492,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
for (i=0; i<cluster_AUlen; i++)
dsk_file->l2_img->abm[(i+cluster_baseAU) >> 3] |= 1 << ((i+cluster_baseAU) & 7);
if (! nb_alloc_physrecs)
- return 0; /* done */
+ return 0; /* done */
}
cluster_index++;
if (cluster_index == 76)
@@ -2500,7 +2500,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
return IMGTOOLERR_NOSPACE;
}
- search_start = dsk_file->l2_img->data_offset; /* initially, search for free space only in data space */
+ search_start = dsk_file->l2_img->data_offset; /* initially, search for free space only in data space */
while (nb_alloc_physrecs)
{
/* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */
@@ -2509,7 +2509,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
for (i=search_start; i<totAUs; i++)
{
if (! (dsk_file->l2_img->abm[i >> 3] & (1 << (i & 7))))
- { /* found one free block */
+ { /* found one free block */
/* compute its length */
cluster_baseAU = i;
cur_block_seclen = 0;
@@ -2536,7 +2536,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
}
if (first_best_block_seclen != INT_MAX)
- { /* found one contiguous block which can hold it all */
+ { /* found one contiguous block which can hold it all */
fphysrecs += nb_alloc_physrecs;
set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs);
@@ -2548,7 +2548,7 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
nb_alloc_physrecs = 0;
}
else if (second_best_block_seclen != 0)
- { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
+ { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
fphysrecs += second_best_block_seclen;
set_UINT16BE(& dsk_file->fdr.fphysrecs, fphysrecs);
@@ -2565,11 +2565,11 @@ static int dsk_alloc_file_physrecs(ti99_lvl2_fileref_dsk *dsk_file, int nb_alloc
return IMGTOOLERR_NOSPACE;
}
else if (search_start != 0)
- { /* we did not find any free physrec in the data section of the disk */
- search_start = 0; /* time to fall back to fdr space */
+ { /* we did not find any free physrec in the data section of the disk */
+ search_start = 0; /* time to fall back to fdr space */
}
else
- return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
+ return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
}
return 0;
@@ -2617,7 +2617,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
return errorcode;
}
if ((get_UINT16BE(win_file->curfdr.clusters[0][0]) == 0) && (get_UINT16BE(win_file->curfdr.prevsibFDR_AU) != 0))
- { /* this is annoying: we have found a sibling FDR filled with 0s: rewind
+ { /* this is annoying: we have found a sibling FDR filled with 0s: rewind
to last non-empty sibling if applicable */
errorcode = win_goto_prev_sibFDR(win_file);
if (errorcode)
@@ -2632,7 +2632,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
+ get_UINT16BE(win_file->curfdr.sibFDR_AUlen) * win_file->l2_img->AUformat.physrecsperAU;
if (num_fphysrec > fphysrecs)
- { /* some extra space has already been allocated */
+ { /* some extra space has already been allocated */
cur_block_seclen = num_fphysrec - fphysrecs;
if (cur_block_seclen > nb_alloc_physrecs)
cur_block_seclen = nb_alloc_physrecs;
@@ -2643,7 +2643,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
/*set_win_fdr_fphysrecs(& win_file->rootfdr.fphysrecs, fphysrecs);*/
nb_alloc_physrecs -= cur_block_seclen;
if (! nb_alloc_physrecs)
- return 0; /* done */
+ return 0; /* done */
}
/* find last non-empty cluster */
@@ -2661,7 +2661,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
for (i=cluster_baseAU; (! (win_file->l2_img->abm[i >> 3] & (1 << (i & 7)))) && (cur_block_seclen < nb_alloc_physrecs) && (i < totAUs); i++)
cur_block_seclen += win_file->l2_img->AUformat.physrecsperAU;
if (cur_block_seclen)
- { /* extend last block */
+ { /* extend last block */
if (cur_block_seclen > nb_alloc_physrecs)
cur_block_seclen = nb_alloc_physrecs;
@@ -2678,13 +2678,13 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
win_file->l2_img->abm[(i+cluster_baseAU) >> 3] |= 1 << ((i+cluster_baseAU) & 7);
nb_alloc_physrecs -= cur_block_seclen;
if (! nb_alloc_physrecs)
- return 0; /* done */
+ return 0; /* done */
}
/* now point to first free entry in cluster table */
cluster_index++;
}
- search_start = win_file->l2_img->data_offset; /* initially, search for free space only in data space */
+ search_start = win_file->l2_img->data_offset; /* initially, search for free space only in data space */
while (nb_alloc_physrecs)
{
/* find smallest data block at least nb_alloc_physrecs in length, and largest data block less than nb_alloc_physrecs in length */
@@ -2693,7 +2693,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
for (i=search_start; i<totAUs; i++)
{
if (! (win_file->l2_img->abm[i >> 3] & (1 << (i & 7))))
- { /* found one free block */
+ { /* found one free block */
/* compute its length */
cluster_baseAU = i;
cur_block_seclen = 0;
@@ -2727,13 +2727,13 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
if (write_absolute_physrec(& win_file->l2_img->l1_img, win_file->curfdr_aphysrec, &win_file->curfdr))
return IMGTOOLERR_WRITEERROR;
if (get_UINT16BE(win_file->curfdr.nextsibFDR_AU) != 0)
- { /* read next sibling FDR */
+ { /* read next sibling FDR */
errorcode = win_goto_next_sibFDR(win_file);
if (errorcode)
return errorcode;
}
else
- { /* allocate new sibling FDR */
+ { /* allocate new sibling FDR */
errorcode = win_alloc_sibFDR(win_file);
if (errorcode)
return errorcode;
@@ -2743,7 +2743,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
}
if (first_best_block_seclen != INT_MAX)
- { /* found one contiguous block which can hold it all */
+ { /* found one contiguous block which can hold it all */
fphysrecs += nb_alloc_physrecs;
cluster_AUlen = (nb_alloc_physrecs + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU;
win_file->fphysrecs = fphysrecs;
@@ -2761,7 +2761,7 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
nb_alloc_physrecs = 0;
}
else if (second_best_block_seclen != 0)
- { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
+ { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
fphysrecs += second_best_block_seclen;
cluster_AUlen = (second_best_block_seclen + win_file->l2_img->AUformat.physrecsperAU - 1) / win_file->l2_img->AUformat.physrecsperAU;
win_file->fphysrecs = fphysrecs;
@@ -2782,11 +2782,11 @@ static int win_alloc_file_physrecs(ti99_lvl2_fileref_win *win_file, int nb_alloc
cluster_index++;
}
else if (search_start != 0)
- { /* we did not find any free physrec in the data section of the disk */
- search_start = 0; /* time to fall back to fdr space */
+ { /* we did not find any free physrec in the data section of the disk */
+ search_start = 0; /* time to fall back to fdr space */
}
else
- return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
+ return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
}
return 0;
@@ -2807,9 +2807,9 @@ static int new_file_lvl2_dsk(struct ti99_lvl2_imgref *l2_img, int parent_ref, ch
if (catalog->num_files >= 127)
/* if num_files == 128, catalog is full */
/* if num_files == 127, catalog is not full, but we don't want to write
- a 128th entry for compatibility with some existing DSRs that detect the
- end of the FDIR array with a 0 entry (and do not check that the index
- has not reached 128) */
+ a 128th entry for compatibility with some existing DSRs that detect the
+ end of the FDIR array with a 0 entry (and do not check that the index
+ has not reached 128) */
return IMGTOOLERR_NOSPACE;
/* find insertion point in catalog */
@@ -2986,8 +2986,8 @@ static int open_file_lvl2_win(struct ti99_lvl2_imgref *l2_img, const char *fpath
/* check integrity of FDR sibling chain */
/* note that as we check that the back chain is consistent with the forward
- chain, we will also detect any cycle in the sibling chain, so we do not
- need to check against them explicitely */
+ chain, we will also detect any cycle in the sibling chain, so we do not
+ need to check against them explicitely */
if (get_UINT16BE(l2_file->win.curfdr.prevsibFDR_AU) != 0)
return IMGTOOLERR_CORRUPTIMAGE;
@@ -3300,23 +3300,23 @@ static int write_file_physrec(struct ti99_lvl2_fileref *l2_file, unsigned fphysr
#ifdef UNUSED_FUNCTION
static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data)
{
- win_fdr fdr_buf;
- unsigned fdr_aphysrec;
- int errorcode = 0;
-
- for (fdr_aphysrec = l2_file->win.eldestfdr_aphysrec;
- fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0);
- fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->win.l2_img, &fdr_buf))
- {
- memcpy(((UINT8 *) &fdr_buf) + offset, data, size);
- if (write_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf))
- {
- errorcode = IMGTOOLERR_WRITEERROR;
- break;
- }
- }
-
- return errorcode;
+ win_fdr fdr_buf;
+ unsigned fdr_aphysrec;
+ int errorcode = 0;
+
+ for (fdr_aphysrec = l2_file->win.eldestfdr_aphysrec;
+ fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0);
+ fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->win.l2_img, &fdr_buf))
+ {
+ memcpy(((UINT8 *) &fdr_buf) + offset, data, size);
+ if (write_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf))
+ {
+ errorcode = IMGTOOLERR_WRITEERROR;
+ break;
+ }
+ }
+
+ return errorcode;
}
#endif
@@ -3831,18 +3831,18 @@ struct dsk_iterator
{
struct ti99_lvl2_imgref *image;
int level;
- int listing_subdirs; /* true if we are listing subdirectories at current level */
- int index[2]; /* current index in the disk catalog */
- ti99_catalog *cur_catalog; /* current catalog */
+ int listing_subdirs; /* true if we are listing subdirectories at current level */
+ int index[2]; /* current index in the disk catalog */
+ ti99_catalog *cur_catalog; /* current catalog */
};
struct win_iterator
{
struct ti99_lvl2_imgref *image;
int level;
- int listing_subdirs; /* true if we are listing subdirectories at current level */
- int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */
- ti99_catalog catalog[MAX_DIR_LEVEL]; /* current catalog */
+ int listing_subdirs; /* true if we are listing subdirectories at current level */
+ int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */
+ ti99_catalog catalog[MAX_DIR_LEVEL]; /* current catalog */
};
@@ -3876,16 +3876,16 @@ enum
};
static OPTION_GUIDE_START( dsk_create_optionguide )
- OPTION_STRING(dsk_createopts_volname, "label", "Volume name" )
+ OPTION_STRING(dsk_createopts_volname, "label", "Volume name" )
OPTION_INT(dsk_createopts_sides, "sides", "Sides" )
OPTION_INT(dsk_createopts_tracks, "tracks", "Tracks" )
- OPTION_INT(dsk_createopts_sectors, "sectors", "Sectors (1->9 for SD, 1->18 for DD, 1->36 for HD)" )
+ OPTION_INT(dsk_createopts_sectors, "sectors", "Sectors (1->9 for SD, 1->18 for DD, 1->36 for HD)" )
OPTION_INT(dsk_createopts_protection, "protection", "Protection (0 for normal, 1 for protected)" )
OPTION_ENUM_START(dsk_createopts_density, "density", "Density" )
- OPTION_ENUM( 0, "Auto", "Auto" )
- OPTION_ENUM( 1, "SD", "Single Density" )
- OPTION_ENUM( 2, "DD", "Double Density" )
- OPTION_ENUM( 3, "HD", "High Density" )
+ OPTION_ENUM( 0, "Auto", "Auto" )
+ OPTION_ENUM( 1, "SD", "Single Density" )
+ OPTION_ENUM( 2, "DD", "Double Density" )
+ OPTION_ENUM( 3, "HD", "High Density" )
OPTION_ENUM_END
OPTION_GUIDE_END
@@ -3895,15 +3895,15 @@ static void ti99_getinfo(const imgtool_class *imgclass, UINT32 state, union imgt
{
switch(state)
{
- case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(ti99_lvl2_imgref); break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(dsk_iterator); break;
-
- case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
- case IMGTOOLINFO_PTR_CLOSE: info->close = ti99_image_exit; break;
- case IMGTOOLINFO_PTR_INFO: info->info = ti99_image_info; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti99_image_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = ti99_image_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = ti99_image_writefile; break;
+ case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES: info->i = sizeof(ti99_lvl2_imgref); break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(dsk_iterator); break;
+
+ case IMGTOOLINFO_STR_EOLN: strcpy(info->s = imgtool_temp_str(), "\r"); break;
+ case IMGTOOLINFO_PTR_CLOSE: info->close = ti99_image_exit; break;
+ case IMGTOOLINFO_PTR_INFO: info->info = ti99_image_info; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti99_image_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = ti99_image_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = ti99_image_writefile; break;
}
}
@@ -3911,11 +3911,11 @@ static void ti99_dsk_getinfo(const imgtool_class *imgclass, UINT32 state, union
{
switch(state)
{
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "dsk"); break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = dsk_image_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = dsk_image_nextenum; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = dsk_image_deletefile; break;
- default: ti99_getinfo(imgclass, state, info);
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "dsk"); break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = dsk_image_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = dsk_image_nextenum; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = dsk_image_deletefile; break;
+ default: ti99_getinfo(imgclass, state, info);
}
}
@@ -3923,13 +3923,13 @@ void ti99_old_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoo
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99_old"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (old MESS format)"); break;
- case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_mess; break;
- case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_mess; break;
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break;
- default: ti99_dsk_getinfo(imgclass, state, info); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99_old"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (old MESS format)"); break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_mess; break;
+ case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_mess; break;
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break;
+ default: ti99_dsk_getinfo(imgclass, state, info); break;
}
}
@@ -3937,13 +3937,13 @@ void ti99_v9t9_get_info(const imgtool_class *imgclass, UINT32 state, union imgto
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "v9t9"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (V9T9 format)"); break;
- case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_v9t9; break;
- case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_v9t9; break;
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break;
- default: ti99_dsk_getinfo(imgclass, state, info); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "v9t9"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (V9T9 format)"); break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_v9t9; break;
+ case IMGTOOLINFO_PTR_CREATE: info->create = dsk_image_create_v9t9; break;
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = dsk_create_optionguide; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), dsk_create_optionspecs); break;
+ default: ti99_dsk_getinfo(imgclass, state, info); break;
}
}
@@ -3951,11 +3951,11 @@ void ti99_pc99fm_get_info(const imgtool_class *imgclass, UINT32 state, union img
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99fm"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 FM format)"); break;
- case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_fm; break;
- case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99fm; */ break;
- default: ti99_dsk_getinfo(imgclass, state, info); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99fm"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 FM format)"); break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_fm; break;
+ case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99fm; */ break;
+ default: ti99_dsk_getinfo(imgclass, state, info); break;
}
}
@@ -3963,11 +3963,11 @@ void ti99_pc99mfm_get_info(const imgtool_class *imgclass, UINT32 state, union im
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99mfm"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 MFM format)"); break;
- case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_mfm; break;
- case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99mfm; */ break;
- default: ti99_dsk_getinfo(imgclass, state, info); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "pc99mfm"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Diskette (PC99 MFM format)"); break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = dsk_image_init_pc99_mfm; break;
+ case IMGTOOLINFO_PTR_CREATE: /* info->create = dsk_image_create_pc99mfm; */ break;
+ default: ti99_dsk_getinfo(imgclass, state, info); break;
}
}
@@ -3975,16 +3975,16 @@ void ti99_ti99hd_get_info(const imgtool_class *imgclass, UINT32 state, union img
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99hd"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Harddisk"); break;
- case IMGTOOLINFO_PTR_OPEN: info->open = win_image_init; break;
- case IMGTOOLINFO_PTR_CREATE: /* info->create = hd_image_create; */ break;
-
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = win_image_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = win_image_nextenum; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = win_image_deletefile; break;
- default: ti99_getinfo(imgclass, state, info);
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti99hd"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI99 Harddisk"); break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = win_image_init; break;
+ case IMGTOOLINFO_PTR_CREATE: /* info->create = hd_image_create; */ break;
+
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = win_image_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = win_image_nextenum; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = win_image_deletefile; break;
+ default: ti99_getinfo(imgclass, state, info);
}
}
@@ -4035,8 +4035,8 @@ static int dsk_image_init(imgtool_image *img, imgtool_stream *f, ti99_img_format
/* read and check subdirectory catalogs */
/* Note that the reserved areas used for HFDC subdirs may be used for other
- purposes by other FDRs, so, if we get any error, we will assume there is no
- subdir after all... */
+ purposes by other FDRs, so, if we get any error, we will assume there is no
+ subdir after all... */
image->dsk.catalogs[0].num_subdirs = 0;
for (i=0; i<3; i++)
{
@@ -4279,7 +4279,7 @@ static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_d
ent->filesize = 256;
/* recurse subdirectory */
- iter->listing_subdirs = 0; /* no need to list subdirs as only the
+ iter->listing_subdirs = 0; /* no need to list subdirs as only the
root dir has subdirs in DSK format */
iter->level = 1;
iter->cur_catalog = &iter->image->dsk.catalogs[iter->index[0]+1];
@@ -4559,7 +4559,7 @@ static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char
get_file_creation_date(&src_file, &date_time);
#if 0
if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0)
- || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
+ || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
current_date_time(&date_time);
#endif
set_file_creation_date(&dst_file, date_time);
@@ -4567,7 +4567,7 @@ static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char
get_file_update_date(&src_file, &date_time);
#if 0
if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0)
- || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
+ || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
current_date_time(&date_time);
#endif
set_file_update_date(&dst_file, date_time);
@@ -4728,7 +4728,7 @@ static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const cha
get_file_creation_date(&src_file, &date_time);
#if 0
if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0)
- || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
+ || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
current_date_time(&date_time);
#endif
set_file_creation_date(&dst_file, date_time);
@@ -4736,7 +4736,7 @@ static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const cha
get_file_update_date(&src_file, &date_time);
#if 0
if ((date_time.time_MSB == 0) || (date_time.time_LSB == 0)
- || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
+ || (date_time.date_MSB == 0) || (date_time.date_LSB == 0))
current_date_time(&date_time);
#endif
set_file_update_date(&dst_file, date_time);
@@ -4941,7 +4941,7 @@ static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const cha
/* free data AUs */
// fphysrecs =
- get_UINT16BE(fdr.fphysrecs);
+ get_UINT16BE(fdr.fphysrecs);
i = 0;
cluster_index = 0;
@@ -4956,7 +4956,7 @@ static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const cha
while (i<=cluster_lastfphysrec)
{
/* the condition below is an error, but it should not prevent
- us from deleting the file */
+ us from deleting the file */
if (cur_AU >= image->AUformat.totAUs)
/*return IMGTOOLERR_CORRUPTIMAGE;*/
break;
@@ -4970,7 +4970,7 @@ static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const cha
cluster_index++;
}
/* the condition below is an error, but it should not prevent us from
- deleting the file */
+ deleting the file */
#if 0
if (i<fphysrecs)
return IMGTOOLERR_CORRUPTIMAGE;
@@ -5082,8 +5082,8 @@ static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const cha
{
/* check integrity of FDR sibling chain, and go to last sibling */
/* note that as we check that the back chain is consistent with the forward
- chain, we will also detect any cycle in the sibling chain, so we do not
- need to check against them explicitely */
+ chain, we will also detect any cycle in the sibling chain, so we do not
+ need to check against them explicitely */
{
int pastendoflist_flag;
unsigned prevfdr_aphysrec;
@@ -5153,7 +5153,7 @@ static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const cha
while (cur_AU<=end_AU)
{
/* the condition below is an error, but it should not prevent
- us from deleting the file */
+ us from deleting the file */
if (cur_AU >= image->AUformat.totAUs)
/*return IMGTOOLERR_CORRUPTIMAGE;*/
break;
diff --git a/src/mess/tools/imgtool/modules/ti990hd.c b/src/mess/tools/imgtool/modules/ti990hd.c
index 5be89a0f928..47682e84d13 100644
--- a/src/mess/tools/imgtool/modules/ti990hd.c
+++ b/src/mess/tools/imgtool/modules/ti990hd.c
@@ -22,7 +22,7 @@ for TI990. */
#define MAX_CYLINDERS 2047
#define MAX_HEADS 31
-#define MAX_SECTORS_PER_TRACK 256 /* 255 for 512-byte-long sector, so that the total number of words that can be recorded on a track may fit in one 16-bit word (store registers command) */
+#define MAX_SECTORS_PER_TRACK 256 /* 255 for 512-byte-long sector, so that the total number of words that can be recorded on a track may fit in one 16-bit word (store registers command) */
/* Max path len in chars: this value is 48 characters in DX10, but since the
path includes at least a leading '.', our value is 47. */
@@ -32,7 +32,7 @@ that is longer than 39 characters. */
#define MAX_PATH_LEN 47
#define MAX_SAFE_PATH_LEN 39
-#define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */
+#define MAX_DIR_LEVEL 25 /* We need to put a recursion limit to avoid endless recursion hazard */
struct UINT16BE
@@ -74,10 +74,10 @@ INLINE void set_UINT32BE(UINT32BE *word, UINT32 data)
*/
struct disk_image_header
{
- UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */
- UINT32BE heads; /* number of heads on hard disk (big-endian) */
- UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */
- UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */
+ UINT32BE cylinders; /* number of cylinders on hard disk (big-endian) */
+ UINT32BE heads; /* number of heads on hard disk (big-endian) */
+ UINT32BE sectors_per_track; /* number of sectors per track on hard disk (big-endian) */
+ UINT32BE bytes_per_sector; /* number of bytes of data per sector on hard disk (big-endian) */
};
enum
@@ -103,50 +103,50 @@ enum
*/
struct ti990_sc0
{
- char vnm[8]; /* volume name */
- UINT16BE tna; /* total number of ADUs */
- UINT8 sbm; /* starting sector of bit maps */
- UINT8 tbm; /* total bit maps */
- UINT16BE rl; /* track 01 record length */
- UINT16BE slt; /* system loader track address */
- UINT8 fill00[6]; /* * * RESERVED * * */
- UINT16BE nba; /* total number of bad ADUs on disk */
- UINT16BE sle; /* system loader entry point */
- UINT16BE sll; /* system loader length */
- UINT8 fill01[8]; /* * * RESERVED * * */
- UINT16BE lt1; /* system loader track (copy 2) */
- UINT8 fill02[8]; /* * * RESERVED * * */
- char pi1[8]; /* primary system file name */
- char pi2[8]; /* secondary system file name */
- UINT16BE pif; /* system selector */
- UINT16BE vda; /* volume directory ADU */
- UINT16BE vpl; /* vcatalog physical record length */
- UINT16BE spa; /* sectors per ADU */
- UINT8 dcd[4]; /* disk creation date */
- char pf1[8]; /* primary program file */
- char pf2[8]; /* secondary program file */
- UINT16BE pff; /* program file switch */
- char of1[8]; /* primary overlay file */
- char of2[8]; /* secondary overlay file */
- UINT16BE off; /* overlay file switch */
- char il1[8]; /* primary intermediate loader */
- char il2[8]; /* secondary intermediate loader */
- UINT16BE ilf; /* intermediate loader flag */
- char din[8]; /* diagnostic file name */
- UINT16BE dif; /* diagnostic flag */
- UINT16BE drs; /* default physical record size "DBUILD DETERMINES DEFAULT PRS" (whatever it means) */
- UINT16BE bal; /* starting sector of bad ADU list */
- UINT16BE spr; /* track 0 sectors per record */
- char wf1[8]; /* WCS primary microcode file */
- char wf2[8]; /* WCS secondary microcode file */
- UINT16BE wff; /* WCS flag switch */
- UINT16BE vif; /* track 1 select flag (whatever it means) volume information copied flag */
- UINT16BE sta; /* state of disk: */
+ char vnm[8]; /* volume name */
+ UINT16BE tna; /* total number of ADUs */
+ UINT8 sbm; /* starting sector of bit maps */
+ UINT8 tbm; /* total bit maps */
+ UINT16BE rl; /* track 01 record length */
+ UINT16BE slt; /* system loader track address */
+ UINT8 fill00[6]; /* * * RESERVED * * */
+ UINT16BE nba; /* total number of bad ADUs on disk */
+ UINT16BE sle; /* system loader entry point */
+ UINT16BE sll; /* system loader length */
+ UINT8 fill01[8]; /* * * RESERVED * * */
+ UINT16BE lt1; /* system loader track (copy 2) */
+ UINT8 fill02[8]; /* * * RESERVED * * */
+ char pi1[8]; /* primary system file name */
+ char pi2[8]; /* secondary system file name */
+ UINT16BE pif; /* system selector */
+ UINT16BE vda; /* volume directory ADU */
+ UINT16BE vpl; /* vcatalog physical record length */
+ UINT16BE spa; /* sectors per ADU */
+ UINT8 dcd[4]; /* disk creation date */
+ char pf1[8]; /* primary program file */
+ char pf2[8]; /* secondary program file */
+ UINT16BE pff; /* program file switch */
+ char of1[8]; /* primary overlay file */
+ char of2[8]; /* secondary overlay file */
+ UINT16BE off; /* overlay file switch */
+ char il1[8]; /* primary intermediate loader */
+ char il2[8]; /* secondary intermediate loader */
+ UINT16BE ilf; /* intermediate loader flag */
+ char din[8]; /* diagnostic file name */
+ UINT16BE dif; /* diagnostic flag */
+ UINT16BE drs; /* default physical record size "DBUILD DETERMINES DEFAULT PRS" (whatever it means) */
+ UINT16BE bal; /* starting sector of bad ADU list */
+ UINT16BE spr; /* track 0 sectors per record */
+ char wf1[8]; /* WCS primary microcode file */
+ char wf2[8]; /* WCS secondary microcode file */
+ UINT16BE wff; /* WCS flag switch */
+ UINT16BE vif; /* track 1 select flag (whatever it means) volume information copied flag */
+ UINT16BE sta; /* state of disk: */
/* 1 = disk surface has not been tested for defects */
/* 2 = disk surface has been tested, but no file system has been installed */
/* 3 = a file system has been installed */
- UINT16BE dct; /* disk creation time */
- UINT16BE fsf; /* * * RESERVED * * */
+ UINT16BE dct; /* disk creation time */
+ UINT16BE fsf; /* * * RESERVED * * */
/* SCOSIZ = >AA */
};
@@ -155,14 +155,14 @@ struct ti990_sc0
*/
struct ti990_dor
{
- UINT16BE nrc; /* # records in directory (minus DOR) nrc = nfl + nar (+ tfc???) */
- UINT16BE nfl; /* # files currently in directory */
- UINT16BE nar; /* # of available records */
- UINT16BE tfc; /* number of temporary files */
- char dnm[8]; /* directory file name (VCATALOG for root) */
- UINT16BE lvl; /* level # of directory (0 for root, 1 for children of root, 2 for grandchildren, etc) */
- char pnm[8]; /* name of parent directory (VCATALOG for root, even though it makes little sense) */
- UINT16BE prs; /* "default physical record length (used for file creation)" */
+ UINT16BE nrc; /* # records in directory (minus DOR) nrc = nfl + nar (+ tfc???) */
+ UINT16BE nfl; /* # files currently in directory */
+ UINT16BE nar; /* # of available records */
+ UINT16BE tfc; /* number of temporary files */
+ char dnm[8]; /* directory file name (VCATALOG for root) */
+ UINT16BE lvl; /* level # of directory (0 for root, 1 for children of root, 2 for grandchildren, etc) */
+ char pnm[8]; /* name of parent directory (VCATALOG for root, even though it makes little sense) */
+ UINT16BE prs; /* "default physical record length (used for file creation)" */
/* DORSIZ = >1C */
};
@@ -171,28 +171,28 @@ struct ti990_dor
*/
enum
{
- ace_flg_rdf = 0x8000, /* read access flag */
- ace_flg_wrf = 0x4000, /* write access flag */
- ace_flg_dlf = 0x2000, /* delete access flag */
- ace_flg_exf = 0x1000, /* execute access flag */
- ace_flg_ctf = 0x0800, /* control access flag */
+ ace_flg_rdf = 0x8000, /* read access flag */
+ ace_flg_wrf = 0x4000, /* write access flag */
+ ace_flg_dlf = 0x2000, /* delete access flag */
+ ace_flg_exf = 0x1000, /* execute access flag */
+ ace_flg_ctf = 0x0800, /* control access flag */
- fdr_fl1_sec = 0x8000, /* file secured flag */
+ fdr_fl1_sec = 0x8000, /* file secured flag */
- fdr_flg_fu = 0xc000, /* file usage bits */
+ fdr_flg_fu = 0xc000, /* file usage bits */
fdr_flg_fu_shift = 14,
- fdr_flg_fmt = 0x3000, /* file format bits */
+ fdr_flg_fmt = 0x3000, /* file format bits */
fdr_flg_fmt_shift = 12,
- fdr_flg_all = 0x0800, /* extendable file flag */
- fdr_flg_ft = 0x0600, /* file type bits */
+ fdr_flg_all = 0x0800, /* extendable file flag */
+ fdr_flg_ft = 0x0600, /* file type bits */
fdr_flg_ft_shift = 9,
- fdr_flg_wpb = 0x0100, /* write protect bit */
- fdr_flg_dpb = 0x0080, /* delete protect bit */
- fdr_flg_tmp = 0x0040, /* temporary file flag */
- fdr_flg_blb = 0x0020, /* blocked file flag */
- fdr_flg_ali = 0x0010, /* alias flag bit */
- fdr_flg_fwt = 0x0008, /* forced write / partial logging */
- fdr_flg_cdr = 0x0001 /* record is CDR */
+ fdr_flg_wpb = 0x0100, /* write protect bit */
+ fdr_flg_dpb = 0x0080, /* delete protect bit */
+ fdr_flg_tmp = 0x0040, /* temporary file flag */
+ fdr_flg_blb = 0x0020, /* blocked file flag */
+ fdr_flg_ali = 0x0010, /* alias flag bit */
+ fdr_flg_fwt = 0x0008, /* forced write / partial logging */
+ fdr_flg_cdr = 0x0001 /* record is CDR */
};
/*
@@ -200,8 +200,8 @@ enum
*/
struct ti990_ace
{
- char agn[8]; /* access group name */
- UINT16BE flg; /* flags */
+ char agn[8]; /* access group name */
+ UINT16BE flg; /* flags */
};
/*
@@ -209,40 +209,40 @@ struct ti990_ace
*/
struct ti990_fdr
{
- UINT16BE hkc; /* hask key count: the number of file descriptor records that are present in the directory that hashed to this record number */
- UINT16BE hkv; /* hask key value: the result of the hash algorithm for the file name actually covered in this record */
- char fnm[8]; /* file name */
- UINT8 rsv[2]; /* reserved */
- UINT16BE fl1; /* flags word 1 */
- UINT16BE flg; /* flags word 2 */
- UINT16BE prs; /* physical record size */
- UINT16BE lrs; /* logical record size */
- UINT16BE pas; /* primary allocation size: # of ADUs allocated in primary allocation block? */
- UINT16BE paa; /* primary allocation address: first ADU of primary allocation block? */
- UINT16BE sas; /* secondary allocation size: used to determinate the # of blocks allocated per secondary allocation */
- UINT16BE saa; /* offset of secondary table: ???? "offset into this FDR of the secondary allocation table, if any. No secondary allocation table is denoted by 0. Secondary allocations are present only for unbounded files." */
- UINT16BE rfa; /* record number of first alias */
- UINT32BE eom; /* end of medium record number */
- UINT32BE bkm; /* end of medium block number */
- UINT16BE ofm; /* end of medium offset / */
+ UINT16BE hkc; /* hask key count: the number of file descriptor records that are present in the directory that hashed to this record number */
+ UINT16BE hkv; /* hask key value: the result of the hash algorithm for the file name actually covered in this record */
+ char fnm[8]; /* file name */
+ UINT8 rsv[2]; /* reserved */
+ UINT16BE fl1; /* flags word 1 */
+ UINT16BE flg; /* flags word 2 */
+ UINT16BE prs; /* physical record size */
+ UINT16BE lrs; /* logical record size */
+ UINT16BE pas; /* primary allocation size: # of ADUs allocated in primary allocation block? */
+ UINT16BE paa; /* primary allocation address: first ADU of primary allocation block? */
+ UINT16BE sas; /* secondary allocation size: used to determinate the # of blocks allocated per secondary allocation */
+ UINT16BE saa; /* offset of secondary table: ???? "offset into this FDR of the secondary allocation table, if any. No secondary allocation table is denoted by 0. Secondary allocations are present only for unbounded files." */
+ UINT16BE rfa; /* record number of first alias */
+ UINT32BE eom; /* end of medium record number */
+ UINT32BE bkm; /* end of medium block number */
+ UINT16BE ofm; /* end of medium offset / */
/* prelog number for KIF */
- UINT32BE fbq; /* free block queue head */
- UINT16BE btr; /* B-tree roots block # */
- UINT32BE ebq; /* empty block queue head */
- UINT16BE kdr; /* key descriptions record # */
- UINT8 ud[6]; /* last update date */
- UINT8 cd[6]; /* creation date */
- UINT8 apb; /* ADU's per block */
- UINT8 bpa; /* blocks per ADU */
- UINT16BE mrs; /* minimumu KIF record size */
- UINT8 sat[64]; /* secondary allocation table: 16 2-word entries. The first word of an entry contains the size, in ADUs, of the secondary allocation. The second word contains the starting ADU of the allocation. */
+ UINT32BE fbq; /* free block queue head */
+ UINT16BE btr; /* B-tree roots block # */
+ UINT32BE ebq; /* empty block queue head */
+ UINT16BE kdr; /* key descriptions record # */
+ UINT8 ud[6]; /* last update date */
+ UINT8 cd[6]; /* creation date */
+ UINT8 apb; /* ADU's per block */
+ UINT8 bpa; /* blocks per ADU */
+ UINT16BE mrs; /* minimumu KIF record size */
+ UINT8 sat[64]; /* secondary allocation table: 16 2-word entries. The first word of an entry contains the size, in ADUs, of the secondary allocation. The second word contains the starting ADU of the allocation. */
/* bytes >86 to >100 are optional */
- UINT8 res[10]; /* reserved: seem to be actually meaningful (at least under DX10 3.6.x) */
- char uid[8]; /* user id of file creator */
- UINT16BE psa; /* public security attribute */
- ti990_ace ace[9]; /* 9 access control entries */
- UINT8 fil[2]; /* not used */
+ UINT8 res[10]; /* reserved: seem to be actually meaningful (at least under DX10 3.6.x) */
+ char uid[8]; /* user id of file creator */
+ UINT16BE psa; /* public security attribute */
+ ti990_ace ace[9]; /* 9 access control entries */
+ UINT8 fil[2]; /* not used */
};
/*
@@ -253,19 +253,19 @@ struct ti990_fdr
*/
struct ti990_adr
{
- UINT16BE hkc; /* hask key count */
- UINT16BE hkv; /* hask key value */
- char fnm[8]; /* file name */
- char psw[4]; /* "password" (whatever it means) */
- UINT16BE flg; /* flags (same as fdr.flg) */
- UINT16BE fill00; /* *** physical record size */
- UINT16BE fill01; /* *** logical record size */
- UINT16BE fill02; /* *** primary allocation size */
- UINT16BE fill03; /* *** primary allocation address */
- UINT16BE fill04; /* *** secondary allocation size */
- UINT16BE fill05; /* *** secondary allocation address */
- UINT16BE rna; /* record number of next ADR */
- UINT16BE raf; /* record # of actual FDR (from 1 through dor.nrc) */
+ UINT16BE hkc; /* hask key count */
+ UINT16BE hkv; /* hask key value */
+ char fnm[8]; /* file name */
+ char psw[4]; /* "password" (whatever it means) */
+ UINT16BE flg; /* flags (same as fdr.flg) */
+ UINT16BE fill00; /* *** physical record size */
+ UINT16BE fill01; /* *** logical record size */
+ UINT16BE fill02; /* *** primary allocation size */
+ UINT16BE fill03; /* *** primary allocation address */
+ UINT16BE fill04; /* *** secondary allocation size */
+ UINT16BE fill05; /* *** secondary allocation address */
+ UINT16BE rna; /* record number of next ADR */
+ UINT16BE raf; /* record # of actual FDR (from 1 through dor.nrc) */
};
/*
@@ -276,25 +276,25 @@ struct ti990_adr
*/
struct ti990_cdr
{
- UINT16BE hkc; /* hask key count */
- UINT16BE hkv; /* hask key value */
- char fnm[8]; /* file name */
- UINT16BE fill00; /* reserved */
- UINT16BE fill01; /* reserved */
- UINT16BE fdf; /* flags (same as fdr.flg) */
- UINT8 flg; /* channel flzgs */
- UINT8 iid; /* owner task installed ID */
- UINT8 typ; /* default resource type */
- UINT8 tf; /* resource type flags */
- UINT16BE mxl; /* maximum message length */
- UINT8 fill04[6]; /* reserved (and, no, I don't know where fill02 and fill03 have gone) */
- UINT16BE rna; /* record number of next CDR or ADR */
- UINT16BE raf; /* record # of actual FDR */
- UINT8 fill05[110]; /* reserved */
- char uid[8]; /* user ID of channel creator */
- UINT16BE psa; /* public security attribute */
- UINT8 scg[94]; /* "SDT with 9 control groups" (whatever it means - and, no, 94 is not dividable by 9) */
- UINT8 fill06[8]; /* reserved */
+ UINT16BE hkc; /* hask key count */
+ UINT16BE hkv; /* hask key value */
+ char fnm[8]; /* file name */
+ UINT16BE fill00; /* reserved */
+ UINT16BE fill01; /* reserved */
+ UINT16BE fdf; /* flags (same as fdr.flg) */
+ UINT8 flg; /* channel flzgs */
+ UINT8 iid; /* owner task installed ID */
+ UINT8 typ; /* default resource type */
+ UINT8 tf; /* resource type flags */
+ UINT16BE mxl; /* maximum message length */
+ UINT8 fill04[6]; /* reserved (and, no, I don't know where fill02 and fill03 have gone) */
+ UINT16BE rna; /* record number of next CDR or ADR */
+ UINT16BE raf; /* record # of actual FDR */
+ UINT8 fill05[110]; /* reserved */
+ char uid[8]; /* user ID of channel creator */
+ UINT16BE psa; /* public security attribute */
+ UINT8 scg[94]; /* "SDT with 9 control groups" (whatever it means - and, no, 94 is not dividable by 9) */
+ UINT8 fill06[8]; /* reserved */
};
/*
@@ -319,16 +319,16 @@ union directory_entry
*/
struct tifile_header
{
- char tifiles[8]; /* always '\7TIFILES' */
- UINT8 secsused_MSB; /* file length in sectors (big-endian) */
+ char tifiles[8]; /* always '\7TIFILES' */
+ UINT8 secsused_MSB; /* file length in sectors (big-endian) */
UINT8 secsused_LSB;
- UINT8 flags; /* see enum above */
- UINT8 recspersec; /* records per sector */
- UINT8 eof; /* current position of eof in last sector (0->255)*/
- UINT8 reclen; /* bytes per record ([1,255] 0->256) */
- UINT8 fixrecs_MSB; /* file length in records (big-endian) */
+ UINT8 flags; /* see enum above */
+ UINT8 recspersec; /* records per sector */
+ UINT8 eof; /* current position of eof in last sector (0->255)*/
+ UINT8 reclen; /* bytes per record ([1,255] 0->256) */
+ UINT8 fixrecs_MSB; /* file length in records (big-endian) */
UINT8 fixrecs_LSB;
- UINT8 res[128-16]; /* reserved */
+ UINT8 res[128-16]; /* reserved */
};
@@ -366,9 +366,9 @@ struct ti990_phys_sec_address
*/
struct ti990_image
{
- imgtool_stream *file_handle; /* imgtool file handle */
- ti990_geometry geometry; /* geometry */
- ti990_sc0 sec0; /* cached copy of sector 0 */
+ imgtool_stream *file_handle; /* imgtool file handle */
+ ti990_geometry geometry; /* geometry */
+ ti990_sc0 sec0; /* cached copy of sector 0 */
};
/*
@@ -377,10 +377,10 @@ struct ti990_image
struct ti990_iterator
{
ti990_image *image;
- int level; /* current recursion level */
- int nrc[MAX_DIR_LEVEL]; /* length of disk catalogs in records */
- int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */
- directory_entry xdr[MAX_DIR_LEVEL]; /* fdr records */
+ int level; /* current recursion level */
+ int nrc[MAX_DIR_LEVEL]; /* length of disk catalogs in records */
+ int index[MAX_DIR_LEVEL]; /* current index in the disk catalog */
+ directory_entry xdr[MAX_DIR_LEVEL]; /* fdr records */
};
@@ -423,25 +423,25 @@ void ti990_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolin
{
switch(state)
{
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti990hd"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI990 Hard Disk"); break;
- case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
- case IMGTOOLINFO_STR_EOLN: /* strcpy(info->s = imgtool_temp_str(), "\r"); */ break;
-
- case IMGTOOLINFO_PTR_OPEN: info->open = ti990_image_init; break;
- case IMGTOOLINFO_PTR_CLOSE: info->close = ti990_image_exit; break;
- case IMGTOOLINFO_PTR_INFO: info->info = ti990_image_info; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = ti990_image_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = ti990_image_nextenum; break;
- case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = ti990_image_closeenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti990_image_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: /* info->read_file = ti990_image_readfile; */ break;
- case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = ti990_image_writefile; */ break;
- case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = ti990_image_deletefile; */ break;
- case IMGTOOLINFO_PTR_CREATE: info->create = ti990_image_create; break;
-
- case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = ti990_create_optionguide; break;
- case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), ti990_create_optionspecs); break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "ti990hd"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "TI990 Hard Disk"); break;
+ case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
+ case IMGTOOLINFO_STR_EOLN: /* strcpy(info->s = imgtool_temp_str(), "\r"); */ break;
+
+ case IMGTOOLINFO_PTR_OPEN: info->open = ti990_image_init; break;
+ case IMGTOOLINFO_PTR_CLOSE: info->close = ti990_image_exit; break;
+ case IMGTOOLINFO_PTR_INFO: info->info = ti990_image_info; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = ti990_image_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = ti990_image_nextenum; break;
+ case IMGTOOLINFO_PTR_CLOSE_ENUM: info->close_enum = ti990_image_closeenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = ti990_image_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: /* info->read_file = ti990_image_readfile; */ break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: /* info->write_file = ti990_image_writefile; */ break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: /* info->delete_file = ti990_image_deletefile; */ break;
+ case IMGTOOLINFO_PTR_CREATE: info->create = ti990_image_create; break;
+
+ case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = ti990_create_optionguide; break;
+ case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), ti990_create_optionspecs); break;
}
}
@@ -763,7 +763,7 @@ static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *c
if (reply)
return IMGTOOLERR_READERROR;
if (!memcmp(element, xdr.fdr.fnm, 8))
- { /* found match !!! */
+ { /* found match !!! */
parent_fdr_secnum = fdr_secnum;
fdr_secnum = base + i;
break;
@@ -895,11 +895,11 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
secsused = get_fdr_secsused(fdr);
if (secsused == 0)
- { /* links array must be empty */
+ { /* links array must be empty */
lnks_index = 0;
}
else
- { /* try to extend last block */
+ { /* try to extend last block */
last_sec = -1;
for (lnks_index=0; lnks_index<76; lnks_index++)
{
@@ -913,7 +913,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
return IMGTOOLERR_CORRUPTIMAGE;
if (last_sec > (secsused-1))
- { /* some extra space has already been allocated */
+ { /* some extra space has already been allocated */
cur_block_len = last_sec - (secsused-1);
if (cur_block_len > nb_alloc_sectors)
cur_block_len = nb_alloc_sectors;
@@ -922,7 +922,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
set_fdr_secsused(fdr, secsused);
nb_alloc_sectors -= cur_block_len;
if (! nb_alloc_sectors)
- return 0; /* done */
+ return 0; /* done */
}
/* block base */
@@ -934,7 +934,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
for (i=cur_sec; (! (image->sec0.abm[i >> 3] & (1 << (i & 7)))) && (cur_block_len < nb_alloc_sectors) && (i < totsecs); i++)
cur_block_len++;
if (cur_block_len)
- { /* extend last block */
+ { /* extend last block */
secsused += cur_block_len;
set_fdr_secsused(fdr, secsused);
last_sec += cur_block_len;
@@ -944,7 +944,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
for (i=0; i<cur_block_len; i++)
image->sec0.abm[(i+cur_sec) >> 3] |= 1 << ((i+cur_sec) & 7);
if (! nb_alloc_sectors)
- return 0; /* done */
+ return 0; /* done */
}
lnks_index++;
if (lnks_index == 76)
@@ -952,7 +952,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
return IMGTOOLERR_NOSPACE;
}
- search_start = image->data_offset; /* initially, search for free space only in data space */
+ search_start = image->data_offset; /* initially, search for free space only in data space */
while (nb_alloc_sectors)
{
/* find smallest data block at least nb_alloc_sectors in length, and largest data block less than nb_alloc_sectors in length */
@@ -961,7 +961,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
for (i=search_start; i<totsecs; i++)
{
if (! (image->sec0.abm[i >> 3] & (1 << (i & 7))))
- { /* found one free block */
+ { /* found one free block */
/* compute its length */
cur_block_start = i;
cur_block_len = 0;
@@ -988,7 +988,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
}
if (first_best_block_len != INT_MAX)
- { /* found one contiguous block which can hold it all */
+ { /* found one contiguous block which can hold it all */
secsused += nb_alloc_sectors;
set_fdr_secsused(fdr, secsused);
@@ -1001,7 +1001,7 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
nb_alloc_sectors = 0;
}
else if (second_best_block_len != 0)
- { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
+ { /* jeez, we need to fragment it. We use the largest smaller block to limit fragmentation. */
secsused += second_best_block_len;
set_fdr_secsused(fdr, secsused);
@@ -1019,11 +1019,11 @@ static int alloc_file_sectors(ti99_image *image, ti99_fdr *fdr, int nb_alloc_sec
return IMGTOOLERR_NOSPACE;
}
else if (search_start != 0)
- { /* we did not find any free sector in the data section of the disk */
- search_start = 0; /* time to fall back to fdr space */
+ { /* we did not find any free sector in the data section of the disk */
+ search_start = 0; /* time to fall back to fdr space */
}
else
- return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
+ return IMGTOOLERR_NOSPACE; /* This should never happen, as we pre-check that there is enough free space */
}
return 0;
@@ -1042,7 +1042,7 @@ static int new_file(ti99_image *image, char filename[10], int *out_fdr_secnum/*,
/* find insertion point in catalog */
i = 0;
if ((image->catalog[0].fdr_secnum == 0) && (image->catalog[1].fdr_secnum != 0))
- i = 1; /* skip empty entry 0 (it must be a non-listable catalog) */
+ i = 1; /* skip empty entry 0 (it must be a non-listable catalog) */
for (; (i<128) && ((fdr_secnum = image->catalog[i].fdr_secnum) != 0) && ((reply = memcmp(image->catalog[i].filename, filename, 10)) < 0); i++)
;
@@ -1510,8 +1510,8 @@ static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const cha
secsused = get_fdr_secsused(&fdr);
- i = 0; /* file logical sector #0 */
- lnks_index = 0; /* start of file block table */
+ i = 0; /* file logical sector #0 */
+ lnks_index = 0; /* start of file block table */
while (i<secsused)
{
if (lnks_index == 76)
@@ -1582,7 +1582,7 @@ static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const ch
reply = find_fdr(image, ti_fname, &fdr, NULL);
if (reply == 0)
- { /* file already exists: causes an error for now */
+ { /* file already exists: causes an error for now */
return IMGTOOLERR_UNEXPECTED;
}
else if (reply != IMGTOOLERR_FILENOTFOUND)
diff --git a/src/mess/tools/imgtool/modules/vzdos.c b/src/mess/tools/imgtool/modules/vzdos.c
index 28e27873e66..2e72db249e8 100644
--- a/src/mess/tools/imgtool/modules/vzdos.c
+++ b/src/mess/tools/imgtool/modules/vzdos.c
@@ -35,9 +35,9 @@ as track map, with one bit for each sector used.
*/
-#define DATA_SIZE (126)
-#define SECTOR_SIZE (0x9b)
-#define MAX_DIRENTS (15*8)
+#define DATA_SIZE (126)
+#define SECTOR_SIZE (0x9b)
+#define MAX_DIRENTS (15*8)
/* vzdos directry entry */
struct vzdos_dirent
@@ -145,7 +145,7 @@ static imgtoolerr_t vzdos_write_sector_data(imgtool_image *img, int track, int s
memcpy(buffer, data, DATA_SIZE + 2);
place_integer_le(buffer, DATA_SIZE + 2, 2, chksum16(data, DATA_SIZE + 2));
- ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, buffer, sizeof(buffer), 0); /* TODO: pass ddam argument from imgtool */
+ ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], data_start, buffer, sizeof(buffer), 0); /* TODO: pass ddam argument from imgtool */
if (ret) return (imgtoolerr_t)ret;
return IMGTOOLERR_SUCCESS;
@@ -370,11 +370,11 @@ static imgtoolerr_t vzdos_write_formatted_sector(imgtool_image *img, int track,
memset(sector_data, 0x00, sizeof(sector_data));
memcpy(sector_data, sector_header, sizeof(sector_header));
- sector_data[10] = (UINT8) track; /* current track */
- sector_data[11] = (UINT8) sector; /* current sector */
- sector_data[12] = (UINT8) track + sector; /* checksum-8 */
+ sector_data[10] = (UINT8) track; /* current track */
+ sector_data[11] = (UINT8) sector; /* current sector */
+ sector_data[12] = (UINT8) track + sector; /* checksum-8 */
- ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, sector_data, sizeof(sector_data), 0); /* TODO: pass ddam argument from imgtool */
+ ret = floppy_write_sector(imgtool_floppy(img), 0, track, sector_order[sector], 0, sector_data, sizeof(sector_data), 0); /* TODO: pass ddam argument from imgtool */
if (ret) return (imgtoolerr_t)ret;
return IMGTOOLERR_SUCCESS;
@@ -898,11 +898,11 @@ void filter_vzsnapshot_getinfo(UINT32 state, union filterinfo *info)
{
switch(state)
{
- case FILTINFO_STR_NAME: info->s = "vzsnapshot"; break;
- case FILTINFO_STR_HUMANNAME: info->s = "VZ Snapshot"; break;
- case FILTINFO_STR_EXTENSION: info->s = "vz"; break;
- case FILTINFO_PTR_READFILE: info->read_file = vzsnapshot_readfile; break;
- case FILTINFO_PTR_WRITEFILE: info->write_file = vzsnapshot_writefile; break;
+ case FILTINFO_STR_NAME: info->s = "vzsnapshot"; break;
+ case FILTINFO_STR_HUMANNAME: info->s = "VZ Snapshot"; break;
+ case FILTINFO_STR_EXTENSION: info->s = "vz"; break;
+ case FILTINFO_PTR_READFILE: info->read_file = vzsnapshot_readfile; break;
+ case FILTINFO_PTR_WRITEFILE: info->write_file = vzsnapshot_writefile; break;
}
}
@@ -940,28 +940,28 @@ void vzdos_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolin
switch(state)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
- case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break;
- case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(vz_iterator); break;
+ case IMGTOOLINFO_INT_PREFER_UCASE: info->i = 1; break;
+ case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES: info->i = sizeof(vz_iterator); break;
/* --- the following bits of info are returned as NULL-terminated strings --- */
- case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "vzdos"); break;
- case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "VZ-DOS format"); break;
- case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
- case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T[0]-2;F[0]-1"); break;
- case IMGTOOLINFO_STR_EOLN: info->s = NULL; break;
+ case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "vzdos"); break;
+ case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "VZ-DOS format"); break;
+ case IMGTOOLINFO_STR_FILE: strcpy(info->s = imgtool_temp_str(), __FILE__); break;
+ case IMGTOOLINFO_STR_WRITEFILE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), "T[0]-2;F[0]-1"); break;
+ case IMGTOOLINFO_STR_EOLN: info->s = NULL; break;
/* --- the following bits of info are returned as pointers to data or functions --- */
- case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
- case IMGTOOLINFO_PTR_OPEN: info->open = NULL; break;
- case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = vzdos_diskimage_beginenum; break;
- case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = vzdos_diskimage_nextenum; break;
- case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = vzdos_diskimage_freespace; break;
- case IMGTOOLINFO_PTR_READ_FILE: info->read_file = vzdos_diskimage_readfile; break;
- case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = vzdos_diskimage_writefile; break;
- case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = vzdos_diskimage_deletefile; break;
- case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = vzdos_diskimage_create; break;
- case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = vzdos_writefile_optionguide; break;
- case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = vzdos_diskimage_suggesttransfer; break;
- case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_vz; break;
+ case IMGTOOLINFO_PTR_MAKE_CLASS: info->make_class = imgtool_floppy_make_class; break;
+ case IMGTOOLINFO_PTR_OPEN: info->open = NULL; break;
+ case IMGTOOLINFO_PTR_BEGIN_ENUM: info->begin_enum = vzdos_diskimage_beginenum; break;
+ case IMGTOOLINFO_PTR_NEXT_ENUM: info->next_enum = vzdos_diskimage_nextenum; break;
+ case IMGTOOLINFO_PTR_FREE_SPACE: info->free_space = vzdos_diskimage_freespace; break;
+ case IMGTOOLINFO_PTR_READ_FILE: info->read_file = vzdos_diskimage_readfile; break;
+ case IMGTOOLINFO_PTR_WRITE_FILE: info->write_file = vzdos_diskimage_writefile; break;
+ case IMGTOOLINFO_PTR_DELETE_FILE: info->delete_file = vzdos_diskimage_deletefile; break;
+ case IMGTOOLINFO_PTR_FLOPPY_CREATE: info->create = vzdos_diskimage_create; break;
+ case IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE: info->writefile_optguide = vzdos_writefile_optionguide; break;
+ case IMGTOOLINFO_PTR_SUGGEST_TRANSFER: info->suggest_transfer = vzdos_diskimage_suggesttransfer; break;
+ case IMGTOOLINFO_PTR_FLOPPY_FORMAT: info->p = (void *) floppyoptions_vz; break;
}
}
diff --git a/src/mess/tools/imgtool/stream.c b/src/mess/tools/imgtool/stream.c
index e7532650ab4..e724cd4a3e4 100644
--- a/src/mess/tools/imgtool/stream.c
+++ b/src/mess/tools/imgtool/stream.c
@@ -64,7 +64,7 @@ static imgtool_stream *stream_open_zip(const char *zipname, const char *subname,
imgfile->position = 0;
// ziperr =
- zip_file_open(zipname, &z);
+ zip_file_open(zipname, &z);
if (!z)
goto error;
@@ -532,5 +532,3 @@ UINT32 stream_printf(imgtool_stream *stream, const char *fmt, ...)
return stream_puts(stream, buf);
}
-
-
diff --git a/src/mess/tools/imgtool/stream.h b/src/mess/tools/imgtool/stream.h
index fedf899a96e..2ae1c2eeb68 100644
--- a/src/mess/tools/imgtool/stream.h
+++ b/src/mess/tools/imgtool/stream.h
@@ -14,7 +14,7 @@
struct imgtool_stream;
-imgtool_stream *stream_open(const char *fname, int read_or_write); /* similar params to mame_fopen */
+imgtool_stream *stream_open(const char *fname, int read_or_write); /* similar params to mame_fopen */
imgtool_stream *stream_open_write_stream(int filesize);
imgtool_stream *stream_open_mem(void *buf, size_t sz);
void stream_close(imgtool_stream *stream);