• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Joe H. Allen's exorsim with 6809 (and 6801)


コミットメタ情報

リビジョン6fd5f8407f93d1fa99a443e3b31d5792633f911d (tree)
日時2020-11-17 01:24:53
作者Joel Matthew Rees <joel.rees@gmai...>
コミッターJoel Matthew Rees

ログメッセージ

assembler additions functional, lightly tested, but allow things like
sts #

変更サマリ

差分

--- a/asm6800.c
+++ b/asm6800.c
@@ -20,6 +20,7 @@
2020 #include <stdlib.h>
2121 #include <string.h>
2222
23+#include "exorsim.h" /* JMR20201103 */
2324 #include "asm6800.h"
2425 #include "utils.h" /* JMR20201103 */
2526
@@ -191,6 +192,9 @@ enum {
191192 ACC, /* Accumulator needed */
192193 ACC1, /* Accumulator optional */
193194 ACCB, /* we need an A or a B: add 0x01 for B */
195+#ifdef SIM6801
196+ ACCD, /* LDD,STD,ADDD,SUBD */
197+#endif /* def SIM6801 */
194198 NONE /* No operand */
195199 };
196200
@@ -236,11 +240,22 @@ struct { char *insn; int opcode; int type; } table[] =
236240 { "orab", 0xca, RM },
237241 { "addb", 0xcb, RM },
238242
243+#ifdef SIM6801
244+ { "subd", 0x83, ACCD },
245+ { "addd", 0xc3, ACCD },
246+ { "ldd", 0xcc, ACCD },
247+ { "std", 0xcd, ACCD },
248+#endif /* def SIM6801 */
249+
239250 { "cpx", 0x8c, IDX },
240251 { "bsr", 0x8d, REL },
241252 { "lds", 0x8e, IDX },
242253 { "sts", 0x8f, IDX },
254+#ifndef SIM6801
243255 { "jsr", 0x8d, RMW },
256+#else /* def SIM6801 */
257+ { "jsr", 0x8d, IDX },
258+#endif /* ndef SIM6801 */
244259 { "ldx", 0xce, IDX },
245260 { "stx", 0xcf, IDX },
246261
@@ -250,6 +265,9 @@ struct { char *insn; int opcode; int type; } table[] =
250265 { "ror", 0x46, RMW },
251266 { "asr", 0x47, RMW },
252267 { "asl", 0x48, RMW },
268+#ifdef SIM6801
269+/* { "lsl", 0x48, NONE }, / * alias */
270+#endif /* def SIM6801 */
253271 { "rol", 0x49, RMW },
254272 { "dec", 0x4a, RMW },
255273 { "inc", 0x4c, RMW },
@@ -263,6 +281,9 @@ struct { char *insn; int opcode; int type; } table[] =
263281 { "rora", 0x46, NONE },
264282 { "asra", 0x47, NONE },
265283 { "asla", 0x48, NONE },
284+#ifdef SIM6801
285+/* { "lsla", 0x48, NONE }, / * alias */
286+#endif /* def SIM6801 */
266287 { "rola", 0x49, NONE },
267288 { "deca", 0x4a, NONE },
268289 { "inca", 0x4c, NONE },
@@ -275,6 +296,9 @@ struct { char *insn; int opcode; int type; } table[] =
275296 { "rorb", 0x56, NONE },
276297 { "asrb", 0x57, NONE },
277298 { "aslb", 0x58, NONE },
299+#ifdef SIM6801
300+/* { "lslb", 0x58, NONE }, / * alias */
301+#endif /* def SIM6801 */
278302 { "rolb", 0x59, NONE },
279303 { "decb", 0x5a, NONE },
280304 { "incb", 0x5c, NONE },
@@ -282,6 +306,11 @@ struct { char *insn; int opcode; int type; } table[] =
282306 { "clrb", 0x5f, NONE },
283307
284308 { "nop", 0x01, NONE },
309+#ifdef SIM6801
310+ { "lsrd", 0x04, NONE },
311+ { "asld", 0x05, NONE },
312+/* { "lsld", 0x05, NONE }, / * alias */
313+#endif /* def SIM6801 */
285314 { "tap", 0x06, NONE },
286315 { "tpa", 0x07, NONE },
287316 { "inx", 0x08, NONE },
@@ -300,10 +329,19 @@ struct { char *insn; int opcode; int type; } table[] =
300329 { "aba", 0x1b, NONE },
301330
302331 { "bra", 0x20, REL },
332+#ifdef SIM6801
333+ { "brn", 0x21, REL },
334+#endif /* def SIM6801 */
303335 { "bhi", 0x22, REL },
304336 { "bls", 0x23, REL },
305337 { "bcc", 0x24, REL },
338+#ifdef SIM6801
339+/* { "bhs", 0x24, REL }, / * alias */
340+#endif /* def SIM6801 */
306341 { "bcs", 0x25, REL },
342+#ifdef SIM6801
343+/* { "blo", 0x25, REL }, / * alias */
344+#endif /* def SIM6801 */
307345 { "bne", 0x26, REL },
308346 { "beq", 0x27, REL },
309347 { "bvc", 0x28, REL },
@@ -325,8 +363,18 @@ struct { char *insn; int opcode; int type; } table[] =
325363 { "psh", 0x36, ACCB },
326364 { "psha", 0x36, NONE },
327365 { "pshb", 0x37, NONE },
366+#ifdef SIM6801
367+ { "pulx", 0x38, NONE },
368+#endif /* def SIM6801 */
328369 { "rts", 0x39, NONE },
370+#ifdef SIM6801
371+ { "abx", 0x3a, NONE },
372+#endif /* defSIM6801 */
329373 { "rti", 0x3b, NONE },
374+#ifdef SIM6801
375+ { "pshx", 0x3c, NONE },
376+ { "mul", 0x3d, NONE },
377+#endif /* def SIM6801 */
330378 { "wai", 0x3e, NONE },
331379 { "swi", 0x3f, NONE },
332380
@@ -537,7 +585,11 @@ unsigned assemble(unsigned char *mem, unsigned addr, char *buf)
537585 add_fixup(sy, addr, FIXUP_DIR, operand);
538586 mem[addr++] = operand;
539587 goto done;
588+#ifndef SIM6801
540589 } else if (type == IDX) {
590+#else /* def SIM6801 */
591+ } else if (type == IDX || type == ACCD) {
592+#endif /* ndef SIM6801 */
541593 /* 16-bit immediate */
542594 mem[addr++] = opcode;
543595 if (sy)
@@ -560,7 +612,11 @@ unsigned assemble(unsigned char *mem, unsigned addr, char *buf)
560612 if (buf[0] == ',' && (buf[1] == 'x' || buf[1] == 'X')) {
561613 ndx:
562614 /* We have an indexed operand */
615+#ifndef SIM6801
563616 if (type == RM || type == IDX || type == RMW) {
617+#else /* def SIM6801 */
618+ if (type == RM || type == IDX || type == ACCD || type == RMW) {
619+#endif /* ndef SIM6801 */
564620 mem[addr++] = opcode + 0x20;;
565621 if (sy)
566622 add_fixup(sy, addr, FIXUP_DIR, operand);
@@ -572,11 +628,19 @@ unsigned assemble(unsigned char *mem, unsigned addr, char *buf)
572628 }
573629 } else {
574630 /* We have a direct address operand */
631+#ifndef SIM6801
575632 if ((type == RM || type == IDX) && !sy && operand < 256) {
633+#else /* def SIM6801 */
634+ if ((type == RM || type == IDX || type == ACCD) && !sy && operand < 256) {
635+#endif /* ndef SIM6801 */
576636 mem[addr++] = opcode + 0x10;
577637 mem[addr++] = operand;
578638 goto done;
639+#ifndef SIM6801
579640 } else if (type == RM || type == IDX || type == RMW) {
641+#else /* def SIM6801 */
642+ } else if (type == RM || type == IDX || type == ACCD || type == RMW) {
643+#endif /* ndef SIM6801 */
580644 mem[addr++] = opcode + 0x30;
581645 if (sy)
582646 add_fixup(sy, addr, FIXUP_EXT, operand);