Go Down

Topic: Unos 0.1.1 - Programs on SD Card Now Supported (Read 17801 times) previous topic - next topic

goodinventor

pYro_65, I am still trying to figure out what I want the system to run the most, since there is such a limited amount of memory. I think that having a working interpreter where you can type in assembly programs would be really useful, so that's what I'll do.

ShapeShifter

#31
Feb 16, 2015, 03:45 am Last Edit: Feb 16, 2015, 03:46 am by ShapeShifter
I think that having a working interpreter where you can type in assembly programs would be really useful
Now, why would you say that?

Most people turn to assembler when they want something to be fast. An interpreter is far from fast. Interpreting assembly language is an oxymoron. It negates all of the advantages of using assembler in the first place. If you want speed, write in real assembler. If you don't need the speed, write in a higher level language like C++. But writing an interpreter in C++ to interpret assembly language? It simply makes no sense.

Now, if you are learning assembly, then having an interactive simulator where you can run instructions, and see how it affects registers and memory could have some appeal. But to do that, you need to be running a true emulation of the processor, and maintaining a virtual machine. Simply running the occasional assembly instruction in the middle of a C++ program won't cut it - not only will you not be able to tell what the instruction accomplished, and you won't know the system state before executing the instruction since it will be the context of the current function, but you run the real risk of the emulated instruction corrupting the C++ environment and crashing your interpreter. While running an interpreted assembler on a virtual processor might have some interest to a few people, the way you are doing it is far away from being an appropriate way of accomplishing it.

goodinventor

Actually, this decision was made due to a lack of memory on the Arduino. Assembly is far less complex than C++, so it will take less memory and be easier to implement. If you have an alternative suggestion, let me know.

Robin2

Actually, this decision was made due to a lack of memory on the Arduino. Assembly is far less complex than C++, so it will take less memory and be easier to implement. If you have an alternative suggestion, let me know.
The mind boggles ....

But this is entertaining

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

AWOL

Actually, this decision was made due to a lack of memory on the Arduino. Assembly is far less complex than C++, so it will take less memory and be easier to implement. If you have an alternative suggestion, let me know.
Did you read reply #31?
Particularly the second paragraph?

rockwallaby

Quote
Assembly is far less complex than C++
far less complex, how far is far, or how less is less?

In 60 seconds can you write in assembler program that executes on a an AVR the equivelent of a simple 'for loop' going from decimal 100 until below decimal 7 at increment decimal -3 and then have the same again for a Motorola 68HC11 MCU and then a SAM3X MCU?

To be fair, I'll give you 30 times that amount of time, so 30 minutes, should that do?
Now, tell us how easy was that?

There are a few of us who only ever programmed in assembler from way back in the early days, and I know I'm happy to now use something more portable and easier to maintain and understand months or years into the future.
____
Paul
Paul - VK7KPA

ShapeShifter

There are a few of us who only ever programmed in assembler from way back in the early days, and I know I'm happy to now use something more portable and easier to maintain and understand months or years into the future.
Wow, talk about a trip back into distant memories... My first job out of college involved writing 6800 assembly language, cross-assembled on a PDP-11, and debugging with a Motorola EXORciser debugger/emulator. Add a couple VT100 terminals (one to the PDP-11, one for the EXORciser) plus an EEPROM programmer and eraser and a couple pieces of test equipment, and it would fill a large workbench (and this is not counting the racks of equipment for the PDP-11.)

It was slow and tedious doing it all in assembler. Man, did I dream of using any other language. Now, I'm still cross-compiling code, but instead of racks full of computer boxes, I have a laptop that's far more powerful, a palm-sized programming pod/debugger, palm sized USB test instruments, and everything fits in a backpack. What an advancement in 30 years. But the best part? It's not needing to use assembler!

You've really got to understand assembler if you want to call yourself an embedded programming professional. But that doesn't mean you have to use it on a daily basis! I would only use assembler for a very specific piece of code that must be highly optimized and couldn't be done with a higher level language, and that would certainly preclude using an interpreter for it.

goodinventor

There are far fewer commands to implement in assembly, which means writing an interpreter for it will take far less memory and will be easier to implement. The only other language that I can imagine implementing on the Arduino is BASIC.

pYro_65

#38
Feb 17, 2015, 06:02 pm Last Edit: Feb 17, 2015, 06:03 pm by pYro_65
There are far fewer commands to implement in assembly, which means writing an interpreter for it will take far less memory and will be easier to implement. The only other language that I can imagine implementing on the Arduino is BASIC.
You haven't used assembly have you?

Every instruction you wish to run will effectively have an overhead of a 'generic' wrapper around it, and will probably render each instruction an order of magnitude slower.

You cannot inject code into the AVR program space like a traditional PC. Your code will most likely suffer a great performance hit compared to a C++ program made to interpret a useful set of operations (not a single instruction).

Before embarking on this crusade, prove yourself right. Create a traditional app in C++ using Arduino libraries which takes a single command over serial and returns the result. Then do the same with asm and see how far you get (before you realize the silliness in interpreting a single machine instruction).
Forum Mod anyone?
https://arduino.land/Moduino/

goodinventor


AWOL

Would BASIC be better to create a usable OS?
No, I don't think so.
(We are still talking about an OS, aren't we?)

goodinventor

No. We are talking about a built-in interpreter for the OS. The OS is in C++.

kowalski

Here is something that you also could wrap into Unos; https://github.com/billroy/bitlash

I think it could help you with the whole interpreter issue. I would also like to recommend that you target the Arduino Mega to get more resources for all the wrapping of libraries and interfaces.

Cheers!

goodinventor

Thanks, kowalski, for the information. I think I'll implement a BASIC interpreter, since I have the memory for it.

kowalski

#44
Feb 19, 2015, 05:22 pm Last Edit: Feb 19, 2015, 05:23 pm by kowalski
Here is something to look at if you what to go for BASIC in your project; https://github.com/BleuLlama/TinyBasicPlus
Study the memory requirements and then add what you have so far put into your "OS".

Cheers!

Go Up