mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 23:29:16 +00:00
Make use of our read/write mappers
This commit is contained in:
parent
e019b6daee
commit
7da3c2ec20
@ -95,6 +95,12 @@ vm_segment_set(vm_segment *segment, size_t index, vm_8bit value)
|
|||||||
return ERR_OOB;
|
return ERR_OOB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if we have a write mapper
|
||||||
|
if (segment->write_table[index]) {
|
||||||
|
segment->write_table[index](segment, index, value);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
segment->memory[index] = value;
|
segment->memory[index] = value;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -117,6 +123,11 @@ vm_segment_get(vm_segment *segment, size_t index)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We may have a read mapper for this address
|
||||||
|
if (segment->read_table[index]) {
|
||||||
|
return segment->read_table[index](segment, index);
|
||||||
|
}
|
||||||
|
|
||||||
return segment->memory[index];
|
return segment->memory[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user