Programming in assembly an a Arduino Uno card

i have an Arduino Uno card. I installed Arduino IDE on Linux and Windows.
how can i program my Uno card in assembly with Arduino IDE on linux or windows?

is it possible to program my Uno card in assembly without using IDE Arduino? if it's possible, which IDE can i use?
SASM for example?

Thanks a lot

See #202 Using Assembler 😵 within an Arduino Sketch - easy to do! 😊 - YouTube

Just interested in why you'd like to program in Assembly, which is of course possible as your research and UKHeliBob's post. I used to do it in the early 80's but only because of memory limitations; and of course it was fun.

His videos are a lot of fun usually!

are the instruction sets the same as you go from one maker to another?

Hi, @trazomtg
Welcome to the forum.

Good reason.. :+1: :+1: :+1:

Definitely... :+1: :+1: :+1:

Tom... :smiley: :+1: :coffee: :australia:
PS. Did Z80 when it was one of the micros to use in the late 70s, even had an evaluation kit with 4x7seg display and lots of development area.

Yep , I did Z80 on a Nascom1 many years back , PIA chips, 1k ram ( 8 chips !) etc …. Ah happy days

I don't follow your question. Are you asking about different manufacturers making the same microprocessor? Or you asking about the many different microprocessors?
Each microprocessor has different architecture, so the instruction set is entirely different for each.
Today you have to watch for different versions of the same microprocessor as bugs are corrected from time-to-time.

I really don't know. do different manufacturers have different instructions sets in general and still different ones depending on the architecture on a device that one company is making? I guess the answer is yes. Now I don't know why I asked!

Since the 1970's and the development of integrated circuits, all computers, main-frame, mini-computers, microprocessors and now micro-controllers, such as the various Arduino machines, have all operated on extremely primitive instructions. What is called "micro-code" runs those primitive instructions in order to implement the "instruction set" for that computer. The reason is the time and expense to repair bugs and errors in the actual silicon chip. Easier to correct or change the prom part of the design than the primitive physical logic.
One time in my experience, a main-frame manufacturer needed to add an instruction, but there was no room in the prom. So they eliminated one instruction they considered least used. Unfortunately that company's check processing software, written in COBOL and assembly, used that very instruction in several places. When the time came for the field engineer to replace the prom, and all software had been updated as per the company instructions, I got a call one night about the check processing software trapping out with an invalid instruction. We were prepared before hand by the company and a phone call their programmer gave me the fix for the instruction they had missed and all was well.
With today's micro controllers, fixing errors means replacing the whole chip, but they are so cheap!
Now you know, but still don't know why you asked!

1 Like

Still wondering why you'd like to use Assembler?
Looks like there are many Z80 users out there. Mine was a ZX Spectrum with Z81and all the perfs.

You can always try Atmel/Microchip Studio. It's free and works with all AVR MCUs

Microchip Studio

Just select Assembler when creating new project

You do need a programmer/debugger to debug your code directly from the application

i have an Arduino Uno card. I installed Arduino IDE on Linux and Windows.
how can i program my Uno card in assembly with Arduino IDE on linux or windows?

The easiest way is to create .S files in the Arduino IDE. ("Easiest" in the sense that you won't have to install anything new. The Arduino IDE will not be very "helpful" WRT writing assembly language code.

is it possible to program my Uno card in assembly without using IDE Arduino?

Yes. You can use one of several other IDEs, or just a text editor and command-line tools. Assembled programs can be uploaded using the Arduino bootloader, or using a separate hardware programmer.

if it's possible, which IDE can i use?
SASM for example?

SASM seems to be be pretty exclusively aimed at writing assembly language for x86 desktop processors.

The usual choice is "Atmel Studio" ("AS7"), now distributed by Microchip (the vendor(s) that actually make the chip.) Another choice is MPLAB-X (originated at Microchip, and retrofitted to support AVR.) There is some concern in the community that AS7 is likely to be discontinued.

Note that there are two slightly different assembly languages in common use for AVRs. One is "AVRASM2" (from Atmel), and the other is the gnu assembler avr-as, which comes with avr-gcc. They support the same instruction set, but have differences in exact syntax, and in "assembler directives" that are big enough that you can't assemble files aimed at one with the other. avr-as is also a "relocating assembler" designed so that you can link your code with external libraries.

are the instruction sets the same as you go from one maker to another?

If you have "Arduino Uno" boards, they should all be built around the same "atmega328p" microcontroller chip and use the same instruction set. The atmega328p is one variety of "AVR" processor, and the all have "very similar" instruction sets (for example, some AVRs do not have a multiply instruction.)
If you use another board that has a microcontroller from a DIFFERENT "CPU family" (say, an Arduino Zero with a SAMD21 chip, or an ESP32 board) that will have a dramatically different instruction set. Your desktop PC has a very different instruction set than any of those (heh. Unless it's an Apple M1, maybe.)

Since the AVR chips pre-date the common availability of C compilers, you can probably find books and magazine articles on how to program them in assembly language. Although they're likely to be 10+ years old, and include instructions for installing AS4 on WXP and other outdated info.

As others have implied, Assembly language programming is not very common any more, so it is difficult to find "modern" instruction. Some classes seem to be using AVR's to teach assembly language "fundamentals" (usually a requirement to get a CS degree.) (Judging by the "please do my homework for me" questions on various fora.)

The chip datasheet will contain basic information on the AVR architecture, and then there is an additional manual that explains all of the instructions in detail: (and then another manual describing the assembler and how to use it.)

1 Like

I think my curiosity was along the lines of how many different assembler languages are there and do they vary much. When I worked on the mainframe version in the prior century it was I guess just called 370 assembler. But I had vic 20 at the time and that thing had it's own assembler fairly different from the 370 stuff. mov vs mvc and they worked differently etc. All ancient history now.

Thanks, that about covers it.

for a "reduced instruction set" that sure has a lot of them!

1 Like

Might I suggest getting your feet wet using GCC inline assembly. A full tutorial is located here.

  1. Not really, once you re-categorize them into lumps ("all the conditional branch instructions are essentially the same instruction, but referencing different status register bits", "there is load and store and they have multiple addressing modes") and instructions that don't actually exist (SER, CLR, TST, SBR, CBR...)

  2. "Reduced" in RISC really refers more to reduced complexity of the instructions than reduced numbers of instructions. IMO. None of those "add the value at memory location offset+[bx]+[si] to a register and then increment si by the size of the operation"

1 Like

a lot of responses!!!

if i want to follow your advices and assembly my Arduino Uno card ... i don't know what to do!!!!!
it's an ATmega328P controller. which Assembly can i use? which IDE can i use? on Linux and Windows.


See reply #2