2017-11-22 05:24:51 +00:00
|
|
|
#ifndef _VM_SEGMENT_H_
|
|
|
|
#define _VM_SEGMENT_H_
|
|
|
|
|
2017-12-02 19:05:53 +00:00
|
|
|
#include "vm_bits.h"
|
2017-11-22 05:24:51 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
size_t size;
|
2017-12-02 19:05:53 +00:00
|
|
|
vm_8bit *memory;
|
2017-11-22 05:24:51 +00:00
|
|
|
} vm_segment;
|
|
|
|
|
|
|
|
extern void vm_segment_copy(vm_segment *, vm_segment *, size_t, size_t, size_t);
|
|
|
|
extern vm_segment *vm_segment_create(size_t);
|
2017-12-02 19:05:53 +00:00
|
|
|
extern void vm_segment_free(vm_segment *);
|
|
|
|
extern vm_8bit vm_segment_get(vm_segment *, size_t);
|
|
|
|
extern void vm_segment_set(vm_segment *, size_t, vm_8bit);
|
2017-11-22 05:24:51 +00:00
|
|
|
|
|
|
|
#define vm_segment_bounds_check(segment, index) \
|
|
|
|
(index == index % segment->size)
|
|
|
|
|
|
|
|
#endif
|