Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Learning Assembly Programming Language

Status
Not open for further replies.

Johnson777717

New Member
Good day all.

I'm just getting into microcontrollers and such. Before I get too involved, I would like to learn the Assembly programming language. I'm used to basic, C, pascal, VB etc. The assembly language looks totally foreign to me, so I can't even begin to try to figure out what is happening in an Assembly program. :roll:

With that said, does anyone know of any good websites or tutorials for learning the Assembly programming language? I'm trying to stay away from buying a book.

Thank you, I appreciate your help. Have a great weekend! :D
 
If you know C you can program in C and see what the complier comes up with in assembly (most compilers will let you generate assembly code when you compile). This isn't a replacement for a good assembly tutorial but should help you understand how to do useful things in assembly. Knowing how C translates into assembly will also help you write better C code.

Brent
 
Hi :D , about Assembler, you must know that Assembler programming for Common Personal Computer is much more dificult and complex than to these tiny uC's / uP's so that is just a relief :D.

The major diference from all the other languages is that in Assembler (to uC's/uP's) you have very few processor instructions thus it's very easy to even memorise them all.

Because the Assembler is the most basic language ever developed, so as you must imagine everything that makes the other languages great is lacking here ex.

In Basic behinde one simple FUNCTION you probablly have dozens, hundreds or even more ASM instructions !!

In C things are more balanced, each C function is converted to ASM by the linker, and then the ASM Compiler compiles the C Converted ASM code to Binary ex.

In ASM you have no linker :
ASM -> Machine Code (01010101011)

but in C:
C -> Linker -> ASM -> Machine Code (01010101011)

Since Visual Basic is private property of Microsoft, they don't give the Linker/Compiler to anyone so you can't even see that process with Non-Free Languages.

Assembler (ASM) is the closest language from the Machine (010101010), lol, can you imagine being programmig with 0 and 1's ?? lololol Confusing no ? lololol, The Assembler simply atributes the code from the processor instruction (ex. 0011 0001) to a Easy to remember name (ex. movlw).

Basicaly all other languages can generate ASM code since all binaries can be disassembled into ASM code again.

Another diference is that you don't have types of variables defined here, you have the equates that are referênces to MEMORY ADRESSes.
That requires that before making those EQUATES you take some time to build the memory adresses map, so that you know where the memory is used or not, to use your variable ou contact with the device ones.

Here you MUST do that stuff with the memory or else you will be having problems with the values you store.
Ex. a Char in C lang takes 1 Byte b'00000000'
X -> 1000 'This coud start in any free to use adress (ex. at 1000)
Y -> 1008 'But this should be next like this
Well, Y is 1 Byte next X, get it ! 8)

The Bad example is:
X -> 1000 'Assuming that X is a char
Y -> 1004 'lol, this overlaps the Y with X
Then you give some val to X
X <- 3 - b'00000011'
and to Y
Y <- 3 - b'00000011'
because of the over lapping
X is 51 - b'00110011'
, lol :D :D :D .

You can use this to your favor, but by mistake that could make you find program errors when the program is fine !! Keep this in mind.
That is not a rule, but if you whant to use many equates, keep the memory organised with the memory map.

This might seem strange at the first look, but when you undertaind this and some other concepts in ASM you will be programming with much ease.


I also program in C++ and V. Basic.net, but you must know that any C compiler for these devices, usualy generate to many ASM instructions because the ones that build the compiler didn't knew what will you be using (device) or what will you do with the program, so they give many ASM instructions to ensure that the code will be executing well.

My advice is that if you whant to program small memory Devices such as PIC 16F84* you will need ASM to ensure the program won't eat all the device space :D :D , that happens when you build big programs in C, or too many functions.
* (now there is a newer version of this one, search in this forum)

If you will use the bigger devices such are the beautifull PIC 18F6720 or even 18F8720 (with external memory) you can use C with no major problems :D :D .

But remeber that in C any Function or too many Loops generate many ASM instructions.

Try ASM if you like it stay some time to get used if not move to C. :D :D

(Did i wrote too mutch ? lol)
 
WOW! :shock: Thank you all for the replies, and the assistance. I'll take a look at what you've stated soon.

Again, I very much appreciate your help! :D
 
Here's the one I originally started with, before I moved to C. It was extremely helpful to me:

**broken link removed**

Good luck!
Der Strom
 
This is a 7+ years old thread.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top