Python-based implementation of Notch's DCPU-16
github.com
github.com
Even if you want to use the same license as notch, you must explicitly specify that, otherwise, no one can really use your code.
I'm not sure the phrasing is correct, at least for the most common example of this issue (european copyright tradition of moral rights): many european countries split the anglo-saxon copyright into estate rights (which are economic) and moral rights which are generally perpetual, inalienable, and imprescriptible.
As a result, while an author can assign (or waive) their estate rights they can not assign or waive their moral rights.
Unless there are additional special cases in the country's lawbooks an author in a moral-rights country can not put his works in the public domain (since it would require waiving rights he can't waive). Either the works can not be copyrighted (and are intrinsically in the public domain) or they will fall into the public domain when the author's rights expire.
So it's not public domain, because some rights are forever yours, but you can very well allow anybody to use modify and distribute your creation.
I don't know of any countries that don't recognise public domain (that is, implement eternal copyright).
There is a related nasty moral right in France about withdrawing your copyrighted works -- "Notwithstanding assignment of his right of exploitation, the author shall enjoy a right to reconsider or of withdrawal, even after publication of his work, with respect to the assignee." If I am reading the other terms on this page right, that might not apply to software in particular, but it could probably apply to Creative Commons licensed writing, e.g. Wikipedia.
Both of those quotes are from http://195.83.177.9/code/liste.phtml?lang=uk&c=36&r=... .
Even worse, French law does not permit a "mostly complete" copyright contract, as I understand the legal history -- so the French courts have actually said things like, "this contract tries to give away your moral rights, that's legally impossible, so the whole license is legal nonsense, so there never was a license, so it is totally proprietary."
(I believe such proof would actually be logically impossible...)
edit:
Assuming I'm a standard, competent web dev-ish Ruby, Python programmer with little experience below those languages.
Sort of a "Assembly Language for Python programmers" guide
It's expensive though; you might do just as well with a used older edition.
A somewhat perverse alternative approach: get a book on how debuggers work (like "How Debuggers Work").
This is basically part of most first year IT / CS courses, and kind of not used in day to day IT so many self taught programmers never learn it.
I wonder how long till someone implements it in minecraft?
But I was kind of imagining that you could essentially emulate a single virtual system per "Stream processor" or whatever they are labeling the basic units. I was factoring that they could run a couple of hundred "virtual cores" per card despite the fact they weren't that optimized. But I will be the first to admit to not really knowing the details.
The other option of course is something like intel's Knights Corner architecture, which wouldn't pay such a penalty on performance for branching.
It's gotten better now, but branching is still extremely unwieldy to do. No branch prediction either.
There's no point in trying to jump through hoops to convince the GPU to be something it isn't. It isn't going to be faster than a CPU, or rather, a lot of CPUs.
Being 5 or 10MHz is irrelevant. Being able to simulate them faster means you need fewer servers to do it. (You can tell who actually works on clouds and who doesn't by the attitude towards performance; people who don't actually work on clouds think performance matters less in the cloud....)
I am fully aware that your average GPU isn't optimal for this task, however I was imagining that there would still be value in shifting the world load off the primary CPUs.
My line of thinking is around being able to use a single GPU stream processor to emulate this CPU in the required performance (ie 10mhz). If you could essentially do that you could have hundreds of these processors emulated for the cost of managing the IO to them.
I am not expecting it to be "Magic Speed Juice", I am actually expecting to be getting 1-5% performance from what the GPU are capable of. However I would see this as a nett advantage if it took the workload off the CPU. Something like Knights Corner could easily do this (its basically a pentium 1 core).
The point I am making is that Notch's CPU is basically a home computer CPU from the 80s. They don't require that much functionality to emulate (as if a dozen emulators in a few hours wasn't a good enough indication) and since OpenCL is turing complete you can emulate anything (see running arm linux on an 8 bit processor), the question is if its efficient enough to be viable?
Can a 1ghz stream processor emulate a 10mhz single issue simple risc core? I have no idea, but I suspect its not the part we have seen so far that will be the determining factor, I believe it will instead be the IO devices that determine the requirements.
ie.
self.registers = { 'A': 0x0000, ... }
then you could access it directly: self.registers['A'] = 0x0001 self.registers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
instead is adding ".value" all over the place where it isn't necessary. I haven't actually tried this but it looks like dropping the Cell class entirely, putting that line in as the definition of registers, then s/.values//g ought to work, or very nearly work.PC, SP, and O are already defined as variables containing the index for that register, a fine way to do it.
By splitting the difference and playing with PyPy you should be able to use Python to dodge out on a lot of the C bookkeeping BS while potentially not paying very much on the speed penalty. Using a lot of Python constructs could result in a multiple orders of magnitude slowdown for only marginal gain in this case.
Or whatever. Your program, of course. (No sarcasm.)
It arguably sucks less, but I'm looking for something better and currently trying various solutions involving __getitem__, closures, function attributes, decorators and a sprinkle of metaprogramming to keep things nicely separated and much less C-ish.
I've already defined opcodes this way (decorator+func) which makes it very descriptive and almost reduces the opcode dispatcher to a one-liner.
https://github.com/lloeki/python-dcpu_16/blob/e78f4b8af895db...
Note that this may cause some problems with evaluation order (notably in SET), as spec says a should always be evaluated before b.
Why not use an integer instead of Cell? 42 is memory address 42, -3 is register R, including for SP, PC, etc. Or addresses >= 0x10000 are registers, then you can just have
def ife(self, a, b):
m = self.mem
self.skip = m[a] != m[b]
with Python's native indexing of the mem[] list, which could be an array().So I need to distinguish Register, Memory Location and Literal. I considered passing around a (type, value) tuple but conditional code based on type really tells the OO programmer in me that polymorphism should be used instead.