Beispiel #1
0
	// if label dump file already chosen, complain and exit
	if (labeldump_filename) {
		Throw_warning("Label dump file already chosen.");
		return SKIP_REMAINDER;
	}

	// get malloc'd copy of filename
	labeldump_filename = DynaBuf_get_copy(GlobalDynaBuf);
	// ensure there's no garbage at end of line
	return ENSURE_EOS;
}


// predefined stuff
static struct node_t	pseudo_opcodes[]	= {
	PREDEFNODE("set",	PO_set),
	PREDEFLAST(s_sl,	PO_sl),
	//    ^^^^ this marks the last element
};


// Parse implicit label definition (can be either global or local).
// GlobalDynaBuf holds the label name.
void Label_implicit_definition(zone_t zone, int stat_flags, int force_bit, int change)
{
	struct result_t	result;
	struct label_t	*label;

	label = Label_find(zone, force_bit);
	// implicit label definition (label)
	if ((stat_flags & SF_FOUND_BLANK) && warn_on_indented_labels)
Beispiel #2
0
// Variables
input_t*	Input_now	= &outermost;	// current input structure


// End of source file ("!endoffile" or "!eof")
static enum eos_t PO_eof(void) {
	// Well, it doesn't end right here and now, but at end-of-line! :-)
	Input_ensure_EOS();
	Input_now->state = INPUTSTATE_EOF;
	return(AT_EOS_ANYWAY);
}

// predefined stuff
static node_t	pseudo_opcodes[]	= {
	PREDEFNODE("eof",	PO_eof),
	PREDEFLAST("endoffile",	PO_eof),
	//    ^^^^ this marks the last element
};


// Functions

// register pseudo opcodes
void Input_init(void) {
	Tree_add_table(&pseudo_opcode_tree, pseudo_opcodes);
}

// Let current input point to start of file
void Input_new_file(char *src) {
/*
Beispiel #3
0
const struct encoder	encoder_pet	= {
	encoderfn_pet
};
const struct encoder	encoder_scr	= {
	encoderfn_scr
};
const struct encoder	encoder_file	= {
	encoderfn_file
};


// keywords for "!convtab" pseudo opcode
static struct ronode	*encoder_tree	= NULL;	// tree to hold encoders
static struct ronode	encoder_list[]	= {
//no!	PREDEFNODE("file",	&encoder_file),	"!ct file" is not needed; just use {} after initial loading of table!
	PREDEFNODE(s_pet,	&encoder_pet),
	PREDEFNODE(s_raw,	&encoder_raw),
	PREDEFLAST(s_scr,	&encoder_scr),
	//    ^^^^ this marks the last element
};


// exported functions


// convert character using current encoding (exported for use by alu.c and pseudoopcodes.c)
char encoding_encode_char(char byte)
{
	return encoder_current->fn(byte);
}
Beispiel #4
0
		Section_now->type = type_zone;// change type to "zone"
	}
	return(ENSURE_EOS);
}

// Start subzone ("!subzone" or "!sz"). Has to be re-entrant.
static enum eos_t PO_subzone(void) {
	// output deprecation warning
	Throw_first_pass_warning("\"!subzone {}\" is deprecated; use \"!zone {}\" instead.");
	// call "!zone" instead
	return(PO_zone());
}

// predefined stuff
static node_t	pseudo_opcodes[]	= {
	PREDEFNODE(s_zone,	PO_zone),
	PREDEFNODE("zn",	PO_zone),
	PREDEFNODE(s_subzone,	PO_subzone),
	PREDEFLAST("sz",	PO_subzone),
	//    ^^^^ this marks the last element
};

// register pseudo opcodes
void Section_init(void) {
	Tree_add_table(&pseudo_opcode_tree, pseudo_opcodes);
}

// Setup outermost section
void Section_passinit(void) {
	zone_max = ZONE_GLOBAL;// will be incremented by next line
	Section_new_zone(&outer_section, type_zone, untitled, FALSE);
Beispiel #5
0
	ID_UNTIL,	// Handles to store instead of
	ID_WHILE,	// the UNTIL and WHILE keywords
};
typedef struct {
	enum cond_key_t	type;	// either ID_UNTIL or ID_WHILE
	int		line;	// original line number
	char*		body;	// pointer to actual expression
} loopcond_t;


// Variables

// predefined stuff
static node_t*	condkey_tree	= NULL;// tree to hold UNTIL and WHILE
static node_t	condkeys[]	= {
	PREDEFNODE("until",	ID_UNTIL),
	PREDEFLAST("while",	ID_WHILE),
	//    ^^^^ this marks the last element
};


// Helper functions for "!for" and "!do"

// Parse a loop body (could also be used for macro body)
static void parse_ram_block(int line_number, char* body) {
	Input_now->line_number = line_number;// set line number to loop start
	Input_now->src.ram_ptr = body;// set RAM read pointer to loop
	// Parse loop body
	Parse_until_eob_or_eof();
	if(GotByte != CHAR_EOB)
		Bug_found("IllegalBlockTerminator", GotByte);
Beispiel #6
0
	FALSE			// short xy
};
#define s_rl	(s_brl + 1)	// Yes, I know I'm sick


// variables
struct cpu_t		*CPU_now;	// struct of current CPU type (default 6502)
struct result_int_t	CPU_pc;		// (pseudo) program counter at start of statement
int			CPU_2add;	// increase PC by this after statement
static intval_t	current_offset;	// PseudoPC - MemIndex (FIXME - why is this needed?)
static int	uses_pseudo_pc;	// offset assembly active?	FIXME - what is this for?
// predefined stuff
static struct node_t	*CPU_tree	= NULL;	// tree to hold CPU types
static struct node_t	CPUs[]	= {
//	PREDEFNODE("z80",		&CPU_Z80),
	PREDEFNODE("6502",		&CPU_6502),
	PREDEFNODE("6510",		&CPU_6510),
	PREDEFNODE("65c02",		&CPU_65c02),
//	PREDEFNODE("Rockwell65c02",	&CPU_Rockwell65c02),
//	PREDEFNODE("WDC65c02",		&CPU_WDC65c02),
	PREDEFLAST(s_65816,		&CPU_65816),
	//    ^^^^ this marks the last element
};


// insert byte until PC fits condition
static enum eos_t PO_align(void) {
	intval_t	and,
			equal,
			fill,
			test	= CPU_pc.intval;
Beispiel #7
0
	return(throw_string("!warn: ", Throw_warning));
}

// throw error as given in source code
static enum eos_t PO_error(void) {
	return(throw_string("!error: ", Throw_error));
}

// throw serious error as given in source code
static enum eos_t PO_serious(void) {
	return(throw_string("!serious: ", Throw_serious_error));
}

// pseudo ocpode table
static node_t	pseudo_opcodes[]	= {
	PREDEFNODE(s_08,	PO_08),
	PREDEFNODE(s_8,		PO_08),
	PREDEFNODE("by",	PO_08),
	PREDEFNODE("byte",	PO_08),
	PREDEFNODE(s_16,	PO_16),
	PREDEFNODE("wo",	PO_16),
	PREDEFNODE("word",	PO_16),
	PREDEFNODE("24",	PO_24),
	PREDEFNODE("32",	PO_32),
	PREDEFNODE("bin",	PO_binary),
	PREDEFNODE("binary",	PO_binary),
	PREDEFNODE("fi",	PO_fill),
	PREDEFNODE("fill",	PO_fill),
//	PREDEFNODE("print",	PO_print),
	PREDEFNODE("warn",	PO_warn),
	PREDEFNODE(s_error,	PO_error),