denull / dcpu-16 Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Add lots of buttons!
Using <textarea> with plaintext for coding is pretty boring... I want to add some colors, but it's may cause some troubles in some browsers (I prefer to do this by myself instead of using existing libraries & frameworks).
Make every value in registers & memory sections clickable: open a tooltip on click allowing to edit current value. Would be quite useful for debugging purposes.
Lines like dat "Abcd; efgh"
are parsed incorrectly (everything after semicolon is considered as comment even if it's within quotes)
They say there is keyboard memory buffer starting at 0x9000
(haven't seen any official confirmation for this though...):
http://0x10cforum.com/forum/m/4932880/viewthread/2711023-preliminary-memory-map-for-dcpu16
Hi there,
LLVM backend has to emit the instructions like:
:autoinit ;;Init data stack register C
SET I, SP
SUB I, 256
:autostart
JSR main
:autohalt SET PC, autohalt
; .file "/home/jookia/Programming/YADOS/main.c"
.text
.globl main
; .align 2
:main
SUB I, 2 ; The Notch order
SET [I], 0 ; The Notch order
SET A, 1337 ; The Notch order
ADD I, 2 ; The Notch order
SET PC, POP ; The Notch order
.text, .globl, .align, .size and may be a few others. It's possible to disable output of some of them (like .align), but disabling .text .globl breaks LLVM test suite and makes it impossible to develop.
In the long run, DCPU16 assemblers will likely support these directives, because they are there for a reason. Since there's no demand for proper support of these directives from the users, but there's demand to use Clang/LLVM and there's no technical possibility to avoid emitting them, I would kindly ask deNULL DCPU-16 assembler to ignore lines with these directives.
These directives always match the regex like "[\s]*[.]globl", so it should be pretty easy to ignore such lines.
The full list of directives to ignore (for now) is:
.globl
.size
.text
.data
.align
I have a collection of tests for DCPU16 assemblers (it's not that large now, but this would be improved over time) here: https://github.com/krasin/dcpu16-tests/tree/master/asm
It makes senses to run these regression tests with your assemblers to make sure that it has no known issues and (which is more important) to make sure that all the bugs you will fix in the future, will not appear later.
This issue is to write a script that will run deNULL assembler on these tests.
See http://dcpu.com/highnerd/rc_1/lem1802.txt
MEM_DUMP_FONT and MEM_DUMP_PALETTE are unimplemented.
Also, MEM_MAP_FONT(0) does not restore the default font.
brk
aka sub pc, 1
used to pause the emulator, but that no longer seems to be working.
It does behave as expected, otherwise. It loops forever on that instruction.
After the moment there will be some standard way for defining macros and constants, it should be implemented in the assembler.
Currently I've seen two possible syntaxes for macro:
#macro name(param1, param2, param3) {
... ; some code
}
(from http://pastebin.com/raw.php?i=aJSkRMyC, presumably Notch's code)
and
#macro name(param1, param2, param3)
... ; some code
#endmacro
(from reddit: http://www.reddit.com/r/dcpu16/comments/ry58l/macro_support_in_assemblers/)
Coders should be able to write not only literals or labels (and one register), but any combination of them (support at least +
, -
and *
operations). Will be especially useful after implementing #define and #macro syntax.
Implementing dissambler should be pretty simple.
Typing is pretty laggy. Profiling indicates that updating the page with the assembled results after every keystroke causes the slowdown.
Simply not updating innerhhtml if the assembler's return value hasn't changed should fix this.
From the default 'Try some basic stuff' program on DCPU.ru:
Code: SET [0x1000], 0x20
'Expected' output: 7de1 1000 0020
Actual output: 7fc1 0020 1000
Disassembling the actual output: SET [0x0020], 0x1000
7fc1
o=0b00001
=SET
b=0b11110
=NEXT WORD
a=0b011111
=NEXT WORD (literal)
The problem appears to be that the DCPU specifications do not state which 'NEXT WORD' should be evaluated first.
In the example below, the label end
passed to the braf
macro is not resolved (it becomes zero) in the assembled output. It should behave like the macro-expanded line following it.
#macro brab(label) {
sub PC, 2+.-label
}
#macro braf(label) {
add PC, label-(2+.)
}
:start
dat 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
brab start
sub PC, 2+.+start
braf end
add PC, end-(2+.)
dat 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
:end
dat 0
If I clear the window and type the following:
dat 4
dat 5
it either is completely unable to parse the second line, or it parses correctly and puts a blank line between the DATs in the disassembly listing on the right. I suspect \r characters are sneaking into the input somehow. It also inserts two line numbers on the left every time I hit enter, but if I paste some code in the line numbers are correct.
So I think hitting Enter is causing a \r and a \n to be inserted in the new code editor, and it's confusing the parser. This is on Chrome/OS X.
edit: whoa! if I try to paste the above in, it pastes with formatting which completely confuses everything.
The keyboard seems to be unresponsive to hardware interrupts, or at least fails to accept keypresses properly. The code I'm running is
SET A, 1
HWI 2
Even if this is run in a loop, C is never set to a nonzero value. Is my code incorrect, or is this a bug?
dcpu.ru definitely requires some interface improvements (Russian version, help, a bit more neat arrangement of the panels).
It's very useful to have a LICENSE file on top of your repository to let others know the legal terms of using and contributing to your code.
As a suggestion, you might want to use The MIT License, the text of which can be taken from http://en.wikipedia.org/wiki/MIT_License
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.