1 / 29

LAB [ 2 ]

Kingdom of Saudi Arabia Princess Nora bint Abdul Rahman University College of Computer Since and Information System CS 221. LAB [ 2 ]. Computer Organization and Assembly Language Programming. What is an assembly language?. Assembly language is a low level programming language.

fathi
Télécharger la présentation

LAB [ 2 ]

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Kingdom of Saudi Arabia • Princess Nora bint Abdul Rahman University • College of Computer Since and Information System • CS 221 LAB [ 2 ] Computer Organization and Assembly Language Programming TA_Fatima ALtamimi

  2. What is an assembly language? • Assembly language is a low level programming language. • The simple computer model as I see it: TA_Fatima ALtamimi

  3. Inside the CPU TA_Fatima ALtamimi

  4. **REGISTER TYPE • general purpose registers • SEGMENT REGISTERS • SPECIAL PURPOSE REGISTERS TA_Fatima ALtamimi

  5. The difference between register & Memory :: • Register :: Because registers are located inside the CPU, they are much faster than memory. Accessing data in a register usually takes no time. Store temporary data of calculations. • Memory:: Accessing a memory location requires the use of a system bus, so it takes much longer. TA_Fatima ALtamimi

  6. **REGISTER TYPE • general purpose registers • SEGMENT REGISTERS • SPECIAL PURPOSE REGISTERS TA_Fatima ALtamimi

  7. Data Registers: AX, BX, CX, DX(1)GENERAL PURPOSE REGISTERS • 8086CPU 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. TA_Fatima ALtamimi

  8. (1)GENERAL PURPOSE REGISTERS • The main purpose of a register :: is to keep a number(variable). • The size :: of the above registers is 16 bit . • 4 general purpose registers (AX, BX, CX, DX) are made of two separate 8 bit registers , • Ex:: AX= 0011000000111001b, then AH=00110000b and AL=00111001b • "H" is for high and "L" is for low part TA_Fatima ALtamimi

  9. (2) SEGMENT REGISTERS • Address Registers CS, DS, SS, ES • CS - 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. TA_Fatima ALtamimi

  10. (2) SEGMENT REGISTERS • The segment registers have a very special purpose - pointing at accessible blocks of memory. • Segment registers work together with general purpose register to access any memory value. • For example if we would like to access memory at the physical address 12345h TA_Fatima ALtamimi

  11. (2) SEGMENT REGISTERS • The way we can access much more memory than with a single register that is limited to 16 bit values. • CPU makes a calculation of physical address by multiplying the segment register by 10h and adding general purpose register to it (1230h * 10h + 45h = 12345h): TA_Fatima ALtamimi

  12. (3) SPECIAL PURPOSE REGISTERS • IP - the instruction pointer. • Flags Register - determines the current state of the processor. • IP register always works together with CS segment register • Flags Register 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. TA_Fatima ALtamimi

  13. Assembly Language Statements • Three different classes • Instructions • Directives (or pseudo-ops) • Macros • Assembly language statement format: • [ label ] mnemonic [operands] [ ;comment ] **Fields in [ ] are optional TA_Fatima ALtamimi

  14. Data Transfer Instruction • MOV • MOVSX-MOVZX • XCHG • LEA TA_Fatima ALtamimi

  15. Open EMU8086 TA_Fatima ALtamimi

  16. TA_Fatima ALtamimi

  17. TA_Fatima ALtamimi

  18. TA_Fatima ALtamimi

  19. TA_Fatima ALtamimi

  20. TA_Fatima ALtamimi

  21. TA_Fatima ALtamimi

  22. TA_Fatima ALtamimi

  23. TA_Fatima ALtamimi

  24. TA_Fatima ALtamimi

  25. TA_Fatima ALtamimi

  26. The mov instruction • The format is mov destination ,source Copies the value from source to destination TA_Fatima ALtamimi

  27. The mov instruction • Five types of operand combinations are allowed: • The operand combinations are valid for all instructions that require two operands TA_Fatima ALtamimi

  28. TA_Fatima ALtamimi

  29. TA_Fatima ALtamimi

More Related