![]() I haven't gotten the Arduino Uno to respond though. I found this out in this site: avr-libc: avr-libc and assembler programs Seems like quite a simple solution for the small amount of support available in the web. I searched for a way to just skip to the assembler part of the compilation, turns out avr-gcc can accept. The toolchain comes with the Arduino IDE, or you can get it from the Ubuntu repositories. Which is then passed to avr-ld to produce an executable. Which it then passes to avr-as to assemble into an object file. After all when avr-gcc compiles a c++ file it first generates an assembly language file. The avr-gcc toolchain will assemble assembly language source files. I don't get much satisfaction out of seeing my C programs work, let alone see an Arduino Sketch work. If you want to learn more about the architecture, well have fun! If you are just doing it for speed, I wouldn't bother personally. I don't know of a stand-alone assembler but there almost certainly is one. You can drop into assembler from C, although it's fiddly IMHO. ![]() Thank you all for the quick and informative replies!Īny particular reason why? Or do you just want to learn assembler? My changes however would improve compile and run-time speed for all "typical" programs, not just the Sieve one. A trade-off to make some things slightly faster at the expense of others. Of course that affected compile speed, not run-time speed, but I think you could do similar things for the run-time part. For example, if you use "for" more frequently than "return" then if you put "for" higher up the list of keywords to be found, it will parse it slightly faster. Not cheating, but subtle things, like the order in which keywords were tested for in the lexer. That's funny! In the day when I produced that compiler I remember that Sieve test, and recall that I did tweak the compiler slightly to improve its performance. It was later discovered that the company actually built into their parser a detection for the Sieve source code and dumped out an EXE that was hand-tweaked assembler! I remember one company consistently won that test, but was almost dead last in all of the other benchmarks. One test that got most of the attention was the Sieve of Eratosthense. Byte Magazine was always running benchmark tests to see which compiler was the "best". However, I would not want to code in assembler on a day-to-day My company produced a C compiler back in the old MSDOS days. ![]() Personally, I wish I hadn't let my assembler abilities get rusty as it can still be useful. Later, Computer Language published the Dhampstone Benchmark that was designed to test a compiler's code generation, rather than its library routines. While there's nothing wrong with this, the Byte benchmarks were a poor test of a compiler's code generation. It was later discovered that the company actually built into their parser a detection for the Sieve source code and dumped out an EXE that was hand-tweaked assembler! Subsequent test revealed that most compiler vendors supplied libraries that were also tweaked assembler. Once again, thanks for My company produced a C compiler back in the old MSDOS days. As you say, knowledge is always useful, and I will indeed try to learn a bit about reading the code, but now I have things much more clear about how useful or not it can be for me. I had always want to have this key points clear. Thanks Nick, that was a very usefull answer to my question. But I wouldn't be writing a big project in assembler these days, personally. It's fine to learn how to read it, knowledge is always useful. The compiler can keep track of register usage, use "tricks" you may not have thought of, move instructions around, and generally produce fast, tight code. You will probably write slower code if you try to do it yourself in assembler, unless you are a real expert. Modern C (and C++) compilers optimize very well. However these days it is only really required for low-level system programming, where you either need to do something not supported by other languages (eg. ![]() Gammon Forum : Programming : General : GPascal - a blast from the past I've written more assembler than I care to remember, for example a Pascal compiler written in assembler for the Apple 2:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |