add some #include's to calm compiler
[a56.git] / toomf.c
1 /*******************************************************
2  *
3  *  a56 - a DSP56001 assembler
4  *
5  *  Written by Quinn C. Jensen
6  *  July 1990
7  *
8  *******************************************************\
9
10 /*
11  * Copyright (C) 2012 Thorsten Alteholz <debian@alteholz.de>
12  *
13  * This file is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published
15  * by the Free Software Foundation, either version 3 of the License,
16  * or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see
25  * <http://www.gnu.org/licenses/>.
26  *
27  * This file incorporates work covered by the following copyright and
28  * permission notice:
29  *
30  * Copyright (C) 1990-1994 Quinn C. Jensen
31  *
32  * Permission to use, copy, modify, distribute, and sell this software
33  * and its documentation for any purpose is hereby granted without fee,
34  * provided that the above copyright notice appear in all copies and
35  * that both that copyright notice and this permission notice appear
36  * in supporting documentation.  The author makes no representations
37  * about the suitability of this software for any purpose.  It is
38  * provided "as is" without express or implied warranty.
39  *
40  */
41 static char *Copyright = "Copyright (C) 1990-1994 Quinn C. Jensen";
42
43 #include <stdio.h>
44
45 /*
46  *  This small program converts the a56.out file from the assembler
47  *  into a file suitable for loading into 56001 memory via the
48  *  SLOADER.ASM serial loader program provided on the Motorola
49  *  Dr. Bubb BBS.
50  *
51  */
52
53 #define MAX 256
54
55 main(argc,argv)
56 int argc;
57 char *argv[];
58 {
59         char buf[MAX];
60         int curaddr = 0;
61         int line = 0;
62         int curseg = '\0';
63         int startaddr = -1;
64
65         while(gets(buf)) {
66                 char seg;
67                 int addr, data;
68                 line++;
69                 if(sscanf(buf, "%c%x%x", &seg, &addr, &data) == 3) {
70                         if(seg == 'I' || seg == 'F') break;
71                         if(seg != curseg || curaddr != addr) {
72                                 printf("\n_DATA %c %04X\n", curseg = seg, curaddr = addr);
73                         }   
74                         if(startaddr == -1 && seg == 'P')
75                                 startaddr = addr;
76                         printf("%06X ", data & 0xFFFFFF);
77                         curaddr++;
78                 }
79         }
80         printf("\n_END %04X\n", startaddr);
81 }