diff --git a/source/assembler.c b/source/assembler.c index 2c7e13c..e60a6af 100644 --- a/source/assembler.c +++ b/source/assembler.c @@ -290,14 +290,21 @@ static void build_move (size_index size, print ((to == MEM) && (from == IMM), size, source); } -next token_count; -byte * token_array; +next token_count = 0; +byte * token_array = NULL; + +int error_empty_array = 0; void assemble (next count, next * array) { /* */ next index; + if ((count == 0) || (array == NULL)) { + error_empty_array = 1; + return; + } + for (index = 0; index < count; ++index) { if ((array [index] >= REGULAR_BEGIN) && (array [index] <= REGULAR_END)) { diff --git a/source/assembler.h b/source/assembler.h index 888948d..d3a94a2 100644 --- a/source/assembler.h +++ b/source/assembler.h @@ -65,6 +65,8 @@ typedef enum { extern next token_count; extern byte * token_array; +extern int error_empty_array; + extern void assemble (next count, next * array); #define ASSEMBLER_H