s502 assembler
A very simple assembler for the 6502 line of processors written in C
Data Structures | Enumerations
token_t.h File Reference

token type struct More...

#include "instructions.h"
#include "addressmode.h"

Go to the source code of this file.

Data Structures

class  Token
 Token type to store token information. More...
 
struct  Token.instr
 instruction data. Not used if token type is not TT_INSTR More...
 
struct  Token.source
 source of this token More...
 

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
}
 
enum  tokenType { TT_INSTR, TT_DIRECTIVE, TT_LABEL }
 possible token types More...
 

Detailed Description

token type struct

Only defines data members to clean up the dependency graph

Definition in file token_t.h.


Data Structure Documentation

◆ Token.instr

struct Token.instr

instruction data. Not used if token type is not TT_INSTR

Definition at line 43 of file token_t.h.

Data Fields
int address address of instruction in resulting bytecode
enum AddressMode addressmode Address mode of the instruction.
Instruction * inst pointer to instruction data
int number operand of the instruction

◆ Token.source

struct Token.source

source of this token

Definition at line 59 of file token_t.h.

Data Fields
char fname[TOKEN_SOURCE_FILE_SIZE] file name of source file
int lineno line in source file

Enumeration Type Documentation

◆ anonymous enum

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.

Definition at line 11 of file token_t.h.

11  {
13  TOKEN_BUFFER_SIZE = 100,
16 };

◆ tokenType

enum tokenType

possible token types

Enumerator
TT_INSTR 

instruction token

TT_DIRECTIVE 

directive token

TT_LABEL 

label token

Definition at line 24 of file token_t.h.

24  {
26  TT_INSTR,
30  TT_LABEL
31 };
TT_INSTR
@ TT_INSTR
instruction token
Definition: token_t.h:26
TOKEN_SOURCE_FILE_SIZE
@ TOKEN_SOURCE_FILE_SIZE
source filename max length. Longer strings will get truncated.
Definition: token_t.h:15
TOKEN_BUFFER_SIZE
@ TOKEN_BUFFER_SIZE
Token max length.
Definition: token_t.h:13
TT_DIRECTIVE
@ TT_DIRECTIVE
directive token
Definition: token_t.h:28
TT_LABEL
@ TT_LABEL
label token
Definition: token_t.h:30