Remix.run Logo
curtisblaine 2 days ago

> If A = −1: Read one keypress from the human operator and place a number representing it into slot[B]. (If no key is pressed, place 0.)

> If B = −1: Display slot[A] as one character of text to the human operator.

This is not well specified imho:

1) What if both A and B are -1? I can't do any of the two, or I would read / write an invalid slot (since slots indexes are >= 0)

2) What does "Read a keypress" mean? Should I wait for the operator to press a key? In that case, how can no key be pressed? Timeout? Or should I just check if a key is already pressed when the instruction is executed?

derdi 2 days ago | parent | next [-]

Agreed that the napkin is pretty unclear. You can check the reference VM for clarification of the de facto intended semantics: https://github.com/adriancable/eternal/blob/main/vm/vm.c

anthk 2 days ago | parent | prev [-]

2) putchar() and getchar() in C with a keycode read and written in ASCII.

Read about the simple subleq first, the eternal machine just adds a simple timer and a display on top of subleq.

1) -1 - -1 evaluate to 0 so it should jump to the instruction pointed by the c[inst] cell.

Subleq explained from XXIIVV:

https://wiki.xxiivv.com/site/subleq.html