23 comments

[ 3.0 ms ] story [ 55.5 ms ] thread
This is a really cool idea! I could see people using this as a testing ground to learn the instruction set as well. Especially if you can make the "paste your code, share your link" part of it as easy as pasting into a single obvious text box (like with pastebin).

If you can make it easy to browse the snippets that would be great. It's probably important to get that working right away so that people can play with different programs and get a feel for the instruction set. (Plus people like to have their stuff seen by others.)

Can't wait to see where this is heading, as well as your JS implementation of DCPU.

Thanks! yes, this is just the minimal feature set (save code, share link). I'm trying to think of a good way to show an index of snippets (and/or if that means people would want private pastes as well). i'm hoping to implement features based on community/user feedback.
I'm starting to think we need a dcpu.ycombinator.com.
Only if you think we also need(ed) the following:

  bitcoin.ycombinator.com
  sopa.ycombinator.com
  apple|facebook|google.ycombinator.com
  privacy-issues.ycombinator.com
  techcrunch.ycombinator.com
  mpaa.ycombinator.com
  ...
I think we'll survive.
This is HN. I'm sure that someone will build some kind of hub site for DCPU-related stuff in short order. Heck, I was toying with the idea myself before most of the weekend escaped from me.

There's already a wiki, GitHub organization, and IRC channel that I know of. If there's no mailing list, there will be.

Anyone else read this as dc-pubin'? >.>
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/

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.
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.
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.

SET PC, [SP++]

SET PC, [--SP]

SET PC, [location with I/O]

> 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.

I'm only getting errors when trying this.

  Error: Subroutine crash
  was not defined (address 40)
Just wrote my first assembler program ever! Thanks, OP.

Prints factorial table (2 columns - index and result) in console display.

http://dcpubin.com/eshsuZqgq

that is seriously cool! congrats on your first asm program :)
Very nice idea.

Is there any easy way to differentiate between programs that definitely work in 0x10C and programs using hypothetical features?

Will there be any way to report programs that are malware? Or to correct the descriptions of supposedly innocent softs that are not innocent?

i'm planning to keep the emulator adhering to only published specs by notch. the only exception is the extra BRK instruction which will stop execution in the emulator.

if malware becomes a problem, i'll address it then, but that's also part of the game...

Malware is part of the game, so it's interesting to see how external sites deal with it. Do they go along with the meta game of people trying to spread malware ("it's at your own risk") or do they try to protect people from malware? Either approach is acceptable, in my opinion.

Good luck!