List of Practical’s Lab No.
LAB 1 LAB 2 LAB 3 LAB 4 LAB 5 LAB 6 LAB 7 LAB 8 LAB 9 LAB 10 LAB 11 LAB 12 LAB 13

Topic Part-I: Debug Utility To study and use DEBUG utility To study more commands of DEBUG utility To study more DEBUG commands. To study more DEBUG commands Part-II: Assembly Language Programming To study and use the arithmetic instructions To study and use the BCD arithmetic. To study string operations. To study the data conversions in assembly language Part-III: Using the SK-80386 Trainer To study SK-80386N trainer. To study machine language programming on trainer To study I/O interfacing and controlling of stepper motor Mini Project: Multiplexing 8 alphanumeric displays using the trainer Mini Project: Continued

Using Debug-I

 To study and use DEBUG utility.
  Monitor a program’s execution for debugging purposes. Examine and alter register and memory contents.


Microprocessor & Assembly Language
Debug is part of ‘Disk Operating System’ (DOS) which is used to enter an assembly language program into PC, execute the program, examine the results and debug any errors. In this lab you will be familiarized with debug environment and commands to examine or modify the MPU’s internal registers. Before using debug make sure that you are in DOS shell. In Windows follow these steps: 1. 2. 3. Start > Run > CMD (Press Enter) Type debug at the command prompt and record your observations. _____________________________________________________________________ Type q at the appeared prompt to quit. _____________________________________________________________________ The first command we will use in debug is called ‘Register’ command. Upon execution of register command the content of all the internal registers of MPU’s are displayed on the screen. 4. After step 1, type r or R to view the register dump. First line: ___________________________________________________________ Second line: _________________________________________________________ Third line: ___________________________________________________________ 5. 6. Write the contents of the general purpose registers in the first line. _____________________________________________________________________ Write the contents of the segment registers. _____________________________________________________________________ Note: Don’t try to change the contents of the segment registers. These have been set by the operating system. Modifying Register Contents:


Type ‘r’ followed by a register name. E.g. Type -r ax What are the contents of AX? _____________________________________________________________________


Enter a new value for AX at the colon prompt. : 12AB Type ‘r’ again to verify the contents of AX. What is the new value in the AX? _____________________________________________________________________


Try these values and record your observations: -R DX


Microprocessor & Assembly Language
DX 0000 : FF _____________________________________________________________________ -R DX DX 00FF : 12345 _____________________________________________________________________ -R DX DX 00FF : NAV _____________________________________________________________________

-R DH _____________________________________________________________________

Modifying Flags In addition to modify the internal register contents, debug can also be used to modify MPU flags. Notations used for displaying the status flags are given in table below: Flag OF DF IF SF ZF AF PF CF Meaning Overflow Direction Interrupt Sign Zero Auxiliary Carry Parity Carry Set OV DN EI NG ZR AC PE CY Reset NV UP DI PL NZ NA PO NC


Microprocessor & Assembly Language

10. To show current flag status type: -R F Name the flags which are set: _____________________________________________________________________ To modify flags just type in new states of all flags separated by spaces and depress enter key. Note that the new flag states can be entered in any order. What will you enter to set ‘Carry’ and ‘Zero’ flag? _____________________________________________________________________ How would you use register command to set the parity flag to even parity? _____________________________________________________________________ CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________


to dump the memory contents you can enter: D DS: 100 or: D 1342: 100 or: D 100 Note that if no segment base register is specified.Microprocessor & Assembly Language Lab: 02 Using Debug-II 2 Lab INTRODUCTION: In the previous lab we were dealing with internal registers of MPU. and only the address of the first byte is shown at the left. Enter. SI. DI. These commands are Dump. BUITEMS . On the debug prompt. type: D This will cause 128 consecutive bytes starting at offset 0100H from the current value in DS to be displayed. In this lab we will discuss Dump command. What is the Physical Address of the first location? ____________________________________________________________________________ What type of information is displayed in the third column? ____________________________________________________________________________ The DUMP command can also be issued by specifying the starting address of the memory block. then data segment will be taken as default. What happens if ‘D’ is entered repeatedly? ____________________________________________________________________________ FICT. This lab is focused on examining and modifying the memory contents. Move. BP etc. Compare and Search. Note that 16 bytes of data are displayed per line. As we have discussed in class that physical address is combination of base address stored in one of segment registers and offset address stored in IP. Fill. There are six commands which are used to examine or modify the contents of storage locations in memory. The DUMP Command: The DUMP (D) command allows us to examine the contents of a memory location or a block of consecutive memory locations.

BUITEMS . For example: D DS: 200 201 What is result of above command? __________________________________________________________ What would be the command to display the contents of 32 bytes of memory located at offset 0300H in the current data segment? __________________________________________________________ Is it possible that the memory contents of segments other than data segment (like code.Microprocessor & Assembly Language Lab: 02 You can also specify the size of block by providing a third parameter in DUMP command.:_________________________ Date: ____________________________ Signature of Instructor: ______________ FICT. stack etc) can be displayed? If yes then what would the parameters? __________________________________________________________ __________________________________________________________ Name: ___________________________ Roll No.

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. The format of Enter command is given below: E [Address] The address part of the Enter command is entered in the same manner as that of Dump command. Instead of loading a list of data into memory. without entering new data. What happens? ______________________________________________________________________ In addition to above methods of modifying memory contents. BUITEMS . Doing this will not affect the existing data in memory. depress ‘Space’ key. The List that follows the address is the data that gets loaded into memory. After executing Enter command without providing the List. What will happen? ______________________________________________________________________ Start a data entry sequence by examining the contents of address DS: 100 and then. This can be done if you don’t provide the List in Enter command as shown below: E DS: 200 Above command causes the value at DS: 200 to be displayed. For example. E DS: 300 “YOUR_NAME” ____________________________________________________________________________ FICT. depress the “– “key. Note that the cursor will be blinking at the end of the data value. you can also enter ASCII data using Enter command.Microprocessor & Assembly Language Lab: 03 Using Debug-III 3 Lab [List] AA AA AA AA AA 104 (enter) The ENTER Command Enter command can be used to modify the memory contents. we can also use Enter command to modify the memory locations one by one. 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.

The FILL Command: Fill command is used to modify the contents of a large block of memory. the address and contents of that byte in both blocks will be displayed. the Move command signifies a ‘Copy-Paste’ operation.Microprocessor & Assembly Language Lab: 03 The above command will cause the ASCII data for letters of your name to be stored in memory. 601 to 661 and so on. You can enter a destination address other than 660 in above command to understand this point. Fortunately Fill command is available in Debug to help us. The format of Compare command is given below: C [Starting Address] [Ending Address] [Destination Address] For example. Such type of comparison can be done by using Compare command. 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. following command sequence can be issued in Debug: C 600 61F 660 During the execution of above command. ______________________________________________________________________ ______________________________________________________________________ The COMPARE Command: Sometime it is required to compare two blocks of memory to determine if they are same or not. If you choose Enter command for this purpose then you will be entering ‘BB’ fifty times. Move command can be used to copy a block of data from memory to another part. BUITEMS . The general form of Search command is given below: S [Starting Address] [Ending Address] [List] ____________________________________________________________________________ FICT. the contents of memory location 600 will be compared to 660. Then copy this block of data to a destination block starting at DS: 660. The MOVE Command: In debug. The format of Fill command is shown below: F [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. Verify that the block move is correctly done. 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. let’s assume that you have to enter the value ‘BB’ at fifty consecutive memory locations starting at address DS: 400. No address will be displayed if the two data are same. to verify the correct movement of block of data we moved previously. 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. Each time unequal elements are found. To clarify this point.

sum being displayed first. Name: ___________________________ Roll No. The format of Hexadecimal command is shown below: H [Num 1] [Num 2] When executed. Using Hexadecimal command. change the contents of storage locations CS: 105 and CS: 113 to FF. ______________________________________________________________________ EXERCIES: Write a sequence of commands that will fill the first six storage locations starting at address CS: 100 with 11. and then use a search command on this 30 byte block of memory to find those storage locations that contain FF. and the fifth six with 55. 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: Debug has ability to add and subtract hexadecimal numbers. display the first 30 bytes of memory starting at CS: 100.Microprocessor & Assembly Language Lab: 03 To understand the use of Search command. the third six with 33. the fourth six with 44. the second six with 22. both sum and differences of Num 1 and Num 2 are displayed on the screen.:_________________________ ____________________________________________________________________________ FICT. 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. BUITEMS . Both operations are performed with a single command known as the ‘Hexadecimal’ command.

Microprocessor & Assembly Language Date: ____________________________ Lab: 03 Signature of Instructor: ______________ ____________________________________________________________________________ FICT. BUITEMS .

whereas in Assembly an H had to be appended at the end of a number to enter it in hexadecimal.3 ADD AX.Difference between Debug programming and Assembly programming are that numbers are hexadecimal by default in Debug.BX ADD AX. use the Go command G.Microprocessor & Assembly Language Lab: 04 Using Debug-IV Entering and Running Programs 4 Lab Use Assemble command –A <starting address> to enter Assembly Language instructions into memory.1 MOV BX.2 MOV CX. as: -G <=staring address> <stop address(es)> ____________________________________________________________________________ FICT. Starting address will be the offset into the code segment by default. To view the machine code. as the first 256 bytes (100H) are reserved by DOS. Type: -A 100 0B12:0100 0B12:0103 0B12:0106 0B12:0109 0B12:010B 0B12:010D MOV AX. use the Unassemble command U in any one of the following ways: -U <starting address> -U <starting address> <ending address> -U <starting address> L <number of bytes > -U <RETURN> To view the 32 bytes beginning at CS:IP Type the following and give your observations: -U 100 10D _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ To execute the instructions.BX INT 3 Note: Do not assemble beginning at an offset lower than 0100. BUITEMS .

INT 3. is reached. use the trace command T as: -T <=starting address> <number of instructions> Type: -T=100 2 _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ -T 3 _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Roll No. BUITEMS . -R _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Then type: -G _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ To trace through the execution of a program.Microprocessor & Assembly Language Lab: 04 If no addresses are given then execution starts at CS:IP and continues till a breakpoint e.g.:_________________________ Date: ____________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT.

Microprocessor & Assembly Language Lab: 04 ____________________________________________________________________________ FICT. BUITEMS .

destination = destination + source 5 Lab The destination operand can be a register or a memory location. THEORY ADD (unsigned addition) The format of the ADD instruction is: ADD destination. destination = destination − source SBB (subtraction with borrow) SBB destination. or an immediate operand. CF.MODEL TINY ____________________________________________________________________________ FICT. The source operand can be a register. source     . BUITEMS .Microprocessor & Assembly Language Lab: 05 Assembly Language Programming-I OBJECT To study and use the arithmetic instructions. source . a memory location. SF. Open Notepad and write down the following code: TITLE ADDITION OF 5 BYTES . destination = destination + source + carry flag ADC (add with carry) ADC destination. OR PF bits can be changed after an arithmetic or logic operation . AF. source . source SUB (unsigned subtraction) SUB destination. destination = destination − source − carry flag EXERCISE & OBSERVATIONS 1. Destination and source both cannot be memory locations at the same time Any of the flags ZF.

Assemble the file and link with ML.STARTUP MOV MOV MOV AGAIN: JNC INC LOC1: DEC JNZ MOV .DATA COUNT DATA1 SUM DW .[SI] LOC1 AH INC SI CX AGAIN SUM.exe program available with MASM 6.233. Write an assembly program that shows the use of ADC. BUITEMS . and SBB instructions.CODE . SUB. Open the exe file in DEBUG and trace it to have a closer look at the execution.EXIT END Lab: 05 EQU DB ? 5 126. 2. Rewrite the same program using full-segment definitions.AX 2. myfile.57 CX.asm 3.67.189.asm 4. PRACTICE EXERCISES 1.OFFSET DATA1 AX.Microprocessor & Assembly Language .11 version or higher using: path:###BOT_TEXT###gt;ml myfile. CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No.0 ADD AL.g. Run the exe file that is generated.COUNT SI. 5. Save the file with some name e.:_________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT.

Microprocessor & Assembly Language Lab: 05 ____________________________________________________________________________ FICT. BUITEMS .

STARTUP MOV BX. Open Notepad and write down the following code: TITLE BCD Addition of two 2-digit numbers 6 Lab .AL MOV NUM1.2 AGAIN: MOV AH.Read the Keyboard INT 21H SUB AL.Repeat for 2 digits CONT: ADD AL.CODE .convert from ASCII to BCD DEC BX JZ CONT MOV CL.BCD addition of two nos.MODEL TINY .00010101B ADD AL.DATA NUM1 DB ? NUM2 DB ? RESULT DB ? .Microprocessor & Assembly Language Lab: 06 Assembly Language Programming-II OBJECT To study and use the BCD arithmetic instructions. BUITEMS . ____________________________________________________________________________ FICT.AL JMP AGAIN .NUM1 DAA .01 .DL .4 SHL AL. EXERCISE & OBSERVATIONS 1.30H .2 digit packed BCD no. is in AL MOV NUM2.CL MOV DL.

Display to screen DOS function 21H . Run the . Give a 2-digit input and monitor the output to verify the addition of the given number with 15.DOS function call .g.CL DL. bcd. Display the other digit MOV DL.:_________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT.Clear off the left most 4 bits ADD DL. Now to display the packed BCD result in AL to screen MOV MOV SHR ADD MOV INT DL.4 DL. PRACTICE EXERCISES 1. Save the file with some name e.Microprocessor & Assembly Language MOV RESULT. Write a program to use BCD subtraction. Note: The result should be within 2 digits. 4. CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No.EXIT END 2.2 .com file that is generated.AL .Store the result in memory location Lab: 06 .Convert to ASCII AH.asm 3.30H INT 21H .RESULT AND DL. BUITEMS .RESULT CL.0FH .30H .

Microprocessor & Assembly Language Lab: 06 ____________________________________________________________________________ FICT. BUITEMS .

SCAS.DS MOV ES. BUITEMS . MOVS.10 . STOS.13.AL MOV AH.10.Make DS and ES point to same data segment .AX CLD .02H INT 21H .data MES DB 'Please enter your name'.startup MOV increment mode for SI and DI MOV SI.'You typed: $' BUF DB 256 DUP (?) .to store the string typed by the user . PROCEDURE 1. can also use dos . 10 for line feed MES2 DB 13. THEORY LODS. COMPS.model small .code .13 for carriage return.Microprocessor & Assembly Language Lab: 07 Assembly Language Programming-III OBJECT To study string display the message. Open Notepad and write down the following code: TITLE String input and output by Byte 7 Lab .OFFSET MES AGAIN: LODSB MOV DL.because STOS uses ES:DI and LODS uses DS:SI .function call AH=09H CMP AL.10 ____________________________________________________________________________ FICT.

CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No. OBSERVATIONS Paste the output of the program here.exe file that is generated. EXERCISES 1.1 AGAIN2: INT 21H STOSB CMP AL. BUITEMS .OFFSET BUF 21H Lab: 07 .'$' AH. CMPSB and MOVSB instructions.exit end 2.OFFSET BUF MOV AH.Microprocessor & Assembly Language JNE AGAIN . Run the .OFFSET MES2 21H DX.g.if enter is pressed then stop MOV MOV MOV INT MOV INT BYTE PTR [DI-1].asm 3. give inputs and monitor the output.13 JNE AGAIN2 .now to take input MOV DI. Write a program to use SCASB.9 DX. string.:_________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT. Save the file with some name e.

BUITEMS .Microprocessor & Assembly Language Lab: 07 ____________________________________________________________________________ FICT.

But we know that when INT 21H is called with AH=01. and a few other values. we shall study a procedure that converts the given data from ASCII to binary and another procedure that converts from binary to ASCII before the data can be displayed to the standard output device. PROCEDURE 1. IMUL. DIV.e. Open Notepad and write down the following code: . Now the conversion from ASCII to binary has to be done for multi-digit input as well. BUITEMS . and other logic operations. and we have applied these instructions on hard coded data. ADC. SUB.Microprocessor & Assembly Language Lab: 08 Assembly Language Programming-IV OBJECT To study data conversions THEORY 8 Lab So far we have discussed the arithmetic operations i. and results given back again as integers.startup CALL READNCONVERT MOV NUM1.model small .stores the binary values at NUM1 and NUM2 . IDIV. 07.code . then we get the character from the keyboard in ASCII form. SBB.A program that reads two decimal numbers from the keyboard and . But what is required is that data must be taken as input from the user as integers. In today’s lab session. ADD. MUL. AX CALL NEXTLINE ____________________________________________________________________________ NUM1 DW ? NUM2 DW ? SUM DW ? DIFF DW ? PROD DD ? . 06.

NUM1 AX. 0 PUSH AX MOV AX.'0' MOV AH.above 4 instructions was not a digit SUB AL.add num1 and num2 SUM.the input character will be in AL CMP AL. AX CONVERTNDISPLAY NEXTLINE AX. BX jump to the end of procedure if the key . NUM2 DIFF. BUITEMS .these overwrite the previous values .Using USES directive . AX NEXTLINE AX. 0 NEXT: MOV INT key with echo . 10 MOV BX.typed . BX MUL CX MOV BX. AX WORD PTR PROD+1.multiply previous digit by 10 . AX JMP NEXT LAST: MOV RET the binary digit is in AX . 1 21H . AX CONVERTNDISPLAY NEXTLINE AX.automatic push of BX of them at the end of registers and thereby READNCONVERT NUM2. DX CONVERTNDISPLAY Lab: 08 with the procedure definition below makes and CX registers to stack.and add to the current digit . NUM1 .input next digit ____________________________________________________________________________ FICT. NUM1 NUM2 WORD PTR PROD. The procedure will use .convert to binary of the digit . '0' JB LAST CMP AL.pop procedure.exit . AX POP AX ADD BX.Microprocessor & Assembly Language CALL MOV CALL ADD MOV CALL CALL MOV SUB MOV CALL CALL MOV MUL MOV MOV CALL . '9' JA LAST . READNCONVERT PROC NEAR USES BX CX MOV CX. and automatic .

Use . convert. Use . View the list file in notepad and paste it. give inputs and monitor the output. ____________________________________________________________________________ FICT. .if .line feed 21H DL. Run the . 30H INT 21H LOOP AGAIN2 RET CONVERTNDISPLAY ENDP NEXTLINE MOV MOV INT MOV INT RET NEXTLINE End .g. 2. OBSERVATIONS Paste the output of the program here. 02 AGAIN2: POP DX ADD DL. Save the file with some name e.Microprocessor & Assembly Language Lab: 08 READNCONVERT ENDP CONVERTNDISPLAY PROC NEAR USES BX CX DX MOV display each digit in ASCII form PROC NEAR USES AX AH. 0AH .if quotient is zero JNE AGAIN MOV AH.the digits in the number to be displayed AGAIN: MOV DX. etc.divide DX-AX by BX so quotient in AX & remainder in DX PUSH DX . EXERCISES 1. 0 .carriage return 21H ENDP 2. 10 .2 DL. BUITEMS . 0 DIV BX .asm 3. 0DH . 0 .exe file that is generated.we will use divide by 10 repeatedly to separate MOV CX. directives in the above program wherever applicable and rewrite it.LISTALL directive in start and generate the list remainder INC CX CMP AX.

CONCLUSION Lab: 08 What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No. BUITEMS .Microprocessor & Assembly Language 3. Use division also.:_________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT.

Microprocessor & Assembly Language Lab: 08 ____________________________________________________________________________ FICT. BUITEMS .

It is an excellent support for programming in Assembly. Data. 3 Channels (8253) Address. hardware structure. It has been specifically designed and manufactured for training engineers in designing. Component CPU ROM RAM Serial Port Parallel Port Printer Port Counter / Timer External I/O Bus Dot Matrix Step Motor Display Keypad Power Supply Specification 80386 / 8032 (Dual CPU) 128 KBYTE (27C256) USER: 64KBYTE Monitor: 64KBYTE 128KBYTE (62256) 2 Ports (8251) SIO-1 RS-232C SIO-2 RS-232C. I/O Selector 3 Color 8 x 8 Matrix 1. It helps studying microprocessor system programming. BUITEMS . A brief description of the components and their technical characteristics is given in the following table.Microprocessor & Assembly Language Lab: 09 SK-80386 Trainer-I OBJECT To study the SK-80386 trainer. memories. Trainer Specifications: The SK-80386N trainer board contains all the necessary components for the study of Microprocessor based systems. PPI-3 Three 8Bit Ports (8255) CENTRONICS (PPI 8255) 16Bit. Control. and interfaces to external devices. based on Intel 80386 microprocessor. THEORY 9 Lab The SK-80386N microcomputer trainer is a microprocessor controlled educational system. use and maintenance of microprocessor systems. RS-422 Four 16Bit Ports (8255) PPI-2.8 Deg. / Step (200 Steps) 168 x 64 LCD with Backlight 28 Keys Input: 110 / 220V ____________________________________________________________________________ FICT.

Addresses 0020 0024 LSB PPI-1 PORT_A MSB Remarks 8255 P I/O EXTERNAL ____________________________________________________________________________ FICT. The overall address range in realmode is from 00000H to FFFFFH. Addresses 00000 000FF 00100 004FF 01000 (100:0000) 1FFFF 20000 3FFFF 40000 4FFFF 50000 5FFFF 60000 6FFFF Description Interrupt Vector Table Stack Area Serial Download Program Open User ROM Open Serial Monitor Program OPEN ROM BANK 0 OPEN ROM BANK 6 RAM BANK 0 I/O Space: The following table shows the available I/O ranges in SK-80386N. The Memory Map is given in the following table. and user expansion area.75A / +5V 2A Lab: 09 Memory Unit: Memory includes ROM. The Trainer only uses a small subset of this potential range of memory. BUITEMS . RAM.Microprocessor & Assembly Language Output: +12V 1A / -12V 0.

and the other is for entering numeric values for any running program (called HEX Keypad). ENT 0 EDIT 1 CRT 2 LCD 3 Key Functions The brief operation of each key is given below. Key RES NMI Operation System Reset. Non Mask able Interrupt ____________________________________________________________________________ FICT. Operator Keypad The Operator Keypad consists of 28 keys (7 x 4). The individual position of each key is shown in the following figure. verifying and executing a program (called Operator Keypad). BUITEMS . One is for entering. RES NMI IRQ C PRN D MOV E FILL F GO REG TRC 8 IB 9 IW A ID B < > F1 4 OB 5 OW 6 OD 7 : .Microprocessor & Assembly Language Lab: 09 Keypad: There are two keypads in SK-80386N.

BUITEMS . (to work on trainer) To enter numeric values Lab: 09 CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No. (when connected with a PC) LCD Mode.Microprocessor & Assembly Language IRQ GO REG TRACE < > F1 : . ENT PRN MOV FILL IB IW ID OB OW OD EDIT CRT LCD O-F Software Interrupt To execute a program from CS:IP address To check and correct register contents Invokes Step-by-Step program execution from CS:IP address Backspace Space Shows the built-in program names and addresses Colon Comma Enter Key (Carriage Return) To Print to printer attached to Centronics Port To copy a memory block To fill a memory block Input a byte from the specified port address Input a word from the specified port address Input a Double word from specified port address Output a Byte to specified port address Output a Word to specified port address Output a Double word to specified port address To check and correct contents of a memory location CRT Mode.:_________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT.

Microprocessor & Assembly Language Lab: 09 ____________________________________________________________________________ FICT. BUITEMS .

press ‘2’ on the operator keypad.Microprocessor & Assembly Language Lab: 10 SK-80386 Trainer-II OBJECT To study the machine language programming on the trainer. we will learn to operate SK-80386N in LCD mode. BUITMS. clears ‘386’ on the dot matrix and the following screen appears on the LCD. LCD and CRT. ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. In order to operate SK-80386N in LCD mode.2 1:CRT 2:LCD Pressing ‘2’ on the operator keypad. SK-80386N can be operated in two modes. verify and execute programs. following message appears on the LCD. Meanwhile ‘386’ appears on the dot matrix. PROCEDURE When the power is turned ON. TUTOR MODE Press Enter To Start __ SK-80386N is now in LCD mode. 33 / 42 . SYSTEMKIT SK-80386 Ver 1. THEORY 10 Lab In this lab session. LCD mode means that there is no PC connected with the trainer and user will be using ‘Operator Keypad’ to enter. ‘SK-80386###BOT_TEXT###gt;’ prompt appears on the LCD.

After performing above steps. ‘386’ appears on the dot matrix. 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__ You can execute any demo program from this list. BUITMS. then press ‘G’ (GO command key) and enter the starting address of the program. For example if you want to execute ‘Dot Matrix’ demo program. 34 / 42 . SK-80386 ###BOT_TEXT###gt;G=6000:130__ Note: To separate segment base and offset address. i. use ‘colon’ key on the operator keypad.Microprocessor & Assembly Language Lab: 10 SK-80386 ###BOT_TEXT###gt;__ Running Demo Programs Press F1 to check the built in ‘Demo’ programs. ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. following message appears on the LCD: SK-80386 ###BOT_TEXT###gt;G=6000:130 Program To Run From 6000:130 OK? (Y/N)__ Press ‘ENT’ key for YES.e. 6000:130.

Press ‘NMI’ or ‘RST’ key. 35 / 42 .Microprocessor & Assembly Language Lab: 10 Note that the message on dot matrix is same as that of turning power ON. Since all demo programs are executed in infinite loop. Entering and verifying Register Contents On the ‘SK-80386’ prompt. BUITMS. press ‘REG’ key to display all the registers on LCD. EAX=00000000 EBX=00000000 ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. Terminating a Program In order to terminate a program. therefore pressing ‘RST’ key resets the trainer. SK-80386 ###BOT_TEXT###gt; Pressing “REG” key shows following screen on the LCD: 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___ Select the desired register by pressing corresponding key (0 – F). Alternatively you can use ‘NMI’ key. terminating program execution. When the corresponding number is entered following dialog box appears.

as shown in figure below: ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. then press ‘IB’ key on operator keypad.Microprocessor & Assembly Language ECX=00000000 EDX=00000000 ESP =000004FF EBP =00000000 ESI =00000000 EDI =00000000 For next page. Enter ‘74’. BUITMS. The port address for the HEX keypad is ‘74H’. If you don’t want to alter the register contents. Lab: 10 Next__ 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. For example if you want to input a ‘Byte’ data from the HEX keypad. We can change the value of the register as follows. press ‘ENT’. IW or ID keys on the operator keypad. 36 / 42 SK-80386 ###BOT_TEXT###gt; IB 74 . then comma and then press ‘ENT’ key. EAX=00000000 :1234__ Go back to “REG” command and verify the entered value of the register. then simply press ‘ENT’ after seeing the following screen: EAX=00001234 :__________ Input Machine Language code and data from the HEX Keypad You can take input from the HEX keypad by pressing one of IB.

LST). Following is a program whose machine code would be entered into SK-80386N for execution: ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. then the ‘FEFE’ would be read by microprocessor. Also note that the HEX keypad works in ‘Reverse’ order. then ‘comma’. and press ‘ENT’ key as shown in figure below: SK-80386 ###BOT_TEXT###gt; OB 80. To do this. For example if you have entered ‘80’ by pressing ‘8’ and ‘0’ hex keys during execution of IB command. then ‘0’. press ‘OB’. then ‘8’. Entering Machine Codes In this section. as shown in following figure: SK-80386 ###BOT_TEXT###gt; IB FEFE 74 Similarly you can use ‘IW’ and ‘ID’ commands to enter word and double word data respectively. You can do this be using Intel Microprocessor’s data sheet. because microprocessor will read the port as soon as IB command is executed. Lets send a byte data ‘08’ to the LEDs. which are mounted just above the HEX keypad. you will learn how to enter ‘Machine Codes’ of an ‘Assembly Language Program’ into SK-80386N for execution. while all other LEDs would be turned OFF. it will send a ‘0 (zero)’ to the microprocessor. means that when you press a key on HEX keypad. The first step of entering a program for execution is to have the machine codes of assembly language mnemonics. BUITMS. or by simply taking machine codes from ‘Listing’ file (. Keep in mind that the ‘Code Segment’ starts from address 100:0000. then ‘0’. and finally ‘8’.Microprocessor & Assembly Language Lab: 10 Note: You must be pressing the desired keys on the HEX keypad while you press ‘ENT’. it will cause the fourth LED to turn ON. The address of the LEDs is ‘’80H’. 37 / 42 . Output Data to LEDs SK-80386N also has 16 LEDs. 08 You can also use ‘OW’ and ‘OD’ commands to send a word and double word respectively.

and human eyes can only differentiate between states if the frequency is below 25Hz. use ‘TRC (TRACE)’ command. For this press start pressing TRC key. Press ‘ENT’ key again to start execution. ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. BUITMS. however. 0100:0). and then the upper byte ‘00’ is entered. press ‘GO’ key. In order to see the actual rotate process. 01 L1: OUT 80H. you have to execute ‘GO’ command. LEDs are actually being rotated. and after some key presses you will note that the first LED is turned ON. SK-80386N will prompt you for a ‘YES/NO’ option. SK-80386 ###BOT_TEXT###gt; GO = 0100:0000 As soon as the program execution starts. then give the starting address of the Code Segment (i. and then press ‘ENT’ key. 38 / 42 . Follow the steps given in table below: Key Press EDIT 100:0 ENT B8 01 00 E7 Key Press 80 D1 C0 EB FA ENT Function Start Entering Program 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 LCD Shows SK-80386###BOT_TEXT###gt; E SK-80386###BOT_TEXT###gt; E 100:0 SK-80386###BOT_TEXT###gt; 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 Note: while entering word data 0001.e. For doing this.Microprocessor & Assembly Language Memory Addresses 0000 0003 0005 0007 Machine Codes B8 0001 E7 08 D1 C0 EB FA Assembly Language Mnemonics MOV AX. In order to execute above program. 01 JMP L1 Lab: 10 Above program can be entered by using ‘EDIT’ command. This continues as you keep pressing TRC. AX ROL AX. This is because microprocessor is running on a very high frequency. all the LEDs on the HEX keypad seems to be turned ON. the lowest byte ‘01’ is entered first.

:_________________________ Signature of Instructor: ______________ ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences. BUITMS.Microprocessor & Assembly Language Lab: 10 CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No. 39 / 42 .

EXE’ is loaded in PC and communication between PC and trainer is established. press ‘1’ in order to select CRT mode. following dialog box appears: __ PC/inter comm. THEORY 11 Lab In this section we will use a PC to download ‘Assembly Language Programs’ using serial communication. SYSTEMKIT SK-80386 Ver 1. load ‘IC. ____________________________________________________________________________ FICT.EXE (InterComm.2 1:CRT 2:LCD The default setting of the serial port are 19200bps baud rate). PROCEDURE To begin. BUITEMS . No parity. While working in ‘IC’. and then specify the full path of the file you want to download.Microprocessor & Assembly Language Lab: 11 SK-80386 TrainerIII OBJECT To study the I/O interfacing on the trainer. and 1 stop bit.04 Fe-Setup F10=Exit/F Call 3:32 C 0:00 Now you are ready to download program into trainer.EXE) program in the PC and connect PC with the trainer using NULL Modem. press ‘L (LOAD)’ on the SK-80386###BOT_TEXT###gt; prompt on the PC. 8 data bits. When ‘IC. The following contents will be displayed on the LCD. V2. After resetting the trainer.

Microprocessor & Assembly Language Lab: 11 SK-80386###BOT_TEXT###gt; L __Sending your file in the HEX format __Ready to Send? (Y/N) Y After executing ‘Load’ command. SK-80386###BOT_TEXT###gt;G Program to run from 100:0000 OK? <Y\N> Y Output would be shown on the dot matrix. __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 (*.EXE’ program to convert a Binary file into HEX file. You can execute the program by using either ‘GO’ or ‘TRC’ command. and following message will be displayed on the PC screen if the transmission was successful. You should give the full path of the file you want to download to trainer. then you should give its full path. For example. BUITEMS . use ‘EXE2BIN. the specified program will be downloaded into trainer. After entering the full path.EXE’ program to convert an executable file into ‘Binary’ file.HEX) format. Then use ‘BIN2HEX. ____________________________________________________________________________ FICT. …………………… Thanking for your cooperation. press ‘ALT + T’ (shortcut for Transmit command in IC) in order to transmit file to trainer. To do this. if you want to download ‘dot_3861.hex’. since Intel Microprocessors understand only HEX files.

:_________________________ Signature of Instructor: ______________ ____________________________________________________________________________ FICT. BUITEMS .Microprocessor & Assembly Language Lab: 11 CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: ___________________________ Date: ____________________________ Roll No.