schweigi / assembler-simulator Goto Github PK
View Code? Open in Web Editor NEWSimple 8-bit Assembler Simulator with Angular.js
Home Page: http://schweigi.github.io/assembler-simulator
Simple 8-bit Assembler Simulator with Angular.js
Home Page: http://schweigi.github.io/assembler-simulator
There is no way to get the remainder of a division operation.
MOV A, 255
NOT A
; A becomes 256
I would like to teach processor my 7 years old son (till now he made 2-bit to 7-seg decoder by using gates on breadboard).
You simulator is the first I found which is simple enough for that.
One thing which would make the simulator even better will be highlighting modified registers.
Enjoyed your simulator very much!
I am giving an "Introduction to Programming" lecture and I'd like to hint my students to your site. For newbies it maybe would be better if they had the opportunity to open the help contents in a separate window. I missed that out as well...
-Richard
Suggested by @ Iko Knyphausen:
You are already highlighting instruction opcodes in RAM (and you can click on them to see the instruction in code – which is great), however, sometimes instruction pointers can be set to arguments instead of opcode (or even to data if DEP is off), resulting in a different instruction altogether. I could envision a little context information on hovering any byte in RAM showing the current meaning of a byte, e.g. opcode, register, or address, but also possible alternatives such as a register or address value interpreted as an opcode.
Hey, I found your superb simulator today. I used to code in assembler about 20 or 30 years ago and I found it very didactic for teammates that now only know high-level coding.
I see the Z is the Zero flag and the C is the Carry flag.
But, what is the F flag to the right? When does it get true?
In the instruction set document instruction-set.html I search for "f" whole words and I don't see any reference to it.
Clicking them could also highlight that line of code
This isn't a huge issue, but on line 486 it shows "MULL" instead of "MUL".
To make this apparent the instruction addresses should be underlined links.
Please excuse my ignorance regarding Assembly language.
Can you add an explanation of the zero and carry flags (or are they called registers?) to the Help?
MOV A, 255
SHL A, 255
A
will now have value 256
. This should not be possible
You cannot use charachters like ' " ' in a string. Using the default example at
https://schweigi.github.io/assembler-simulator/
For example if you want to use ""Hello world!" the program won't be able to recognize the " and will print on the screen only the character \
There is no NOP
Suggested by @ Iko Knyphausen:
Label RAM 0-F in both dimensions. It would make calculating addresses much quicker.
We add State export/import buttons. Export gives you a string encoding the full registers/RAM. Import does the reverse.
Ideally we could allowing embedding a state string near the top of the code listing.
Hi Schweigi,
first of all : great thanks for this very nice work ! I use it for computer science teaching, and it s a top tool for learning computer basics :-)
Then : do you plan to add an input device ? It would be marvellous ! Why not an input device with a little buffer, and two memory mapped registers (this would force the stack memory zone to be shifted just by two cells) : a status register for signaling, and a data register for inputed data gathering, each one being one byte large.
The status register bits could be as this :
It could work as follows :
If there are bytes inputed (via the keyboard captured through the web navigator, or via a GUI keypad in the input panel), the status register would be "0x01" else it would be "0x00".
The current first inputed byte in the input buffer would be accessible in the data register, and the rest of the buffer would be visible in the GUI in the "input" pannel
Any "mov" from the data register would then gather the first inputed byte in the buffer, and this byte would be removed from the buffer, and the following byte of the buffer would be available in the data register.
(*) And what about an extensible input device ? It could be structured like this :
a panel in the GUI clearly identified in the HTML code as a div with an "id=input-panel" (wiich would let set its inner HTML easily via JS/DOM)
a JS callback named i.e. "input-registers-action", called automagically every time a "mov" is targetting the status or data register (moving values from or to these register), with the avent details as parameters :
-- first parameter : a string signaling the type of register access ("R" for read, "W" for write)
-- second parameter : a string signaling the register which is accessed ("S" for status, "D" for data)
-- and a third and last parameter being the value put or read to/from the register
This could enable users to customize the input device as needed, without requiring more work for you, as all the customization would be possible from the JS callback which could analyze the fired event, doing what is needed about the app logic, and finally modify the appearance of the input panel (via innerHTML of the div with "id=input-panel") for presenting the user with the modified state of the input panel.
So it would be possible to emulate a bout all possible input device, even an hard disk controler with a hard disk connected to it, but yes only in PIO mode, but it would be so great enough ;-)
Sorry for this (too ?) long post, and these are just ideas, nothing more, nothing less :-)
Regards.
Mickaël.
Awesome project! I see it implements memory mapped output for the "hello, world" example.
Is there memory mapped input for the keyboard?
I really like what you have done here. Very fun to play with. Some possible issues I see with the addressing of memory, opt codes and registers. I say possible because there is also a chance I just don't understand assembly and how the CPU and memory addressing works. But here I go anyway:
You have opt codes 1-97, however, memory addresses start at 0 and the registers start at 0 as well.
For example, the following set of instructions loaded into memory can be confusing to read:
JMP start
hello: DB "abc" ; Variable
DB 0 ; String terminator
start:
MOV A, hello
MOV B, 232
JMP is set to memory location 0 as 1F. Memory location 1 is set to 6 (the memory location and not the MOV opt code). In memory, address 6 stores a MOV opt code which is the number 6. Memory location 7 is set to 00 which addresses the register A and not the memory location 0 which is currently set to the JMP opt code. Empty memory cells are set to 00 and do not refer to the memory location 0 or the A register.
Would it be best to start the registers at 0, start the memory at 9 and opt codes at 265? I hope I was clear and forgive me if I am not understanding any of this :-)
I've realizated some examples (https://github.com/soundtrack42/assembly-8-bit-examples) how can I link them to this project?
As a beginner, I'm having a hard time understanding the compare/conditional jump sections in instruction-set.html
Namely, how would I jump if a register is greater than a constant? (or another register)
I see that instruction JA
has the description >
, but I'm confused to what are the values being compared? If it is only checking the zero and carry flags, then how is the instruction JA
different from JNBE
?
Hello, thanks for this very entertaining piece of work! I am new to assembly, so I was wondering why the A and B registers are pushed on to the stack before the print and then popped off at the end.
This would allow the Code area to expand as necessary. (At least it could be bigger initially)
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.