mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-12 14:04:28 +00:00
Tweaked some CLI error messages and renamed some functions, no change in functionality.
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@67 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
fcbebf8343
commit
9dcb622b3d
15
src/acme.c
15
src/acme.c
@ -17,7 +17,7 @@
|
||||
|
||||
#define RELEASE "0.95.7" // update before release (FIXME)
|
||||
#define CODENAME "Fenchurch" // update before release
|
||||
#define CHANGE_DATE "16 Feb" // update before release
|
||||
#define CHANGE_DATE "21 Feb" // update before release
|
||||
#define CHANGE_YEAR "2016" // 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
|
||||
@ -257,7 +257,8 @@ static int perform_pass(void)
|
||||
flow_parse_and_close_file(fd, toplevel_sources[ii]);
|
||||
} else {
|
||||
fprintf(stderr, "Error: Cannot open toplevel file \"%s\".\n", toplevel_sources[ii]);
|
||||
// FIXME - if "filename" starts with "-", tell user to give options FIRST, files SECOND!
|
||||
if (toplevel_sources[ii][0] == '-')
|
||||
fprintf(stderr, "Options (starting with '-') must be given _before_ source files!\n");
|
||||
++pass_real_errors;
|
||||
}
|
||||
}
|
||||
@ -335,10 +336,8 @@ static void keyword_to_dynabuf(const char keyword[])
|
||||
static void set_output_format(void)
|
||||
{
|
||||
keyword_to_dynabuf(cliargs_safe_get_next("output format"));
|
||||
if (output_set_output_format()) {
|
||||
// FIXME - list actual formats instead of outputting a fixed list!
|
||||
// FIXME - or AT LEAST define error message near the actual format list, so they match!
|
||||
fprintf(stderr, "%sUnknown output format (use 'cbm', 'plain' or 'apple').\n", cliargs_error);
|
||||
if (outputfile_set_format()) {
|
||||
fprintf(stderr, "%sUnknown output format (known formats are: %s).\n", cliargs_error, outputfile_formats);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -354,9 +353,7 @@ static void set_starting_cpu(void)
|
||||
if (new_cpu_type) {
|
||||
default_cpu = new_cpu_type;
|
||||
} else {
|
||||
// FIXME - list actual types instead of outputting a fixed list!
|
||||
// FIXME - or AT LEAST define error message near the actual type list, so they match!
|
||||
fprintf(stderr, "%sUnknown CPU type (use 6502, 6510, c64dtv2, 65c02 or 65816).\n", cliargs_error);
|
||||
fprintf(stderr, "%sUnknown CPU type (known types are: %s).\n", cliargs_error, cputype_names);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// CPU type stuff
|
||||
@ -59,6 +59,7 @@ static struct cpu_type cpu_type_65816 = {
|
||||
// predefined stuff
|
||||
static struct ronode *cputype_tree = NULL;
|
||||
static struct ronode cputype_list[] = {
|
||||
#define KNOWN_TYPES "'6502', '6510', 'c64dtv2', '65c02', '65816'" // shown in CLI error message for unknown types
|
||||
// PREDEFNODE("z80", &cpu_type_Z80),
|
||||
PREDEFNODE("6502", &cpu_type_6502),
|
||||
PREDEFNODE("6510", &cpu_type_6510),
|
||||
@ -66,10 +67,10 @@ static struct ronode cputype_list[] = {
|
||||
PREDEFNODE("65c02", &cpu_type_65c02),
|
||||
// PREDEFNODE("Rockwell65c02", &cpu_type_Rockwell65c02),
|
||||
// PREDEFNODE("WDC65c02", &cpu_type_WDC65c02),
|
||||
PREDEFLAST(s_65816, &cpu_type_65816),
|
||||
PREDEFLAST("65816", &cpu_type_65816),
|
||||
// ^^^^ this marks the last element
|
||||
};
|
||||
|
||||
const char cputype_names[] = KNOWN_TYPES; // string to show if cputype_find() returns NULL
|
||||
|
||||
// lookup cpu type held in DynaBuf and return its struct pointer (or NULL on failure)
|
||||
const struct cpu_type *cputype_find(void)
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// CPU type stuff
|
||||
@ -31,6 +31,7 @@ extern void vcpu_check_and_set_reg_length(int *var, int make_long);
|
||||
extern void cputype_passinit(const struct cpu_type *cpu_type);
|
||||
// lookup cpu type held in DynaBuf and return its struct pointer (or NULL on failure)
|
||||
extern const struct cpu_type *cputype_find(void);
|
||||
extern const char cputype_names[]; // string to show if cputype_find() returns NULL
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// Global stuff - things that are needed by several modules
|
||||
@ -26,7 +26,6 @@
|
||||
|
||||
// constants
|
||||
|
||||
const char s_65816[] = "65816";
|
||||
const char s_and[] = "and";
|
||||
const char s_asl[] = "asl";
|
||||
const char s_asr[] = "asr";
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// Global stuff - things that are needed by several modules
|
||||
@ -21,7 +21,6 @@
|
||||
|
||||
#define SF_FOUND_BLANK (1u << 0) // statement had space or tab
|
||||
#define SF_IMPLIED_LABEL (1u << 1) // statement had implied label def
|
||||
extern const char s_65816[];
|
||||
extern const char s_and[];
|
||||
extern const char s_asl[];
|
||||
extern const char s_asr[];
|
||||
|
16
src/output.c
16
src/output.c
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// Output stuff
|
||||
@ -58,7 +58,7 @@ static struct output *out = &default_output;
|
||||
// FIXME - make static
|
||||
struct vcpu CPU_state; // current CPU state
|
||||
|
||||
// FIXME - move file format stuff to some other .c file!
|
||||
// FIXME - move output _file_ stuff to some other .c file!
|
||||
// possible file formats
|
||||
enum output_format {
|
||||
OUTPUT_FORMAT_UNSPECIFIED, // default (uses "plain" actually)
|
||||
@ -67,8 +67,9 @@ enum output_format {
|
||||
OUTPUT_FORMAT_PLAIN // code only
|
||||
};
|
||||
// predefined stuff
|
||||
static struct ronode *file_format_tree = NULL; // tree to hold output formats
|
||||
static struct ronode *file_format_tree = NULL; // tree to hold output formats (FIXME - a tree for three items, really?)
|
||||
static struct ronode file_format_list[] = {
|
||||
#define KNOWN_FORMATS "'plain', 'cbm', 'apple'" // shown in CLI error message for unknown formats
|
||||
PREDEFNODE("apple", OUTPUT_FORMAT_APPLE),
|
||||
PREDEFNODE(s_cbm, OUTPUT_FORMAT_CBM),
|
||||
// PREDEFNODE("o65", OUTPUT_FORMAT_O65),
|
||||
@ -77,6 +78,7 @@ static struct ronode file_format_list[] = {
|
||||
};
|
||||
// chosen file format
|
||||
static enum output_format output_format = OUTPUT_FORMAT_UNSPECIFIED;
|
||||
const char outputfile_formats[] = KNOWN_FORMATS; // string to show if outputfile_set_format() returns nonzero
|
||||
|
||||
|
||||
// report binary output
|
||||
@ -302,7 +304,7 @@ int output_initmem(char content)
|
||||
|
||||
|
||||
// try to set output format held in DynaBuf. Returns zero on success.
|
||||
int output_set_output_format(void)
|
||||
int outputfile_set_format(void)
|
||||
{
|
||||
void *node_body;
|
||||
|
||||
@ -319,7 +321,7 @@ int output_set_output_format(void)
|
||||
|
||||
// if file format was already chosen, returns zero.
|
||||
// if file format isn't set, chooses CBM and returns 1.
|
||||
int output_prefer_cbm_file_format(void)
|
||||
int outputfile_prefer_cbm_format(void)
|
||||
{
|
||||
if (output_format != OUTPUT_FORMAT_UNSPECIFIED)
|
||||
return 0;
|
||||
@ -329,7 +331,7 @@ int output_prefer_cbm_file_format(void)
|
||||
|
||||
// select output file ("!to" pseudo opcode)
|
||||
// returns zero on success, nonzero if already set
|
||||
int output_set_output_filename(void)
|
||||
int outputfile_set_filename(void)
|
||||
{
|
||||
// if output file already chosen, complain and exit
|
||||
if (output_filename) {
|
||||
@ -551,7 +553,7 @@ void vcpu_set_pc(intval_t new_pc, int segment_flags)
|
||||
Output_start_segment(new_offset, segment_flags);
|
||||
}
|
||||
/*
|
||||
FIXME - TODO:
|
||||
TODO - overhaul program counter and memory pointer stuff:
|
||||
general stuff: PC and mem ptr might be marked as "undefined" via flags field.
|
||||
However, their "value" fields are still updated, so we can calculate differences.
|
||||
|
||||
|
18
src/output.h
18
src/output.h
@ -1,8 +1,8 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// Output stuff
|
||||
// Output stuff (FIXME - split into outbuf, outfile/format and vcpu parts)
|
||||
#ifndef output_H
|
||||
#define output_H
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
// current CPU state
|
||||
// FIXME - move struct definition to .c file and change other .c files' accesses to fn calls
|
||||
// FIXME - move vcpu struct definition to .c file and change other .c files' accesses to fn calls
|
||||
struct vcpu {
|
||||
const struct cpu_type *type; // current CPU type (default 6502) (FIXME - move out of struct again?)
|
||||
struct result pc; // current program counter (pseudo value)
|
||||
@ -30,8 +30,7 @@ struct vcpu {
|
||||
|
||||
|
||||
// variables
|
||||
// FIXME - restrict visibility to .c file
|
||||
extern struct vcpu CPU_state; // current CPU state
|
||||
extern struct vcpu CPU_state; // current CPU state FIXME - restrict visibility to .c file
|
||||
|
||||
|
||||
// Prototypes
|
||||
@ -62,12 +61,13 @@ extern void output_le32(intval_t);
|
||||
// returns zero if ok, nonzero if already set
|
||||
extern int output_initmem(char content);
|
||||
// try to set output format held in DynaBuf. Returns zero on success.
|
||||
extern int output_set_output_format(void);
|
||||
extern int outputfile_set_format(void);
|
||||
extern const char outputfile_formats[]; // string to show if outputfile_set_format() returns nonzero
|
||||
// if file format was already chosen, returns zero.
|
||||
// if file format isn't set, chooses CBM and returns 1.
|
||||
extern int output_prefer_cbm_file_format(void);
|
||||
extern int outputfile_prefer_cbm_format(void);
|
||||
// try to set output file name held in DynaBuf. Returns zero on success.
|
||||
extern int output_set_output_filename(void);
|
||||
extern int outputfile_set_filename(void);
|
||||
// write smallest-possible part of memory buffer to file
|
||||
extern void Output_save_file(FILE *fd);
|
||||
// change output pointer and enable output
|
||||
@ -75,7 +75,7 @@ extern void Output_start_segment(intval_t address_change, int segment_flags);
|
||||
// Show start and end of current segment
|
||||
extern void Output_end_segment(void);
|
||||
|
||||
// set program counter to defined value (FIXME - allow undefined!)
|
||||
// set program counter to defined value (TODO - allow undefined!)
|
||||
extern void vcpu_set_pc(intval_t new_pc, int flags);
|
||||
// get program counter
|
||||
extern void vcpu_read_pc(struct result *target);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// pseudo opcode stuff
|
||||
@ -34,7 +34,6 @@ enum eos {
|
||||
// constants
|
||||
static const char s_08[] = "08";
|
||||
#define s_8 (s_08 + 1) // Yes, I know I'm sick
|
||||
#define s_16 (s_65816 + 3) // Yes, I know I'm sick
|
||||
#define s_sl (s_asl + 1) // Yes, I know I'm sick
|
||||
#define s_rl (s_brl + 1) // Yes, I know I'm sick
|
||||
|
||||
@ -107,13 +106,13 @@ static enum eos po_to(void)
|
||||
if (pass_count)
|
||||
return SKIP_REMAINDER;
|
||||
|
||||
if (output_set_output_filename())
|
||||
if (outputfile_set_filename())
|
||||
return SKIP_REMAINDER;
|
||||
|
||||
// select output format
|
||||
// if no comma found, use default file format
|
||||
if (Input_accept_comma() == FALSE) {
|
||||
if (output_prefer_cbm_file_format()) {
|
||||
if (outputfile_prefer_cbm_format()) {
|
||||
// output deprecation warning
|
||||
Throw_warning("Used \"!to\" without file format indicator. Defaulting to \"cbm\".");
|
||||
}
|
||||
@ -125,7 +124,7 @@ static enum eos po_to(void)
|
||||
if (Input_read_and_lower_keyword() == 0)
|
||||
return SKIP_REMAINDER;
|
||||
|
||||
if (output_set_output_format()) {
|
||||
if (outputfile_set_format()) {
|
||||
// error occurred
|
||||
Throw_error("Unknown output format.");
|
||||
return SKIP_REMAINDER;
|
||||
@ -980,7 +979,7 @@ static struct ronode pseudo_opcode_list[] = {
|
||||
PREDEFNODE("byte", po_byte),
|
||||
PREDEFNODE("wo", po_16),
|
||||
PREDEFNODE("word", po_16),
|
||||
PREDEFNODE(s_16, po_16),
|
||||
PREDEFNODE("16", po_16),
|
||||
PREDEFNODE("be16", po_be16),
|
||||
PREDEFNODE("le16", po_le16),
|
||||
PREDEFNODE("24", po_24),
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ACME - a crossassembler for producing 6502/65c02/65816 code.
|
||||
// Copyright (C) 1998-2014 Marco Baye
|
||||
// Copyright (C) 1998-2016 Marco Baye
|
||||
// Have a look at "acme.c" for further info
|
||||
//
|
||||
// symbol stuff
|
||||
@ -235,6 +235,7 @@ void symbols_list(FILE *fd)
|
||||
|
||||
void symbols_vicelabels(FILE *fd)
|
||||
{
|
||||
// FIXME - if type checking is enabled, maybe only output addresses?
|
||||
// the order of dumped labels is important because VICE will prefer later defined labels
|
||||
// dump unused labels
|
||||
Tree_dump_forest(symbols_forest, ZONE_GLOBAL, dump_vice_unusednonaddress, fd);
|
||||
|
Loading…
Reference in New Issue
Block a user