diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-23 13:36:35 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-23 13:36:35 -0500 |
commit | 6826d32ca70ec6b6e751813bb595b6ade288cb69 (patch) | |
tree | 0322d95d880083f608492be73f66918be15c01c9 /src/vm/vm.js | |
parent | c7f8ede9223502a96a74adf0cb790ac41de04742 (diff) |
add random non-overlapping ranges in core
Diffstat (limited to 'src/vm/vm.js')
-rw-r--r-- | src/vm/vm.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/vm/vm.js b/src/vm/vm.js new file mode 100644 index 0000000..1ec890b --- /dev/null +++ b/src/vm/vm.js @@ -0,0 +1,36 @@ +'use strict'; + + +const { Core } = require('./core.js'); +const { + DAT, + MOV, ADD, SUB, CMP, SLT, + JMP, JMZ, JMN, DJN, SPL, +} = require('./instruction.js'); + + +class Warrior { + constructor(start) { + this.queue = [start]; + } + + isDead() { return (this.queue.length === 0); } + + append(heads) { + this.queue.push(...heads); + } + + next() { + const pc = this.queue[0]; + this.queue = this.queue.slice(1); + return next; + } +}; + + +class RedcodeVm { + constructor(coresize, warriors) { + this.core = new Core(coresize); + + } +}; |