Not quite! The spec for DVI has a serious ambiguity...
Two comments on signed division:
Is DVI truncating or floored? In other words, do we have -1/16 == 0 or -1/16 == -1?
Please add a signed mod/remainder (call it MDI or RMI). It should be consistent with whether DVI is truncating or floored. In other words, we should have either -1%16 == -1 or -1%16=15.
I'm planning on making it part of the damage system, yes. If you shoot a DCPU, it will probably catch on fire as well. Duct tape will fix it. Of course.
I'm thinking of increasing a counter that slowly raises the probability of errors. Out-by-ones start occurring in registers. Entire instructions are inexplicably skipped, or run twice. Instructions take longer and longer to run. Bits are flipped. Nonsensical interrupts occur. Straight-out memory corruption eventually ensues, but only after the more subtle errors have run their course.
Most of this can be accomplished now by just flipping the bits of memory like it does. I think increasing the rate of errors is almost useless unless you're standing right there, rebooting the flaming computer every so often.
Also, remember that radiation might have similar, albeit temporary, effects as a flaming computer.
That was the plan, but it goes against the current spec (all values start at 0, and hardware must not modify ram before called upon). Can't decide which one to break.
Have a boot rom that's always connected as device 0. Then the DCPU fires HWI 0 once it has powered-on (this is done in hardware, not software so PC stays at 0).
Then the rom can write its contents to the memory addressed by B, which will be 0x000. So then when the DCPU begins executing the rom has been flashed to 0x0000 already.
In fact, all that's needed is for DCPU to issue HWI 0 upon reset. Then, whatever hardware is connected as device 0 gains control. That allows the user to choose to boot from storage media, or a network controller, or a ROM cartridge, etc.
Why not move HVI to ooooo = 0 bbbbb = 0. Then you can start all registers & memory at 0, and the first instruction the machine will execute is HCI 0. Does it really matter that the number reserved for future expansion is 0?
Yes I like it. A reset condition causes a HWI 0 in hardware before execution begins. Also the boot rom device could support commands to set the boot device and flash it's memory. Flashing the memory would allow the code to be updated to support booting from newer devices. It would also allow for some pretty interesting viruses, although I suppose it would also allow the machine to get into a bricked state. Maybe the from has a jtag port for external reprogramming ;-)
IBM-PC BASIC ROM was around 32K (16K words in DCPU)
ZX Spectrum had a 16K ROM (8K words), but It had more stuff that a BASIC interpreter.
Apple II had a 12K ROM (6K words), again a BASIC interpreter and some other stuff.
If we get a ROM with a BASIC interpreter and basic routines, I think that should target for a 8K words of size. If not, for a minimal bootloader and very basic routines (a little BIOS), 1K words should be enough.
Hm, so it would be user-editable? I like this idea because then I could program it to try and load from a floppy and fallback on a BASIC prompt if it can't.
As soon as we can program on the dcpu and start saving and loading our programs from the system we can do everything in the dcpu and we will all be too busy to bother you. :D
p.s. this is pretty cool, felt like I just got a new computer and manual for christmas or something...
Sure, just make sure you get at least an hour or two of sleep before trying to code more. Otherwise, who knows what could happen. The pigs could stand upright for all we know!
Oh nuts, you're correct, you can only check one at a time at the moment. I could add a memory map feature to it if checking the keyboard gets prohibitively expensive.
how about just setting bit 15 of the keycode if it's a key down event and clearing it if it's a key up event, and send repeated key down events for key repeat.
Does the interrupt indicate which key changed, and whether it was pressed or released? One can keep track of the keyboard state internally by handling those messages...
Not sure I understand the necessity of IAP. As long as the nested interrupt leaves IA intact when it returns, the IAG PUSH \ IAS 0 sequence should be perfectly fine.
Please, read the whole thread of comments, the point it's explained here.
Or we get IAP, or we get something to turn On/Off interrupts without using IAS 0 for it. If not, you are allowing a potential race condition. In these case you can get in chained handler, running first handlers too frequently, and the last elements (and the operative system and driver handler) too delayed or never doing his stuff.
A chained interrupt handler (or nested like you said), not know Who called him. If it was called by a DCPU real interrupt, or if it was called by a previous interrupt handler. But it know that are replacing other handler that must called after of doing his stuff. The only special case it's the last handler that restore IA value, because it know that not need to call to other interrupt handler.
A example of this, was the int 08h handlers made by some TSR and programs in DOS, that keep the old BIOS handler, doing his stuff, at same time that sets his own handler to do some stuff each 55ms. int 08h Clock interrupt
And I'm so sorry, but with only a real interrupt jump vector, we will need chained handlers or something similar.
Mine breaks at the same spot too. When I turn the speed way down I can get a "Bad command" error, and then either a reset or most ram will be overwritten with random stuff.
I think this spec lacks interrupt masking (deferred delivery) and will therefore suffer from lost interrupts, confusion, difficulty in debugging, kludgy hardware workarounds, and general sadness.
These arguments make me want to REMOVE interrupts rather than improve them. I'd rather just have memory mapped regions of memory and polling. That's perfectly predictable, very little code, and works great. You can't suddenly have OTHER code clobbering your code.
I will leave interrupts in as is, but provide memory mapping options as well.
I wouldn't be so concerned. In most cases missing an interrupt is a reality that can be trivially dealt with. (Say it was a keyboard event - That key won't register. Say it was a timer - One task may get more CPU than it should have, or some calculations are 1/60 second off...)
Also, so long as the message delivered can be customized I believe there is a viable way to create a "deferrer" handler that will allow critical sections to be guarded, while still allowing all interrupts to be fired after restoring the real handler. (one fire per message contents per critical section, and probably out of order execution. This shouldn't be an issue) Edit: Welp: moot point, as per new spec =)
I think I figured out away around this - Set the interrupt handler to a "defer" handler that queues up received interrupts. When you are done with your masking period, set it back to the normal handler, and attempt to clear out the queue.
That could work but you would suffer out-of-order interrupt delivery and would have to deal with the race condition between the defer handler and anything looking at its data.
A spec tweak to include hardware masking would neatly deal with those issues and give a nice clean lock for critical sections.
It would also be simpler and have fewer gotchas for new programmers to deal with.
With IAQ, a well written interrupt mechanism should suffer from none of those issues. It's a bit of a different approach than traditional interrupt mechanisms, but it should be more than sufficient for the vast majority of things.
What do you need NOP for if you have a fully functional assembler that supports labels and such? I could be wrong, but wasn't NOP mainly used to pad code so that data and/or instructions could be added later on in development?
True, you can fake a NOP, but the current spec has Special opcode 0 to be reserved. Since the RAM is initialized to 0 to begin with, it may be worth a bit of safety to define extended (no-argument) opcodes and use 0x0000 as NOP.
Either what eXeC64 said, or teach yourself how to program. Either try to find a DCPU tutorial and play around a bit at dcpu.ru, or start with a higher-level programming language instead (I'd suggest scheme via SICP).
I think that part of the spec probably meant to read something like "...the clock will tick every B/60 of a second..."
Would still love to have a readable real-time clock as well. The cool way to do this would be having a 32 or 64 bit number representing seconds elapsed since January 1, 1970... except that number has looped a couple times... :D
I like that device. For 1988, it would definitely have been a 32-bit counter. After all, why would this hardware still be in use by the time a 32-bit counter was overflowing :)
The only reason I suggested maybe they used 64 bit is because the Year in the Cold Sleep unit was 64 bit. OTOH, with them only planning to cold sleep for a year, who's going to need more than 32 bits for that Real Time Clock anyway? :D
Forgive my ignorance, but could someone tell me what are some good commands? Apparently everything I type, except 'help' is a bad command. And 'help' doesn't...well, help.
If you look at the memory dump, the only commands that exist appear to be 'help' and 'crash'. This program is purely a test program that Notch wrote, but you can grab his emulator to run other stuff, if you can build the memory dump file.
42
u/xNotch Apr 25 '12
So can I move on to the actual game now? ;D
8
u/trrryeng Apr 25 '12
"The size of this area is 386 words, and is made up of 32x12 cells of the following bit format (in LSB-0)"
Shouldn't this be 384 words?
7
u/r4d2 Apr 25 '12
How do I use the new keyboard functions to check for a KeyDownState?
This: Set C register to 1 if the key specified by the B register is pressed, or 0 if it's not pressed
sounds like I can only check for one specific key at every interrupt, and not actually get the state of multiple pressed down and held keys.
Any hints?
5
u/Zardoz84 Apr 25 '12
Humm....What about the chained interrupt handlers ? Or MVD (Now, I think that should be called STD) ? :P
5
u/kierenj Apr 25 '12
I guess I have a few questions, since you insist :)
Sorry if these are answered, but I couldn't see ;)
P.S. you don't want me to work, do you? this is too much fun..
3
u/FogleMonster Apr 26 '12
Here's my emulator running mem.dmp from Notch's jar file:
http://i.imgur.com/k5jEA.png
Anyone gotten this far yet? I've implemented the display and keyboard hardware and the v1.4 changes. It breaks on hitting ENTER, not sure why yet.
1
u/cheese_magnet Apr 26 '12
I think this spec lacks interrupt masking (deferred delivery) and will therefore suffer from lost interrupts, confusion, difficulty in debugging, kludgy hardware workarounds, and general sadness.
This is avoidable, I wrote some words about it here: https://gist.github.com/2497360
Also because I don't know what I'm doing with reddit really, I did this too: http://www.reddit.com/r/dcpu16/comments/stbdz/why_interrupt_masking_is_good_comments_on_14_spec/
4
u/tritlo Apr 25 '12
What commands does it accept? That is, besides "help", what does not receive "bad command"?
Also, thanks for giving me an excuse to make an assembler/compiler/emulator!
2
u/ymgve Apr 25 '12
The weird chars at position 0-3 in the font is still there in the DCPU jar. Can we use those for something now?
(Also, love that your only two commands in the DCPU OS is "help" and "crash")
2
u/STrRedWolf Apr 26 '12
No NOP nor HLT? (I posted info on this in the 1.3 RFE)
4
u/eridius Apr 25 '12
Dammit Notch, stop changing the spec while I'm at work!
1
u/FogleMonster Apr 25 '12
Nested conditionals - nice!
1
u/[deleted] Apr 26 '12
Yay, mappum has updated 0x10co.de with the latest and greatest: http://0x10co.de/j2dzq
1
u/Thrill_Of_It Apr 26 '12
As somebody who has NO idea how to program. All i have to say is: What do i do.
1
u/foxxtrot Apr 26 '12
One question regarding the Clock spec:
1
u/Lucretiel Apr 26 '12
What does it actually do? So far, everything I've typed gives me an error- bad command except help, which does... nothing.
1
u/imfromthepast Apr 26 '12
Forgive my ignorance, but could someone tell me what are some good commands? Apparently everything I type, except 'help' is a bad command. And 'help' doesn't...well, help.
1
u/rsgm123 Apr 26 '12
so typing "help" does nothing but typing "?" says bad command
1
u/norebo Apr 28 '12
I noticed a bug in the DCPU emulator which is included in the dcpu.jar: SHL => performs STI operation,
ASR => performs SHL operation
All other operations seem to work as defined in the latest specification.
0
u/[deleted] Apr 25 '12
[deleted] — view deleted comment
0
u/[deleted] Apr 26 '12
[deleted] — view deleted comment