interpreter.h File Reference

Pseudo-assembler interpreter. More...

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

Include dependency graph for interpreter.h:

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


Data Structures

struct  Register
 Register of the pseudo-assembler. More...
struct  stackElement
 An element in the call stack. More...
struct  CallStack
 The call stack. More...

Typedefs

typedef struct stackElement StackElement
 An element in the call stack.

Enumerations

enum  JumpMode { JUMP_TO_ADDRESS, JUMP_TO_LINE }
 The jump mode to use. More...

Functions

void pasm_init ()
 Initialize the PASM library.
void pasm_free ()
 Free all allocated memory that is still dynamically allocated by the PASM library.
void pasm_reset ()
 Reset the PASM library.
void pasm_setJumpMode (JumpMode mode)
 Set the jump mode.
Register pasm_getRegister ()
 Get the state of the register.
ErrorCode pasm_interpretInstruction (Instruction instruction)
 Interpret a pseudo-assembler instruction.
ErrorCode pasm_compileProgram (const char *program, uint32_t size)
 Compile a pseudo-assembler program.
void pasm_step ()
 Interpret the next instruction.
void pasm_runProgram ()
 Run the whole pseudo-assembler program at once.
void pasm_stopProgram ()
 Stop the current pseudo-assembler program.

Detailed Description

Pseudo-assembler interpreter.

The interpreter is the core of the library. It is mainly used to initialize the library and to start, run and stop pseudo-assembler programs.

Author:
Wesley Stessens

Typedef Documentation

typedef struct stackElement StackElement

An element in the call stack.


Enumeration Type Documentation

enum JumpMode

The jump mode to use.

Enumerator:
JUMP_TO_ADDRESS  Jump to addresses.
JUMP_TO_LINE  Jump to line numbers.


Function Documentation

ErrorCode pasm_compileProgram ( const char *  program,
uint32_t  size 
)

Compile a pseudo-assembler program.

Parameters:
program The program to compile. Each instruction needs to be on a seperate line. Newlines must be used to seperate the lines.
size The number of instructions (or lines) of the pseudo-assembler program.
Note:
You don't necessarily have to know the right value for the size parameter. The PASM library will use the value to determine how much virtual static memory to create because this will allow for faster data seeking. If the size is smaller, the remaining instructions will be allocated as virtual dynamic memory instead.
Returns:
An error code (NO_ERROR if no error occured)

void pasm_free (  ) 

Free all allocated memory that is still dynamically allocated by the PASM library.

Note:
You need to call this when you want to stop using the PASM library.

Register pasm_getRegister (  ) 

Get the state of the register.

Returns:
Copy of the register state

void pasm_init (  ) 

Initialize the PASM library.

Note:
You need to do this before calling any other function in the library.

ErrorCode pasm_interpretInstruction ( Instruction  instruction  ) 

Interpret a pseudo-assembler instruction.

Parameters:
instruction Instruction to interpret
Returns:
An error code (NO_ERROR if no error occured)

void pasm_reset (  ) 

Reset the PASM library.

All resources will be freed and the GUI will be sent the INTERPRETER_RESET signal.

void pasm_runProgram (  ) 

Run the whole pseudo-assembler program at once.

If you want to step through the program step by step, consider using the pasm_step() function.

See also:
pasm_step()

void pasm_setJumpMode ( JumpMode  mode  ) 

Set the jump mode.

Parameters:
mode Jump mode

void pasm_step (  ) 

Interpret the next instruction.

If you want to run the whole pseudo-assembler program at once, consider using the pasm_runProgram() function.

See also:
pasm_runProgram


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