[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
ASMFAQ_General
Back to Main ASM FAQ page.
1: What does ASM stand for?
2: How does ASM differ from normal C programming?
3: How do cross C compilers work?
3: How is ASM programming done?
4: How do we design an assembly program?
5: How do we write and test the programs?
6: What is single step debugging?
7: What are the hardware and software tools available for testing the program?
8: How do we develop the lines of code?
9: What is a Linker?
10: What is an emulator?
1: What does ASM stand for?
ASM stands for Assembly. It basically consists of mnemonics. These mnemonics are nothing more than the instruction set of the microprocessor or microcontroller.
2: How does ASM differ from normal C programming?
ASM is basically low level programming or machine oriented programming (directly speaks to the hardware). Though C programming can be used both as low level and high level programming language or problem oriented language (normally working as front end with no control for the hardware) it is hence called a middle level programming language. We have cross C compilers for almost all of the microcontrollers today. For instance, for the 8051 architecture we have compilers from Keil Software and SDCC (Small Device C Compiler).
3: How do cross C compilers work?
The initial code is written C. The cross C compiler will read a C program file and convert it into it’s assembly language equivalent. Then further, it automatically invokes the assembler, to produce the Machine code file. The compiler behaves differently, depending on what functions are provided to it. Most cross C compilers have different software architecture and are not compatible with each other. As code, compiled by Keil is different from the code compiled by Archimedes for the same source file in C. In addition, cross C compiled files occupy more memory than assembly built files. Therefore, if memory is not an issue cross C compilers are preferred.
3: How is ASM programming done?
A digital computer is a sequential circuit that fetches a program instruction from code memory, decodes the instruction and then executes it . The instructions are kept in the program memory with the help of utility programs normally shipped with the programmer. As already mentioned earlier the architecture for different microcontrollers is different.
To begin programming the microcontroller we must begin with:
4: How do we design an assembly program?
Once we know the problem to be solved , we make a plan of how to tackle the problem. Such a kind of a plan is called an algorithm. A step by step procedure to cater to the problem. An algorithm’s diagram equivalent is called a flowchart. Both the flowchart and the algorithm must not contain any code or mnemonics. That is, they must not be microprocessor specific.
Depending on the scope of the problem we decide whether we have to do single stretch programming or modular programming. Modular programming is generally done in case of large complex solutions.
5: How do we write and test the programs?
Testing the program on a step by step basis and checking the contents of various registers is called single step debugging. The debugger can also run the program fully stopping only at user specified places in the program called breakpoints. For instance, when getting into and getting out of a software loop.
7: What are the hardware and software tools available for testing the program?
The tools available for testing a program are the circuit board (where the solution has to be provided), a programmer (a programmer for that particular chip has to be available), Sometimes and ICE (In Circuit Emulator) is also used. With the help of an ICE, we can find out whether the board is working. It is normally connected through to the PC.
8: How do we develop the lines of code?
Assembly language programs are written as a sequence of text lines. A text line is nothing more than a line of alphanumeric characters that are stored in a disk file. Each file ends when a carriage return character is stored by the text editor onto the disk. The file is created by using a word processor or a text editor. The only condition placed on the file is that it must be stored in pure ASCII format. By using this format, unusual characters like tabs and font size do not appear in the final file. Each line of text is an instruction to the CPU, a directive to the assembler or a combination of the two.
9: What is a linker?
A linker is a program used to join several .obj (object files) into a single executable file. This is normally used in modular programming. Each module can be individually written, tested and debugged. Then, when all the modules work they can be linked together.
The linker produces a [] file, which contains the binary codes of all the combined files. The linker also produces a [] map file, which contains information about the [] files. The linker does not assign absolute addresses to the program but it assigns only ?relative addresses starting from 0. This kind of program can be anywhere in the memory map and used properly.
10: What is an emulator?
One of the ways of real testing the working of the hardware and the software together is with the help of an emulator.
An emulator is combination of hardware and software . It usually used to debug the hardware and software of an external circuit board or a card. A multi wire cable, i.e mostly an RS-232 link connects the PC to the emulator. At the other end of the emulator, the prototype card/circuit is connected. Through the connection, the software of the emulator allows one to download the object code into the RAM in the system being tested and execute it.
Like a debugger, an emulator allows one to load, run and verify the contents of memory/registers and change or insert additional information into the program. Another powerful feature of an emulator is the ability to use either system memory or the memory of the client card that one is debugging.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
ASMFAQ_General
Assembly Frequently Asked Questions (General)
Introduction
Welcome to the General Assembler Frequently Asked Questions page. The General Assembler FAQ is open for everyone to contribute to, so if you find a mistake or something that is missing please do feel free to make corrections and add new content. For more information, click here.Back to Main ASM FAQ page.
1: What does ASM stand for?
2: How does ASM differ from normal C programming?
3: How do cross C compilers work?
3: How is ASM programming done?
4: How do we design an assembly program?
5: How do we write and test the programs?
6: What is single step debugging?
7: What are the hardware and software tools available for testing the program?
8: How do we develop the lines of code?
9: What is a Linker?
10: What is an emulator?
1: What does ASM stand for?
ASM stands for Assembly. It basically consists of mnemonics. These mnemonics are nothing more than the instruction set of the microprocessor or microcontroller.
2: How does ASM differ from normal C programming?
ASM is basically low level programming or machine oriented programming (directly speaks to the hardware). Though C programming can be used both as low level and high level programming language or problem oriented language (normally working as front end with no control for the hardware) it is hence called a middle level programming language. We have cross C compilers for almost all of the microcontrollers today. For instance, for the 8051 architecture we have compilers from Keil Software and SDCC (Small Device C Compiler).
3: How do cross C compilers work?
The initial code is written C. The cross C compiler will read a C program file and convert it into it’s assembly language equivalent. Then further, it automatically invokes the assembler, to produce the Machine code file. The compiler behaves differently, depending on what functions are provided to it. Most cross C compilers have different software architecture and are not compatible with each other. As code, compiled by Keil is different from the code compiled by Archimedes for the same source file in C. In addition, cross C compiled files occupy more memory than assembly built files. Therefore, if memory is not an issue cross C compilers are preferred.
3: How is ASM programming done?
A digital computer is a sequential circuit that fetches a program instruction from code memory, decodes the instruction and then executes it . The instructions are kept in the program memory with the help of utility programs normally shipped with the programmer. As already mentioned earlier the architecture for different microcontrollers is different.
To begin programming the microcontroller we must begin with:
- To understand and study the hardware architecture.
- Make ourselves familiar with the instruction set of that particular microcontroller and assembly language instructions. If one is an expert at C then one must look for a suitable cross C compiler.
- In the assembler program we normally have the text editor, compiler/assembler, debugger and the help file/manual.
- We must then use the manual for getting a feel of the features and working of the cross [[compiler]. Have a look at the examples given there. Understand the syntax there will be a slight variation from the C syntax like certain special library files may be included.
- One of the important things we must look out for is that whether C code along with assembly code in the same program is compiled or not.
- Begin with writing small programs and then move on to larger programs with complex logic.
4: How do we design an assembly program?
Once we know the problem to be solved , we make a plan of how to tackle the problem. Such a kind of a plan is called an algorithm. A step by step procedure to cater to the problem. An algorithm’s diagram equivalent is called a flowchart. Both the flowchart and the algorithm must not contain any code or mnemonics. That is, they must not be microprocessor specific.
Depending on the scope of the problem we decide whether we have to do single stretch programming or modular programming. Modular programming is generally done in case of large complex solutions.
5: How do we write and test the programs?
- A text editor is loaded from the disk into the Random Access Memory (RAM). The programmer edits the program, saving it on a disk as a pure ASCII file. The saved file is called a source file.
- The assembler program is loaded from disk into RAM and assembles the source code.
- Once the errors are removed the source file is reassembled. A debugging or simulation program is loaded from the disk into the RAM and the machine language file is tested under user control.
- Any logical errors are detected in run time testing (done practically) during debugging and the entire process repeated until the program executes as desired.
Testing the program on a step by step basis and checking the contents of various registers is called single step debugging. The debugger can also run the program fully stopping only at user specified places in the program called breakpoints. For instance, when getting into and getting out of a software loop.
7: What are the hardware and software tools available for testing the program?
The tools available for testing a program are the circuit board (where the solution has to be provided), a programmer (a programmer for that particular chip has to be available), Sometimes and ICE (In Circuit Emulator) is also used. With the help of an ICE, we can find out whether the board is working. It is normally connected through to the PC.
8: How do we develop the lines of code?
Assembly language programs are written as a sequence of text lines. A text line is nothing more than a line of alphanumeric characters that are stored in a disk file. Each file ends when a carriage return character is stored by the text editor onto the disk. The file is created by using a word processor or a text editor. The only condition placed on the file is that it must be stored in pure ASCII format. By using this format, unusual characters like tabs and font size do not appear in the final file. Each line of text is an instruction to the CPU, a directive to the assembler or a combination of the two.
9: What is a linker?
A linker is a program used to join several .obj (object files) into a single executable file. This is normally used in modular programming. Each module can be individually written, tested and debugged. Then, when all the modules work they can be linked together.
The linker produces a [] file, which contains the binary codes of all the combined files. The linker also produces a [] map file, which contains information about the [] files. The linker does not assign absolute addresses to the program but it assigns only ?relative addresses starting from 0. This kind of program can be anywhere in the memory map and used properly.
10: What is an emulator?
One of the ways of real testing the working of the hardware and the software together is with the help of an emulator.
An emulator is combination of hardware and software . It usually used to debug the hardware and software of an external circuit board or a card. A multi wire cable, i.e mostly an RS-232 link connects the PC to the emulator. At the other end of the emulator, the prototype card/circuit is connected. Through the connection, the software of the emulator allows one to download the object code into the RAM in the system being tested and execute it.
Like a debugger, an emulator allows one to load, run and verify the contents of memory/registers and change or insert additional information into the program. Another powerful feature of an emulator is the ability to use either system memory or the memory of the client card that one is debugging.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
