Introduction to Programming 8086: Prog. Language

 

Introduction to Programming 8086 : Prog. Language

                                       There are three language levels that can be used to write a program for a Microprocessor.

1)     Machine Language :

                           In Machine language, we can write a program as simply a sequence of the binary codes for the instruction to execute microcomputer. The three instruction program is given below:

Program:-

1.      Input a value from PORT 05.

2.      ADD 7 to this value.

3.      Output the result to PORT 02

MEMORY ADDRESS

CONTENTS (BINARY)

CONTENTS (HEXADECIMAL)

OPERATION

01000 H

11100100

E4

INPUT FROM

01001 H

00000101

05

PORT 05 H

01002 H

00000100

04

ADD

01003 H

00000111

07

07 H

01004 H

11100110

E6

OUTPUT TO

01005 H

00000010

02

PORT 02

                                      Table 1: Machine Language Program

 

                           This binary form of the program is referred to as ‘machine language’ because it is the form required require by the machine. Therefore it is difficult for a programmer to memorize the thousands of binary instruction codes for 8086 Microprocessor (CPU). Also, it is very easy for an error to occur when working with long series of 1’s and 0’s. Using Hexadecimal representation for binary codes might help some, but there are still thousands of instruction codes, to deal with.

2)     Assembly Language :

                           Assembly language use 2, 3 or 4 letter mnemonics to represent each instruction type. Mnemonics are usually initials or a shortened form language of the English words for operation performed by the instruction. For example the mnemonic for subtraction is SUB. Assembly Language statement are usually written in a stander four field, as shown below,

 

LABEL FIELD

OPCODE FIELD

OPERAND FIELD

COMMENTS FIELD

NEXT:

 

 

SUB

 

MOV

 

AL,07

 

BL,AL

;SUB 07H FROM CONTAINTS OF AL REGISTER

;MOVE CONTENT OF AL INTO BL REGISTER

Table 2: Assembly Language Program Statement Format

           In above table,

·        Label is symbol used to represent address

·  The opcode field contains the mnemonic for instruction to be performed. Instruction mnemonics are sometime called operation codes, or opcodes.

·       The operand field of the statement contains the data, the memory address, the port address or the name of register on which the instruction is to be performed.

·     The comments field which start with semicolon. Comments do not the part of the language but it is important. You write a comments in a program to remind you for the function that an instruction perform in the program.

3)         

3)  High-Level Languages :

                           Another way to write a program for a microprocessor is with a High-Level Language such as BASIC, Pascal or C. These languages use program statements which are even more English – like than those of assembly language. An interpreter program or a compiler program is used to translate High-Level language to Machine Language code. Program can usually fast written in high-level language but execute more slowly and required more memory than the same program written in assembly language. 

 

Post a Comment

1 Comments