2017-04-22 18:39:52 +00:00
|
|
|
/*************************************
|
|
|
|
* C02 Assembly Language Routines *
|
|
|
|
*************************************/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "files.h"
|
2018-02-13 22:25:57 +00:00
|
|
|
//#include "parse.h"
|
2017-04-22 18:39:52 +00:00
|
|
|
#include "asm.h"
|
|
|
|
|
2017-05-16 00:25:11 +00:00
|
|
|
/* Process comment */
|
2017-04-22 18:39:52 +00:00
|
|
|
void prccmt()
|
|
|
|
{
|
|
|
|
if (strlen(cmtasm)) {
|
|
|
|
strcpy(asmcmt, ";");
|
|
|
|
strcat(asmcmt, cmtasm);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
asmcmt[0] = 0;
|
|
|
|
setcmt("");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* output a single line of assembly code */
|
|
|
|
void asmlin(char *opcode, char *oprnd)
|
|
|
|
{
|
|
|
|
if (strlen(lblasm)) strcat(lblasm, LABSFX);
|
|
|
|
prccmt();
|
|
|
|
fprintf(outfil, ASMFMT, lblasm, opcode, oprnd, asmcmt);
|
|
|
|
if (debug) printf(ASMFMT, lblasm, opcode, oprnd, asmcmt);
|
|
|
|
lblasm[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* output a single comment line */
|
|
|
|
void cmtlin()
|
|
|
|
{
|
|
|
|
DEBUG("Writing Comment Line: %s\n", cmtasm);
|
|
|
|
fprintf(outfil, "; %s\n", cmtasm);
|
|
|
|
setcmt("");
|
|
|
|
}
|