Skip to content

Commit

Permalink
docs: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MeerkatBoss committed Oct 18, 2022
1 parent d5f3439 commit 12cb247
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/asm/asm_flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@

#include "argparser.h"

/**
* @brief
* Output file name
*/
#define output_file (*output_file_addr_())

/**
* @brief
* Listing file name
*/
#define listing_file (*listing_file_addr_())

const char** output_file_addr_();
Expand Down
38 changes: 38 additions & 0 deletions src/asm/asm_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include "assembler.h"
#include "text_lines.h"

/**
* @brief
* Asssembly result description
*/
enum assembly_result
{
ASM_SUCCESS = 0,
Expand All @@ -24,28 +28,62 @@ enum assembly_result
ASM_FIXUP_OVF = -4
};

/**
* @brief
* Maximum length of label name
*/
const size_t MAX_LABEL_LEN = 32;

/**
* @brief
* Assembler label description
*/
struct asm_label
{
char name[MAX_LABEL_LEN];
ssize_t addr;
};

/**
* @brief
* Unknown label reference
*/
struct fixup
{
size_t label_number;
size_t addr;
};

/**
* @brief
* Assembler constant definition
*/
struct asm_def
{
char name[MAX_LABEL_LEN];
int value;
};

/**
* @brief
* Maximum allowed number of labels in a program
*/
const size_t MAX_LABELS = 64;

/**
* @brief
* Maximum allowed number of unknown label references
*/
const size_t MAX_FIXUPS = MAX_LABELS * 4;

/**
* @brief
* State of assembly process
*
* @warning
* Size of this struct exceeds 8kB. Avoid stack-allocating or
* copying it
*/
struct assembly_state
{
padded_header header;
Expand Down

0 comments on commit 12cb247

Please sign in to comment.