First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.

Slides:



Advertisements
Similar presentations
Lecture 5: MIPS Instruction Set
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
Base 10 Denary Decimal
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
COE Computer Organization & Assembly Language
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
Hexadecimal and ASCII Lesson Objective: Understand the purpose of ASCII and how to use it. Lesson Outcome: Convert between Hexadecimal and ASCII Convert.
Assembly & Machine Languages
A-Level Computing Data representation. Objectives Know how data can be represented in a computer system Understand the need for various forms of representation.
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Instruction Set Architecture
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
Computer Science 101 How the Assembler Works. Assembly Language Programming.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Conversions Denary to Binary Method 1
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Working with 8-bit bytes and hexadecimal
Hexadecimal Data Representation. Objectives  Know how the Hexadecimal counting system works  Be able to convert between denary, binary & hexadecimal.
Data Representation Hexadecimal  Although computers work in binary it is sometimes inconvenient for humans to read everything in Binary. For example in.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
1.4 Representation of data in computer systems Instructions.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Introduction to Number Representation A451 GCSE Computing.
Representation of Data Binary Representation of Instructions teachwithict.weebly.com.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Two’s Complement The language of machines, part II.
Winter 2016CISC101 - Prof. McLeod1 Today Numeric representation (or “How does binary and hexadecimal work?”). How can a CPU understand instructions written.
Conversions 1)Binary to Denary Method 1 Work out the position values of the binary bits and add those values together So above would be
Binary a. express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal;
Computer Organization Exam Review CS345 David Monismith.
Octal to Decimal Decimal Octal Binary Hexadecimal.
CPU Organisation & Operation
Binary numbers: Week 7 Lesson 1
Morgan Kaufmann Publishers
EPSII 59:006 Spring 2004.
2.0 COMPUTER SYSTEM 2.2 Number System and Representation
The University of Adelaide, School of Computer Science
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Computer Architecture & Operations I
Computer Architecture
Binary Code  
Computer Programming Machine and Assembly.
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
Computer Architecture & Operations I
MIPS Instruction Encoding
Binary Lesson 3 Hexadecimal
ECEG-3202 Computer Architecture and Organization
MIPS Instruction Encoding
Topic 3: Data Hexadecimal.
Binary Lesson 3 Hexadecimal
Binary Lesson 3 Hexadecimal
Data Binary Conversion.
Binary Lesson 3 Hexadecimal
Binary Lesson 4 Hexadecimal and Binary Practice
CS 286 Computer Organization and Architecture
Binary Lesson 4 Hexadecimal and Binary Practice
Example 1: (expression evaluation)
Binary Lesson 7 Review of Binary and Hexadecimal
Computer Architecture and System Programming Laboratory
CS 111 – Sept. 16 Machine language examples Instruction execution
Algoritmos y Programacion
Presentation transcript:

First Foray into Programming (the hard way)

A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction set is a list of all the Op- Codes, such as:  Load  Add  Store

Machine Code Machine code is a series of 1s and 0s We can easily encode our instruction – each instruction has a binary representation. Op-Code (4 bit)Machine Operation 0000Load from memory 0001Load operand value 0100Add from memory 0101Add operand value 1000Store into memory

Representing a full instruction One instruction is 16 bits (how many bytes?) long. This is our word size. The first 4 bits are the op-code, the rest is the operand. QUESTION - How many memory locations can be addressed?

Machine Code vs Assembly vs Load #23 Add 2 Store 65 This is a 1-to-1 mapping

Questions Using a 2 byte word with a 4-bit op-code, write the following in machine code:  Load 76  Add #43  Add 90  Store 12  Load #45 Write the following in assembly language:   

Hexadecimal Hex is the base-16 number system, the 16 digits are:  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F  Sometimes A-F are in lower case A3 = 10*16^2 + 3*16 = 10* *16 = = D = 6*16^2 + 13*16 = 6* *16 = = 1744

Hexadecimal (2) Each 4-bit binary number can be represented by one hex digit. Write the following in hex:     Load 76  Add #43  Add 90

Homework Create a program that does something involving all 5 op codes. Write this in assembly using a 2-byte word. Convert this into machine code in denary Finally, write this in hexadecimal.