Search This Blog

Thursday, April 26, 2012

Understanding the program structure of 8086 microprocessor

The program writing in 8086 is quite different from that of 8085. Why one may ask?? Well answer to that is first their architecture are different. Different architecture means different set of instruction code. Secondly 8086 is a 16 bit processor. Meaning it processes 16bit of data, twice as much data as the 8085.

There are 2 ways to write a program. One as I say a simplified segment way other the simple way.

Simplified Segment
Simple way
Basic Structure
Basic Structure
.model model_type
.data data_segment_name
-------
.code code_segment_name
----
----
----
END
Data_segment_name SEGMENT
----
----
Data_segment_name ENDS
Code_segment_name SEGMENT
----
----
Code_segment_name ENDS
Here we don’t need to end each and every segment by using ENDS instruction. When compiler detects start of another segment or meets the instruction END it automatically assumes the end of the segment.
Here every segment needs to ended properly using Segment ENDS instruction. Failing to do so will raise a syntax error.
Here writing name of data segment or code segment is not nesscessary. A simple .code and .data will create a local reference type segment usable in the single file.
Here writing the name of data segment and the code segment is very very essential. The segment created here needs to have a name without which complier will not be able to differentiate between memory segmentation. No two segments can have a same name.
Here model type is to written as small, huge, large etc etc…
Here model type needn’t to be mentioned.

Rest explanation of program code can be found as comment along with the program.

No comments:

Post a Comment