helper.h File Reference

Helper functionality for all other files. More...

#include "errorcodes.h"
#include <stdint.h>

Include dependency graph for helper.h:

This graph shows which files directly or indirectly include this file:


Data Structures

struct  Instruction
 Representation of an instruction in an easily accessible structure. More...

Defines

#define NO_ADDRESSING   0x0
 Address mode: no addressing.
#define IMMEDIATE_ADDRESSING   0x0
 Address mode: immediate addressing.
#define DIRECT_ADDRESSING   0x1
 Address mode: direct addressing.
#define INDIRECT_ADDRESSING   0x2
 Address mode: indirect addressing.
#define NO_OPERAND   0xffffff
 Value for the operand when no operand has been given.

Enumerations

enum  Boolean { _FALSE = 0, _TRUE = 1 }
 Boolean type. More...

Functions

Instruction pasm_stringToInstruction (char *line, ErrorCode *error)
 Compile a string into an instruction.
char * pasm_instructionToString (Instruction instruction)
 Get a string representation of an instruction.
uint32_t pasm_instructionToValue (Instruction instruction)
 Convert an instruction to its numerical value.
Instruction pasm_valueToInstruction (int32_t value)
 Convert a numerical value to an instruction.
int32_t pasm_getSignedValue (uint32_t unsignedValue)
 Convert an unsigned value into a signed value.
uint32_t pasm_getUnsignedValue (int32_t signedValue)
 Convert a signed value into an unsigned value.

Detailed Description

Helper functionality for all other files.

Author:
Wesley Stessens

Enumeration Type Documentation

enum Boolean

Boolean type.

Note:
To avoid conflicts with other libraries, the values for FALSE and TRUE are prepended with an underscore.
Enumerator:
_FALSE  Value for false.
_TRUE  Value for true.


Function Documentation

int32_t pasm_getSignedValue ( uint32_t  unsignedValue  ) 

Convert an unsigned value into a signed value.

Parameters:
unsignedValue The unsigned value
Returns:
Signed value

uint32_t pasm_getUnsignedValue ( int32_t  signedValue  ) 

Convert a signed value into an unsigned value.

Parameters:
signedValue The signed value
Returns:
Unsigned value

char* pasm_instructionToString ( Instruction  instruction  ) 

Get a string representation of an instruction.

Parameters:
instruction Instruction to get a string representation for
Returns:
String representation of the instruction
Note:
The string returned by this function must be freed after you are done using it!

uint32_t pasm_instructionToValue ( Instruction  instruction  ) 

Convert an instruction to its numerical value.

Parameters:
instruction Instruction to convert
Returns:
Numerical value of the instruction

Instruction pasm_stringToInstruction ( char *  line,
ErrorCode error 
)

Compile a string into an instruction.

Note:
This function changes the line variable. Be careful.
Parameters:
line String representation of an instruction to compile into an actual instruction
error An error code (NO_ERROR if no error occured)
Returns:
The compiled instruction

Instruction pasm_valueToInstruction ( int32_t  value  ) 

Convert a numerical value to an instruction.

Parameters:
value Numerical value to convert
Returns:
Instruction that is compiled from the value


Generated on Thu Jun 11 02:07:49 2009 for PASM by  doxygen 1.5.6