UPLOAD

    3.9K

    EEEN 311 - LOGIC CIRCUITS AND MICROPROCESSORS: Laboratory Manual 1

    Published: July 18, 2018

    EEEN 311 - LOGIC CIRCUITS AND MICROPROCESSORS: Laboratory Manual 1 Assembly Lab

    Comments

    EEEN 311 - LOGIC CIRCUITS AND MICROPROCESSORS: Laboratory Manual 1

    • 1. EEEN 311 Logic Circuits & Microprocessors EEEN 311 Logic Circuits & Microprocessors Emu8086 Tutorial
    • 2. ABOUT  8086 and emu8086 §8086 is a 16-bit Intel microprocessor. §The machine code in 8086 can be easily compatible with next generation Pentium microprocessors such as Pentium 4, Core 2 duo etc. §Therefore, learning the programming skills of 8086 is a good start for the ones who interest low level programming of Intel processors. §Emu8086 is an emulator that simulate 8086 microprocessor on your computer. It can be regarded as a Virtual PC. §This emulator has much easier syntax than the other emulators and their visual interface is very helpful. §Therefore it is very suitable for the beginners. ABOUT 8086 and emu8086
    • 3. INSTALLING emu8086 INSTALLING emu8086 §Here is the official link that provides free trial of emu8086 §http://www.emu8086.com/
    • 4. STARTING emu8086 STARTING emu8086 §After the installation we are ready to use emulator §Click the emu8086.exe (has a green icon) §After the trial info, a window should be opened that involve ‘new’, ‘code examples’, ‘quick tutor’ icons. For writing a new code click new. §Then you should select the extension of the file that you write. Select COM §Now we are ready to start
    • 5. STARTING emu8086 STARTING emu8086 Wednesday, July 18, 2018 5 §Then you should select the extension of the file that you write. Select COM §Now we are ready to start
    • 6. STARTING emu8086 STARTING emu8086
    • 7. STARTING emu8086 STARTING emu8086 §As you see, org 100h and ret codes are written by default. §Org 100h means that your code starts with CS:0100. In other words it corresponds to the Instruction pointer. §Ret means that the code is written up to that line. §There are some tools that can be useful such as calculator and convertor §These tools can help you to convert and calculate numbers in binary, octal, decimal, and hexadecimal cases.
    • 8. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §We are ready to write some simple programs and observe the results. §Suppose we want to store 1234h number into AX accumulator.
    • 9. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §Note that if you just write 1234 instead of 1234h, then emulator thinks that this number is decimal. §Now click the emulate button, The new window demonstrates your code in the memory and the values of registers before your code run. Note that AX is 0000h before our code run
    • 10. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §If you do not receive any error message, click run. §You should receive ‘the program has returned to the control operating system’ then your code works well and you will see that the value of AX will be 1234.
    • 11. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §Now we are going to use the memory of the 8086. §Suppose we want to store 1234h value inside the memory 0080:1200
    • 12. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §As you see the code is correctly written and executed. §But how can we check the memory 0080:1200? §Click view and then click memory.
    • 13. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §Now the values in the memory are available for us. The visible memory starts from F400:0154 as indicated but we need to look at the address 0080:1200.
    • 14. PROGRAMMING IN emu8086 PROGRAMMING IN emu8086 §We type 0080:1200 address box and we observe that the desired value has been stored inside the memory. §Note that the address of 0080:1200 involve 34 and 0080:1201 involve 12. This implies little endian convention.
    • 15. EXERCISE  EXERCISE §The values 1020h and 2040h are assigned to addresses 0080:1000h and 0080:1002h respectively. Then, we want to add these numbers and store the summation in 0080:1004h. Write a program for the desired purpose § §org 100h § §mov ax,0080h §mov ds,ax §mov [1000h],1020h ; assign 1020 to 0080:1000h §mov [1002h],2040h ; assign 2040 to 0080:1002h §mov ax, [1000h] ; assign the value inside the 0080:1000h to ax § §; your job is adding the numbers and store the result in 0080:1004h § §ret §Then, calculate the two times of the value in 0080:1004h and store it in 0080:1006h