Motorola M6800 (6800) Exorciser / SWTPC emulator plus 6801 instruction set emulation
リビジョン | 0203aae90733aec52af26bf9eef230a1e73cb5f8 (tree) |
---|---|
日時 | 2020-11-05 22:20:15 |
作者 | Joel Matthew Rees <joel.rees@gmai...> |
コミッター | Joel Matthew Rees |
cleaning up the output of make (not CFLAGS -Wall)
@@ -19,7 +19,9 @@ | ||
19 | 19 | #include <stdio.h> |
20 | 20 | #include <stdlib.h> |
21 | 21 | #include <string.h> |
22 | + | |
22 | 23 | #include "asm6800.h" |
24 | +#include "utils.h" /* JMR20201103 */ | |
23 | 25 | |
24 | 26 | /* Fixup types */ |
25 | 27 |
@@ -24,10 +24,13 @@ | ||
24 | 24 | #include <fcntl.h> |
25 | 25 | #include <sys/poll.h> |
26 | 26 | #include <signal.h> |
27 | +#include <unistd.h> /* JMR20201103 */ | |
27 | 28 | |
28 | 29 | #include "sim6800.h" |
30 | +#include "unasm6800.h" /* JMR202021103 */ | |
29 | 31 | #include "exor.h" |
30 | 32 | #include "exorterm.h" |
33 | +#include "utils.h" /* JMR20201103 */ | |
31 | 34 | |
32 | 35 | /* Options */ |
33 | 36 |
@@ -0,0 +1,22 @@ | ||
1 | +/* Configurations for Joseph H. Allen's Exorsim | |
2 | + * This file copyright 2020 Joel Matthew Rees | |
3 | + * | |
4 | + * This is free software; you can redistribute it and/or modify it under the | |
5 | + * terms of the GNU General Public License as published by the Free Software | |
6 | + * Foundation; either version 1, or (at your option) any later version. | |
7 | + * | |
8 | + * It is distributed in the hope that it will be useful, but WITHOUT ANY | |
9 | + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
10 | + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
11 | + * details. | |
12 | + * | |
13 | + * You should have received a copy of the GNU General Public License along with | |
14 | + * this software; see the file COPYING. If not, write to the Free Software Foundation, | |
15 | + * 675 Mass Ave, Cambridge, MA 02139, USA. | |
16 | + */ | |
17 | + | |
18 | + | |
19 | +/* #define SIM6800 0x6800 */ | |
20 | +#define SIM6801 0x6801 | |
21 | + | |
22 | + |
@@ -21,7 +21,10 @@ | ||
21 | 21 | #include <string.h> |
22 | 22 | #include <fcntl.h> |
23 | 23 | #include <sys/poll.h> |
24 | +#include <unistd.h> /* JMR20201103 */ | |
25 | + | |
24 | 26 | #include "exorterm.h" |
27 | +#include "utils.h" /* JMR20201103 */ | |
25 | 28 | |
26 | 29 | /* State of real terminal */ |
27 | 30 |
@@ -559,6 +559,9 @@ int del_file(int rib_sector) | ||
559 | 559 | return 0; |
560 | 560 | } |
561 | 561 | |
562 | +/* Defined below in this file: (JMR20201103) */ | |
563 | +int find_file(char *filename, int *type, int del); | |
564 | + | |
562 | 565 | /* Delete file name */ |
563 | 566 | |
564 | 567 | int rm(char *name) |
@@ -22,9 +22,11 @@ | ||
22 | 22 | #include <fcntl.h> |
23 | 23 | #include <sys/poll.h> |
24 | 24 | #include <signal.h> |
25 | +#include <unistd.h> /* JMR20201105 */ | |
25 | 26 | |
26 | 27 | #include "utils.h" |
27 | 28 | #include "asm6800.h" |
29 | +#include "unasm6800.h" /* JMR20201105 */ | |
28 | 30 | #include "sim6800.h" |
29 | 31 | #include "exor.h" |
30 | 32 |
@@ -176,11 +178,11 @@ int b_cmd(char *p) | ||
176 | 178 | { |
177 | 179 | int val; |
178 | 180 | if (!*p) { |
179 | - brk = 0; | |
181 | + hasbrk = 0; /* JMR20201103 */ | |
180 | 182 | printf("Breakpoint cleared\n"); |
181 | 183 | } else if (parse_hex(&p, &val)) { |
182 | 184 | brk_addr = val; |
183 | - brk = 1; | |
185 | + hasbrk = 1; /* JMR20201103 */ | |
184 | 186 | printf("Breakpoint set at %4.4X\n", brk_addr); |
185 | 187 | } else |
186 | 188 | huh(); |
@@ -333,7 +335,9 @@ int u_cmd(char *p) | ||
333 | 335 | int target; |
334 | 336 | int x; |
335 | 337 | for (x = 0; x != 22; ++x) { |
336 | - unasm_line(mem, &addr, buf, &target, 1); | |
338 | + unsigned short saddr = (unsigned short) addr; /* JMR20201105 hidden endian issues */ | |
339 | + unasm_line(mem, &saddr, buf, &target, 1); /* JMR20201105 */ | |
340 | + addr = saddr; /* JMR20201105 ugly hack, let Joe figure it out. */ | |
337 | 341 | fprintf(mon_out, "%s\n", buf); |
338 | 342 | } |
339 | 343 | last_u = addr; |
@@ -16,10 +16,15 @@ | ||
16 | 16 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 | */ |
18 | 18 | |
19 | +/* Modifications for 6801 copyright 2020 Joel Matthew Rees | |
20 | +*/ | |
21 | + | |
22 | + | |
19 | 23 | #include <stdio.h> |
20 | 24 | #include <stdlib.h> |
21 | 25 | #include <string.h> |
22 | 26 | |
27 | +#include "exorsim.h" /* JMR20201103 */ | |
23 | 28 | #include "exor.h" |
24 | 29 | #include "unasm6800.h" |
25 | 30 | #include "asm6800.h" |
@@ -46,7 +51,8 @@ unsigned char i_flag; /* 1=masked, 0=enabled */ | ||
46 | 51 | unsigned char h_flag; |
47 | 52 | |
48 | 53 | /* Breakpoint */ |
49 | -int brk; | |
54 | +/* int brk; */ | |
55 | +int hasbrk; /* JMR20201103: 'brk' conflicts with unistd library. */ | |
50 | 56 | unsigned short brk_addr; |
51 | 57 | |
52 | 58 | /* Trace buffer */ |
@@ -693,8 +699,8 @@ void sim(void) | ||
693 | 699 | t->ea = 0; |
694 | 700 | t->data = 0; |
695 | 701 | |
696 | - if (brk && brk_addr == pc || stop) { | |
697 | - if (brk && brk_addr == pc) | |
702 | + if (hasbrk && brk_addr == pc || stop) { /* JMR20201103 */ | |
703 | + if (hasbrk && brk_addr == pc) /* JMR20201103 */ | |
698 | 704 | printf("\r\nBreakpoint!\n"); |
699 | 705 | monitor(); |
700 | 706 | t->pc = pc; |
@@ -7,7 +7,8 @@ extern int reset; | ||
7 | 7 | extern int abrt; |
8 | 8 | extern int sp_stop; |
9 | 9 | |
10 | -extern int brk; | |
10 | +/* extern int brk; */ | |
11 | +extern int hasbrk; /* JMR20201103 'brk' conflicts with unistd library. */ | |
11 | 12 | extern unsigned short brk_addr; |
12 | 13 | |
13 | 14 | /* CPU registers */ |
@@ -31,6 +32,8 @@ void write_flags(unsigned char f); | ||
31 | 32 | |
32 | 33 | void sim(void); |
33 | 34 | |
35 | +void simulated(unsigned short addr); /* For exor.c, JMR20201103 */ | |
36 | + | |
34 | 37 | /* Dump trace buffer */ |
35 | 38 | void show_traces(int n); |
36 | 39 |
@@ -21,6 +21,7 @@ | ||
21 | 21 | #include <string.h> |
22 | 22 | |
23 | 23 | #include "unasm6800.h" |
24 | +#include "utils.h" /* JMR20201103 */ | |
24 | 25 | |
25 | 26 | struct fact *swi_facts; |
26 | 27 | int targets[65536]; |
@@ -53,7 +54,8 @@ void parse_facts(FILE *f) | ||
53 | 54 | if (buf[0] && buf[strlen(buf)-1]=='\r') |
54 | 55 | buf[strlen(buf)-1] = 0; |
55 | 56 | p = buf; |
56 | - unsigned short addr; | |
57 | + /* unsigned short addr; */ | |
58 | + int addr; /* JMR20201103 parse_hex() wants an int pointer. */ | |
57 | 59 | char keyword[100]; |
58 | 60 | int len; |
59 | 61 | char label[100]; |