-
Notifications
You must be signed in to change notification settings - Fork 1
/
image.h
93 lines (74 loc) · 2.03 KB
/
image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#if 0
===========================================================================
I M A G E . H
Copyright 1989 Atari Games. All rights reserved.
Author: Lyle Rains
===========================================================================
#endif
#ifndef IMAGE_DEFINED
#define IMAGE_DEFINED 1
#include "mixit.h"
#if 0
# define SHOW(x) x
#else
# define SHOW(x)
#endif
#ifndef min
# define min(a,b) ((a) <= (b) ? (a) : (b))
#endif
/*
* Exported objects:
*
* DEFAULT_PAGESIZE, LogicalAddr, BlockGroup, MemBlock, Chunk, Page, Image,
* imageWrite(), imageRead(), imageFree(), imageDump(), imageCheck()
*/
#define DEFAULT_PAGESIZE 0x4000
typedef struct blockgroup
{
struct blockgroup *next;
} BlockGroup;
/* MemBlock is the structure used by both Pages and Chunks. */
typedef struct memblock
{
struct memblock *next; /* CAUTION: see KLUDGE WARNING below!! */
LogicalAddr begin;
LogicalAddr end;
struct memblock *chunkList; /* only used on `Page's. */
char *data;
} MemBlock, Chunk, Page;
typedef struct image
{
BlockGroup *blockGroupList;
MemBlock *freeBlockList;
Page *pageList;
Page *symbolList;
size_t pageSize;
Page **oldPageLink;
Chunk **oldChunkLink;
uchar skipBytes;
uchar bytesPerAddr;
uchar fillChar;
} Image;
typedef struct inrecord
{
LogicalAddr recSAddr; /* Start address of segment (inclusive) */
LogicalAddr recEAddr; /* End address of segment (inclusive) */
LogicalAddr recSegBase; /* segment offset for intel format (always 0 otherwise) */
/* int beenConverted; */
uchar *recBuf;
size_t recBufLen;
uchar *recData;
size_t recLen;
size_t recConvertedLen;
int recType;
FILE *recFile;
struct gpf *gpfPtr;
void *recPrivate; /* so the GetRec() routines can save some state info */
} InRecord;
#define REC_XFER 15
#define REC_TRANSPARENT 13
#define REC_DATA 0
#define REC_EOF -1
#define REC_ERR -2
#define REC_UNKNOWN -3
#endif /* IMAGE_DEFINED */