Function will automatically detect and load file version specified within the file.
The only way to set the memory up by hand is to directly modify the memory
and register arrays—refer to the reference for the ERRIC hardware documentation
to determine the needed registers and instruction codes.
Execution
The library offers 2 functions to execute the code—step(struct erric_t* erric)
and execute(struct erric_t* erric), Fig. 20.9. The step() function executes the instruction pointed to by the Program Counter register and directly returns
the status code returned by the instruction. The execute() function executes
instructions one-by-one, starting from PC until it encounters any erroneous status
code. The final status code can be accessed by erric_t->status_code field.
{
struct erric_t* erric = init_erric();
read_file(filename, erric);
step(erric);
execute(erric);
free_erric(erric);
}
Fig. 20.9 Execution struct
304
20 ERRIC Machine Code Simulator
Précédent

- 311/315

Suivant