Release 0.94.11: Number arguments to !warn, !error and !serious are now output in hex format as well. Also changed docs accordingly.

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@32 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye
2014-05-28 21:39:15 +00:00
parent 6c59f05179
commit 8b2c8187a2
9 changed files with 49 additions and 54 deletions

View File

@@ -454,29 +454,35 @@ Example: rts ; some assembler mnemonic
"!eof" is reached.
Call: !warn STRING_VALUE
Call: !warn STRING_VALUE [, STRING_VALUE]*
Purpose: Show a warning during assembly.
Parameters: STRING_VALUE: A string given in double quotes.
Parameters: STRING_VALUE: Can be either a string given in double
quotes or any formula the value parser accepts.
Numbers will be output in decimal _and_ hex format.
Example: !if * > $a000 {
!warn "Program reached ROM area."
!warn "Program reached ROM: ", * - $a000, " bytes overlap."
}
Call: !error STRING_VALUE
Call: !error STRING_VALUE [, STRING_VALUE]*
Purpose: Generate an error during assembly (therefore, no
output file will be generated).
Parameters: STRING_VALUE: A string given in double quotes.
Parameters: STRING_VALUE: Can be either a string given in double
quotes or any formula the value parser accepts.
Numbers will be output in decimal _and_ hex format.
Example: rts ; end of some function
start !source "colors.a"
end !if end - start > 256 {
!error "Color strings exceed 256 chars!"
!error "Color strings are ", end - start - 256, " bytes too long."
}
Call: !serious STRING_VALUE
Call: !serious STRING_VALUE [, STRING_VALUE]*
Purpose: Generate a serious error, immediately stopping
assembly.
Parameters: STRING_VALUE: A string given in double quotes.
Parameters: STRING_VALUE: Can be either a string given in double
quotes or any formula the value parser accepts.
Numbers will be output in decimal _and_ hex format.
Example: !source "part1.a" ; sets part1_version
!source "part2.a" ; sets part2_version
!if part1_version != part2_version {

View File

@@ -12,6 +12,14 @@ platform used. There should be another help file in this archive
outlining the platform specific changes.
----------------------------------------------------------------------
Section: New in release 0.94.11
----------------------------------------------------------------------
If !warn, !error and !serious are called with numbers, those will now
be output in hex format as well. Also mentioned this in docs.
----------------------------------------------------------------------
Section: New in release 0.94.10
----------------------------------------------------------------------

View File

@@ -15,9 +15,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define RELEASE "0.94.10" // update before release (FIXME)
#define RELEASE "0.94.11" // update before release (FIXME)
#define CODENAME "Zarquon" // update before release
#define CHANGE_DATE "17 May" // update before release
#define CHANGE_DATE "28 May" // update before release
#define CHANGE_YEAR "2014" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" // FIXME
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME

View File

@@ -434,6 +434,7 @@ static void parse_decimal_value(void) // Now GotByte = first digit
intval_t intval = (GotByte & 15); // this works. it's ASCII.
GetByte();
// TODO - add "0b" prefix for binary values?
if ((intval == 0) && (GotByte == 'x')) {
parse_hexadecimal_value();
return;

View File

@@ -164,24 +164,27 @@ static enum eos throw_string(const char prefix[], void (*fn)(const char *))
ALU_any_result(&result);
if (result.flags & MVALUE_IS_FP) {
// floating point
if (result.flags & MVALUE_DEFINED)
DynaBuf_add_double(
user_message,
result.val.fpval);
else
DynaBuf_add_string(
user_message,
"<UNDEFINED FLOAT>");
if (result.flags & MVALUE_DEFINED) {
char buffer[40];
// write up to 30 significant characters.
// remaining 10 should suffice for sign,
// decimal point, exponent, terminator etc.
sprintf(buffer, "%.30g", result.val.fpval);
DynaBuf_add_string(user_message, buffer);
} else {
DynaBuf_add_string(user_message, "<UNDEFINED FLOAT>");
}
} else {
// integer
if (result.flags & MVALUE_DEFINED)
DynaBuf_add_signed_long(
user_message,
result.val.intval);
else
DynaBuf_add_string(
user_message,
"<UNDEFINED INT>");
if (result.flags & MVALUE_DEFINED) {
char buffer[32]; // 11 for dec, 8 for hex
sprintf(buffer, "%ld (0x%lx)", (long) result.val.intval, (long) result.val.intval);
DynaBuf_add_string(user_message, buffer);
} else {
DynaBuf_add_string(user_message, "<UNDEFINED INT>");
}
}
}
} while (Input_accept_comma());

View File

@@ -1,5 +1,5 @@
// ACME - a crossassembler for producing 6502/65c02/65816 code.
// Copyright (C) 1998-2009 Marco Baye
// Copyright (C) 1998-2014 Marco Baye
// Have a look at "acme.c" for further info
//
// Configuration
@@ -10,7 +10,6 @@
// types
typedef unsigned int zone_t;
typedef signed long intval_t; // at least 32 bits
#define INTVAL_MAXCHARACTERS 11 // -2^32 takes 11 characters
typedef unsigned long uintval_t; // just for logical shift right
// result structure type definition with support for floating point
struct result_t { // either int or float

View File

@@ -95,7 +95,7 @@ void DynaBuf_add_string(struct dynabuf *db, const char *string)
while ((byte = *string++))
DYNABUF_APPEND(db, byte);
}
/*
// make sure DynaBuf is large enough to take "size" more bytes
// return pointer to end of current contents
static char *ensure_free_space(struct dynabuf *db, int size)
@@ -103,25 +103,7 @@ static char *ensure_free_space(struct dynabuf *db, int size)
while ((db->reserved - db->size) < size)
resize(db, MAKE_LARGER_THAN(db->reserved));
return db->buffer + db->size;
}
// add string version of int to buffer (without terminator)
void DynaBuf_add_signed_long(struct dynabuf *db, signed long value)
{
char *write = ensure_free_space(db, INTVAL_MAXCHARACTERS + 1);
db->size += sprintf(write, "%ld", value);
}
// add string version of float to buffer (without terminator)
void DynaBuf_add_double(struct dynabuf *db, double value)
{
char *write = ensure_free_space(db, 40); // reserve 40 chars
// write up to 30 significant characters. remaining 10 should suffice
// for sign, decimal point, exponent, terminator etc.
db->size += sprintf(write, "%.30g", value);
}
}*/
// Convert buffer contents to lower case (target and source may be identical)
void DynaBuf_to_lower(struct dynabuf *target, struct dynabuf *source)

View File

@@ -46,10 +46,6 @@ extern void DynaBuf_enlarge(struct dynabuf *db);
extern char *DynaBuf_get_copy(struct dynabuf *db);
// copy string to buffer (without terminator)
extern void DynaBuf_add_string(struct dynabuf *db, const char *);
// add string version of int to buffer (without terminator)
extern void DynaBuf_add_signed_long(struct dynabuf *db, signed long value);
// add string version of float to buffer (without terminator)
extern void DynaBuf_add_double(struct dynabuf *db, double value);
// converts buffer contents to lower case
extern void DynaBuf_to_lower(struct dynabuf *target, struct dynabuf *source);
// add char to buffer

View File

@@ -577,7 +577,7 @@ static void not_in_bank(intval_t target)
{
char buffer[60]; // 640K should be enough for anybody
sprintf(buffer, "Target not in bank (0x%lx).", target);
sprintf(buffer, "Target not in bank (0x%lx).", (long) target);
Throw_error(buffer);
}
@@ -601,7 +601,7 @@ static void group_only_relative8_addressing(int opcode)
if ((offset < -128) || (offset > 127)) {
char buffer[60]; // 640K should be enough for anybody
sprintf(buffer, "Target out of range (%ld; %ld too far).", offset, offset < -128 ? -128 - offset : offset - 127);
sprintf(buffer, "Target out of range (%ld; %ld too far).", (long) offset, (long) (offset < -128 ? -128 - offset : offset - 127));
Throw_error(buffer);
}
}