aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.zc
blob: e730946f3c320b0905be348486288e9a9df38b9b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace core;
include rt;

// the core pokes at headers and raw memory on purpose and runs at full speed: no index bounds checks
unbounded;

// calls the host gate with an operation and three machine-word arguments.
// returns the host result; negative values indicate a failed operation.
int syscall(int operation, word a, word b, word c) {
	return rt.syscall(operation, a, b, c);
}

// the current operand-stack pointer, expressed as a word address.
word dsp() { return rt.dsp(); }
// converts a vm word address to its byte address.
word addr_b(word address) { return rt.addr_b(address); }
// loads one unsigned byte from a byte address.
int ld8(word address) { return rt.ld8(address); }
// stores the low byte of value at a byte address.
int st8(word address, int value) { return rt.st8(address, value); }
// stops execution of the current vm program.
int halt() { return rt.halt(); }