You are on page 1of 14

Microprocessor & Assembly Language Lab: 02

FICT, BUITEMS Page 1 of 14

Microprocessor & Assembly Language

Lab: 03

Using Debug-III

3
Lab
AA AA AA AA AA 104 (enter)

The ENTER Command


Enter command can be used to modify the memory contents. The format of Enter command is given below: E [Address] [List]

The address part of the Enter command is entered in the same manner as that of Dump command. The List that follows the address is the data that gets loaded into memory. For example, following command will load five consecutive bytes to memory locations starting at address DS: 100 with the value AA? E DS: 100

You can verify the results of above command by issuing Dump command: D DS: 100

Note that we have also given the ending address of the memory block which is to be dumped. Instead of loading a list of data into memory, we can also use Enter command to modify the memory locations one by one. This can be done if you dont provide the List in Enter command as shown below: E DS: 200

Above command causes the value at DS: 200 to be displayed. Note that the cursor will be blinking at the end of the data value. At this point you can either enter new value which will replace the existing data or you can depress the return key to terminate the Enter command. Doing this will not affect the existing data in memory. After executing Enter command without providing the List, depress Space key. What will happen? ______________________________________________________________________ Start a data entry sequence by examining the contents of address DS: 100 and then, without entering new data, depress the key. What happens? ______________________________________________________________________

In addition to above methods of modifying memory contents, you can also enter ASCII data using Enter command. E DS: 300 YOUR_NAME

The above command will cause the ASCII data for letters of your name to be stored in memory.

The FILL Command:


Fill command is used to modify the contents of a large block of memory. It would be time consuming to use Enter command to modify a large memory block since you have to modify each location one by one. To clarify this point, lets assume that you have to enter the value BB at fifty consecutive memory locations starting at address DS: 400. If you choose Enter command for this purpose then you will be entering BB fifty times. Fortunately Fill command is available in Debug to help us. The format of Fill command is shown below:

____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language

Lab: 03

[Starting Address]

[Ending Address]

[List]

The above problem can be solved easily using Fill command: F 400 431 BB

You can try Enter command to notice the difference between Fill and Enter commands.

The MOVE Command:


In debug, the Move command signifies a Copy-Paste operation. Move command can be used to copy a block of data from memory to another part. The format of Move command is given below: M [Starting Address] [Ending Address] [Destination Address]

Fill each storage location in the block of memory from addresses DS: 600 through DS:
61F with the value 11. Then copy this block of data to a destination block starting at DS: 660. Verify that the block move is correctly done. ______________________________________________________________________ ______________________________________________________________________

The COMPARE Command:


Sometime it is required to compare two blocks of memory to determine if they are same or not. Such type of comparison can be done by using Compare command. The format of Compare command is given below: C [Starting Address] [Ending Address] [Destination Address]

For example, to verify the correct movement of block of data we moved previously, following command sequence can be issued in Debug: C 600 61F 660

During the execution of above command, the contents of memory location 600 will be compared to 660, 601 to 661 and so on. Each time unequal elements are found, the address and contents of that byte in both blocks will be displayed. No address will be displayed if the two data are same. You can enter a destination address other than 660 in above command to understand this point.

The Search Command:


The Search command is used to scan through a block of data in memory to determine whether or not it contains specific value. The general form of Search command is given below: S [Starting Address] [Ending Address] [List]

To understand the use of Search command, type following command sequence: F S 100 100 16F 17F 22 33 33

How many memory locations contained 33?

What are the addresses? ______________________________________________________________________ ______________________________________________________________________

Hexadecimal Addition and Subtraction:

____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language

Lab: 03

Debug has ability to add and subtract hexadecimal numbers. Both operations are performed with a single command known as the Hexadecimal command. The format of Hexadecimal command is shown below: H [Num 1] [Num 2]

When executed, both sum and differences of Num 1 and Num 2 are displayed on the screen, sum being displayed first. Using Hexadecimal command, write down the command sequence you will issue to calculate the Physical Address of next instruction to be executed? ______________________________________________________________________

Find the negative of 6H using Hexadecimal command. ______________________________________________________________________

EXERCIES:
Write a sequence of commands that will fill the first six storage locations starting at address CS: 100 with 11, the second six with 22, the third six with 33, the fourth six with 44, and the fifth six with 55; change the contents of storage locations CS: 105 and CS: 113 to FF; display the first 30 bytes of memory starting at CS: 100; and then use a search command on this 30 byte block of memory to find those storage locations that contain FF.

Name: Date: ____________________________

Roll No:

. Signature of Instructor: ______________

____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language

Lab: 09

SK-80386 Trainer-

OBJECT To study the SK-80386 trainer. THEORY

9
Lab

The SK-80386N microcomputer trainer is a microprocessor controlled educational system, based on Intel 80386 microprocessor. It has been specifically designed and manufactured for training engineers in designing, use and maintenance of microprocessor systems. It is an excellent support for programming in Assembly. It helps studying microprocessor system programming, hardware structure, memories, and interfaces to external devices.

Trainer Specifications:
The SK-80386N trainer board contains all the necessary components for the study of Microprocessor based systems. A brief description of the components and their technical characteristics is given in the following table. Component Specification CPU 80386 / 8032 (Dual CPU) ROM 128 KBYTE (27C256) USER: 64KBYTE Monitor: 64KBYTE RAM 128KBYTE (62256) Serial Port 2 Ports (8251) SIO-1 RS-232C SIO-2 RS-232C, RS-422 Parallel Port Four 16Bit Ports (8255) PPI-2, PPI-3 Three 8Bit Ports (8255) Printer Port CENTRONICS (PPI 8255) Counter / Timer 16Bit, 3 Channels (8253) External I/O Bus Address, Data, Control, I/O Selector Dot Matrix 3 Color 8 x 8 Matrix Step Motor 1.8 Deg. / Step (200 Steps) Display 168 x 64 LCD with Backlight Keypad 28 Keys Power Supply Input: 110 / 220V Output: +12V 1A / -12V 0.75A / +5V 2A

Memory Unit:
Memory includes ROM, RAM, and user expansion area. The overall address range in real-mode is from 00000H to FFFFFH. The Trainer only uses a small subset of this potential range of memory. The Memory Map is given in the following table. Addresses Description 00000 Interrupt Vector Table 000FF 00100 Stack Area RAM BANK 0 004FF 01000 (100:0000) Serial Download Program 1FFFF 20000 Open OPEN 3FFFF 40000 User ROM ROM BANK 0 4FFFF 50000 Open OPEN 5FFFF 60000 Serial Monitor Program ROM BANK 6 6FFFF

____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language I/O Space:


The following table shows the available I/O ranges in SK-80386N. Addresses 0020 0024 LSB PPI-1 PORT_A MSB Remarks 8255 P I/O EXTERNAL

Lab: 09

Keypad:
There are two keypads in SK-80386N. One is for entering, verifying and executing a program (called Operator Keypad), and the other is for entering numeric values for any running program (called HEX Keypad).

Operator Keypad
The Operator Keypad consists of 28 keys (7 x 4). The individual position of each key is shown in the following figure.

RES GO < :

NMI RE G > ,

IRQ TR C F1 ENT

C PRN 8 IB 4 OB 0 EDIT

D MOV 9 IW 5 OW 1 CRT

E FILL A ID 6 OD 2 LCD

F B 7 3

Key Functions ____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language


The brief operation of each key is given below. Key Operation RES System Reset. NMI Non Mask able Interrupt IRQ Software Interrupt GO To execute a program from CS:IP address REG To check and correct register contents TRACE Invokes Step-by-Step program execution from CS:IP address < Backspace > Space F1 Shows the built-in program names and addresses : Colon , Comma ENT Enter Key (Carriage Return) PRN To Print to printer attached to Centronics Port MOV To copy a memory block FILL To fill a memory block IB Input a byte from the specified port address IW Input a word from the specified port address ID Input a Double word from specified port address OB Output a Byte to specified port address OW Output a Word to specified port address OD Output a Double word to specified port address EDIT To check and correct contents of a memory location CRT CRT Mode, (when connected with a PC) LCD LCD Mode, (to work on trainer) O-F To enter numeric values

Lab: 09

CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: Roll No: . Signature of Instructor: ______________

Date: ____________________________

____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language

Lab: 10

SK-80386 Trainer-II

OBJECT
To study the machine language programming on the trainer.

10
Lab

THEORY
In this lab session, we will learn to operate SK-80386N in LCD mode. SK-80386N can be operated in two modes, LCD and CRT. LCD mode means that there is no PC connected with the trainer and user will be using Operator Keypad to enter, verify and execute programs.

PROCEDURE
When the power is turned ON, following message appears on the LCD. Meanwhile 386 appears on the dot matrix. In order to operate SK80386N in LCD mode, press 2 on the operator keypad.

Pressing 2 on the operator keypad, clears 386 on the dot matrix and the following screen appears on the LCD.

SYSTEMKIT SK-80386 Ver 1.2 1:CRT 2:LCD

TUTOR MODE Press Enter To Start __

SK-80386N is now in LCD mode. SK-80386\> prompt appears on the LCD.

SK-80386 \>__

Running Demo Programs ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences, BUITMS. 8 / 14

Microprocessor & Assembly Language


Press F1 to check the built in Demo programs. Pressing F1 shows following LCD screen: Demo Program Addresses 6000:130=Dot matrix 6000:140=LED 6000:150=Button 6000:160=Step Motor 6000:170=EXT.PPI Press ENT to return__

Lab: 10

You can execute any demo program from this list. For example if you want to execute Dot Matrix demo program, then press G (GO command key) and enter the starting address of the program, i.e. 6000:130.

SK-80386 \>G=6000:130__

Note: To separate segment base and offset address, use colon key on the operator keypad. After performing above steps, following message appears on the LCD:

SK-80386 \>G=6000:130 Program To Run From 6000:130 OK? (Y/N)__

Press ENT key for YES. 386 appears on the dot matrix.

Note that the message on dot matrix is same as that of turning power ON.

Terminating a Program ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences, BUITMS. 9 / 14

Microprocessor & Assembly Language

Lab: 10

In order to terminate a program, Press NMI or RST key. Since all demo programs are executed in infinite loop, therefore pressing RST key resets the trainer, terminating program execution. Alternatively you can use NMI key.

Entering and verifying Register Contents


On the SK-80386 prompt, press REG key to display all the registers on LCD.

SK-80386 \>
Pressing REG key shows following screen on the LCD:

0=AX 4=SP 8=DS C=IP dialog box appears.

1=BX 2=CX 3=DX 5=BP 6=SI 7=DI 9=ES A=SS B=CS D=FL Press No___

Select the desired register by pressing corresponding key (0 F). When the corresponding number is entered following

EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000000 ESP =000004FF EBP =00000000 ESI =00000000 EDI =00000000 For next page, press ENT. We can change the value of the register as follows. EAX=00000000 :1234__

Next__

Go back to REG command and verify the entered value of the register.

0=AX 4=SP 8=DS C=IP

1=BX 2=CX 3=DX 5=BP 6=SI 7=DI 9=ES A=SS B=CS D=FL Press No___

The new value of the register is shown by pressing the respective number of the register. If you dont want to alter the register contents, then simply press ENT after seeing the following screen:

EAX=00001234 :__________

Input Machine Language code and data from the HEX Keypad ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences, BUITMS. 10 / 14

Microprocessor & Assembly Language

Lab: 10

You can take input from the HEX keypad by pressing one of IB, IW or ID keys on the operator keypad. The port address for the HEX keypad is 74H. For example if you want to input a Byte data from the HEX keypad, then press IB key on operator keypad. Enter 74, then comma and then press ENT key, as shown in figure below:

SK-80386 \> IB

74

Note: You must be pressing the desired keys on the HEX keypad while you press ENT, because microprocessor will read the port as soon as IB command is executed. Also note that the HEX keypad works in Reverse order, means that when you press a key on HEX keypad, it will send a 0 (zero) to the microprocessor. For example if you have entered 80 by pressing 8 and 0 hex keys during execution of IB command, then the FEFE would be read by microprocessor, as shown in following figure:

SK-80386 \> IB FEFE

74

Similarly you can use IW and ID commands to enter word and double word data respectively.

Output Data to LEDs


SK-80386N also has 16 LEDs, which are mounted just above the HEX keypad. The address of the LEDs is 80H. Lets send a byte data 08 to the LEDs, it will cause the fourth LED to turn ON, while all other LEDs would be turned OFF. To do this, press OB, then 8, then 0, then comma, then 0, and finally 8, and press ENT key as shown in figure below:

SK-80386 \> OB

80, 08

You can also use OW and OD commands to send a word and double word respectively.

Entering Machine Codes


In this section, you will learn how to enter Machine Codes of an Assembly Language Program into SK-80386N for execution. Keep in mind that the Code Segment starts from address 100:0000. The first step of entering a program for execution is to have the machine codes of assembly language mnemonics. You can do this be using Intel Microprocessors data sheet, or by simply taking machine codes from Listing file (.LST). Following is a program whose machine code would be entered into SK-80386N for execution: Memory Addresses 0000 0003 0005 0007 Machine Codes B8 0001 E7 08 D1 C0 EB FA Assembly Language Mnemonics AX, 01 80H, AX AX, 01 L1

MOV L1: OUT ROL JMP

Above program can be entered by using EDIT command. Follow the steps given in table below:

Key Press EDIT

Function Start Entering Program

LCD Shows SK-80386\> E

________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences, BUITMS. 11 / 14

Microprocessor & Assembly Language


100:0 ENT B8 01 00 E7 Key Press 80 D1 C0 EB FA ENT Starting Address of CS Execute Edit Command Machine Code Machine Code Machine Code Machine Code Function Machine Code Machine Code Machine Code Machine Code Machine Code Terminate EDIT SK-80386\> E 100:0 SK-80386\> E 100:0 0100:0000 FF _ 0100:0000 FF B8 0100:0001 FF 01 0100:0002 FF 00 0100:0003 FF E7 LCD Shows 0100:0004 FF 80 0100:0005 FF D1 0100:0006 FF C0 0100:0007 FF EB 0100:0008 FF FA 0100:0008 FF

Lab: 10

Note: while entering word data 0001, the lowest byte 01 is entered first, and then the upper byte 00 is entered. In order to execute above program, you have to execute GO command. For doing this, press GO key, then give the starting address of the Code Segment (i.e. 0100:0), and then press ENT key. SK-80386N will prompt you for a YES/NO option. Press ENT key again to start execution.

SK-80386 \> GO = 0100:0000

As soon as the program execution starts, all the LEDs on the HEX keypad seems to be turned ON, however, LEDs are actually being rotated. This is because microprocessor is running on a very high frequency, and human eyes can only differentiate between states if the frequency is below 25Hz. In order to see the actual rotate process, use TRC (TRACE) command. For this press start pressing TRC key, and after some key presses you will note that the first LED is turned ON. This continues as you keep pressing TRC. CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________

Name: Date: ____________________________

Roll No:

. Signature of Instructor: ______________

________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences, BUITMS. 12 / 14

Microprocessor & Assembly Language

Lab: 11

SK-80386 TrainerIII
OBJECT
To study the I/O interfacing on the trainer.

11
Lab
2:LCD

THEORY
In this section we will use a PC to download Assembly Language Programs using serial communication.

PROCEDURE
To begin, load IC.EXE (InterComm.EXE) program in the PC and connect PC with the trainer using NULL Modem. After resetting the trainer, press 1 in order to select CRT mode.

SYSTEMKIT SK-80386 Ver 1.2 1:CRT

The default setting of the serial port are 19200bps baud rate), 8 data bits, No parity, and 1 stop bit. The following contents will be displayed on the LCD. When IC.EXE is loaded in PC and communication between PC and trainer is established, following dialog box appears: __ PC/inter comm. V2.04 Fe-Setup F10=Exit/F Call 3:32 C 0:00 Now you are ready to download program into trainer. While working in IC, press L (LOAD) on the SK-80386\> prompt on the PC, and then specify the full path of the file you want to download. SK-80386\> L __Sending your file in the HEX format __Ready to Send? (Y/N) Y After executing Load command, press ALT + T (shortcut for Transmit command in IC) in order to transmit file to trainer. __Send Now ALT+T (Instruction for sending the file code in HEX form) Name of the file to transmit <default is>: _ Note: The file should be in HEX (*.HEX) format, since Intel Microprocessors understand only HEX files. To do this, use EXE2BIN.EXE program to convert an executable file into Binary file. Then use BIN2HEX.EXE program to convert a Binary file into HEX file. You should give the full path of the file you want to download to trainer. For example, if you want to download dot_3861.hex, then you should give its full path. After entering the full path, the specified program will be downloaded into trainer, and following message will be displayed on the PC screen if the transmission was successful. Thanking for your cooperation.

____________________________________________________________________________ FICT, BUITEMS

Microprocessor & Assembly Language

Lab: 11

You can execute the program by using either GO or TRC command.

SK-80386\>G

Program to run from 100:0000 OK? <Y\N> Y Output would be shown on the dot matrix.

CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: Date: ____________________________ Roll No: .

Signature of Instructor: ______________

____________________________________________________________________________ FICT, BUITEMS

You might also like