Programming using assembly language (low level languages) requires an understanding of the register, including the name of each register of the controller chip used and the structure of the register itself. Physically, the work of a microcontroller can be described as a cycle of reading instructions stored in memory. Microcontroller specify the address of the program memory to be read, and make the process of reading the data in the memory.
Data read instruksi.Alamat interpreted as instructions stored by the microcontroller in the register, known as a program counter. These instructions eg arithmetic program involving two registers. Existing facilities in the assembly program was minimal, unlike in the top-level programming language (high-level programming language) everything is ready. Author of the assembly program should determine everything, determine the location of a program written in the program memory, making constant data and tablel constant in-memory program, create a variable that is used in the working-memory data and so forth.
Program-source assembly (assembly source program) is a collection of command lines written by the program-text editor (text editor) is simple, for example EDIT.COM program in DOS or in the Windows Notepad program or Mide-51. Line-printah set is usually stored in a file with the name extension *. ASM and so forth, depending on the Assembler program that will be used to process the program-source assembly.
Each line-command is a command that is intact, meaning that a command may not be broken up into more than one line. One could command line consists of four parts, the first part is recognized as a label or often also referred to as a symbol, the second part is recognized as the operation code, operand and the third part is the last part is a comment. Among the parts separated by a space or a tabulator.
Label
Labels are used to name a command-line, in order to easily menyebitnya in the writing program. Labels can give a name to the line in question. Part label is often referred to as a symbol part, this occurs when the labels are not used to mark parts of the program, but rather are used to mark the data section.
Operation Code section
Operation code (operation code or often abbreviated as opcode) is part of the command to be done. In this case there are two kinds of operation code, the first is the code-operating to regulate the work of the microprocessor / microcontroller. The second type is used to regulate the work of the assembler program, often referred to as assembler directive. -Operation code is written in mnemonic form, namely the form of abbreviations which are relatively easy to remember, for example, is MOV, ACALL, RET, and so forth.
Code-operation is determined by pabrikpembuatikroprosesor / mikrokontroler.Tugas the translation is done by a program called as a program-code Assembler.Di outside the specified operating manufacturer of microprocessors / microcontrollers, there are also code-operating to regulate the work of the assembler program, for example, be used to determine the position of the program in memory (ORG), is used to form the variable (DS), forming tables and constant data (DB, DW) and so forth.
Part operand
Operand is a complementary part of the operation code, but not all operations require operand code, thus could happen a command line consisting only of the operation code without operand. Conversely there is also an operation code that needs more than one operand, in this case between the operand one another separated by operand koma.Bentuk vary widely, could be codes that are used to express registers in the processor, could be a number-memory ( memory address) that is expressed by the number or the name of the label, can be data that is prepared in-operation-kan.
The comments section
The comments section is a program author notes, this section although it is not absolutely necessary but it helps problems of documentation. Read the comments on any command-line, easily understandable purpose line is concerned, this is very helpful others who read the program. Separators the comment section to previous section is a space or tabulator, though the first letter of comment frequently in the form of a semicolon, a sign of special separators for comment.
For the purposes of documentation intensive, often a line that is a comment only, in this case the first letter of the line in question is a semi-colon. AT89S51 has a very complete set of instructions. MOV instruction for byte grouped according to the addressing mode (addressing modes). Addressing mode operand dioperasikan.Berikut explain how the explanation of the various addressing modes. Form a common assembly programs are as follows:
Hexadecimal memory content is known by our microcontroller, which is a representation of an assembly language that we have made. Mnemonic or opcode is the code that will take action against the operand. Operand data is processed by the opcode. An opcode can take 1, 2 or more operands, sometimes also unnecessary operand. While the comments we can give by using a semicolon (;). Here’s an example of the number of operands that is different in an assembly.
CJNE R5, # 22h, action; it takes 3 operand MOVXDPTR, A; it takes 2 operand RL A; 1 operand NOP; does not require the operand
The program that has been completed we created can be saved with the extension .asm. Then we can create an object with the extension program using compiler Mide HEX-51