CHAP 6

Cards (114)

  • Computer program
    A set of instructions that tells the computer what to do
  • Computer programming languages

    • Fortran
    • C
    • C++
    • Java
    • Python
  • Machine language
    • Computer hardware operates only with binary numbers (1s and 0s)
    • Microprocessors designed to understand (or execute) a set of instructions where each instruction is given a binary code (also called machine code)
    • It is not possible to develop program directly at this level
  • Assembly language

    One level above machine language<|>Uses alphabetic abbreviations, called mnemonics, so that it is easier to understand and remember<|>These mnemonics are also decided by the manufacturer
  • Assembly language
    • Easier to understand by humans but not computers
    • Still needs to be translated to machine code (using an ASSEMBLER) to execute on microprocessor
  • High level languages
    Use English statements and known mathematical symbols<|>A single high level statement may be composed of many assembly commands<|>Program written in High level language cannot be directly executed, it still needs to be translated to final machine code
  • Assembly language
    • The most basic language that the microprocessor can understand
    • Exploring assembly language will give us a better understanding of how the microprocessor works
    • In some cases, part of the high level program can employ assembly language program to optimize code or to interact directly with hardware (e.g. to access microprocessor registers directly)
  • Instruction Groups
    • Movement Instructions
    • Arithmetic Instructions
    • Logical Instructions
    • Jump instructions
  • Byte
    8 bits
  • Word
    16 bits or 2 bytes
  • Double word
    32 bits or 4 bytes
  • Little endian
    The least significant byte is stored in the lowest-numbered memory location, and the most significant byte is stored in the highest
  • 8086 Registers
    • AX
    • BX
    • CX
    • DX
    • CS
    • DS
    • SS
    • ES
    • SP
    • BP
    • SI
    • DI
    • FLAGS
    • IP
  • Registers
    • Provide a scratch pad so that the processor can keep data on a temporary basis
    • Used to keep the data handy to avoid costly memory accesses
  • Instruction Pointer Register (IP)
    A 16-bit register used in conjunction with the code segment register (CS) to generate a 20-bit physical address (CS:IP)<|>Not directly accessible by a programmer but can be altered through the use of a number of instructions, e.g. JMP, CALL, INT, etc.
  • Segment Registers (CS,DS,SS,ES)

    Required because the total addressable RAM space is 1 Mb = 2^20 in size whereas all of the pointer registers are only 16-bits
  • Generating Memory Addresses
    1. Physical address = (Segment Register * 16) + Pointer Register
    2. More than one segment & pointer combination can point to the same physical address
  • Memory Segments
    Code: for program instructions<|>Data: for data<|>Stack: for subroutines<|>Extra: additional for data
  • Default Segment Usage
    IP and CS: Instructions
    SP and SS: Stack
    BP and SS: Data
    BX, SI, DI and DS: Data
  • Flags
    CF - Carry Flag
    ZF - Zero Flag
  • put in AX address

    Physical location of the memory
  • SI paired with data segment
    Compiler will decide which data is assigned to which memory
  • DS and SI are decided by the compiler, so memory should not crash
  • Segment Over-Ride
    Physical address is ES:SI or ES * 10h + SI
  • With CF = 1
  • Adding two numbers
    1. Carry cannot be 2
    2. Carry will be 0 or 1
  • Extra 1 will raise carry flag
  • CF - Carry
    Indicates if there is a carry from the addition
  • ZF - Zero
    Indicates if the result of an arithmetic operation is zero
  • 2EH - 2EH
    • ZF = 1
  • 2EH - 05H
    • ZF = 0
  • Is it possible to add and have ZF = 1?
  • F F
    0 1 +

    • With CF = 1 and ZF = 1
  • Addressing Modes
    • Register
    • Immediate
    • Direct
    • Register indirect
    • Indexed
    • Register Relative
    • Based Indexed
    • Relative based Indexed
  • Move instruction
    Moves data from source to destination
  • MOV AX,BX
    • Register to register
  • MOV AX,0005H
    • Data to register
  • MOV AX,[5000H]

    • Memory to register
  • MOV AX,[BX]
    • Register indirect
  • MOV AX,[SI]

    • Indexed