What is an assembly language Assembly language is a low level programming language Inside the CPU Architecture 8086 Microprocessor 4 Execution Unit EU EU executes instructions that have already been fetched by the BIU ID: 1031430
Download Presentation The PPT/PDF document "Emulator 8086 Lecture 3" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
1. Emulator 8086Lecture 3
2. What is an assembly language?Assembly language is a low level programming language.
3. Inside the CPU
4. Architecture8086 Microprocessor4Execution Unit (EU)EU executes instructions that have already been fetched by the BIU.BIU and EU functions separately.Bus Interface Unit (BIU)BIU fetches instructions, reads data from memory and I/O ports, writes data to memory and I/ O ports.Four 16-bit segment registersCode Segment (CS)Data Segment (DS)Stack Segment (SS)Extra Segment (ES)
5.
6.
7.
8. Signed Numbers
9. Emulator Calculator
10.
11. Inside the CPUGENERAL PURPOSE REGISTERS8086 CPU has 8 general purpose registers, each register has its own name:AX - the accumulator register (divided into AH / AL).BX - the base address register (divided into BH / BL).CX - the count register (divided into CH / CL).DX - the data register (divided into DH / DL).SI - source index register.DI - destination index register.BP - base pointer.SP - stack pointer.
12. Inside the CPUSEGMENT REGISTERSCS - points at the segment containing the current program.DS - generally points at segment where variables are defined.ES - extra segment register, it's up to a coder to define its usage.SS - points at the segment containing the stack.
13. Inside the CPUSPECIAL PURPOSE REGISTERSIP - the instruction pointer it points to currently executing instruction.Flags Register - determines the current state of the processor.is modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program.Generally you cannot access these registers directly.
14. 14Sl.No.TypeRegister widthName of register1General purpose register16 bitAX, BX, CX, DX8 bitAL, AH, BL, BH, CL, CH, DL, DH2Pointer register16 bitSP, BP3Index register16 bitSI, DI4Instruction Pointer16 bitIP5Segment register16 bitCS, DS, SS, ES6Flag (PSW)16 bitFlag registerInside the CPU
15. MOV instructionThe MOV instruction: copies a word or byte of data from a specified source to a specified destination. MOV Destination, Source
16. These types of operands are supported:MOV REG, memoryMOV memory, REGMOV REG, REGMOV memory, immediateMOV REG, immediateREG: AX, BX, CX, DX, AH, AL, BL, BH, CH, CL, DH, DL, DI, SI, BP, SP.memory: [BX]immediate: 5, 3Fh, 10001101b, etc...MOV instruction
17. For segment registers only these types of MOV are supported:MOV SREG, memoryMOV memory, SREGMOV REG, SREGMOV SREG, REGSREG: DS, ES, SS, and only as second operand: CS.REG: AX, BX, CX, DX, AH, AL, BL, BH, CH, CL, DH, DL, DI, SI, BP, SP.memory: [BX]MOV instruction
18. MOV instructionNotes:The source and destination cannot both be memory locations. They must both be of the same type (bytes or words). MOV SREG, SREGMOV SREG, immediateMOV instruction does not affect any flag.
19. Notes:Binary numbers must have "b" suffix, example: 00011011b Hexadecimal numbers must have "h" suffix, and start with a zerowhen first digit is a letter (A..F), example: 0ABCDh
20. MOV instructionMOV CX, 037AH ; Put immediate number 037AH to CX MOV CX, 03H ret
21. MOV instructionMOV [437AH],55h ;MOV BL,[437AH] ; Copy byte in memory at offset 437AH to BL ; remove h only 55
22. MOV instructionMOV BX, 5F4FhMOV AX, BX ; Copy content of register BX to AX
23. MOV instructionMOV [BX], 88hMOV DL, [BX] ; Copy byte from memory at [BX] to DL ret
24. MOV instructionMOV BX, 5F4FhMOV [BX], 88hMOV DL, [BX]
25. MOV instructionMOV AX, 1234hMOV [2351h], AX ; Copy AX to two memory locations
26. MOV instructionMOV AX, 1234hMOV [2351h], AX ; mov cl,[2352h] ; try without hret
27. MOV instructionMOV [1234h], [2234h]ret
28. MOV instructionMOV Al, 1234hMOV AH, 34hRet
29. MOV instructionMOV CH, 01011111b ; set CH to binary value.Ret ; remove b ; try only 0101 MOV CH, 0101
30. MOV instructionMOV SI, 01011111b ; set SI to binary value.MOV DI, 1234HRet
31. MOV instructionMOV AX, 4563HMOV BX, 56HMOV SS,AX MOV DS,BX
32. MOV instructionMOV AX, 4563HMOV BX, 56HMOV SS,AX MOV DS,BX MOV AX,DS MOV BX,SS
33. MOV instructionMOV AX, 4563HMOV BX, 56HMOV [BX],AXMOV SS,[BX]
34. MOV instructionMOV SS, 56HMOV DS,SS RET
35. MOV instructionMOV AX,67HMOV SS, AXMOV DS,SS RET
36. MOV Instructions Q: write a program in Assembly language to swap the contents of AX 5555h and BX 4242h using general registerMOV BX, 5555hMOV AX, 4242h ; mov dx,axmov ax,bxmov bx,dxret