Skip to content

Commit 0945e51

Browse files
committed
minor fixes
1 parent 287bb91 commit 0945e51

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

src/mktap.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,21 @@ static int mktap(const char *input, const char *output, const char *name, int ad
114114
WRITE1(ofd, st.st_size & 0xff, &checksum);
115115
WRITE1(ofd, (st.st_size & 0xff00) >> 8, &checksum);
116116

117-
/* Address */
118-
WRITE1(ofd, address & 0xff, &checksum);
119-
WRITE1(ofd, (address & 0xff00) >> 8, &checksum);
117+
/* Parameter 1 */
118+
if (type == 0) {
119+
/* Program: no auto-run */
120+
WRITE1(ofd, 0, &checksum);
121+
WRITE1(ofd, 128, &checksum);
122+
} else if (type == 3) {
123+
/* Bytes: start address */
124+
WRITE1(ofd, address & 0xff, &checksum);
125+
WRITE1(ofd, (address & 0xff00) >> 8, &checksum);
126+
} else {
127+
WRITE1(ofd, 0, &checksum);
128+
WRITE1(ofd, 128, &checksum);
129+
}
120130

121-
/* Reserved */
131+
/* Parameter 2 */
122132
WRITE1(ofd, 0, &checksum);
123133
WRITE1(ofd, 128, &checksum);
124134

@@ -156,7 +166,7 @@ int main(int argc, char *argv[])
156166
int address = 0;
157167
int type = 3;
158168

159-
while ((opt = getopt(argc, argv, "a:hn:o:s:")) != -1) {
169+
while ((opt = getopt(argc, argv, "a:hn:o:s:t:")) != -1) {
160170
switch (opt) {
161171
case 'a':
162172
sscanf(optarg, "%i", &address);

0 commit comments

Comments
 (0)