mirror of
https://github.com/fachat/xa65.git
synced 2024-09-30 07:56:36 +00:00
first round of commenting
This commit is contained in:
parent
485a7ec1a5
commit
fc88d6f1c4
@ -1,7 +1,7 @@
|
|||||||
# Unix gcc or DOS go32 cross-compiling gcc
|
# Unix gcc or DOS go32 cross-compiling gcc
|
||||||
#
|
#
|
||||||
VERS = 2.4.1
|
VERS = 2.4.1
|
||||||
CC = gcc
|
CC = gcc -Wall
|
||||||
LD = gcc
|
LD = gcc
|
||||||
# for testing. not to be used; build failures in misc/.
|
# for testing. not to be used; build failures in misc/.
|
||||||
#CFLAGS = -O2 -W -Wall -pedantic -ansi -g
|
#CFLAGS = -O2 -W -Wall -pedantic -ansi -g
|
||||||
|
30
xa/src/xa.c
30
xa/src/xa.c
@ -29,13 +29,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* macros */
|
|
||||||
#include "xad.h"
|
|
||||||
|
|
||||||
/* structs and defs */
|
/* structs and defs */
|
||||||
#include "xah.h"
|
#include "xah.h"
|
||||||
#include "xah2.h"
|
#include "xah2.h"
|
||||||
|
|
||||||
|
/* macros */
|
||||||
|
#include "xad.h"
|
||||||
|
|
||||||
/* exported functions are defined here */
|
/* exported functions are defined here */
|
||||||
#include "xa.h"
|
#include "xa.h"
|
||||||
#include "xal.h"
|
#include "xal.h"
|
||||||
@ -136,10 +136,6 @@ int main(int argc, char *argv[]) {
|
|||||||
char *lfile; /* labels go here */
|
char *lfile; /* labels go here */
|
||||||
char *ifile;
|
char *ifile;
|
||||||
|
|
||||||
char old_e[MAXLINE];
|
|
||||||
char old_l[MAXLINE];
|
|
||||||
char old_o[MAXLINE];
|
|
||||||
|
|
||||||
tim1 = time(NULL);
|
tim1 = time(NULL);
|
||||||
|
|
||||||
// note: unfortunately we do no full distinction between 65C02 and 65816.
|
// note: unfortunately we do no full distinction between 65C02 and 65816.
|
||||||
@ -876,6 +872,7 @@ static int pass2(void) {
|
|||||||
|
|
||||||
static int pass1(void) {
|
static int pass1(void) {
|
||||||
signed char o[2 * MAXLINE]; /* doubled for token listing */
|
signed char o[2 * MAXLINE]; /* doubled for token listing */
|
||||||
|
char s[MAXLINE];
|
||||||
int l, er, al;
|
int l, er, al;
|
||||||
|
|
||||||
memode = 0;
|
memode = 0;
|
||||||
@ -1135,13 +1132,14 @@ static int puttmps(signed char *s, int l) {
|
|||||||
|
|
||||||
static char l[MAXLINE];
|
static char l[MAXLINE];
|
||||||
|
|
||||||
static int xa_getline(char *s) {
|
static int xa_getline(char *out_line) {
|
||||||
static int ec;
|
static int ec;
|
||||||
|
|
||||||
static int i, c;
|
static int i, c;
|
||||||
int hkfl, j, comcom;
|
int hkfl = 0;
|
||||||
|
int wr_cnt = 0;
|
||||||
|
int comcom = 0;
|
||||||
|
|
||||||
j = hkfl = comcom = 0;
|
|
||||||
ec = E_OK;
|
ec = E_OK;
|
||||||
|
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
@ -1174,7 +1172,7 @@ static int xa_getline(char *s) {
|
|||||||
if (!ec || ec == E_EOF) {
|
if (!ec || ec == E_EOF) {
|
||||||
int startofline = 1;
|
int startofline = 1;
|
||||||
do {
|
do {
|
||||||
c = s[j] = l[i++];
|
c = out_line[wr_cnt] = l[i++];
|
||||||
|
|
||||||
if (!(hkfl & 2) && c == '\"')
|
if (!(hkfl & 2) && c == '\"')
|
||||||
hkfl ^= 1;
|
hkfl ^= 1;
|
||||||
@ -1209,14 +1207,14 @@ static int xa_getline(char *s) {
|
|||||||
if (!isspace(c)) {
|
if (!isspace(c)) {
|
||||||
startofline = 0;
|
startofline = 0;
|
||||||
}
|
}
|
||||||
j++;
|
wr_cnt++;
|
||||||
} while (c != '\0' && j < MAXLINE - 1 && i < MAXLINE - 1);
|
} while (c != '\0' && wr_cnt < MAXLINE - 1 && i < MAXLINE - 1);
|
||||||
|
|
||||||
s[j] = '\0';
|
out_line[wr_cnt] = '\0';
|
||||||
} else
|
} else
|
||||||
s[0] = '\0';
|
out_line[0] = '\0';
|
||||||
#if 0
|
#if 0
|
||||||
printf("got line: %s\n", s);
|
printf("got line: %s\n", out_line);
|
||||||
#endif
|
#endif
|
||||||
return (ec);
|
return (ec);
|
||||||
}
|
}
|
||||||
|
36
xa/src/xad.h
36
xa/src/xad.h
@ -1,6 +1,6 @@
|
|||||||
/* xa65 - 65xx/65816 cross-assembler and utility suite
|
/* xa65 - 65xx/65816 cross-assembler and utility suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1989-1997 André Fachat (a.fachat@physik.tu-chemnitz.de)
|
* Copyright (C) 1989-1997 Andr<EFBFBD> Fachat (a.fachat@physik.tu-chemnitz.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#define cval(s) 256 * ((s)[1] & 255) + ((s)[0]&255)
|
#define cval(s) 256 * ((s)[1] & 255) + ((s)[0]&255)
|
||||||
#define lval(s) 65536 * ((s)[2] & 255) + 256 * ((s)[1] & 255) + ((s)[0] & 255)
|
#define lval(s) 65536 * ((s)[2] & 255) + 256 * ((s)[1] & 255) + ((s)[0] & 255)
|
||||||
|
|
||||||
|
/* deprecated. should be replaced with the following inline function */
|
||||||
#define wval(i, v, f) do { \
|
#define wval(i, v, f) do { \
|
||||||
t[i++] = T_VALUE; \
|
t[i++] = T_VALUE; \
|
||||||
t[i++] = v & 255; \
|
t[i++] = v & 255; \
|
||||||
@ -39,6 +41,38 @@
|
|||||||
t[i++] = f & 255; \
|
t[i++] = f & 255; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define wvalo(i, v, f) do { \
|
||||||
|
out[i++] = T_VALUE; \
|
||||||
|
out[i++] = v & 255; \
|
||||||
|
out[i++] = (v >> 8) & 255; \
|
||||||
|
out[i++] = (v >> 16) & 255; \
|
||||||
|
out[i++] = f & 255; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes a token for an integer value (24 bits), and a flag into an output buffer
|
||||||
|
* (typically the tokenizer output stream)
|
||||||
|
*
|
||||||
|
* returns number of bytes written
|
||||||
|
*
|
||||||
|
* Flag could be for example:
|
||||||
|
* 'd' - to be printed as decimal
|
||||||
|
* '$' - to be printed as hex
|
||||||
|
* '&' - to be printed as octal
|
||||||
|
* '%' - to be printed as binary
|
||||||
|
* ''' - to be printed as char with single quote delimiter
|
||||||
|
* '"' - to be printed as char with double quote delimiter
|
||||||
|
*/
|
||||||
|
static inline int write_val(signed char *out_token, int value, char flag) {
|
||||||
|
int l = 0;
|
||||||
|
out_token[l++] = T_VALUE;
|
||||||
|
out_token[l++] = value & 255;
|
||||||
|
out_token[l++] = (value >> 8) & 255;
|
||||||
|
out_token[l++] = (value >> 16) & 255;
|
||||||
|
out_token[l++] = flag & 255;
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
#define wval_len 5 /* number of bytes stored in wval() call */
|
#define wval_len 5 /* number of bytes stored in wval() call */
|
||||||
|
|
||||||
#endif /* __XA65_XAD_H__ */
|
#endif /* __XA65_XAD_H__ */
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
/* structs and defs */
|
/* structs and defs */
|
||||||
|
|
||||||
#include "xad.h"
|
|
||||||
#include "xah.h"
|
#include "xah.h"
|
||||||
|
#include "xad.h"
|
||||||
#include "xar.h"
|
#include "xar.h"
|
||||||
#include "xah2.h"
|
#include "xah2.h"
|
||||||
#include "xap.h"
|
#include "xap.h"
|
||||||
|
@ -439,8 +439,8 @@ int list_tokens(char *buf, signed char *input, int len) {
|
|||||||
if (tmp >= 0 && tmp < number_of_valid_tokens) {
|
if (tmp >= 0 && tmp < number_of_valid_tokens) {
|
||||||
/* assembler keyword */
|
/* assembler keyword */
|
||||||
/*printf("tmp=%d, kt[tmp]=%p\n", tmp, kt[tmp]);*/
|
/*printf("tmp=%d, kt[tmp]=%p\n", tmp, kt[tmp]);*/
|
||||||
if (kt[tmp] != NULL) {
|
if (keyword_table[tmp] != NULL) {
|
||||||
outp += list_string(buf + outp, kt[tmp]);
|
outp += list_string(buf + outp, keyword_table[tmp]);
|
||||||
}
|
}
|
||||||
outp += list_sp(buf + outp);
|
outp += list_sp(buf + outp);
|
||||||
inp += 1;
|
inp += 1;
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "xad.h"
|
|
||||||
#include "xah.h"
|
#include "xah.h"
|
||||||
#include "xah2.h"
|
#include "xah2.h"
|
||||||
|
#include "xad.h"
|
||||||
|
|
||||||
#include "xar.h"
|
#include "xar.h"
|
||||||
#include "xa.h"
|
#include "xa.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* xa65 - 65xx/65816 cross-assembler and utility suite
|
/* xa65 - 65xx/65816 cross-assembler and utility suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1989-1997 André Fachat (a.fachat@physik.tu-chemnitz.de)
|
* Copyright (C) 1989-1997 Andr<EFBFBD> Fachat (a.fachat@physik.tu-chemnitz.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -39,6 +39,6 @@ long gm_ppm(void);
|
|||||||
long ga_ppm(void);
|
long ga_ppm(void);
|
||||||
|
|
||||||
extern Datei *filep;
|
extern Datei *filep;
|
||||||
extern char s[MAXLINE];
|
//extern char s[MAXLINE];
|
||||||
|
|
||||||
#endif /* __XA65_XAP_H__ */
|
#endif /* __XA65_XAP_H__ */
|
||||||
|
@ -22,8 +22,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "xad.h"
|
|
||||||
#include "xah.h"
|
#include "xah.h"
|
||||||
|
#include "xad.h"
|
||||||
|
|
||||||
#include "xar.h"
|
#include "xar.h"
|
||||||
#include "xa.h"
|
#include "xa.h"
|
||||||
#include "xal.h"
|
#include "xal.h"
|
||||||
|
580
xa/src/xat.c
580
xa/src/xat.c
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
/* xa65 - 65xx/65816 cross-assembler and utility suite
|
/* xa65 - 65xx/65816 cross-assembler and utility suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1989-1997 André Fachat (a.fachat@physik.tu-chemnitz.de)
|
* Copyright (C) 1989-1997 Andr<EFBFBD> Fachat (a.fachat@physik.tu-chemnitz.de)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,7 +25,7 @@ int t_p1(signed char *s, signed char *t, int *ll, int *al);
|
|||||||
int t_p2_l(signed char *t, int *ll, int *al);
|
int t_p2_l(signed char *t, int *ll, int *al);
|
||||||
int b_term(char *s, int *v, int *l, int pc);
|
int b_term(char *s, int *v, int *l, int pc);
|
||||||
|
|
||||||
extern char *kt[]; // table of key words, needed for listing
|
extern char *keyword_table[]; // table of key words, needed for listing
|
||||||
extern char *arith_ops[]; // table of arithmetic operators, needed for listing
|
extern char *arith_ops[]; // table of arithmetic operators, needed for listing
|
||||||
extern int number_of_valid_tokens; // as it says, in the "kt" table
|
extern int number_of_valid_tokens; // as it says, in the "kt" table
|
||||||
|
|
||||||
|
@ -22,10 +22,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "xad.h"
|
|
||||||
#include "xau.h"
|
|
||||||
#include "xah.h"
|
#include "xah.h"
|
||||||
#include "xal.h"
|
#include "xal.h"
|
||||||
|
#include "xad.h"
|
||||||
|
|
||||||
|
#include "xau.h"
|
||||||
|
|
||||||
#undef DEBUG_UNDEF
|
#undef DEBUG_UNDEF
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user