Skip to content

Instantly share code, notes, and snippets.

@dkorolev
Created May 21, 2022 14:27
Show Gist options
  • Save dkorolev/3a53e03d3cf55a27a9752628ffbffcc9 to your computer and use it in GitHub Desktop.
Save dkorolev/3a53e03d3cf55a27a9752628ffbffcc9 to your computer and use it in GitHub Desktop.
N = 8;
ram = [];
for (let i = 0; i < N; ++i) {
ram[0x500 + i] = 0;
}
ram[0] = N;
al = 0
si = 0x500
ram[si] = al
++si;
++al;
ram[si] = al
cx = ram[0]
cx -= 2;
while (cx) {
al = ram[si - 1]
al += ram[si]
++si
ram[si] = al
--cx
}
for (let i = 0; i < 8; ++i) {
console.log(ram[0x500 + i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment