fixed bug where labels could be used before pc definition,

added test files.


git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@344 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2024-02-21 01:26:13 +00:00
parent 08dad45efb
commit 2e2eb5e60c
24 changed files with 56 additions and 10 deletions

View File

@ -321,7 +321,7 @@ static void is_not_defined(struct symbol *optional_symbol, char *name, size_t le
}
dynabuf_clear(errormsg_dyna_buf);
dynabuf_add_string(errormsg_dyna_buf, "Value not defined (");
dynabuf_add_string(errormsg_dyna_buf, "Symbol not defined (");
length += errormsg_dyna_buf->size;
dynabuf_add_string(errormsg_dyna_buf, name);
@ -385,6 +385,7 @@ static void get_symbol_value(scope_t scope, size_t name_length, unsigned int unp
static void parse_program_counter(unsigned int unpseudo_count) // Now GotByte = "*"
{
struct number pc;
struct object *arg;
GetByte();
vcpu_read_pc(&pc);
@ -393,7 +394,10 @@ static void parse_program_counter(unsigned int unpseudo_count) // Now GotByte =
is_not_defined(NULL, "*", 1);
if (unpseudo_count)
pseudopc_unpseudo(&pc, pseudopc_get_context(), unpseudo_count);
PUSH_INT_ARG(pc.val.intval, pc.flags, pc.addr_refs); // FIXME - when undefined pc is allowed, this must be changed for numtype!
// push to arg stack
arg = &arg_stack[arg_sp++];
arg->type = &type_number;
arg->u.number = pc;
}

View File

@ -212,18 +212,13 @@ static int first_symbol_of_statement(void)
static void set_label(scope_t scope, bits force_bit, bits powers)
{
struct symbol *symbol;
struct number pc;
struct object result;
if ((statement_flags & SF_FOUND_BLANK) && config.warn_on_indented_labels)
Throw_first_pass_warning("Label name not in leftmost column.");
symbol = symbol_find(scope);
vcpu_read_pc(&pc); // FIXME - if undefined, check pass.complain_about_undefined and maybe throw "value not defined"!
result.type = &type_number;
result.u.number.ntype = NUMTYPE_INT; // FIXME - if undefined, use NUMTYPE_UNDEFINED!
result.u.number.flags = 0;
result.u.number.val.intval = pc.val.intval;
result.u.number.addr_refs = pc.addr_refs;
vcpu_read_pc(&result.u.number); // FIXME - if undefined, check pass.complain_about_undefined and maybe throw "value not defined"!
symbol_set_object(symbol, &result, powers);
if (force_bit)
symbol_set_force_bit(symbol, force_bit);

View File

@ -133,7 +133,7 @@ static void report_redefinition(struct rwnode *macro_node)
struct macro *original_macro = macro_node->body;
// show warning with location of current definition
Throw_warning(exception_macro_twice);
Throw_warning(exception_macro_twice); // FIXME - throw as info?
// CAUTION, ugly kluge: fiddle with input_now and section_now
// data to generate helpful error messages
input_now->original_filename = original_macro->def_filename;

View File

@ -9,7 +9,7 @@
#define RELEASE "0.97" // update before release FIXME
#define CODENAME "Zem" // update before release
#define CHANGE_DATE "16 Feb" // update before release FIXME
#define CHANGE_DATE "17 Feb" // update before release FIXME
#define CHANGE_YEAR "2024" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME

7
testing/auto/unpseudo.a Normal file
View File

@ -0,0 +1,7 @@
*=$1000
nop
!pseudopc $0300 {
nop
!if * != $0301 { !error "pseudo pc is not $301" }
!if &* != $1002 { !error "un-pseudo'd pc is not $1002" }
}

View File

@ -0,0 +1,4 @@
!macro dings {
}
!macro dings { ; -> "Macro already defined."
}

View File

@ -0,0 +1 @@
!cbm ; -> ""!cbm" is obsolete; use "!ct pet" instead."

View File

@ -0,0 +1,2 @@
*=$1000
!pseudopc $c000 ; -> ""!pseudopc/!realpc" is obsolete; use "!pseudopc {}" instead."

View File

@ -0,0 +1,2 @@
*=$1000
!realpc ; -> ""!pseudopc/!realpc" is obsolete; use "!pseudopc {}" instead."

View File

@ -0,0 +1,2 @@
Zaphod
*=Zaphod ; -> "Symbol not defined." -> "Value not defined."

View File

@ -0,0 +1,3 @@
!cpu 65ce02
*=$1000
sed ; -> "Found SED instruction for CPU with known decimal SBC bug."

View File

@ -0,0 +1,2 @@
!symbollist "dummy.o"
!symbollist "dummy.o" ; -> "Symbol list file name already chosen."

View File

@ -0,0 +1,2 @@
!to "dummy.o", cbm
!to "dummy.o", cbm ; -> "Output file name already chosen."

View File

@ -0,0 +1 @@
result = 3 eor 5 ; -> ""EOR" is deprecated; use "XOR" instead."

View File

@ -0,0 +1 @@
!to "dummy.o" ; -> "Used "!to" without file format indicator."

View File

@ -0,0 +1 @@
result = 3 and 2.7 ; -> "Converted to integer for binary logic operator."

View File

@ -0,0 +1 @@
result = 2.7 and 3 ; -> "Converted to integer for binary logic operator."

View File

@ -0,0 +1,2 @@
*=$1000
jmp ($01ff) ; -> "Assembling buggy JMP($xxff) instruction."

View File

@ -0,0 +1,2 @@
*=$1000
label ; -> "Label name not in leftmost column."

View File

@ -0,0 +1,3 @@
!cpu nmos6502
*=$1000
ane #$ff ; -> "Assembling unstable ANE #NONZERO instruction."

View File

@ -0,0 +1,3 @@
!cpu nmos6502
*=$1000
lxa #$ff ; -> "Assembling unstable LXA #NONZERO instruction."

View File

@ -0,0 +1,4 @@
*=$1000
!for i, 5 { ; -> "Found old "!for" syntax."
nop
}

View File

@ -0,0 +1,2 @@
*=$1000
label beq (label) ; -> "There are unneeded parentheses, you know indirect addressing is impossible here, right?"

View File

@ -0,0 +1,2 @@
*=$1000
 label ; -> "Symbol name starts with a shift-space character."