Path: home => avr main => how-to => assemble win    (Diese Seite in Deutsch: Flag DE) Logo
How-To logo

How-to assemble a source code file with avr_sim

Even simpler as with gavrasm the assembler source code can be assembled with avr_sim. The following shows how to do that.

If you have an *.asm file available, download the latest version of avr_sim from this website. Versions for 64-bit-Windows and -Linux are provided. If you need it for another operating system, you'll have to compile it with Lazarus from the source code. How this is made is written in the handbook for avr_sim, which you can also download from the above linked website.

After unpacking the executable version to a folder of your choice you start avr_sim.exe (for Windows) or avr_sim (for Linux). You are asked then for a folder that your assembler source codes are located in. Navigate to that folder and click ok. Choosing the wrong folder does not cause any errors, as long as the folder exists and is accessible with your rights.

avr_sim starts This (or a similar window of the current avr_sim version) should show up.

avr_sim menu In the Project menu you now click on "New from asm" or you use the shortcut Ctrl-A. Both opens a file dialog, with which you can navigate to your *.asm file to be assembled. This file should have either an .include "*" entry or a .device "[AVR type]" directive that fixes the AVR type. Otherwise avr_sim won't work. If your file misses that, you'll have to add this line with a simple text editor (Notepad, Notepad++, KWrite, o.ä.). Or you can add this in avr_sim's editor, save the change and re-open the project.

If the source code uses other .include files, those have to be in the same folder. Otherwise avr_sim will complain.

When the file is loaded for the first time, you'll be asked for a package type. For simply assembling choose whatever you like, it does not matter.

avr_sim loaded the asm file That is how avr_sim looks like when the source code has been successfully loaded. Now simply press "Assemble" or Strg-Z and assembling goes on. If that is successfull, a message appears and the assembled list file opens. If not: the error file opens and shows all errors. if you right-click on an error entry here and you click "Go to error" the source file opens in the line where the error occurred.

If assembling was successfull, the assembled .hex file as well as the .eep file are in the same folder where your source code is located. These can now be burned to the controller using the appropriate programming software.

Done. It can be made even simpler, but I think that is simple enough.

To the top of that page, to the Q+A page

©2020 by