News for hackers. Stuff that matters.
Re:Show HN: dcpubin - a pastebin for DCPU-16 programs by lloeki on Monday April 09, 2012 @05:40AM (#3816333)
In my implementation I simply set my run loop to break out if last_pc == cpu.pc.

Thus an HLT instruction is virtually equivalent to an instruction setting the PC back to PC itself, which, unless an outside force sets PC or [PC] to something else (think shared memory between multiple CPUs), is an unbreakable infinite loop.

Re:Show HN: dcpubin - a pastebin for DCPU-16 programs by dy9 on Monday April 09, 2012 @06:55PM (#3819718)
SET PC, [SP++]

SET PC, [--SP]

SET PC, [location with I/O]

Re:Show HN: dcpubin - a pastebin for DCPU-16 programs by lloeki on Wednesday April 11, 2012 @02:57PM (#3829050)
> SET PC, [SP++] > SET PC, [--SP]

Good call, detecting (PC, SP) fixed point then, although using the stack to jump onto itself is wicked. I don't want to go and solve the halting problem either.

> SET PC, [location with I/O]

Qualifies as outside force. I'm not sure I want to write/run a program that JMP to an @ provided by I/O, this reads like an SQL injection.