mirror of
https://github.com/fachat/xa65.git
synced 2025-04-08 18:37:12 +00:00
added 0xHEX and 0OCTAL parsing with -XC compatibility parameter
This commit is contained in:
parent
25796d051a
commit
fb84a3cfca
@ -83,8 +83,11 @@ Add cross-reference list to labellist (requires
|
||||
Enables compatibility settings to become more (not fully!) compatible with other 6502 assemblers.
|
||||
Currently supported are compatibility set "MASM" and "CA65".
|
||||
"MASM" allows colons to appear in comments. This does not affect colon interpretation elsewhere.
|
||||
"CA65" allows the ":=" label definition (instead of "="), and also the "cheap local labels" using
|
||||
"CA65" allows the ":=" label definition (instead of "="), It adds the "unnamed labels" and also the
|
||||
"cheap local labels" using
|
||||
the "@" character. This, however, disables the "@" 24-bit enforcement.
|
||||
"C" enables the usage of "0xHEX" and "0OCTAL" C-style number encodings. Note that you can combine
|
||||
compatibility sets e.g. with "-XCA65 -XC".
|
||||
.TP
|
||||
.B \-M
|
||||
Allow colons to appear in comments; for MASM compatibility. This does
|
||||
|
@ -65,6 +65,7 @@ int ncmos, cmosfl, w65816, n65816;
|
||||
/* compatibility flags */
|
||||
int masm = 0; /* MASM */
|
||||
int ca65 = 0; /* CA65 */
|
||||
int ctypes = 0; /* C compatibility, like "0xab" types */
|
||||
|
||||
int nolink = 0;
|
||||
int romable = 0;
|
||||
@ -1222,6 +1223,7 @@ typedef struct {
|
||||
static compat_set compat_sets[] = {
|
||||
{ "MASM", &masm },
|
||||
{ "CA65", &ca65 },
|
||||
{ "C", &ctypes },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
@ -27,6 +27,7 @@ extern int noglob;
|
||||
extern int showblk;
|
||||
extern int relmode;
|
||||
extern int crossref;
|
||||
extern int ctypes;
|
||||
extern char altppchar;
|
||||
|
||||
extern int tlen, tbase;
|
||||
|
26
xa/src/xah.h
26
xa/src/xah.h
@ -95,20 +95,20 @@ typedef struct {
|
||||
|
||||
#define BUFSIZE 4096 /* File-Puffegroesse (wg Festplatte) */
|
||||
|
||||
#define E_OK 0 /* Fehlernummern */
|
||||
#define E_SYNTAX -1 /* Syntax Fehler */
|
||||
#define E_LABDEF -2 /* Label definiert */
|
||||
#define E_NODEF -3 /* Label nicht definiert */
|
||||
#define E_LABFULL -4 /* Labeltabelle voll */
|
||||
#define E_LABEXP -5 /* Label erwartet */
|
||||
#define E_NOMEM -6 /* kein Speicher mehr */
|
||||
#define E_ILLCODE -7 /* Illegaler Opcode */
|
||||
#define E_ADRESS -8 /* Illegale Adressierung */
|
||||
#define E_OK 0 /* No error */
|
||||
#define E_SYNTAX -1 /* Syntax error */
|
||||
#define E_LABDEF -2 /* Label already defined (duplicate label definition) */
|
||||
#define E_NODEF -3 /* Label not defined */
|
||||
#define E_LABFULL -4 /* Label table full */
|
||||
#define E_LABEXP -5 /* Label expected but not found */
|
||||
#define E_NOMEM -6 /* out of memory */
|
||||
#define E_ILLCODE -7 /* Illegal Opcode */
|
||||
#define E_ADRESS -8 /* Illegal Addressing mode */
|
||||
#define E_RANGE -9 /* Branch out of range */
|
||||
#define E_OVERFLOW -10 /* Ueberlauf */
|
||||
#define E_DIV -11 /* Division durch Null */
|
||||
#define E_PSOEXP -12 /* Pseudo-Opcode erwartet */
|
||||
#define E_BLKOVR -13 /* Block-Stack Uebergelaufen */
|
||||
#define E_OVERFLOW -10 /* overflow */
|
||||
#define E_DIV -11 /* Division by zero */
|
||||
#define E_PSOEXP -12 /* Pseudo-Opcode expected but not found */
|
||||
#define E_BLKOVR -13 /* Block-Stack overflow */
|
||||
#define E_FNF -14 /* File not found (pp) */
|
||||
#define E_EOF -15 /* End of File */
|
||||
#define E_BLOCK -16 /* Block inkonsistent */
|
||||
|
20
xa/src/xat.c
20
xa/src/xat.c
@ -2130,16 +2130,30 @@ fprintf(stderr, "could not find %s\n", (char *)s+p);
|
||||
}
|
||||
}
|
||||
else
|
||||
if(s[p]<='9' && s[p]>='0')
|
||||
if(s[p]<='9' && (s[p]>'0' || (s[p] == '0' && !ctypes)))
|
||||
{
|
||||
tg_dez(s+p,&ll,&v);
|
||||
p+=ll;
|
||||
wval(q,v, 'd');
|
||||
}
|
||||
else
|
||||
|
||||
/* handle encodings: hex, binary, octal, quoted strings */
|
||||
/* handle encodings: hex, binary, octal, quoted strings */
|
||||
switch(s[p]) {
|
||||
case '0':
|
||||
// only gets here when "ctypes" is set, and starts with 0
|
||||
// we here check for the C stype "0xHEX" and "0OCTAL" encodings
|
||||
if ('x' == tolower(s[p+1])) {
|
||||
// c-style hex
|
||||
tg_hex(s+p+2, &ll, &v);
|
||||
p+=2+ll;
|
||||
wval(q, v, '$');
|
||||
} else {
|
||||
// c-style octal
|
||||
tg_oct(s+p+1,&ll,&v);
|
||||
p+=1+ll;
|
||||
wval(q,v, '&');
|
||||
}
|
||||
break;
|
||||
case '$':
|
||||
tg_hex(s+p+1,&ll,&v);
|
||||
p+=1+ll;
|
||||
|
Loading…
x
Reference in New Issue
Block a user