News for hackers. Stuff that matters.
Re:Show HN: dcpubin - a pastebin for DCPU-16 programs by swalsh on Sunday April 08, 2012 @06:02PM (#3815051)
The javascript version of the CPU seems to be turning into something really cool.

Here a person made a real-time IDE: http://dwilliamson.github.com/

Re:Show HN: dcpubin - a pastebin for DCPU-16 programs by someone13 on Sunday April 08, 2012 @07:45PM (#3815271)
Worth noting that since there's no "halt" instruction, people often use an endless loop to designate the end of the program. This causes Chrome, at least, to suck up a lot of CPU.
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.

Re:Show HN: dcpubin - a pastebin for DCPU-16 programs by tkahn6 on Sunday April 08, 2012 @07:53PM (#3815285)
As far as I've seen, the de facto convention is to have a BRK mnemonic with a total instruction value of 0x0000. It has the nice property of causing a halt when uninitialized memory is executed.