Lab: 03
Using Debug-III
3
Lab
AA AA AA AA AA 104 (enter)
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.
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.
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. ______________________________________________________________________ ______________________________________________________________________
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.
To understand the use of Search command, type following command sequence: F S 100 100 16F 17F 22 33 33
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? ______________________________________________________________________
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.
Roll No:
Lab: 09
SK-80386 Trainer-
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
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
Lab: 09
CONCLUSION What have you learnt in this session? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________ Name: Roll No: . Signature of Instructor: ______________
Date: ____________________________
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.
SK-80386 \>__
Running Demo Programs ________________________________________________________________________________ _ Faculty of Computer & Emerging Sciences, BUITMS. 8 / 14
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:
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.
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.
SK-80386 \>
Pressing REG key shows following screen on the LCD:
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.
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
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:
74
Similarly you can use IW and ID commands to enter word and double word data respectively.
SK-80386 \> OB
80, 08
You can also use OW and OD commands to send a word and double word respectively.
Above program can be entered by using EDIT command. Follow the steps given in table below:
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.
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? _____________________________________________________________________ _____________________________________________________________________ _____________________________________________________________________
Roll No:
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.
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.
Lab: 11
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: .