Hi Evrybody again, if any good person could recommend an Assmebler to try on the Arduino or possibly rpi4 i feel ready to start some programming, sorry about my dyslexia moderators, thanks in advance loads
The Arduino IDE supports assembly language. Any file in your sketch that ends in the .S file extension will be compiled as assembly.
You can add such a file to the sketch via the Arduino IDE by following these instructions:
- Click the downward pointing triangle button on the right side of the tab bar.
- From the dropdown menu, click "New Tab" (each file of the sketch is shown in the Arduino IDE as a tab).
- In the "Name for new file" field, enter the filename you want for your assembly file, ending in the .S file extension (make sure to use an uppercase "S").
- Click the "OK" button.
You can now add assembly language to the tab you added to the sketch.
There is an example of a blink sketch using assembly language here:
https://forum.arduino.cc/index.php?topic=413151.0
Many thanks for the information,, i cant wait to check it out, Regards
I do not get the fascination with assembly language I keep seeing on here. When I started programming, in the 70s, it was a necessity, but the last time I used assembler was in the late 90s, and that was on a special purpose RISC CPU that I designed myself. Since then, it's been all high level languages. Except for exceedingly rare exceptions, high level languages are far better, and will get the job done in a tiny fraction of the time. The difference in speed and memory use will be minimal.
RayLivingston:
I do not get the fascination with assembly language I keep seeing on here. When I started programming, in the 70s, it was a necessity, but the last time I used assembler was in the late 90s, and that was on a special purpose RISC CPU that I designed myself. Since then, it's been all high level languages. Except for exceedingly rare exceptions, high level languages are far better, and will get the job done in a tiny fraction of the time. The difference in speed and memory use will be minimal.
Thats what I'm hearing from the Python people now..
I still like my c++ so I kinda' understand.
-jim lee
i dont understand high level language at all so i am hoping to start from what i know if possible then maybe i can sort of cross compile in my head bit by bit until i get a grasp of it. i am needing a memory map or hardware locations so i can get a start, i am not sure if there is some program that cross compiles into several languages so i can take a look and see if i can figure out what this high level stuff is doing, hope that makes some sort of sense and i would like any comments or suggestions, i am keen to get going sifting through all the different programs and terminals and stuff seems to take forever, i have spent days and days on this had have not wriiten a thing yet because its all syntax errors and cut and paste stuff, Opp codes is what is in my head not word proccesing and cut and paste, Regards
Assembly has its justification: Would you be able to make time critical bit banging with C(++)? Why are libraries used for handling stuff like like NeoPixels written in assembly?
Oh, and then there is the joy by making something at the lowest possible level! ![]()
Somewhat an echo of what @Danois90 posted while I was writing this:
Arduino isn't necessarily about always doing things the optimal way. We each have our own path to our goal, whether that is learning, fun, or a finished project. As long as your path ends up taking you toward whatever that goal might be, then it's all good. For some, that might be Scratch or Python, for others assembly.
You only need a faint sketch of your level of understanding of the internal operation of a CPU, to understand and use high level languages. What I see here, is mainly not a reluctance to learn something new, it's a reluctance to let go something that has become familiar and comfortable.
If you've coded any kind of control structure in low level, you've already coded some high level construct. All you need to do is learn their "names". For example, have you ever made a conditional branch backwards?
label:
...do something
if not foo, goto label
then you have already coded a do-while
do
{
...do something
}
while (foo);
...and so on it goes. I'm sure you've used do-while, while, if, else, all of it.
with assembly language the errors are much easier to trace.
Danois90:
Assembly has its justification: Would you be able to make time critical bit banging with C(++)? Why are libraries used for handling stuff like like NeoPixels written in assembly?
The neat thing about AVR is that the RISC instruction set was developed in direct collaboration with IAR so that c/c++ could result in optimal machine code.
The Naken Assembler is a free, small, command line assembler for a large number of processors:
sevenoutpinball:
with assembly language the errors are much easier to trace.
and make
It’s hard for me to take @mrrooty seriously.
C can be used at a very low level, as has been implied above, offering expression of programs that would be almost one to one translatable into machine codes. I am betting that many assembly programs begin life expressed in terms (like a flowchart e.g.) that would be easier to realize immediately in C.
Do yourself a favor and just learn C using a good book like K&R and your choice of online interpreter independent of any future desire to talk to hardware. You seem quite smart, so it won’t take too long if you use other than what appears to be a shot gun scatter brained approach and an unwillingness to temporarily drop your habits and biases.
C is a very small language by modern standards. Mostly it is just a real help for what is a real PITA with opcode and memory map programming: taking care of bookkeeping, resource management and getting long sequences of instructions like complicated array references &c. correct effortlessly.
And it is quite good these days in terms of results. Some things will always need assembly language, but I have seen plenty of real time stuff that moves along in C quite nicely.
Someone here can probably tell you what very small part of UNIX was coded in assembly or machine language. The rest is C. What portion of Linux is anything but C?
Notice I leave out C++. It has a place, I suppose, but I would completely understand a, er, reluctance to understand it.
Get a grip on C, it won’t restrict you in any way from doing things how you like. You just might find, however, that while you were off doing your thing there has been a crap ton of progress around the challenge of getting machines to do what we want.
a7
Thanks alto that was a really good post for me, Things are starting to fall into place a little for me, I just had a look at the Arduino architecture and there is nothing really there as such, i think i am starting in the wrong place and not quite the correct hardware, I am wondering if there is an Arduino emulator for the PC and the Neopixel led strips and other sensors, i want to see things happening in real time and i dont see that can be done on the Arduino, but that would be possible through emulation, i could later attatch to the physical world, I am going to post this as a new question if thats ok, i also picked up a Pi4b and i have not really done anything with it yet, thanks for your post and i would welocome any comments ideas, i going to give C a look at right now, Regards
Yes, there is TinkerCad.
Thanks Aaarg did you get you icon from a tv show called the adventure game, it was on tv about 40 years ago ???
mrroosty:
Thanks Aaarg did you get you icon from a tv show called the adventure game, it was on tv about 40 years ago ???
No, it's the result of editing the default icon that used to be provided the old forum software. Now you get the default one you have.
alto777:
Notice I leave out C++. It has a place, I suppose, but I would completely understand a, er, reluctance to understand it.
In my experience, before knowing c++, I did a lot of extra steps. Because, for example, I couldn't instantiate a class object, I would copy and paste large portions of variables and functions and go through and change the names of everything. I am reluctant to apply object-oriented programming to everything, but I can't go back to c without classes.