-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtoomf.c
executable file
·62 lines (56 loc) · 1.6 KB
/
toomf.c
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
/*******************************************************
*
* a56 - a DSP56001 assembler
*
* Written by Quinn C. Jensen
* July 1990
*
*******************************************************\
/*
* Copyright (C) 1990-1994 Quinn C. Jensen
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. The author makes no representations
* about the suitability of this software for any purpose. It is
* provided "as is" without express or implied warranty.
*
*/
static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
/*
* This small program converts the a56.out file from the assembler
* into a file suitable for loading into 56001 memory via the
* SLOADER.ASM serial loader program provided on the Motorola
* Dr. Bubb BBS.
*
*/
#include <stdio.h>
#define MAX 256
main(argc,argv)
int argc;
char *argv[];
{
char buf[MAX];
int curaddr = 0;
int line = 0;
int curseg = '\0';
int startaddr = -1;
while(fgets(buf, sizeof(buf), stdin)) {
char seg;
int addr, data;
line++;
if(sscanf(buf, "%c%x%x", &seg, &addr, &data) == 3) {
if(seg == 'I' || seg == 'F') break;
if(seg != curseg || curaddr != addr) {
printf("\n_DATA %c %04X\n", curseg = seg, curaddr = addr);
}
if(startaddr == -1 && seg == 'P')
startaddr = addr;
printf("%06X ", data & 0xFFFFFF);
curaddr++;
}
}
printf("\n_END %04X\n", startaddr);
}