LD:000 ---> #FFFF
LD:066 ---> #FFFF
-NOEX:020 ---> #FFFF
+NOEX:002 ---> #FFFF
NOP:000 ---> #0000
-LD:011 ---> #1000
-ST:010 ---> #1100
-LAD:010 ---> #1200
-LD:020 ---> #1400
-ADDA:011 ---> #2000
-SUBA:011 ---> #2100
-ADDL:011 ---> #2200
-SUBL:011 ---> #2300
-ADDA:020 ---> #2400
-SUBA:020 ---> #2500
-ADDL:020 ---> #2600
-SUBL:020 ---> #2700
-AND:011 ---> #3000
-OR:011 ---> #3100
-XOR:011 ---> #3200
-AND:020 ---> #3400
-OR:020 ---> #3500
-XOR:020 ---> #3600
-CPA:011 ---> #4000
-CPL:011 ---> #4100
-CPA:020 ---> #4400
-CPL:020 ---> #4500
-SLA:010 ---> #5000
-SRA:010 ---> #5100
-SLL:010 ---> #5200
-SRL:010 ---> #5300
-JMI:030 ---> #6100
-JNZ:030 ---> #6200
-JZE:030 ---> #6300
-JUMP:030 ---> #6400
-JPL:030 ---> #6500
-JOV:030 ---> #6600
-PUSH:030 ---> #7000
-POP:040 ---> #7100
-CALL:030 ---> #8000
-SVC:030 ---> #F000
+LD:001 ---> #1000
+ST:001 ---> #1100
+LAD:001 ---> #1200
+LD:002 ---> #1400
+ADDA:001 ---> #2000
+SUBA:001 ---> #2100
+ADDL:001 ---> #2200
+SUBL:001 ---> #2300
+ADDA:002 ---> #2400
+SUBA:002 ---> #2500
+ADDL:002 ---> #2600
+SUBL:002 ---> #2700
+AND:001 ---> #3000
+OR:001 ---> #3100
+XOR:001 ---> #3200
+AND:002 ---> #3400
+OR:002 ---> #3500
+XOR:002 ---> #3600
+CPA:001 ---> #4000
+CPL:001 ---> #4100
+CPA:002 ---> #4400
+CPL:002 ---> #4500
+SLA:001 ---> #5000
+SRA:001 ---> #5100
+SLL:001 ---> #5200
+SRL:001 ---> #5300
+JMI:003 ---> #6100
+JNZ:003 ---> #6200
+JZE:003 ---> #6300
+JUMP:003 ---> #6400
+JPL:003 ---> #6500
+JOV:003 ---> #6600
+PUSH:003 ---> #7000
+POP:004 ---> #7100
+CALL:003 ---> #8000
+SVC:003 ---> #F000
RET:000 ---> #8100
CMDSRC_FILE := cmd.c
TARGETDIR := ../../../src
INCLUDEDIR := ../../../include
-TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmd.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c # Set test target files
+TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmd.c $(TARGETDIR)/exec.c $(TARGETDIR)/struct.c $(TARGETDIR)/dump.c $(TARGETDIR)/word.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c # Set test target files
$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES)
$(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^
#include <stdio.h>
#include "struct.h"
#include "cerr.h"
+#include "exec.h"
int main(){
int i;
+++ /dev/null
-#FFFF ---> 077
-#0001 ---> 077
-#0000 ---> 000
-#1000 ---> 011
-#1100 ---> 010
-#1200 ---> 010
-#1400 ---> 020
-#2000 ---> 011
-#2100 ---> 011
-#2200 ---> 011
-#2300 ---> 011
-#2400 ---> 020
-#2500 ---> 020
-#2600 ---> 020
-#2700 ---> 020
-#3000 ---> 011
-#3100 ---> 011
-#3200 ---> 011
-#3400 ---> 020
-#3500 ---> 020
-#3600 ---> 020
-#4000 ---> 011
-#4100 ---> 011
-#4400 ---> 020
-#4500 ---> 020
-#5000 ---> 010
-#5100 ---> 010
-#5200 ---> 010
-#5300 ---> 010
-#6100 ---> 030
-#6200 ---> 030
-#6300 ---> 030
-#6400 ---> 030
-#6500 ---> 030
-#6600 ---> 030
-#7000 ---> 030
-#7100 ---> 040
-#8000 ---> 030
-#F000 ---> 030
-#8100 ---> 000
+++ /dev/null
-include ../Define.mk
-include ../Test.mk
-
-CC := gcc
-CFLAGS := -Wall
-
-.INTERMEDIATE: $(CMD_FILE)
-
-CMDSRC_FILE := cmd.c
-TARGETDIR := ../../../src
-INCLUDEDIR := ../../../include
-TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c # Set test target files
-
-$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES)
- $(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^
+++ /dev/null
-#include <stdio.h>
-#include "struct.h"
-#include "cerr.h"
-
-int main(){
- int i;
- CMDTYPE type;
- WORD codelist[] = {
- 0xFFFF, 0x0001,
- 0x0, 0x1000, 0x1100, 0x1200, 0x1400,
- 0x2000, 0x2100, 0x2200, 0x2300, 0x2400,
- 0x2500, 0x2600, 0x2700, 0x3000, 0x3100,
- 0x3200, 0x3400, 0x3500, 0x3600, 0x4000,
- 0x4100, 0x4400, 0x4500, 0x5000, 0x5100,
- 0x5200, 0x5300, 0x6100, 0x6200, 0x6300,
- 0x6400, 0x6500, 0x6600, 0x7000, 0x7100,
- 0x8000, 0xF000, 0x8100,
- };
-
- cerr = malloc_chk(sizeof(CERR), "cerr"); /* エラーの初期化 */
- create_code_type();
- for(i = 0; i < ARRAYSIZE(codelist); i++) {
- type = getcmdtype(codelist[i]);
- printf("#%04X ---> 0%02o\n", codelist[i], type);
- if(cerr->num != 0) {
- printf("\t%s", cerr->msg);
- freecerr();
- }
- }
- free_code_type();
- return 0;
-}
CMDSRC_FILE := cmd.c
TARGETDIR := ../../../src
INCLUDEDIR := ../../../include
-TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c $(TARGETDIR)/assemble.c $(TARGETDIR)/word.c $(TARGETDIR)/label.c $(TARGETDIR)/struct.c $(TARGETDIR)/token.c # Set test target files
+TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c $(TARGETDIR)/assemble.c $(TARGETDIR)/word.c $(TARGETDIR)/label.c $(TARGETDIR)/struct.c $(TARGETDIR)/token.c $(TARGETDIR)/exec.c $(TARGETDIR)/dump.c # Set test target files
$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES)
$(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^
-0: IOTEST START
-cl->label: IOTEST
-cl->cmd: START
-cl->opdc: 0
-
-1: OUT OBUF1,OLEN1
+0: OUT OBUF1,OLEN1
cl->cmd: OUT
cl->opdc: 2
cl->opdv[0]: OBUF1
cl->opdv[1]: OLEN1
-2: OUT OBUF2,OLEN2 ;comment
+1: OUT OBUF2,OLEN2 ;comment
cl->cmd: OUT
cl->opdc: 2
cl->opdv[0]: OBUF2
cl->opdv[1]: OLEN2
-3: OUT OBUF1,OLEN1
+2: OUT OBUF1,OLEN1
cl->cmd: OUT
cl->opdc: 2
cl->opdv[0]: OBUF1
cl->opdv[1]: OLEN1
-4: OUT OBUF1,OLEN1
+3: OUT OBUF1,OLEN1
cl->cmd: OUT
cl->opdc: 2
cl->opdv[0]: OBUF1
cl->opdv[1]: OLEN1
-5: OUT OBUF2,OLEN2
+4: OUT OBUF2,OLEN2
cl->cmd: OUT
cl->opdc: 2
cl->opdv[0]: OBUF2
cl->opdv[1]: OLEN2
-6: OUT OBUF1, OLEN1
+5: OUT OBUF1, OLEN1
cl->cmd: OUT
cl->opdc: 1
cl->opdv[0]: OBUF1
error - 121: cannot get operand token
-7: BEGIN LD GR1, A
+6: BEGIN LD GR1, A
cl->label: BEGIN
cl->cmd: LD
cl->opdc: 1
cl->opdv[0]: GR1
error - 121: cannot get operand token
-8:
+7:
+cl is NULL
+
+8: ;comment
cl is NULL
- error - 121: cannot get operand token
9: ;comment
cl is NULL
- error - 121: cannot get operand token
CC := gcc
CFLAGS := -g -Wall
-.INTERMEDIATE: $(CMD_FILE)
+# .INTERMEDIATE: $(CMD_FILE)
CMDSRC_FILE := cmd.c
TARGETDIR := ../../../src
INCLUDEDIR := ../../../include
-TESTTARGET_FILES := $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c $(TARGETDIR)/word.c $(TARGETDIR)/struct.c $(TARGETDIR)/token.c $(TARGETDIR)/hash.c # Set test target files
+TESTTARGET_FILES := $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c $(TARGETDIR)/word.c $(TARGETDIR)/struct.c $(TARGETDIR)/token.c $(TARGETDIR)/hash.c $(TARGETDIR)/exec.c $(TARGETDIR)/dump.c # Set test target files
$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES)
$(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^
- @rm -rf cmd.dSYM
+
+clean_cmd:
+ @rm -rf cmd.dSYM cmd
+
+clean: clean_cmd
+
int main(){
int i, j;
char *testline[] = {
- "IOTEST START\n",
+ /* "IOTEST START\n", */
" OUT OBUF1,OLEN1\n",
" OUT OBUF2,OLEN2 ;comment\n",
" OUT OBUF1,OLEN1 \n",
" OUT OBUF1, OLEN1 \n",
"BEGIN LD GR1, A\n",
"\n",
+ ";comment\n",
" ;comment\n"
};
CMDLINE *testcl = malloc(sizeof(CMDLINE));
- cerr_init(); /* エラーの初期化 */
addcerrlist_tok();
for(i = 0; i < sizeof testline /sizeof testline[0]; i++) {
+ cerr_init(); /* エラーの初期化 */
printf("%d: %s", i, testline[i]);
testcl = linetok(testline[i]);
if(testcl == NULL) {
CMDSRC_FILE := cmd.c
TARGETDIR := ../../../src
INCLUDEDIR := ../../../include
-TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c $(TARGETDIR)/assemble.c $(TARGETDIR)/word.c $(TARGETDIR)/label.c $(TARGETDIR)/struct.c $(TARGETDIR)/token.c # Set test target files
+TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c $(TARGETDIR)/cmd.c $(TARGETDIR)/assemble.c $(TARGETDIR)/word.c $(TARGETDIR)/label.c $(TARGETDIR)/struct.c $(TARGETDIR)/token.c $(TARGETDIR)/exec.c $(TARGETDIR)/dump.c # Set test target files
$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES)
$(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^