Assembly Language A Brief Introduction
Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming Assembler Machine Language
First: Machine Code Machine Code is a language made of only 1’s and 0’s. It consists of: –Operators (instructions) –Operands (data) you can program in machine code it’s just very tedious
What is It? A language which has a one-to-one correspondence with machine code. That is, Every assembly instruction has a unique machine code representation. Assembly language is specific for each processor.
Background: CPU The CPU consists of: –ALU – Arithmetic/ Logic Unit Does all the math –Registers Temporary storage for executing instructions. D- Flip-Flops! –Program Counter Stores the address in ram of the current instruction –Decode Unit Figures out what to do with the instruction
How it works When the OS lets a program run, it is loaded into RAM Called into the CPU one instruction at a time CPU performs the instruction and updates the program counter.
An instruction Consists of: Op Code- a 3 letter pneumonic code representing a instruction (add, mov…) Operands specify which data should be operated on and where the answer should be stored. (Registers, Numbers, addresses in Ram)
For Example: mov The move instruction moves one hexadecimal byte into a specified register. Ex: mov AL,3F ;moves the number 3F into register AL
Your Code Every line of your assembly code should have a brief comment explaining what it does. Open the Assignment and try make some ASM programs!