| 1 |
//cxx . . $ `<file>/src/asm/global.h`/ |
| 2 |
// ACME - a crossassembler for producing 6502/65c02/65816 code. |
| 3 |
// Copyright (C) 1998-2006 Marco Baye |
| 4 |
// Have a look at "acme.c" for further info |
| 5 |
// |
| 6 |
// Global stuff - things that are needed by several modules |
| 7 |
#ifndef global_H |
| 8 |
#define global_Hcxx . . $ `src/asm/global.h:8:9`! |
| 9 |
|
| 10 |
#include <stdio.h> |
| 11 |
#include <stdlib.h> |
| 12 |
#include <setjmp.h> |
| 13 |
#include "config.h"cxx . . $ `<file>/src/asm/config.h`/ |
| 14 |
|
| 15 |
|
| 16 |
// Constants |
| 17 |
|
| 18 |
#define SF_FOUND_BLANKcxx . . $ `src/asm/global.h:18:9`! (1u) // statement had space or tab |
| 19 |
#define SF_IMPLIED_LABELcxx . . $ `src/asm/global.h:19:9`! (2u) // statement had implied label def |
| 20 |
extern const char s_65816cxx . . $ s_65816.[]; |
| 21 |
extern const char s_andcxx . . $ s_and.[]; |
| 22 |
extern const char s_aslcxx . . $ s_asl.[]; |
| 23 |
extern const char s_asrcxx . . $ s_asr.[]; |
| 24 |
extern const char s_brlcxx . . $ s_brl.[]; |
| 25 |
extern const char s_cbmcxx . . $ s_cbm.[]; |
| 26 |
extern const char s_eorcxx . . $ s_eor.[]; |
| 27 |
extern const char s_errorcxx . . $ s_error.[]; |
| 28 |
extern const char s_lsrcxx . . $ s_lsr.[]; |
| 29 |
extern const char s_scrxorcxx . . $ s_scrxor.[]; |
| 30 |
// Error messages during assembly |
| 31 |
extern const char exception_cannot_open_input_filecxx . . $ exception_cannot_open_input_file.[]; |
| 32 |
extern const char exception_missing_stringcxx . . $ exception_missing_string.[]; |
| 33 |
extern const char exception_no_left_bracecxx . . $ exception_no_left_brace.[]; |
| 34 |
extern const char exception_no_memory_leftcxx . . $ exception_no_memory_left.[]; |
| 35 |
extern const char exception_no_right_bracecxx . . $ exception_no_right_brace.[]; |
| 36 |
//extern const char exception_not_yet[]; |
| 37 |
extern const char exception_number_out_of_rangecxx . . $ exception_number_out_of_range.[]; |
| 38 |
extern const char exception_pc_undefinedcxx . . $ exception_pc_undefined.[]; |
| 39 |
extern const char exception_syntaxcxx . . $ exception_syntax.[]; |
| 40 |
// Byte flags table |
| 41 |
extern const char Byte_flagscxx . . $ Byte_flags.[]; |
| 42 |
#define BYTEFLAGScxx . . $ `src/asm/global.h:42:9`!(c) (Byte_flags[(unsigned char) c]) |
| 43 |
#define STARTS_KEYWORDcxx . . $ `src/asm/global.h:43:9`! (1u << 7) // Byte is allowed to start a keyword |
| 44 |
#define CONTS_KEYWORDcxx . . $ `src/asm/global.h:44:9`! (1u << 6) // Byte is allowed in a keyword |
| 45 |
#define BYTEIS_UPCASEcxx . . $ `src/asm/global.h:45:9`! (1u << 5) // Byte is upper case and can be |
| 46 |
// converted to lower case by OR-ing this bit(!) |
| 47 |
#define BYTEIS_SYNTAXcxx . . $ `src/asm/global.h:47:9`! (1u << 4) // special character for input syntax |
| 48 |
#define FOLLOWS_ANONcxx . . $ `src/asm/global.h:48:9`! (1u << 3) // preceding '-' are backward label |
| 49 |
// bits 2, 1 and 0 are unused |
| 50 |
|
| 51 |
|
| 52 |
// Variables |
| 53 |
|
| 54 |
extern node_tcxx . . $ node_t#* pseudo_opcode_treecxx . . $ pseudo_opcode_tree.;// tree to hold pseudo opcodes |
| 55 |
// structures |
| 56 |
enum eos_tcxx . . $ eos_t# { |
| 57 |
SKIP_REMAINDERcxx . . $ SKIP_REMAINDER., // skip remainder of line - (after errors) |
| 58 |
ENSURE_EOScxx . . $ ENSURE_EOS., // make sure there's nothing left in statement |
| 59 |
PARSE_REMAINDERcxx . . $ PARSE_REMAINDER., // parse what's left |
| 60 |
AT_EOS_ANYWAYcxx . . $ AT_EOS_ANYWAY., // actually, same as PARSE_REMAINDER |
| 61 |
}; |
| 62 |
extern int pass_countcxx . . $ pass_count.; |
| 63 |
extern int Process_verbositycxx . . $ Process_verbosity.;// Level of additional output |
| 64 |
extern char GotBytecxx . . $ GotByte.;// Last byte read (processed) |
| 65 |
// Global counters |
| 66 |
extern int pass_undefined_countcxx . . $ pass_undefined_count.;// "NeedValue" type errors in current pass |
| 67 |
extern int pass_real_errorscxx . . $ pass_real_errors.; // Errors yet |
| 68 |
extern signed long max_errorscxx . . $ max_errors.; // errors before giving up |
| 69 |
extern FILEcxx . . $ FILE#* msg_streamcxx . . $ msg_stream.; // set to stdout by --errors_to_stdout |
| 70 |
extern jmp_bufcxx . . $ jmp_buf# exception_envcxx . . $ exception_env.; |
| 71 |
extern char* error_messagecxx . . $ error_message.; |
| 72 |
//extern int cbm_load_address; |
| 73 |
|
| 74 |
// Macros for skipping a single space character |
| 75 |
#define SKIPSPACEcxx . . $ `src/asm/global.h:75:9`!() do {if(GotByte == ' ') GetByte();} while(0) |
| 76 |
#define NEXTANDSKIPSPACEcxx . . $ `src/asm/global.h:76:9`!() do {if(GetByte() == ' ') GetByte();} while(0) |
| 77 |
|
| 78 |
|
| 79 |
// Prototypes |
| 80 |
|
| 81 |
// Allocate memory and die if not available |
| 82 |
extern inline void* safe_malloccxx . . $ safe_malloc(bfcfa4d6b7f7ef64).(size_tcxx . . $ size_t#); |
| 83 |
// Parse block, beginning with next byte. |
| 84 |
// End reason (either CHAR_EOB or CHAR_EOF) can be found in GotByte afterwards |
| 85 |
// Has to be re-entrant. |
| 86 |
extern void Parse_until_eob_or_eofcxx . . $ Parse_until_eob_or_eof(49f6e7a06ebc5aa8).(void); |
| 87 |
// Skip space. If GotByte is CHAR_SOB ('{'), parse block and return TRUE. |
| 88 |
// Otherwise (if there is no block), return FALSE. |
| 89 |
// Don't forget to call EnsureEOL() afterwards. |
| •90 |
extern boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! Parse_optional_blockcxx . . $ Parse_optional_block(c9857a73d68e59ba).(void); |
| 91 |
// Output a warning. |
| 92 |
// This means the produced code looks as expected. But there has been a |
| 93 |
// situation that should be reported to the user, for example ACME may have |
| 94 |
// assembled a 16-bit parameter with an 8-bit value. |
| 95 |
extern void Throw_warningcxx . . $ Throw_warning(85c52e162fed56f9).(const char*); |
| 96 |
// Output a warning if in first pass. See above. |
| 97 |
extern void Throw_first_pass_warningcxx . . $ Throw_first_pass_warning(85c52e162fed56f9).(const char*); |
| 98 |
// Output an error. |
| 99 |
// This means something went wrong in a way that implies that the output |
| 100 |
// almost for sure won't look like expected, for example when there was a |
| 101 |
// syntax error. The assembler will try to go on with the assembly though, so |
| 102 |
// the user gets to know about more than one of his typos at a time. |
| 103 |
extern void Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(const char*); |
| 104 |
// Output a serious error, stopping assembly. |
| 105 |
// Serious errors are those that make it impossible to go on with the |
| 106 |
// assembly. Example: "!fill" without a parameter - the program counter cannot |
| 107 |
// be set correctly in this case, so proceeding would be of no use at all. |
| 108 |
extern void Throw_serious_errorcxx . . $ Throw_serious_error(85c52e162fed56f9).(const char*); |
| 109 |
// Handle bugs |
| 110 |
extern void Bug_foundcxx . . $ Bug_found(34d26762b42c433a).(const char*, int); |
| 111 |
|
| 112 |
|
| 113 |
#endif |