Any particular reason why? Or do you just want to learn assembler?You can drop into assembler from C, although it's fiddly IMHO. I don't know of a stand-alone assembler but there almost certainly is one.If you are just doing it for speed, I wouldn't bother personally. If you want to learn more about the architecture, well have fun!
I've written more assembler than I care to remember, for example a Pascal compiler written in assembler for the Apple 2:http://www.gammon.com.au/forum/?id=11203However 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. C) or something very timing-specific.Modern C (and C++) compilers optimize very well. You will probably write slower code if you try to do it yourself in assembler, unless you are a real expert. 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.It's fine to learn how to read it, knowledge is always useful. But I wouldn't be writing a big project in assembler these days, personally.
@Nick: My company produced a C compiler back in the old MSDOS days. Byte Magazine was always running benchmark tests to see which compiler was the "best". One test that got most of the attention was the Sieve of Eratosthense. I remember one company consistently won that test, but was almost dead last in all of the other benchmarks. 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!
/home/tanhadron/Programs/tavrasm/bin/tavrasm -i PumpController.asm -o PumpController.hex -e PumpController.lst
/home/tanhadron/Programs/arduino-1.0.3/hardware/tools/avrdude -C/home/tanhadron/Programs/arduino-1.0.3/hardware/tools/avrdude.conf -pattiny44 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/home/tanhadron/Projects/PumpController/PumpController.hex:i
The avr-gcc toolchain will assemble assembly language source files. After all when avr-gcc compiles a c++ file it first generates an assembly language file. Which it then passes to avr-as to assemble into an object file. Which is then passed to avr-ld to produce an executable. The toolchain comes with the Arduino IDE, or you can get it from the Ubuntu repositories. terry
I use tavrasm. Here is the syntax I use in my build shell script:Code: [Select]/home/tanhadron/Programs/tavrasm/bin/tavrasm -i PumpController.asm -o PumpController.hex -e PumpController.lstThen I use avrdude to send the hex file to my ATtiny44. Or 13. Or 85, or whatever.Code: [Select]/home/tanhadron/Programs/arduino-1.0.3/hardware/tools/avrdude -C/home/tanhadron/Programs/arduino-1.0.3/hardware/tools/avrdude.conf -pattiny44 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/home/tanhadron/Projects/PumpController/PumpController.hex:i There is a little bit of house keeping in the actual asm file. Set up the interrupt vectors, initialize the stack, disable the watchdog timer... but once you have done it once, the template is there and using it for other programs is simply a cut and paste.
Personally, I wish I hadn't let my assembler abilities get rusty as it can still be useful. However, I would not want to code in assembler on a day-to-day basis.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16