aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2016-03-08 13:51:57 +0000
committerIan C <ianc@noddybox.co.uk>2016-03-08 13:51:57 +0000
commit282fa7725993c9b0b0d2bb0977c124f11abea1fd (patch)
treee798be921f3cfc51ef0ca39c195a07218defc8d8 /src
parent3bad2fc2e05e0ddbf7d398f120b6d5d525476ff9 (diff)
Wildcard for args, EX changes and CP/M test.
+ Added '*' wildcard for macro arguments + Allow 'EX' with parameters reversed on the Z80 + Added simple CP/M example test. + Added some files to gitignore
Diffstat (limited to 'src')
-rw-r--r--src/casm.c2
-rw-r--r--src/macro.c26
-rw-r--r--src/test/cpm.144
-rw-r--r--src/test/z80.15
-rw-r--r--src/z80.c7
5 files changed, 80 insertions, 4 deletions
diff --git a/src/casm.c b/src/casm.c
index 35cd205..9f685f8 100644
--- a/src/casm.c
+++ b/src/casm.c
@@ -406,6 +406,8 @@ static struct
{
{"equ", EQU},
{".equ", EQU},
+ {"eq", EQU},
+ {".eq", EQU},
{"org", ORG},
{".org", ORG},
{"ds", DS},
diff --git a/src/macro.c b/src/macro.c
index 03891c2..3e0ce2b 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -390,9 +390,29 @@ char *MacroPlay(Macro *macro)
}
else
{
- num[in_num] = 0;
- AddArg(str, macro, atoi(num));
- in_num = -1;
+ if (in_num == 0 && line[rd] == '*')
+ {
+ int f;
+
+ rd++;
+
+ for(f = 0; f < macro->argc; f++)
+ {
+ if (f > 0)
+ {
+ VarcharAddChar(str, ',');
+ }
+
+ AddArg(str, macro, f);
+ }
+ in_num = -1;
+ }
+ else
+ {
+ num[in_num] = 0;
+ AddArg(str, macro, atoi(num));
+ in_num = -1;
+ }
}
}
else if (in_arg != -1)
diff --git a/src/test/cpm.1 b/src/test/cpm.1
new file mode 100644
index 0000000..60ec8c2
--- /dev/null
+++ b/src/test/cpm.1
@@ -0,0 +1,44 @@
+ ;
+ ; CP/M example (macro test)
+ ;
+ cpu z80
+ option output-file,x.com
+
+BDOS: equ 5
+CONOUT: eq 9
+
+strout: macro addr
+ ld de,@addr
+ ld c,CONOUT
+ call BDOS
+ endm
+
+strout1:macro
+ ld de,str
+ ld a,'$'
+ ld c,CONOUT
+.loop
+ ex de,hl
+ cp (hl)
+ ex hl,de
+ jr z,end_str
+ call BDOS
+ inc de
+ jr loop
+
+.str defb \*,0
+.end_str
+
+ endm
+
+
+ ; Main code
+ ;
+ org $100
+
+ strout str
+ strout1 "Bye world", 13, 10, '$'
+
+ ret
+
+str: defb "Hello World",13,10,'$'
diff --git a/src/test/z80.1 b/src/test/z80.1
index d41828e..732d1cb 100644
--- a/src/test/z80.1
+++ b/src/test/z80.1
@@ -221,6 +221,11 @@ exchange:
ex (sp),hl
ex (sp),ix
ex (sp),iy
+ ex hl,de
+ ex af',af
+ ex hl,(sp)
+ ex ix,(sp)
+ ex iy,(sp)
ldi
ldir
ldd
diff --git a/src/z80.c b/src/z80.c
index ad42795..71bda75 100644
--- a/src/z80.c
+++ b/src/z80.c
@@ -1206,10 +1206,15 @@ CommandStatus EX(const char *label, int argc, char *argv[],
static RegisterPairCodes codes[] =
{
DE16, HL16, {0xeb},
+ HL16, DE16, {0xeb},
AF16, AF16_ALT, {0x08},
+ AF16_ALT, AF16, {0x08},
SP_ADDRESS, HL16, {0xe3},
+ HL16, SP_ADDRESS, {0xe3},
SP_ADDRESS, IX16, {SHIFT_IX, 0xe3},
- SP_ADDRESS, IY16, {SHIFT_IY, 0xe3}
+ IX16, SP_ADDRESS, {SHIFT_IX, 0xe3},
+ SP_ADDRESS, IY16, {SHIFT_IY, 0xe3},
+ IY16, SP_ADDRESS, {SHIFT_IY, 0xe3}
};
RegisterMode r1, r2;