From 9dc0c5bbb8cdf53cc1602dfe6091146f10071ef8 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Sat, 25 Sep 2021 15:56:12 -0400 Subject: [PATCH] Added command line argument parsing to asm02.c02 --- cc02src/asm02.c02 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cc02src/asm02.c02 b/cc02src/asm02.c02 index cd43b88..ef8b714 100644 --- a/cc02src/asm02.c02 +++ b/cc02src/asm02.c02 @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -353,10 +354,26 @@ void prttbl() { } } +/* Read Command Line Arguments and Open Files */ +void doargs() { + if (debug) {setdst(sysbfr); printf("PARSING ARGUMENTS \"%s\"%n");} + aa = argset(); if (aa) xerror("NO ARGUMENTS SPECIFIED"); + + aa = argget(inpnam); if(!aa) xerror("INPUT FILE NOT SPECIFIED"); + if (debug) printf(" PARSED INPNAM \"%s\"%n"); + + aa = argget(outnam); //if(!aa) xerror("OUTPUT FILE NOT SPECIFIED"); + if (debug) printf(" PARSED OUTNAM \"%s\"%n"); + + aa = argget(lstnam); + if (debug) printf(" PARSED LSTNAM \"%s\"%n"); + +} + main: symbgn = &$8000; symend = &$A000; symptr = symbgn; //Set up Symbol Table symblk($FF); blkset(0); //Initialize Symbol Table - setdst(inpnam); strcpy("opcodes.a02"); + doargs(); //Read File Names and Options from Command Line Arguments inpfil = opnfil(0,inpnam); asmfil(0); fclose(inpfil);