s502 assembler
A very simple assembler for the 6502 line of processors written in C
|
Number module to parse numbers. More...
#include "state.h"
Go to the source code of this file.
Enumerations | |
enum | { OPC_INVALID = 0xff, MAP_MAX_KEY_LEN = 32, NUMBER_ERROR = -1, NUMBER_LABEL_NODEF = -2, STATE_MAX_STRING_LEN = 32, TOKEN_BUFFER_SIZE = 100, TOKEN_SOURCE_FILE_SIZE = 32 } |
Functions | |
int | number_get_number (State *s, char *str) |
interpret a string as a constant, label or number More... | |
int | number_char_to_digit (char c) |
Convert a hex char to a digit. More... | |
Number module to parse numbers.
Handles number in decimal and hex, labels, constants and modifiers
Definition in file number.h.
anonymous enum |
Enumerator | |
---|---|
OPC_INVALID | An invalid opcode to signal invalid / non-existent variations. |
MAP_MAX_KEY_LEN | Key buffer size for Map. |
NUMBER_ERROR | Could not parse a number or constant is undefined. |
NUMBER_LABEL_NODEF | Undefined label. |
STATE_MAX_STRING_LEN | max string length for input/output files |
TOKEN_BUFFER_SIZE | Token max length. |
TOKEN_SOURCE_FILE_SIZE | source filename max length. Longer strings will get truncated. |
int number_char_to_digit | ( | char | c | ) |
Convert a hex char to a digit.
c | char to convert |
Handles upper or lowercase chars
Returns NUMBER_ERROR on failed conversion
Definition at line 12 of file number.c.
References NUMBER_ERROR.
Referenced by instruction_load(), and number_parse_number().
int number_get_number | ( | State * | s, |
char * | str | ||
) |
interpret a string as a constant, label or number
s | State to read constant / label values from |
str | string to interpret |
Definition at line 75 of file number.c.
References number_get_raw().
Referenced by compile_data(), compile_pad(), and token_get_operand().