Lab 1: Introduction to BGC 8088 And Microprocessor
1.0 Assalamualaikum
Welcome to Intel x86 Assembly Language programing Lab. In this lab we will learn and practice
programming 8088 using Microtraininer. Quick introduction to BGC Micro trainer given below.
The basic idea is to write Assembly codes directly into memory.
2.0 BGC Microtrainer
1. CPU: Intel 8088 running at Clock Rate of 4.77 Mhz
2. System Memory consist of 32 KB RAM and 16 KB ROM (expandable to 32 KB)
3. Display: 2 X 40 character LCD module
4. Keyboard: 56 keys keyboard (alphanumeric and ASCII Symbols)
5. Built in Printer Interface: Provides the most general parallel printer interface. Connection is
similar to any IBM PC
6. RS232. To allow program to be transferred from host PC to BGC 8088 and vice versa
7. Parallel Control Interface This interface is built from 3 IC chips (8254, 8255 and 8259 A) It
provides 3 8 bits I/O Ports, 3 Timers, 5 interrupt signals
3.0 Monitor Commands
As you could see, the system has no keyboard, big monitors and software, therefor, we use
Monitor Commands(short key) to instruct the Trainer, for example to start writing program, to
execute a program, etc. The monitor commands must be typed in a command prompt which is
displayed using * in the small display. Here is the list of some commonly used monitor
commands
1. Assembler Commands (A, I and U)
A: Assemble the assembly language instructions
I: Insert Mode
U: Dissembler: (List)
2. Program Control Commands (G and R)
G: Execute
R: Display / Modify the register content
T: Trace program execution
3. Memory Management (C, D, E, F, M)
C: Compare the memory contents
D: Display the memory content
E: Substitute the memory content
F: Fill into a memory block
M: Move the memory content
4. Numerical treatment (B, H, J, S, V)
B: Convert decimal into binary
H: Calculate the sum and difference of two hexadecimal numbers
J: Convert decimal number into hexadecimal number
S: Convert hexadecimal number into decimal number
5. I/O Commands ( N , O )
N: Input data from I/O device
1
Lab 1: Introduction to BGC 8088 And Microprocessor
O: Output data to I/O device
6. Communication commands ( L, Z )
L: Download a program from host
Z: Upload a program to host
4.0 Introduction to Assembly Language Programming
Assembly language is a hardware language and a low level language. This means, unlike in high
level language the programmer should have knowledge on the hardware details and their
limitation as well as the ‘mnemonics’ or the language. The programmer should understand the
MP’s registers, memory organization and limitation of the syntax. The group of instruction for
8088 is known as x86 instruction set, basically refers to set of supported instructions.
A typical assembly instruction has the following format:
Opcode Destination_operand Source_operand , for example MOV AX, BX
MOV is the opcode which means operation code, which is your syntax
While destination operand and source operand is ‘places’ of your data. The data can be given
directly , from a register and from a memory
X86 instructions can be categorized such as (1) artimetric and logical group (2) Data copy (3)
Branch instruction (4) loop instructions (5) Machine Control (6) Flag instruction (7) Shift and
Rotate (8) String Instruction (9) IO instructions
Many believe studying and programming in Assembly is difficult and hard, but believe me, it is not
!!
5.0 An Adddition Programme : Lets start programming !!
Lets begin with simple instructions, lets use
MOV , means copying data from source operand to destination operand , example MOV AX,
1234(h) means we are writing 1234(h) to register AX
ADD means addition , example ADD AX, BX means Ax=AX+BX
5.1 Lets write a program to add 12(h) with 36(h) using 8 bit register
The Assembly language for this program is
MOV AL, 12
MOV BL,36
ADD AL,BL
Use the following steps to write and execute the program
- Type monitor command ‘a’ on command prompt
- System will take you to address prompt where you will see something like
0100:0000, which means you are at segment address 0100 (h) and offset address
0000(h)
- Type you’re your first line and use CR to go to next address
2
Lab 1: Introduction to BGC 8088 And Microprocessor
- Type your second instruction
- Type your third instruction
- When finish exit the address prompt by entering CR
Next is to execute your program , use g=startaddress, lastaddress
Example : g=0000,0006 or g=0,6
Your result will be stored in register AX. Confirm your programe is correct by validating content in
AX
5.2 Exercise :
(1) Repeat the program with 16 bit registers , use 16 bit numbers such as 1234(h) with
4321(h) ( change AL to AX and BL to BX )
(2) Do addition for 5678(h)+F001(h) , ( Note your result will be stored in AX ad DX)
(3) Note the changes in the offset address
6.0 A substraction programme
We do substraction using SUB instruction, its syntax is as follows:
SUB AX, BX, which means AX=AX-BX
Write a program for 8 bit substraction and 16 bit substraction
7.0 A multiplication programme
A multiplication syntax in x86 is unique as it is a single operand instruction. It accepts only source
operand . Example MUL BX, MUL BL, MUL CX .
MUL BX means DX.AX=AX*BX incase of 16 bit multipication
MUL BL means AH.AL=AL*BL in case of 8 bit multiplication
Do the following
(1) 2(h)*3(h)
(2) 34(h)*56(h)
(3) 1234(h)*2(h)
(4) 1234*67(h)
Note : register AH/ DX will used to accommodate bigger results, means if your 8 bit multiplication
Summary
After finishing all the steps above, one should have basic knowledge on writing and executing an
assembly language program with BGC 8088. More monitor commands will be explored in coming
labs together with more Intel’s Instruction Set for 8088.
Following questions is to be answered in a separate paper ( hand written only) . Please submit
this manual in 1 ( one ) week from date of practical section. Late reports will carry –2 marks .
Extremely late reports ( i.e. reports submitted after lab manual is returned to class ) will not
graded.
3
Lab 1: Introduction to BGC 8088 And Microprocessor
Questions
1. What’s the difference between a Microprocessor and a Micro controller?
2. What are registers? List all the registers for 8088 and 8086 and their usage.
3. What is memory? What are they made of and how are they arranged in Intel 8088?
4. Explain following terms
a. ALU
b. Pipelining
c. Micron
5. What is Effective address, briefly how do we calculate from
Segment: offset ex : 0100:0000
d. Explain the following terms
Clock Rate:
RAM:
ROM:
Memory:
Interrupt Signals
e. Name 3 IC chips mentioned in the above section (no. 7)