

Show HN: dcpubin - a pastebin for DCPU-16 programs - jazzychad
http://dcpubin.com/

======
swalsh
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/>

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

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

~~~
dy9
SET PC, [SP++]

SET PC, [--SP]

SET PC, [location with I/O]

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

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

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

------
jazzychad
a few of examples:

fibonacci recursive: <http://dcpubin.com/ppJrob0g2>

fibonacci tail-call: <http://dcpubin.com/epaCb-NI2>

itoa: <http://dcpubin.com/puu5gf0C6>

------
pagekalisedown
I'm starting to think we need a dcpu.ycombinator.com.

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

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

~~~
kylemaxwell
There's also a subreddit.

<http://reddit.com/r/dcpu16>

------
atamyrat
Just wrote my first assembler program ever! Thanks, OP.

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

<http://dcpubin.com/eshsuZqgq>

~~~
jazzychad
that is seriously cool! congrats on your first asm program :)

------
olalonde
I'm starting to wonder how long before someone manufactures a DCPU chip...

~~~
huragok
Or a FPGA core.

~~~
sybreon
Done! <http://sybreon.github.com/dcpu16/>

------
DanBC
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?

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

~~~
DanBC
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!

------
Tyr42
I'm only getting errors when trying this.

    
    
      Error: Subroutine crash
      was not defined (address 40)

------
johnernaut
Anyone else read this as dc-pubin'? >.>

