First step to making tape file names arbitrary
This commit is contained in:
parent
556b9473e0
commit
c1e55502d9
2
vm.c
2
vm.c
|
@ -61,6 +61,8 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Perform all the essential stages in order */
|
||||
struct lilith* vm;
|
||||
tape_01_name = "tape_01";
|
||||
tape_02_name = "tape_02";
|
||||
vm = create_vm(1 << 21);
|
||||
load_program(vm, argv);
|
||||
execute_vm(vm);
|
||||
|
|
4
vm.h
4
vm.h
|
@ -258,3 +258,7 @@ void destroy_vm(struct lilith* vm);
|
|||
void read_instruction(struct lilith* vm, struct Instruction *current);
|
||||
void eval_instruction(struct lilith* vm, struct Instruction* current);
|
||||
void outside_of_world(struct lilith* vm, uint32_t place, char* message);
|
||||
|
||||
/* Allow tape names to be effectively changed */
|
||||
char* tape_01_name;
|
||||
char* tape_02_name;
|
||||
|
|
|
@ -163,12 +163,12 @@ void vm_FOPEN_READ(struct lilith* vm)
|
|||
{
|
||||
if(0x00001100 == vm->reg[0])
|
||||
{
|
||||
tape_01 = fopen("tape_01", "r");
|
||||
tape_01 = fopen(tape_01_name, "r");
|
||||
}
|
||||
|
||||
if (0x00001101 == vm->reg[0])
|
||||
{
|
||||
tape_02 = fopen("tape_02", "r");
|
||||
tape_02 = fopen(tape_02_name, "r");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,12 +176,12 @@ void vm_FOPEN_WRITE(struct lilith* vm)
|
|||
{
|
||||
if(0x00001100 == vm->reg[0])
|
||||
{
|
||||
tape_01 = fopen("tape_01", "w");
|
||||
tape_01 = fopen(tape_01_name, "w");
|
||||
}
|
||||
|
||||
if (0x00001101 == vm->reg[0])
|
||||
{
|
||||
tape_02 = fopen("tape_02", "w");
|
||||
tape_02 = fopen(tape_02_name, "w");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue