Lab SessionIV CSIT120 Fall 2000 - PowerPoint PPT Presentation

About This Presentation
Title:

Lab SessionIV CSIT120 Fall 2000

Description:

Machine Language Programming ... a series of machine language instructions and data ... Run Genti's translator by using the link given in the course web pages ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 18
Provided by: sunyfr
Category:
Tags: sessioniv | csit120 | fall | lab

less

Transcript and Presenter's Notes

Title: Lab SessionIV CSIT120 Fall 2000


1
Lab Session-IV CSIT-120 Fall 2000
  • Precedence Rules
  • Machine Language Programming
  • The Micro Machine
  • The Micro Simulator
  • The Micro Translator (Thanks to Genti)
  • Experiment 4.1 and Lab Exercise 4-B
  • Experiment 4.2
  • Lab 4 Continued

2
Mixing Arithmetic Operations
  • When we try to perform several arithmetic
    operations in one expression, the expression
    becomes quite complex
  • For example, consider the following
  • Q (ABC)(AB/C)
  • Q ((AB)C)((AB)/C)???
  • Q (A(BC))(A(B/C))???

3
Precedence Rules
  • In order to resolve complex expressions without
    any ambiguity, a set of precedence rules is
    defined
  • ( )Parenthesis have top priority
  • In arithmetic operations, and / take precedence
    over and -
  • has lowest priority

4
Machine Language Programming
  • All programs written in C, Java or any other
    user-level language are translated to the machine
    language after compilation
  • Look at an example that shows how a C program
    line will be converted to the machine language of
    Micro, an example machine

5
The Compilation of Programs
6
Machine Language Programs
  • A compiled and linked program is a series of
    machine language instructions and data
  • Each processor has its own set of machine
    language instructions
  • Can programs compiled for Pentium II run on Alpha
    workstation?

7
The Micro Machine
  • The Micro Machine has
  • 256 Memory cells, each cell can hold 1 byte
  • Memory addresses range 00-FF (two digits)
  • 16 General Purpose Registers
  • Register addresses range 0-F (one digit)
  • Program Counter and Instruction Register
  • 12 Machine Language Instructions (1-C)

8
The Micro Simulator
  • The Micro Simulator is a C Program
  • Download this program by visiting The Micro
    link in the labs webpage of the course
  • Click on micro to download or cut paste this
    program and save as a C file
  • Double click on this file to run Visual C
  • Compile and run the program

9
The Micro Simulator
  • The full screen display shows the contents of the
    memory from cell 00 to cell FF
  • It also shows contents of registers R0 through
    R15
  • PC and IR contents are visible too
  • The machine has several single-letter commands
  • (4-A) Experiment 4.1 (PC incr?)

10
Gentis Translator
  • It is obvious that writing hex code is cryptic
    and prone to errors.
  • If anything goes wrong, it is difficult to trace
    the errors (or debug the code)
  • To make it human-friendly, Our TA last semester
    Mr. Genti developed a translator for the assembly
    language of micro

11
Gentis Translator
  • This translator assumes the program is written
    using some suggested mnemonics
  • Following is a list of instructions and their
    corresponding hex code and mnemonics

12
Gentis Translator
13
Strategy for Programming Micro
  • Develop your program using this list in a text
    file using wordpad or notepad
  • Run Gentis translator by using the link given in
    the course web pages
  • Program asks for input file name and output file
    name
  • It will leave the hex code in a text file
  • Keep that file in view when you load the program
    into micro simulator

14
The Power to Simulate
  • The Micro Simulator can run programs designed by
    you too
  • Lab Exercise 4-B
  • Design a program that adds values 1 through 5
    together and leaves the result in register R9.
    These values should be loaded into the memory by
    hand.
  • (4-C) Experiment 4.2

15
Lab-4 Continued
  • The Micro Machine and its Simulator
  • The JUMP instruction and its usage
  • Experiment 4.4

16
Micro and its Simulator
  • What is the memory size in Micro?
  • How many instructions are there?
  • How can we start executing a program in Micro?
  • What is the difference between S and G commands?
  • What does Gentis Translator do?

17
JUMP Instruction
  • JUMP instruction is provided to facilitate the
    implementation of loops and branches
  • Its format is B RXY (JUMP RXY)
  • It means jump to location XY if RR0
  • Unconditional jump if R0 compared to itself
  • Experiment 4.4
Write a Comment
User Comments (0)
About PowerShow.com