//
-// RMAC - Reboot's Macro Assembler for all Atari computers
+// RMAC - Renamed Macro Assembler for all Atari computers
// DIRECT.C - Directive Handling
-// Copyright (C) 199x Landon Dyer, 2011-2020 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
{
// Reset the attributes of this symbol...
regname->sattr = 0;
- regname->sattre &= ~(EQUATEDREG | BANK_0 | BANK_1);
+ regname->sattre &= ~EQUATEDREG;
regname->sattre |= UNDEF_EQUR;
}
//
-// Include binary file
+// Include binary file (can add addition size & position params, comma separated)
//
int d_incbin(void)
{
// Attempt to open the include file in the current directory, then (if that
// failed) try list of include files passed in the enviroment string or by
- // the "-d" option.
+ // the "-i" option.
TOKEN filename = tok[1];
+
if ((fd = open(string[filename], _OPEN_INC)) < 0)
{
for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++)
allright:
tok += 2;
+
if (*tok != EOL)
{
// Check size parameter (can be omitted)
close(fd);
return ERROR;
}
+ if ((int64_t)size <= 0)
+ {
+ return error("invalid incbin size requested");
+ }
}
else
size = lseek(fd, 0L, SEEK_END);
close(fd);
return ERROR;
}
+
lseek(fd, pos, SEEK_SET);
- size -= pos;
+ if ((int64_t)(size - pos) < 0)
+ {
+ return error("requested incbin size out of range");
+ }
}
else
{
}
}
else
- return(comma_error);
+ return error(comma_error);
}
else
pos = lseek(fd, 0L, SEEK_SET);
}
else
{
- //size_pos_fallthrough:
+ // size & pos not given, so assume offset of 0 and all of the binary
size = lseek(fd, 0L, SEEK_END);
pos = lseek(fd, 0L, SEEK_SET);
}
+
chcheck(size);
DEBUG { printf("INCBIN: File '%s' is %li bytes.\n", string[filename], size); }
//
int d_regbank0(void)
{
- // Set active register bank zero
- regbank = BANK_0;
+ // Deprecated, it's not as if this did anything useful, ever
+ warn("regbank0 ignored");
return 0;
}
int d_regbank1(void)
{
- // Set active register bank one
- regbank = BANK_1;
+ // Deprecated, it's not as if this did anything useful, ever
+ warn("regbank1 ignored");
return 0;
}
DEBUG { printf("Directive: .ds.[size] = %u, sloc = $%X\n", siz, sloc); }
uint64_t eval;
+ WORD eattr;
if ((cursect & (M6502 | M56KPXYL)) == 0)
{
auto_even();
}
- if (abs_expr(&eval) != OK)
- return 0;
-
+ if (expr(exprbuf, &eval, &eattr, NULL) < 0)
+ return ERROR;
+
// Check to see if the value being passed in is negative (who the hell does
// that?--nobody does; it's the code gremlins, or rum, what does it)
// N.B.: Since 'eval' is of type uint64_t, if it goes negative, it will
rdsp = 0; // Unset DSP assembly
robjproc = 0; // Unset OP assembly
dsp56001 = 0; // Unset 56001 assembly
- regbank = BANK_N; // Set no default register bank
return 0;
}
rgpu = 0; // Unset GPU assembly
robjproc = 0; // Unset OP assembly
dsp56001 = 0; // Unset 56001 assembly
- regbank = BANK_N; // Set no default register bank
return 0;
}